Skip to content

Commit

Permalink
Improved plant bag harvesting (#27789)
Browse files Browse the repository at this point in the history
  • Loading branch information
FunnyMan3595 authored Jan 6, 2025
1 parent 6eaec2c commit 568a509
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
4 changes: 3 additions & 1 deletion code/modules/hydroponics/grown/misc_seeds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
growing_icon = 'icons/obj/hydroponics/growing_flowers.dmi'
genes = list(/datum/plant_gene/trait/plant_type/weed_hardy)

/obj/item/seeds/starthistle/harvest(mob/user)
/obj/item/seeds/starthistle/harvest(mob/user, obj/item/storage/bag/plants/bag)
var/obj/machinery/hydroponics/parent = loc
var/output_loc = parent.Adjacent(user) ? user.loc : parent.loc
var/seed_count = getYield()
for(var/i in 1 to seed_count)
var/obj/item/seeds/starthistle/harvestseeds = Copy()
harvestseeds.forceMove(output_loc)
if(bag && bag.can_be_inserted(harvestseeds))
bag.handle_item_insertion(harvestseeds, user, TRUE)

parent.update_tray(user, seed_count)

Expand Down
4 changes: 3 additions & 1 deletion code/modules/hydroponics/grown/replicapod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
return text


/obj/item/seeds/replicapod/harvest(mob/user = usr) //now that one is fun -- Urist
/obj/item/seeds/replicapod/harvest(mob/user, obj/item/storage/bag/plants/bag)
var/obj/machinery/hydroponics/parent = loc
var/make_podman = 0
var/ckey_holder = null
Expand Down Expand Up @@ -102,5 +102,7 @@
for(var/i=0,i<seed_count,i++)
var/obj/item/seeds/replicapod/harvestseeds = src.Copy()
harvestseeds.forceMove(output_loc)
if(bag && bag.can_be_inserted(harvestseeds))
bag.handle_item_insertion(harvestseeds, user, TRUE)

parent.update_tray(user, 1)
11 changes: 5 additions & 6 deletions code/modules/hydroponics/hydroponics_tray.dm
Original file line number Diff line number Diff line change
Expand Up @@ -857,12 +857,11 @@
to_chat(user, "<span class='warning'>This plot is completely devoid of weeds! It doesn't need uprooting.</span>")

else if(istype(O, /obj/item/storage/bag/plants))
attack_hand(user)
var/obj/item/storage/bag/plants/S = O
for(var/obj/item/food/grown/G in locate(user.x,user.y,user.z))
if(!S.can_be_inserted(G))
return
S.handle_item_insertion(G, user, TRUE)
if(!harvest)
attack_hand(user)
return

myseed.harvest(user, O)

else if(istype(O, /obj/item/shovel/spade))
if(!myseed && !weedlevel)
Expand Down
4 changes: 3 additions & 1 deletion code/modules/hydroponics/seeds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@

return new /obj/item/unsorted_seeds(src, mutation_level, tray.get_mutation_focus())

/obj/item/seeds/proc/harvest(mob/user = usr)
/obj/item/seeds/proc/harvest(mob/user, obj/item/storage/bag/plants/bag)
var/obj/machinery/hydroponics/tray = loc
var/output_loc = tray.Adjacent(user) ? user.loc : tray.loc // Needed for TK

Expand All @@ -222,6 +222,8 @@
var/obj/item/produce = new product(output_loc, mutated_seed)
if(!produce)
return
if(bag && bag.can_be_inserted(produce))
bag.handle_item_insertion(produce, user, TRUE)

product_name = produce.name

Expand Down

0 comments on commit 568a509

Please sign in to comment.