Skip to content

Commit

Permalink
Ports Compost Bin and Rake for more cost effective farming (#2064)
Browse files Browse the repository at this point in the history
A shoddy style farm for botany shows how much funding we give to the farming department.

add: compost bin
add: seed extractor
  • Loading branch information
InsightfulParasite authored May 1, 2024
1 parent 460c865 commit 048c427
Show file tree
Hide file tree
Showing 6 changed files with 317 additions and 23 deletions.
Binary file not shown.
111 changes: 111 additions & 0 deletions ModularTegustation/primitive_farming/farming_structures.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
//Imported from Desert Rose

/////////////////
// COMPOST BIN //
/////////////////

/obj/structure/reagent_dispensers/compostbin
name = "compost bin"
desc = "A smelly structure made of wooden slats where refuse is thrown. Dump unwanted seeds and produce in, pull usable compost out."
icon = 'ModularTegustation/Teguicons/farming_structures.dmi'
icon_state = "compostbin"
resistance_flags = INDESTRUCTIBLE
anchored = TRUE
reagent_id = /datum/reagent/compost

/obj/structure/reagent_dispensers/compostbin/Initialize()
. = ..()
reagents.clear_reagents()
reagents.add_reagent(reagent_id, 100)

/obj/structure/reagent_dispensers/compostbin/attackby(obj/item/W, mob/user, params)
if(W.is_refillable())
return 0 //so we can refill them via their afterattack.
if(reagents.total_volume == tank_volume)
to_chat(user,span_warning("The [src] is filled to capacity!"))
return
if(istype(W, /obj/item/seeds) || istype(W, /obj/item/food))
if(user.transferItemToLoc(W, src))
to_chat(user, span_notice("You load the [W] into the [src]."))
playsound(loc, 'sound/effects/blobattack.ogg', 25, 1, -1)
process_compost()
else
to_chat(user, span_warning("That's not compostable! Try seeds or flowers instead."))
else if(istype(W, /obj/item/storage/bag/plants))
var/obj/item/storage/bag/plants/PB = W
for(var/obj/item/G in PB.contents)// This check can be less than thorough because the bag has already authenticated the contents, hopefully
if(SEND_SIGNAL(PB, COMSIG_TRY_STORAGE_TAKE, G, src))
to_chat(user, "<span class='info'>You empty the [PB] into the [src].</span>")
playsound(loc, 'sound/effects/blobattack.ogg', 25, 1, -1)
process_compost()

/obj/structure/reagent_dispensers/compostbin/proc/process_compost()
for(var/obj/item/C in contents)
if(istype(C, /obj/item/seeds))
var/obj/item/seeds/S = C
reagents.add_reagent(/datum/reagent/compost, S.yield)
if(istype(C, /obj/item/food))
reagents.add_reagent(/datum/reagent/compost, 10)
qdel(C)

////////////////////
// SEED EXTRACTOR //
////////////////////

/obj/structure/seed_grinder
name = "seed grinder"
desc = "A crude grinding machine repurposed from kitchen appliances. Plants go in, seeds come out."
icon = 'ModularTegustation/Teguicons/farming_structures.dmi'
icon_state = "sextractor_manual"
density = FALSE
anchored = TRUE

/obj/structure/seed_grinder/proc/seedify(obj/item/O, t_max, obj/structure/seed_grinder/extractor, mob/living/user)
var/t_amount = 0
var/list/seeds = list()
if(t_max == -1)
t_max = rand(1,2) //Slightly worse than the actual thing

var/seedloc = O.loc
if(extractor)
seedloc = extractor.loc

if(istype(O, /obj/item/food/grown/))
var/obj/item/food/grown/F = O
if(F.seed)
if(user && !user.temporarilyRemoveItemFromInventory(O)) //couldn't drop the item
return
while(t_amount < t_max)
var/obj/item/seeds/t_prod = F.seed.Copy()
seeds.Add(t_prod)
t_prod.forceMove(seedloc)
t_amount++
qdel(O)
return seeds

else if(istype(O, /obj/item/grown))
var/obj/item/grown/F = O
if(F.seed)
if(user && !user.temporarilyRemoveItemFromInventory(O))
return
while(t_amount < t_max)
var/obj/item/seeds/t_prod = F.seed.Copy()
t_prod.forceMove(seedloc)
t_amount++
qdel(O)
return 1

return 0

/obj/structure/seed_grinder/attackby(obj/item/O, mob/user, params)

if(default_unfasten_wrench(user, O)) //So we can move them around
return

else if(seedify(O,-1, src, user))
to_chat(user, span_notice("You extract some seeds."))
return
else if(user.a_intent != INTENT_HARM)
to_chat(user, span_warning("You can't extract any seeds from \the [O.name]!"))
else
return ..()
51 changes: 28 additions & 23 deletions code/game/objects/items/stacks/sheets/sheet_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -208,32 +208,37 @@ GLOBAL_LIST_INIT(plasteel_recipes, list ( \
* Wood
*/
GLOBAL_LIST_INIT(wood_recipes, list ( \
new/datum/stack_recipe("wooden sandals", /obj/item/clothing/shoes/sandal, 1), \
new/datum/stack_recipe("wood floor tile", /obj/item/stack/tile/wood, 1, 4, 20), \
new/datum/stack_recipe("wood table frame", /obj/structure/table_frame/wood, 2, time = 10), \
new/datum/stack_recipe("rolling pin", /obj/item/kitchen/rollingpin, 2, time = 30), \
new/datum/stack_recipe("wooden chair", /obj/structure/chair/wood/, 3, time = 10, one_per_turf = TRUE, on_floor = TRUE), \
//Items
new/datum/stack_recipe("picture frame", /obj/item/wallframe/picture, 1, time = 10),\
new/datum/stack_recipe("painting frame", /obj/item/wallframe/painting, 1, time = 10),\
new/datum/stack_recipe("wooden sandals", /obj/item/clothing/shoes/sandal, 1), \
new/datum/stack_recipe("wood floor tile", /obj/item/stack/tile/wood, 1, 4, 20), \
new/datum/stack_recipe("firebrand", /obj/item/match/firebrand, 2, time = 100), \
new/datum/stack_recipe("rolling pin", /obj/item/kitchen/rollingpin, 2, time = 30), \
new/datum/stack_recipe("tiki mask", /obj/item/clothing/mask/gas/tiki_mask, 2), \
new/datum/stack_recipe("mortar", /obj/item/reagent_containers/glass/mortar, 3), \
new/datum/stack_recipe("wooden bucket", /obj/item/reagent_containers/glass/bucket/wooden, 3, time = 10),\
new/datum/stack_recipe("honey frame", /obj/item/honey_frame, 5, time = 10),\
new/datum/stack_recipe("rake", /obj/item/cultivator/rake, 5, time = 10),\
//Structures
new/datum/stack_recipe("wood table frame", /obj/structure/table_frame/wood, 2, time = 10), \
new/datum/stack_recipe("wooden chair", /obj/structure/chair/wood/, 3, time = 10, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("winged wooden chair", /obj/structure/chair/wood/wings, 3, time = 10, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("wooden barricade", /obj/structure/barricade/wooden, 5, time = 50, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("coffin", /obj/structure/closet/crate/coffin, 5, time = 15, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("book case", /obj/structure/bookcase, 4, time = 15, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("drying rack", /obj/machinery/smartfridge/drying_rack, 10, time = 15, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("wooden barrel", /obj/structure/fermenting_barrel, 8, time = 50, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("dog bed", /obj/structure/bed/dogbed, 10, time = 10, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("dresser", /obj/structure/dresser, 10, time = 15, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("picture frame", /obj/item/wallframe/picture, 1, time = 10),\
new/datum/stack_recipe("painting frame", /obj/item/wallframe/painting, 1, time = 10),\
new/datum/stack_recipe("ore box", /obj/structure/ore_box, 4, time = 50, one_per_turf = TRUE, on_floor = TRUE),\
new/datum/stack_recipe("wooden barricade", /obj/structure/barricade/wooden, 5, time = 50, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("coffin", /obj/structure/closet/crate/coffin, 5, time = 15, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("display case chassis", /obj/structure/displaycase_chassis, 5, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("wooden crate", /obj/structure/closet/crate/wooden, 6, time = 50, one_per_turf = TRUE, on_floor = TRUE),\
new/datum/stack_recipe("wooden barrel", /obj/structure/fermenting_barrel, 8, time = 50, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("dog bed", /obj/structure/bed/dogbed, 10, time = 10, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("dresser", /obj/structure/dresser, 10, time = 15, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("loom", /obj/structure/loom, 10, time = 15, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("drying rack", /obj/machinery/smartfridge/drying_rack, 10, time = 15, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("primitive produce bin", /obj/machinery/smartfridge/bottlerack/grownbin, 25, time = 15, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("primitive seed bin", /obj/machinery/smartfridge/bottlerack/seedbin, 25, time = 15, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("primitive seed grinder", /obj/structure/seed_grinder, 30, time = 15, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("book case", /obj/structure/bookcase, 35, time = 15, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("apiary", /obj/structure/beebox, 40, time = 50),\
new/datum/stack_recipe("tiki mask", /obj/item/clothing/mask/gas/tiki_mask, 2), \
new/datum/stack_recipe("honey frame", /obj/item/honey_frame, 5, time = 10),\
new/datum/stack_recipe("wooden bucket", /obj/item/reagent_containers/glass/bucket/wooden, 3, time = 10),\
new/datum/stack_recipe("rake", /obj/item/cultivator/rake, 5, time = 10),\
new/datum/stack_recipe("ore box", /obj/structure/ore_box, 4, time = 50, one_per_turf = TRUE, on_floor = TRUE),\
new/datum/stack_recipe("wooden crate", /obj/structure/closet/crate/wooden, 6, time = 50, one_per_turf = TRUE, on_floor = TRUE),\
new/datum/stack_recipe("loom", /obj/structure/loom, 10, time = 15, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("mortar", /obj/item/reagent_containers/glass/mortar, 3), \
new/datum/stack_recipe("firebrand", /obj/item/match/firebrand, 2, time = 100), \
null, \
new/datum/stack_recipe_list("pews", list(
new /datum/stack_recipe("pew (middle)", /obj/structure/chair/pew, 3, one_per_turf = TRUE, on_floor = TRUE),
Expand Down
161 changes: 161 additions & 0 deletions code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm
Original file line number Diff line number Diff line change
Expand Up @@ -581,3 +581,164 @@
return TRUE
else
return FALSE

// -------------------------
// Rack - Unpowered Smartfridge
// -------------------------
/obj/machinery/smartfridge/bottlerack
name = "bottle rack"
desc = "The organised way of mass storing your brews."
icon = 'ModularTegustation/Teguicons/farming_structures.dmi'
icon_state = "rack"
layer = BELOW_OBJ_LAYER
density = TRUE
use_power = NO_POWER_USE
max_integrity = 35
max_n_of_items = 30
circuit = null
//remember, you have initial_contents, which gets loaded by citadel, and ALWAYS spawns those items
//the chance_initial_contents will take each item and give it a 50 percent chance of not spawning
var/list/chance_initial_contents

/obj/machinery/smartfridge/bottlerack/Initialize()
. = ..()

if(islist(chance_initial_contents))
for(var/typekey in chance_initial_contents)
var/amount = chance_initial_contents[typekey]
if(isnull(amount))
amount = 1
for(var/i in 1 to amount)
if(prob(50))
load(new typekey(src))
//because after we load the objects, we need to update the icon
update_icon()

/obj/machinery/smartfridge/bottlerack/on_deconstruction()
new /obj/item/stack/sheet/mineral/wood(drop_location(), 5)
..()

//god, don't just put the procs, at least put a return there!
/obj/machinery/smartfridge/bottlerack/RefreshParts()
return //because we don't want the parent refresh parts giving us a shit ton of space

/obj/machinery/smartfridge/bottlerack/default_deconstruction_screwdriver()
return FALSE //because... we don't want it to default deconstruct?

/obj/machinery/smartfridge/bottlerack/exchange_parts()
return FALSE //because it shouldn't exchange parts!

/obj/machinery/smartfridge/bottlerack/spawn_frame()
return //because we won't spawn a frame because we shouldn't be deconstructable

/obj/machinery/smartfridge/bottlerack/default_deconstruction_crowbar(obj/item/crowbar/C, ignore_panel = 1)
. = ..()

/obj/machinery/smartfridge/bottlerack/accept_check(obj/item/O)
if(!istype(O, /obj/item/reagent_containers) || (O.item_flags & ABSTRACT) || !O.reagents || !O.reagents.reagent_list.len)
return FALSE
if(istype(O, /obj/item/reagent_containers/glass) || istype(O, /obj/item/reagent_containers/food/drinks) || istype(O, /obj/item/reagent_containers/food/condiment))
return TRUE
// --------------------------------------
// Update Icons for Racks with 30 storage
// --------------------------------------
/obj/machinery/smartfridge/bottlerack/update_icon_state()
. = ..()
SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays)
if(machine_stat)
icon_state = "[initial(icon_state)]-off"
return

if(!visible_contents)
icon_state = "[initial(icon_state)]"
return

var/list/shown_contents = contents - component_parts
var/storage_percent = (shown_contents.len / max_n_of_items) * 100
switch(storage_percent)
if(0)
icon_state = "[initial(icon_state)]"
if(1 to 10)
icon_state = "[initial(icon_state)]-1"
if(11 to 20)
icon_state = "[initial(icon_state)]-2"
if(21 to 60)
icon_state = "[initial(icon_state)]-3"
if(61 to 80)
icon_state = "[initial(icon_state)]-4"
if(81 to INFINITY)
icon_state = "[initial(icon_state)]-5"

// -------------------------
// Gardentool Rack FALLOUT CERTIFIED
// -------------------------
/obj/machinery/smartfridge/bottlerack/gardentool
name = "garden toolrack"
desc = "The farmers organisational tool storage."
icon = 'ModularTegustation/Teguicons/farming_structures.dmi'
icon_state = "gardentool"
resistance_flags = INDESTRUCTIBLE
max_n_of_items = 30

/obj/machinery/smartfridge/bottlerack/gardentool/accept_check(obj/item/O)
if(istype(O, /obj/item/plant_analyzer) || istype(O, /obj/item/reagent_containers/spray) || istype(O, /obj/item/cultivator) || istype(O, /obj/item/hatchet) || istype(O, /obj/item/scythe) || istype(O, /obj/item/reagent_containers/glass/bottle/nutrient) || istype(O, /obj/item/reagent_containers/glass/bottle/killer) || istype(O, /obj/item/shovel) || istype(O, /obj/item/reagent_containers/glass/bucket) || istype(O, /obj/item/storage/bag/plants) || istype(O, /obj/item/storage/bag/plants/portaseeder))
return TRUE
return FALSE

/obj/machinery/smartfridge/bottlerack/gardentool/preload
initial_contents = list(
/obj/item/shovel = 2,
/obj/item/cultivator/rake = 2,
/obj/item/reagent_containers/glass/bucket/wooden = 3,
/obj/item/storage/bag/plants = 2)

// -------------------------
// Seedbin FALLOUT CERTIFIED
// -------------------------
/obj/machinery/smartfridge/bottlerack/seedbin
name = "seed bin"
desc = "Organised dumping ground for the starters of life."
icon = 'ModularTegustation/Teguicons/farming_structures.dmi'
icon_state = "seedbin"
density = FALSE
max_n_of_items = 400

/obj/machinery/smartfridge/bottlerack/seedbin/accept_check(obj/item/O)
if(istype(O, /obj/item/seeds))
return TRUE
return FALSE

/obj/machinery/smartfridge/bottlerack/seedbin/preload
chance_initial_contents = list(
/obj/item/seeds/reishi = 1,
/obj/item/seeds/plump = 1,
/obj/item/seeds/chanter = 1,
/obj/item/seeds/harebell = 1,
/obj/item/seeds/pumpkin = 1,
/obj/item/seeds/rainbow_bunch = 1,
/obj/item/seeds/carrot = 1,
/obj/item/seeds/tomato = 1,
)
initial_contents = list(
/obj/item/seeds/wheat = 3,
/obj/item/seeds/watermelon = 2,
/obj/item/seeds/apple = 2,
/obj/item/seeds/aloe = 2,
/obj/item/seeds/potato = 2,
)

//-------------------------
// grownbin FALLOUT CERTIFIED
//-------------------------
/obj/machinery/smartfridge/bottlerack/grownbin
name = "Harvest bin"
desc = "A large box, to contain the harvest that the Earth has blessed upon you."
icon = 'ModularTegustation/Teguicons/farming_structures.dmi'
icon_state = "grownbin"
density = FALSE
max_n_of_items = 1000

/obj/machinery/smartfridge/bottlerack/grownbin/accept_check(obj/item/O)
if(istype(O, /obj/item/grown) || istype(O, /obj/item/food/grown))
return TRUE
return FALSE
16 changes: 16 additions & 0 deletions code/modules/reagents/chemistry/reagents/other_reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,22 @@

//////////////////////////////////Hydroponics stuff///////////////////////////////

/datum/reagent/compost
name = "compost"
description = "A mixture of waste and rotten plant matter that nurtures plants and keeps them free of pests."
reagent_state = SOLID
color = "#44341F"
taste_description = "rot"

//Compost when used on soil
/datum/reagent/compost/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray)
. = ..()
if(chems.has_reagent(src.type, 1))
mytray.adjustPests(-1)
if(myseed && chems.has_reagent(src.type, 1))
myseed.adjust_yield(round(chems.get_reagent_amount(src.type) * 0.1))
myseed.adjust_potency(round(chems.get_reagent_amount(src.type) * 0.1))

/datum/reagent/plantnutriment
name = "Generic nutriment"
description = "Some kind of nutriment. You can't really tell what it is. You should probably report it, along with how you obtained it."
Expand Down
1 change: 1 addition & 0 deletions lobotomy-corp13.dme
Original file line number Diff line number Diff line change
Expand Up @@ -3983,6 +3983,7 @@
#include "ModularTegustation\fishing\code\rod_components\fishing_lines.dm"
#include "ModularTegustation\living\living.dm"
#include "ModularTegustation\living\carbon\life.dm"
#include "ModularTegustation\primitive_farming\farming_structures.dm"
#include "ModularTegustation\tegu_borg_code\cyborg_upgrades.dm"
#include "ModularTegustation\tegu_borg_code\medborg_holobed.dm"
#include "ModularTegustation\tegu_borg_code\tegu_airlock_electroadaptive.dm"
Expand Down

0 comments on commit 048c427

Please sign in to comment.