Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows emptying nutrients from botany trays, fixes a couple minor bugs #392

Merged
merged 2 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/modules/hydroponics/hydroitemdefines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
returned_message += "\nPest level: [span_notice("[scanned_tray.pestlevel] / [MAX_TRAY_PESTS]")]"
returned_message += "\nToxicity level: [span_notice("[scanned_tray.toxic] / [MAX_TRAY_TOXINS]")]"
returned_message += "\nWater level: [span_notice("[scanned_tray.waterlevel] / [scanned_tray.maxwater]")]"
returned_message += "\nNutrition level: [span_notice("[round(scanned_tray.reagents.total_volume)] / [scanned_tray.maxnutri]")]"
returned_message += "\nNutrition level: [span_notice("[round(scanned_tray.reagents.total_volume)] / [scanned_tray.maxnutri]")] Right-click to empty."
if(scanned_tray.yieldmod != 1)
returned_message += "\nYield modifier on harvest: [span_notice("[scanned_tray.yieldmod]x")]"

Expand Down
41 changes: 33 additions & 8 deletions code/modules/hydroponics/hydroponics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@
. += span_info("It's empty.")

. += span_info("Water: [waterlevel]/[maxwater].")
. += span_info("Nutrient: [round(reagents.total_volume)]/[maxnutri].")
. += span_info("Nutrient: [round(reagents.total_volume)]/[maxnutri]. Right-click to empty.")
if(self_sustaining)
. += span_info("The tray's self-sustenance is active, protecting it from species mutations, weeds, and pests.")
if(self_growing)
Expand Down 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
Loading