Skip to content

Commit

Permalink
you can now empty nutrients
Browse files Browse the repository at this point in the history
  • Loading branch information
KoboldCommando committed Sep 25, 2023
1 parent 0df75c4 commit 9ff3650
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions code/modules/hydroponics/hydroponics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1029,12 +1029,13 @@
return
if(issilicon(user)) //How does AI know what plant is?
return
var/growth_mult = (1.01 ** -myseed.maturation)
if(growth >= myseed.harvest_age * growth_mult)
//if(myseed.harvest_age < age * max(myseed.production * 0.044, 0.5) && (myseed.harvest_age) < (age - lastproduce) * max(myseed.production * 0.044, 0.5) && (!harvest && !dead))
nutrimentMutation()
if(myseed && myseed.yield != -1) // Unharvestable shouldn't be harvested
set_plant_status(HYDROTRAY_PLANT_HARVESTABLE)
if(myseed)
var/growth_mult = (1.01 ** -myseed.maturation)
if(growth >= myseed.harvest_age * growth_mult)
//if(myseed.harvest_age < age * max(myseed.production * 0.044, 0.5) && (myseed.harvest_age) < (age - lastproduce) * max(myseed.production * 0.044, 0.5) && (!harvest && !dead))
nutrimentMutation()
if(myseed && myseed.yield != -1) // Unharvestable shouldn't be harvested
set_plant_status(HYDROTRAY_PLANT_HARVESTABLE)

if(plant_status == HYDROTRAY_PLANT_HARVESTABLE)
return myseed.harvest(user)
Expand All @@ -1048,6 +1049,30 @@
if(user)
user.examinate(src)

/obj/machinery/hydroponics/attack_hand_secondary(mob/user, list/modifiers)
. = ..()
if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN)
return
if(issilicon(user))
return

if(reagents.total_volume)
to_chat(user, span_notice("You begin to dump out the tray's nutrient mix."))
if(do_after(user, 4 SECONDS, target = src))
playsound(user.loc, 'sound/effects/slosh.ogg', 50, TRUE, -1)
//dump everything on the floor
var/turf/user_loc = user.loc
if(istype(user_loc, /turf/open))
user_loc.add_liquid_from_reagents(reagents)
else
user_loc = get_step_towards(user_loc, src)
user_loc.add_liquid_from_reagents(reagents)
adjust_plant_nutriments(100) //PURGE
else
to_chat(user, span_warning("The tray's nutrient mix is already empty!"))

return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN

/**
* Update Tray Proc
* Handles plant harvesting on the tray side, by clearing the seed, names, description, and dead stat.
Expand Down Expand Up @@ -1179,7 +1204,7 @@
///The usb port circuit

/obj/item/circuit_component/hydroponics
display_name = "Hydropnics Tray"
display_name = "Hydroponics Tray"
desc = "Automate the means of botanical production. Trigger to toggle auto-grow."
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL

Expand Down

0 comments on commit 9ff3650

Please sign in to comment.