mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 08:37:43 +01:00
Hydroponics Tray USB Port (plus a tiny refactor needed to fit it in) (#62652)
Adds a USB port to constructable hydroponic trays. I had to refactor some hydro tray code, which is kinda old, to fit the USB circuit and the new signals in.
This commit is contained in:
@@ -379,6 +379,6 @@
|
||||
QDEL_IN(shroom, 10)
|
||||
for(var/obj/machinery/hydroponics/tray in T)
|
||||
new /obj/effect/temp_visual/revenant(tray.loc)
|
||||
tray.pestlevel = rand(8, 10)
|
||||
tray.weedlevel = rand(8, 10)
|
||||
tray.toxic = rand(45, 55)
|
||||
tray.set_pestlevel(rand(8, 10))
|
||||
tray.set_weedlevel(rand(8, 10))
|
||||
tray.set_toxic(rand(45, 55))
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
var/obj/item/seeds/replicapod/harvestseeds = src.Copy()
|
||||
result.Add(harvestseeds)
|
||||
harvestseeds.forceMove(output_loc)
|
||||
parent.update_tray()
|
||||
parent.update_tray(user, seed_count)
|
||||
return result
|
||||
|
||||
// Congratulations! %Do you want to build a pod man?%
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
var/obj/item/seeds/starthistle/harvestseeds = Copy()
|
||||
harvestseeds.forceMove(output_loc)
|
||||
|
||||
parent.update_tray()
|
||||
parent.update_tray(user, seed_count)
|
||||
|
||||
// Corpse flower
|
||||
/obj/item/seeds/starthistle/corpse_flower
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
var/toxic = 0
|
||||
///Current age
|
||||
var/age = 0
|
||||
///Is it dead?
|
||||
var/dead = FALSE
|
||||
///The status of the plant in the tray. Whether it's harvestable, alive, missing or dead.
|
||||
var/plant_status = HYDROTRAY_NO_PLANT
|
||||
///Its health
|
||||
var/plant_health
|
||||
///Last time it was harvested
|
||||
@@ -39,10 +39,8 @@
|
||||
var/lastcycle = 0
|
||||
///About 10 seconds / cycle
|
||||
var/cycledelay = 200
|
||||
///Ready to harvest?
|
||||
var/harvest = FALSE
|
||||
///The currently planted seed
|
||||
var/obj/item/seeds/myseed = null
|
||||
var/obj/item/seeds/myseed
|
||||
///Obtained from the quality of the parts used in the tray, determines nutrient drain rate.
|
||||
var/rating = 1
|
||||
///Can it be unwrenched to move?
|
||||
@@ -63,7 +61,6 @@
|
||||
reagents.add_reagent(/datum/reagent/plantnutriment/eznutriment, 10) //Half filled nutrient trays for dirt trays to have more to grow with in prison/lavaland.
|
||||
. = ..()
|
||||
|
||||
|
||||
/obj/machinery/hydroponics/constructable
|
||||
name = "hydroponics tray"
|
||||
icon = 'icons/obj/hydroponics/equipment.dmi'
|
||||
@@ -73,6 +70,7 @@
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS, null, CALLBACK(src, .proc/can_be_rotated))
|
||||
AddComponent(/datum/component/plumbing/simple_demand)
|
||||
AddComponent(/datum/component/usb_port, list(/obj/item/circuit_component/hydroponics))
|
||||
|
||||
/obj/machinery/hydroponics/constructable/proc/can_be_rotated(mob/user, rotation_type)
|
||||
return !anchored
|
||||
@@ -94,13 +92,16 @@
|
||||
if(in_range(user, src) || isobserver(user))
|
||||
. += span_notice("The status display reads: Tray efficiency at <b>[rating*100]%</b>.")
|
||||
|
||||
|
||||
/obj/machinery/hydroponics/Destroy()
|
||||
if(myseed)
|
||||
qdel(myseed)
|
||||
myseed = null
|
||||
QDEL_NULL(myseed)
|
||||
return ..()
|
||||
|
||||
/obj/machinery/hydroponics/Exited(atom/movable/gone)
|
||||
. = ..()
|
||||
if(!QDELETED(src) && gone == myseed)
|
||||
set_seed(null, FALSE)
|
||||
|
||||
/obj/machinery/hydroponics/constructable/attackby(obj/item/I, mob/living/user, params)
|
||||
if (!user.combat_mode)
|
||||
// handle opening the panel
|
||||
@@ -134,21 +135,18 @@
|
||||
/obj/machinery/hydroponics/process(delta_time)
|
||||
var/needs_update = 0 // Checks if the icon needs updating so we don't redraw empty trays every time
|
||||
|
||||
if(myseed && (myseed.loc != src))
|
||||
myseed.forceMove(src)
|
||||
|
||||
if(self_sustaining)
|
||||
if(powered())
|
||||
adjustWater(rand(1,2) * delta_time * 0.5)
|
||||
adjustWeeds(-0.5 * delta_time)
|
||||
adjustPests(-0.5 * delta_time)
|
||||
adjust_waterlevel(rand(1,2) * delta_time * 0.5)
|
||||
adjust_weedlevel(-0.5 * delta_time)
|
||||
adjust_pestlevel(-0.5 * delta_time)
|
||||
else
|
||||
set_self_sustaining(FALSE)
|
||||
visible_message(span_warning("[name]'s auto-grow functionality shuts off!"))
|
||||
|
||||
if(world.time > (lastcycle + cycledelay))
|
||||
lastcycle = world.time
|
||||
if(myseed && !dead)
|
||||
if(myseed && plant_status != HYDROTRAY_PLANT_DEAD)
|
||||
// Advance age
|
||||
age++
|
||||
if(age < myseed.maturation)
|
||||
@@ -167,47 +165,44 @@
|
||||
|
||||
// Lack of nutrients hurts non-weeds
|
||||
if(reagents.total_volume <= 0 && !myseed.get_gene(/datum/plant_gene/trait/plant_type/weed_hardy))
|
||||
adjustHealth(-rand(1,3))
|
||||
adjust_plant_health(-rand(1,3))
|
||||
|
||||
//Photosynthesis/////////////////////////////////////////////////////////
|
||||
// Lack of light hurts non-mushrooms
|
||||
if(isturf(loc))
|
||||
var/turf/currentTurf = loc
|
||||
var/lightAmt = currentTurf.get_lumcount()
|
||||
if(myseed.get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism))
|
||||
if(lightAmt < 0.2)
|
||||
adjustHealth(-1 / rating)
|
||||
else // Non-mushroom
|
||||
if(lightAmt < 0.4)
|
||||
adjustHealth(-2 / rating)
|
||||
var/is_fungus = myseed.get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism)
|
||||
if(lightAmt < (is_fungus ? 0.2 : 0.4))
|
||||
adjust_plant_health((is_fungus ? -1 : -2) / rating)
|
||||
|
||||
//Water//////////////////////////////////////////////////////////////////
|
||||
// Drink random amount of water
|
||||
adjustWater(-rand(1,6) / rating)
|
||||
adjust_waterlevel(-rand(1,6) / rating)
|
||||
|
||||
// If the plant is dry, it loses health pretty fast, unless mushroom
|
||||
if(waterlevel <= 10 && !myseed.get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism))
|
||||
adjustHealth(-rand(0,1) / rating)
|
||||
adjust_plant_health(-rand(0,1) / rating)
|
||||
if(waterlevel <= 0)
|
||||
adjustHealth(-rand(0,2) / rating)
|
||||
adjust_plant_health(-rand(0,2) / rating)
|
||||
|
||||
// Sufficient water level and nutrient level = plant healthy but also spawns weeds
|
||||
else if(waterlevel > 10 && reagents.total_volume > 0)
|
||||
adjustHealth(rand(1,2) / rating)
|
||||
adjust_plant_health(rand(1,2) / rating)
|
||||
if(myseed && prob(myseed.weed_chance))
|
||||
adjustWeeds(myseed.weed_rate)
|
||||
adjust_weedlevel(myseed.weed_rate)
|
||||
else if(prob(5)) //5 percent chance the weed population will increase
|
||||
adjustWeeds(1 / rating)
|
||||
adjust_weedlevel(1 / rating)
|
||||
|
||||
//Toxins/////////////////////////////////////////////////////////////////
|
||||
|
||||
// Too much toxins cause harm, but when the plant drinks the contaiminated water, the toxins disappear slowly
|
||||
if(toxic >= 40 && toxic < 80)
|
||||
adjustHealth(-1 / rating)
|
||||
adjustToxic(-rating * 2)
|
||||
adjust_plant_health(-1 / rating)
|
||||
adjust_toxic(-rating * 2)
|
||||
else if(toxic >= 80) // I don't think it ever gets here tbh unless above is commented out
|
||||
adjustHealth(-3)
|
||||
adjustToxic(-rating *3)
|
||||
adjust_plant_health(-3)
|
||||
adjust_toxic(-rating * 3)
|
||||
|
||||
//Pests & Weeds//////////////////////////////////////////////////////////
|
||||
|
||||
@@ -217,8 +212,8 @@
|
||||
myseed.adjust_potency(-rand(2,6)) //Pests eat leaves and nibble on fruit, lowering potency.
|
||||
myseed.set_potency(min((myseed.potency), CARNIVORY_POTENCY_MIN, MAX_PLANT_POTENCY))
|
||||
else
|
||||
adjustHealth(2 / rating)
|
||||
adjustPests(-1 / rating)
|
||||
adjust_plant_health(2 / rating)
|
||||
adjust_pestlevel(-1 / rating)
|
||||
|
||||
else if(pestlevel >= 4)
|
||||
if(!myseed.get_gene(/datum/plant_gene/trait/carnivory))
|
||||
@@ -227,13 +222,13 @@
|
||||
myseed.set_potency(min((myseed.potency), CARNIVORY_POTENCY_MIN, MAX_PLANT_POTENCY))
|
||||
|
||||
else
|
||||
adjustHealth(1 / rating)
|
||||
adjust_plant_health(1 / rating)
|
||||
if(prob(50))
|
||||
adjustPests(-1 / rating)
|
||||
adjust_pestlevel(-1 / rating)
|
||||
|
||||
else if(pestlevel < 4 && myseed.get_gene(/datum/plant_gene/trait/carnivory))
|
||||
if(prob(5))
|
||||
adjustPests(-1 / rating)
|
||||
adjust_pestlevel(-1 / rating)
|
||||
|
||||
// If it's a weed, it doesn't stunt the growth
|
||||
if(weedlevel >= 5 && !myseed.get_gene(/datum/plant_gene/trait/plant_type/weed_hardy))
|
||||
@@ -264,23 +259,23 @@
|
||||
// Plant dies if plant_health <= 0
|
||||
if(plant_health <= 0)
|
||||
plantdies()
|
||||
adjustWeeds(1 / rating) // Weeds flourish
|
||||
adjust_weedlevel(1 / rating) // Weeds flourish
|
||||
|
||||
// If the plant is too old, lose health fast
|
||||
if(age > myseed.lifespan)
|
||||
adjustHealth(-rand(1,5) / rating)
|
||||
adjust_plant_health(-rand(1,5) / rating)
|
||||
|
||||
// Harvest code
|
||||
if(age > myseed.production && (age - lastproduce) > myseed.production && (!harvest && !dead))
|
||||
if(age > myseed.production && (age - lastproduce) > myseed.production && plant_status == HYDROTRAY_PLANT_GROWING)
|
||||
if(myseed && myseed.yield != -1) // Unharvestable shouldn't be harvested
|
||||
harvest = TRUE
|
||||
set_plant_status(HYDROTRAY_PLANT_HARVESTABLE)
|
||||
else
|
||||
lastproduce = age
|
||||
if(prob(5)) // On each tick, there's a 5 percent chance the pest population will increase
|
||||
adjustPests(1 / rating)
|
||||
adjust_pestlevel(1 / rating)
|
||||
else
|
||||
if(waterlevel > 10 && reagents.total_volume > 0 && prob(10)) // If there's no plant, the percentage chance is 10%
|
||||
adjustWeeds(1 / rating)
|
||||
adjust_weedlevel(1 / rating)
|
||||
|
||||
// Weeeeeeeeeeeeeeedddssss
|
||||
if(weedlevel >= 10 && prob(50) && !self_sustaining) // At this point the plant is kind of fucked. Weeds can overtake the plant spot.
|
||||
@@ -320,16 +315,17 @@
|
||||
|
||||
/obj/machinery/hydroponics/proc/update_plant_overlay()
|
||||
var/mutable_appearance/plant_overlay = mutable_appearance(myseed.growing_icon, layer = OBJ_LAYER + 0.01)
|
||||
if(dead)
|
||||
plant_overlay.icon_state = myseed.icon_dead
|
||||
else if(harvest)
|
||||
if(!myseed.icon_harvest)
|
||||
plant_overlay.icon_state = "[myseed.icon_grow][myseed.growthstages]"
|
||||
switch(plant_status)
|
||||
if(HYDROTRAY_PLANT_DEAD)
|
||||
plant_overlay.icon_state = myseed.icon_dead
|
||||
if(HYDROTRAY_PLANT_HARVESTABLE)
|
||||
if(!myseed.icon_harvest)
|
||||
plant_overlay.icon_state = "[myseed.icon_grow][myseed.growthstages]"
|
||||
else
|
||||
plant_overlay.icon_state = myseed.icon_harvest
|
||||
else
|
||||
plant_overlay.icon_state = myseed.icon_harvest
|
||||
else
|
||||
var/t_growthstate = clamp(round((age / myseed.maturation) * myseed.growthstages), 1, myseed.growthstages)
|
||||
plant_overlay.icon_state = "[myseed.icon_grow][t_growthstate]"
|
||||
var/t_growthstate = clamp(round((age / myseed.maturation) * myseed.growthstages), 1, myseed.growthstages)
|
||||
plant_overlay.icon_state = "[myseed.icon_grow][t_growthstate]"
|
||||
return plant_overlay
|
||||
|
||||
/obj/machinery/hydroponics/proc/update_status_light_overlays()
|
||||
@@ -342,9 +338,20 @@
|
||||
. += mutable_appearance('icons/obj/hydroponics/equipment.dmi', "over_lowhealth3")
|
||||
if(weedlevel >= 5 || pestlevel >= 5 || toxic >= 40)
|
||||
. += mutable_appearance('icons/obj/hydroponics/equipment.dmi', "over_alert3")
|
||||
if(harvest)
|
||||
if(plant_status == HYDROTRAY_PLANT_HARVESTABLE)
|
||||
. += mutable_appearance('icons/obj/hydroponics/equipment.dmi', "over_harvest3")
|
||||
|
||||
///Sets a new value for the myseed variable, which is the seed of the plant that's growing inside the tray.
|
||||
/obj/machinery/hydroponics/proc/set_seed(obj/item/seeds/new_seed, delete_old_seed = TRUE)
|
||||
var/old_seed = myseed
|
||||
myseed = new_seed
|
||||
if(old_seed && delete_old_seed)
|
||||
qdel(old_seed)
|
||||
set_plant_status(new_seed ? HYDROTRAY_PLANT_GROWING : HYDROTRAY_NO_PLANT) //To make sure they can't just put in another seed and insta-harvest it
|
||||
if(myseed && myseed.loc != src)
|
||||
myseed.forceMove(src)
|
||||
SEND_SIGNAL(src, COMSIG_HYDROTRAY_SET_SEED, new_seed)
|
||||
|
||||
/*
|
||||
* Setter proc to set a tray to a new self_sustaining state and update all values associated with it.
|
||||
*
|
||||
@@ -359,13 +366,108 @@
|
||||
update_use_power(self_sustaining ? IDLE_POWER_USE : NO_POWER_USE)
|
||||
update_appearance()
|
||||
|
||||
SEND_SIGNAL(src, COMSIG_HYDROTRAY_SET_SELFSUSTAINING, new_value)
|
||||
|
||||
/obj/machinery/hydroponics/proc/set_weedlevel(new_weedlevel, update_icon = TRUE)
|
||||
if(weedlevel == new_weedlevel)
|
||||
return
|
||||
SEND_SIGNAL(src, COMSIG_HYDROTRAY_SET_WEEDLEVEL, new_weedlevel)
|
||||
weedlevel = new_weedlevel
|
||||
if(update_icon)
|
||||
update_appearance()
|
||||
|
||||
/obj/machinery/hydroponics/proc/set_pestlevel(new_pestlevel, update_icon = TRUE)
|
||||
if(pestlevel == new_pestlevel)
|
||||
return
|
||||
SEND_SIGNAL(src, COMSIG_HYDROTRAY_SET_PESTLEVEL, new_pestlevel)
|
||||
pestlevel = new_pestlevel
|
||||
if(update_icon)
|
||||
update_appearance()
|
||||
|
||||
/obj/machinery/hydroponics/proc/set_waterlevel(new_waterlevel, update_icon = TRUE)
|
||||
if(waterlevel == new_waterlevel)
|
||||
return
|
||||
SEND_SIGNAL(src, COMSIG_HYDROTRAY_SET_WATERLEVEL, new_waterlevel)
|
||||
waterlevel = new_waterlevel
|
||||
if(update_icon)
|
||||
update_appearance()
|
||||
|
||||
var/difference = new_waterlevel - waterlevel
|
||||
if(difference > 0)
|
||||
adjust_toxic(-round(difference/4))//Toxicity dilutation code. The more water you put in, the lesser the toxin concentration.
|
||||
|
||||
/obj/machinery/hydroponics/proc/set_plant_health(new_plant_health, update_icon = TRUE, forced = FALSE)
|
||||
if(plant_health == new_plant_health || ((!myseed || plant_status == HYDROTRAY_PLANT_DEAD) && !forced))
|
||||
return
|
||||
SEND_SIGNAL(src, COMSIG_HYDROTRAY_SET_PLANT_HEALTH, new_plant_health)
|
||||
plant_health = new_plant_health
|
||||
if(update_icon)
|
||||
update_appearance()
|
||||
|
||||
/obj/machinery/hydroponics/proc/set_toxic(new_toxic, update_icon = TRUE)
|
||||
if(toxic == new_toxic)
|
||||
return
|
||||
SEND_SIGNAL(src, COMSIG_HYDROTRAY_SET_TOXIC, new_toxic)
|
||||
toxic = new_toxic
|
||||
if(update_icon)
|
||||
update_appearance()
|
||||
|
||||
/obj/machinery/hydroponics/proc/set_plant_status(new_plant_status)
|
||||
if(plant_status == new_plant_status)
|
||||
return
|
||||
SEND_SIGNAL(src, COMSIG_HYDROTRAY_SET_PLANT_STATUS, new_plant_status)
|
||||
plant_status = new_plant_status
|
||||
|
||||
// The following procs adjust the hydroponics tray variables, and make sure that the stat doesn't go out of bounds.
|
||||
|
||||
/**
|
||||
* Adjust water.
|
||||
* Raises or lowers tray water values by a set value. Adding water will dillute toxicity from the tray.
|
||||
* * adjustamt - determines how much water the tray will be adjusted upwards or downwards.
|
||||
*/
|
||||
/obj/machinery/hydroponics/proc/adjust_waterlevel(amt)
|
||||
set_waterlevel(clamp(waterlevel + amt, 0, maxwater), FALSE)
|
||||
|
||||
/**
|
||||
* Adjust Health.
|
||||
* Raises the tray's plant_health stat by a given amount, with total health determined by the seed's endurance.
|
||||
* * adjustamt - Determines how much the plant_health will be adjusted upwards or downwards.
|
||||
*/
|
||||
/obj/machinery/hydroponics/proc/adjust_plant_health(amt)
|
||||
set_plant_health(clamp(plant_health + amt, 0, myseed?.endurance), FALSE)
|
||||
|
||||
/**
|
||||
* Adjust toxicity.
|
||||
* Raises the plant's toxic stat by a given amount.
|
||||
* * adjustamt - Determines how much the toxic will be adjusted upwards or downwards.
|
||||
*/
|
||||
/obj/machinery/hydroponics/proc/adjust_toxic(amt)
|
||||
set_toxic(clamp(toxic + amt, 0, MAX_TRAY_TOXINS), FALSE)
|
||||
|
||||
/**
|
||||
* Adjust Pests.
|
||||
* Raises the tray's pest level stat by a given amount.
|
||||
* * adjustamt - Determines how much the pest level will be adjusted upwards or downwards.
|
||||
*/
|
||||
/obj/machinery/hydroponics/proc/adjust_pestlevel(amt)
|
||||
set_pestlevel(clamp(pestlevel + amt, 0, MAX_TRAY_PESTS), FALSE)
|
||||
|
||||
|
||||
/**
|
||||
* Adjust Weeds.
|
||||
* Raises the plant's weed level stat by a given amount.
|
||||
* * adjustamt - Determines how much the weed level will be adjusted upwards or downwards.
|
||||
*/
|
||||
/obj/machinery/hydroponics/proc/adjust_weedlevel (amt)
|
||||
set_weedlevel(clamp(weedlevel + amt, 0, MAX_TRAY_WEEDS), FALSE)
|
||||
|
||||
/obj/machinery/hydroponics/examine(user)
|
||||
. = ..()
|
||||
if(myseed)
|
||||
. += span_info("It has [span_name("[myseed.plantname]")] planted.")
|
||||
if (dead)
|
||||
if (plant_status == HYDROTRAY_PLANT_DEAD)
|
||||
. += span_warning("It's dead!")
|
||||
else if (harvest)
|
||||
else if (plant_status == HYDROTRAY_PLANT_HARVESTABLE)
|
||||
. += span_info("It's ready to harvest.")
|
||||
else if (plant_health <= (myseed.endurance / 2))
|
||||
. += span_warning("It looks unhealthy.")
|
||||
@@ -387,38 +489,35 @@
|
||||
* Plants a new weed in an empty tray, then resets the tray.
|
||||
*/
|
||||
/obj/machinery/hydroponics/proc/weedinvasion()
|
||||
dead = FALSE
|
||||
var/oldPlantName
|
||||
if(myseed) // In case there's nothing in the tray beforehand
|
||||
oldPlantName = myseed.plantname
|
||||
qdel(myseed)
|
||||
myseed = null
|
||||
else
|
||||
oldPlantName = "empty tray"
|
||||
var/obj/item/seeds/new_seed
|
||||
switch(rand(1,18)) // randomly pick predominative weed
|
||||
if(16 to 18)
|
||||
myseed = new /obj/item/seeds/reishi(src)
|
||||
new_seed = new /obj/item/seeds/reishi(src)
|
||||
if(14 to 15)
|
||||
myseed = new /obj/item/seeds/nettle(src)
|
||||
new_seed = new /obj/item/seeds/nettle(src)
|
||||
if(12 to 13)
|
||||
myseed = new /obj/item/seeds/harebell(src)
|
||||
new_seed = new /obj/item/seeds/harebell(src)
|
||||
if(10 to 11)
|
||||
myseed = new /obj/item/seeds/amanita(src)
|
||||
new_seed = new /obj/item/seeds/amanita(src)
|
||||
if(8 to 9)
|
||||
myseed = new /obj/item/seeds/chanter(src)
|
||||
new_seed = new /obj/item/seeds/chanter(src)
|
||||
if(6 to 7)
|
||||
myseed = new /obj/item/seeds/tower(src)
|
||||
new_seed = new /obj/item/seeds/tower(src)
|
||||
if(4 to 5)
|
||||
myseed = new /obj/item/seeds/plump(src)
|
||||
new_seed = new /obj/item/seeds/plump(src)
|
||||
else
|
||||
myseed = new /obj/item/seeds/starthistle(src)
|
||||
new_seed = new /obj/item/seeds/starthistle(src)
|
||||
set_seed(new_seed)
|
||||
age = 0
|
||||
plant_health = myseed.endurance
|
||||
lastcycle = world.time
|
||||
harvest = FALSE
|
||||
weedlevel = 0 // Reset
|
||||
pestlevel = 0 // Reset
|
||||
update_appearance()
|
||||
set_plant_health(myseed.endurance, update_icon = FALSE)
|
||||
set_weedlevel(0, update_icon = FALSE) // Reset
|
||||
set_pestlevel(0) // Reset
|
||||
visible_message(span_warning("The [oldPlantName] is overtaken by some [myseed.plantname]!"))
|
||||
TRAY_NAME_UPDATE
|
||||
|
||||
@@ -432,42 +531,32 @@
|
||||
|
||||
|
||||
/obj/machinery/hydroponics/proc/mutatespecie() // Mutagent produced a new plant!
|
||||
if(!myseed || dead)
|
||||
if(!myseed || plant_status == HYDROTRAY_PLANT_DEAD || !LAZYLEN(myseed.mutatelist))
|
||||
return
|
||||
|
||||
var/oldPlantName = myseed.plantname
|
||||
if(LAZYLEN(myseed.mutatelist))
|
||||
var/mutantseed = pick(myseed.mutatelist)
|
||||
qdel(myseed)
|
||||
myseed = null
|
||||
myseed = new mutantseed
|
||||
else
|
||||
return
|
||||
var/mutantseed = pick(myseed.mutatelist)
|
||||
set_seed(new mutantseed(src))
|
||||
|
||||
hardmutate()
|
||||
age = 0
|
||||
plant_health = myseed.endurance
|
||||
set_plant_health(myseed.endurance, update_icon = FALSE)
|
||||
lastcycle = world.time
|
||||
harvest = FALSE
|
||||
weedlevel = 0 // Reset
|
||||
set_weedlevel(0, update_icon = FALSE)
|
||||
|
||||
var/message = span_warning("[oldPlantName] suddenly mutates into [myseed.plantname]!")
|
||||
addtimer(CALLBACK(src, .proc/after_mutation, message), 0.5 SECONDS)
|
||||
|
||||
/obj/machinery/hydroponics/proc/mutateweed() // If the weeds gets the mutagent instead. Mind you, this pretty much destroys the old plant
|
||||
if( weedlevel > 5 )
|
||||
if(myseed)
|
||||
qdel(myseed)
|
||||
myseed = null
|
||||
set_seed(null)
|
||||
var/newWeed = pick(/obj/item/seeds/liberty, /obj/item/seeds/angel, /obj/item/seeds/nettle/death, /obj/item/seeds/kudzu)
|
||||
myseed = new newWeed
|
||||
dead = FALSE
|
||||
set_seed(new newWeed(src))
|
||||
hardmutate()
|
||||
age = 0
|
||||
plant_health = myseed.endurance
|
||||
set_plant_health(myseed.endurance, update_icon = FALSE)
|
||||
lastcycle = world.time
|
||||
harvest = FALSE
|
||||
weedlevel = 0 // Reset
|
||||
set_weedlevel(0, update_icon = FALSE) // Reset
|
||||
|
||||
var/message = span_warning("The mutated weeds in [src] spawn some [myseed.plantname]!")
|
||||
addtimer(CALLBACK(src, .proc/after_mutation, message), 0.5 SECONDS)
|
||||
@@ -485,13 +574,12 @@
|
||||
* Cleans up various stats for the plant upon death, including pests, harvestability, and plant health.
|
||||
*/
|
||||
/obj/machinery/hydroponics/proc/plantdies()
|
||||
plant_health = 0
|
||||
harvest = FALSE
|
||||
pestlevel = 0 // Pests die
|
||||
set_plant_health(0, update_icon = FALSE, forced = TRUE)
|
||||
set_plant_status(HYDROTRAY_PLANT_DEAD)
|
||||
set_pestlevel(0, update_icon = FALSE) // Pests die
|
||||
lastproduce = 0
|
||||
if(!dead)
|
||||
update_appearance()
|
||||
dead = TRUE
|
||||
update_appearance()
|
||||
SEND_SIGNAL(src, COMSIG_HYDROTRAY_PLANT_DEATH)
|
||||
|
||||
/**
|
||||
* Plant Cross-Pollination.
|
||||
@@ -504,7 +592,7 @@
|
||||
//Here is where we check for window blocking.
|
||||
if(!Adjacent(T) && range <= 1)
|
||||
continue
|
||||
if(T.myseed && !T.dead)
|
||||
if(T.myseed && T.plant_status != HYDROTRAY_PLANT_DEAD)
|
||||
T.myseed.set_potency(round((T.myseed.potency+(1/10)*(myseed.potency-T.myseed.potency))))
|
||||
T.myseed.set_instability(round((T.myseed.instability+(1/10)*(myseed.instability-T.myseed.instability))))
|
||||
T.myseed.set_yield(round((T.myseed.yield+(1/2)*(myseed.yield-T.myseed.yield))))
|
||||
@@ -572,7 +660,7 @@
|
||||
//This was originally in apply_chemicals, but due to apply_chemicals only holding nutrients, we handle it here now.
|
||||
if(reagent_source.reagents.has_reagent(/datum/reagent/water, 1))
|
||||
var/water_amt = reagent_source.reagents.get_reagent_amount(/datum/reagent/water) * transfer_amount / reagent_source.reagents.total_volume
|
||||
H.adjustWater(round(water_amt))
|
||||
H.adjust_waterlevel(round(water_amt))
|
||||
reagent_source.reagents.remove_reagent(/datum/reagent/water, water_amt)
|
||||
reagent_source.reagents.trans_to(H.reagents, transfer_amount, transfered_by = user)
|
||||
lastuser = WEAKREF(user)
|
||||
@@ -593,13 +681,11 @@
|
||||
return
|
||||
SEND_SIGNAL(O, COMSIG_SEED_ON_PLANTED, src)
|
||||
to_chat(user, span_notice("You plant [O]."))
|
||||
dead = FALSE
|
||||
myseed = O
|
||||
set_seed(O)
|
||||
TRAY_NAME_UPDATE
|
||||
age = 1
|
||||
plant_health = myseed.endurance
|
||||
set_plant_health(myseed.endurance)
|
||||
lastcycle = world.time
|
||||
update_appearance()
|
||||
return
|
||||
else
|
||||
to_chat(user, span_warning("[src] already has seeds in it!"))
|
||||
@@ -608,8 +694,7 @@
|
||||
else if(istype(O, /obj/item/cultivator))
|
||||
if(weedlevel > 0)
|
||||
user.visible_message(span_notice("[user] uproots the weeds."), span_notice("You remove the weeds from [src]."))
|
||||
weedlevel = 0
|
||||
update_appearance()
|
||||
set_weedlevel(0)
|
||||
return
|
||||
else
|
||||
to_chat(user, span_warning("This plot is completely devoid of weeds! It doesn't need uprooting."))
|
||||
@@ -619,7 +704,7 @@
|
||||
if(!myseed)
|
||||
to_chat(user, span_notice("This plot is empty."))
|
||||
return
|
||||
else if(!harvest)
|
||||
else if(plant_status != HYDROTRAY_PLANT_HARVESTABLE)
|
||||
to_chat(user, span_notice("This plant must be harvestable in order to be grafted."))
|
||||
return
|
||||
else if(myseed.grafted)
|
||||
@@ -633,7 +718,7 @@
|
||||
|
||||
snip.forceMove(drop_location())
|
||||
myseed.grafted = TRUE
|
||||
adjustHealth(-5)
|
||||
adjust_plant_health(-5)
|
||||
return
|
||||
|
||||
else if(istype(O, /obj/item/geneshears))
|
||||
@@ -667,7 +752,7 @@
|
||||
qdel(gene)
|
||||
break
|
||||
myseed.reagents_from_genes()
|
||||
adjustHealth(-15)
|
||||
adjust_plant_health(-15)
|
||||
to_chat(user, span_notice("You carefully shear the genes off of the [myseed.plantname], leaving the plant looking weaker."))
|
||||
update_appearance()
|
||||
return
|
||||
@@ -703,16 +788,12 @@
|
||||
user.visible_message(span_notice("[user] digs out the plants in [src]!"), span_notice("You dig out all of [src]'s plants!"))
|
||||
if(myseed) //Could be that they're just using it as a de-weeder
|
||||
age = 0
|
||||
plant_health = 0
|
||||
set_plant_health(0, update_icon = FALSE, forced = TRUE)
|
||||
lastproduce = 0
|
||||
if(harvest)
|
||||
harvest = FALSE //To make sure they can't just put in another seed and insta-harvest it
|
||||
qdel(myseed)
|
||||
myseed = null
|
||||
set_seed(null)
|
||||
name = initial(name)
|
||||
desc = initial(desc)
|
||||
weedlevel = 0 //Has a side effect of cleaning up those nasty weeds
|
||||
update_appearance()
|
||||
set_weedlevel(0) //Has a side effect of cleaning up those nasty weeds
|
||||
return
|
||||
else if(istype(O, /obj/item/storage/part_replacer))
|
||||
RefreshParts()
|
||||
@@ -766,14 +847,12 @@
|
||||
return
|
||||
if(issilicon(user)) //How does AI know what plant is?
|
||||
return
|
||||
if(harvest)
|
||||
if(plant_status == HYDROTRAY_PLANT_HARVESTABLE)
|
||||
return myseed.harvest(user)
|
||||
|
||||
else if(dead)
|
||||
dead = FALSE
|
||||
else if(plant_status == HYDROTRAY_PLANT_DEAD)
|
||||
to_chat(user, span_notice("You remove the dead plant from [src]."))
|
||||
qdel(myseed)
|
||||
myseed = null
|
||||
set_seed(null)
|
||||
update_appearance()
|
||||
TRAY_NAME_UPDATE
|
||||
else
|
||||
@@ -810,70 +889,25 @@
|
||||
* Sends messages to the cleaer about plants harvested, or if nothing was harvested at all.
|
||||
* * User - The mob who clears the tray.
|
||||
*/
|
||||
/obj/machinery/hydroponics/proc/update_tray(mob/user)
|
||||
harvest = FALSE
|
||||
/obj/machinery/hydroponics/proc/update_tray(mob/user, product_count)
|
||||
lastproduce = age
|
||||
if(istype(myseed, /obj/item/seeds/replicapod))
|
||||
to_chat(user, span_notice("You harvest from the [myseed.plantname]."))
|
||||
else if(myseed.getYield() <= 0)
|
||||
else if(product_count <= 0)
|
||||
to_chat(user, span_warning("You fail to harvest anything useful!"))
|
||||
else
|
||||
to_chat(user, span_notice("You harvest [myseed.getYield()] items from the [myseed.plantname]."))
|
||||
to_chat(user, span_notice("You harvest [product_count] items from the [myseed.plantname]."))
|
||||
if(!myseed.get_gene(/datum/plant_gene/trait/repeated_harvest))
|
||||
qdel(myseed)
|
||||
myseed = null
|
||||
dead = FALSE
|
||||
set_seed(null)
|
||||
name = initial(name)
|
||||
desc = initial(desc)
|
||||
TRAY_NAME_UPDATE
|
||||
if(self_sustaining) //No reason to pay for an empty tray.
|
||||
set_self_sustaining(FALSE)
|
||||
else
|
||||
set_plant_status(HYDROTRAY_PLANT_GROWING)
|
||||
update_appearance()
|
||||
|
||||
/// Tray Setters - The following procs adjust the tray or plants variables, and make sure that the stat doesn't go out of bounds.
|
||||
/**
|
||||
* Adjust water.
|
||||
* Raises or lowers tray water values by a set value. Adding water will dillute toxicity from the tray.
|
||||
* * adjustamt - determines how much water the tray will be adjusted upwards or downwards.
|
||||
*/
|
||||
/obj/machinery/hydroponics/proc/adjustWater(adjustamt)
|
||||
waterlevel = clamp(waterlevel + adjustamt, 0, maxwater)
|
||||
|
||||
if(adjustamt>0)
|
||||
adjustToxic(-round(adjustamt/4))//Toxicity dilutation code. The more water you put in, the lesser the toxin concentration.
|
||||
|
||||
/**
|
||||
* Adjust Health.
|
||||
* Raises the tray's plant_health stat by a given amount, with total health determined by the seed's endurance.
|
||||
* * adjustamt - Determines how much the plant_health will be adjusted upwards or downwards.
|
||||
*/
|
||||
/obj/machinery/hydroponics/proc/adjustHealth(adjustamt)
|
||||
if(myseed && !dead)
|
||||
plant_health = clamp(plant_health + adjustamt, 0, myseed.endurance)
|
||||
|
||||
/**
|
||||
* Adjust Health.
|
||||
* Raises the plant's plant_health stat by a given amount, with total health determined by the seed's endurance.
|
||||
* * adjustamt - Determines how much the plant_health will be adjusted upwards or downwards.
|
||||
*/
|
||||
/obj/machinery/hydroponics/proc/adjustToxic(adjustamt)
|
||||
toxic = clamp(toxic + adjustamt, 0, MAX_TRAY_TOXINS)
|
||||
|
||||
/**
|
||||
* Adjust Pests.
|
||||
* Raises the tray's pest level stat by a given amount.
|
||||
* * adjustamt - Determines how much the pest level will be adjusted upwards or downwards.
|
||||
*/
|
||||
/obj/machinery/hydroponics/proc/adjustPests(adjustamt)
|
||||
pestlevel = clamp(pestlevel + adjustamt, 0, MAX_TRAY_PESTS)
|
||||
|
||||
/**
|
||||
* Adjust Weeds.
|
||||
* Raises the plant's weed level stat by a given amount.
|
||||
* * adjustamt - Determines how much the weed level will be adjusted upwards or downwards.
|
||||
*/
|
||||
/obj/machinery/hydroponics/proc/adjustWeeds(adjustamt)
|
||||
weedlevel = clamp(weedlevel + adjustamt, 0, MAX_TRAY_WEEDS)
|
||||
SEND_SIGNAL(src, COMSIG_HYDROTRAY_ON_HARVEST, user, product_count)
|
||||
|
||||
/**
|
||||
* Spawn Plant.
|
||||
@@ -916,3 +950,141 @@
|
||||
|
||||
/obj/machinery/hydroponics/soil/CtrlClick(mob/user)
|
||||
return //Soil has no electricity.
|
||||
|
||||
|
||||
///The usb port circuit
|
||||
|
||||
/obj/item/circuit_component/hydroponics
|
||||
display_name = "Hydropnics Tray"
|
||||
desc = "Automate the means of botanical production. Trigger to toggle auto-grow."
|
||||
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL
|
||||
|
||||
var/obj/machinery/hydroponics/attached_tray
|
||||
///If self-sustaining (also called auto-grow) should be turned on or off when the trigger is triggered.
|
||||
var/datum/port/input/selfsustaining_setting
|
||||
///Whether the plant in the tray is harvestable, alive, missing or dead.
|
||||
var/datum/port/output/plant_status
|
||||
///Whether the self sustaining mode is on
|
||||
var/datum/port/output/is_self_sustaining
|
||||
///Triggered when the plant is harvested
|
||||
var/datum/port/output/plant_harvested
|
||||
///The product amount of the last harvest
|
||||
var/datum/port/output/last_harvest
|
||||
///Triggered when the plant dies
|
||||
var/datum/port/output/plant_died
|
||||
///Triggered when a seed is either planted by someone or takes over the tray.
|
||||
var/datum/port/output/seeds_planted
|
||||
///The amount of water in the tray.
|
||||
var/datum/port/output/water_level
|
||||
///The amount of toxins in the tray.
|
||||
var/datum/port/output/toxic_level
|
||||
///The amount of pests in the tray.
|
||||
var/datum/port/output/pests_level
|
||||
///The amount of weeds in the tray.
|
||||
var/datum/port/output/weeds_level
|
||||
///The health of the plant in the tray.
|
||||
var/datum/port/output/plant_health
|
||||
///The amount of reagents in the tray
|
||||
var/datum/port/output/reagents_level
|
||||
|
||||
/obj/item/circuit_component/hydroponics/populate_ports()
|
||||
selfsustaining_setting = add_input_port("Auto-Grow Setting", PORT_TYPE_NUMBER)
|
||||
|
||||
plant_status = add_output_port("Plant Status", PORT_TYPE_NUMBER)
|
||||
is_self_sustaining = add_output_port("Auto-Grow Status", PORT_TYPE_NUMBER)
|
||||
plant_harvested = add_output_port("Plant Harvested", PORT_TYPE_SIGNAL)
|
||||
last_harvest = add_output_port("Last Harvest Amount", PORT_TYPE_NUMBER)
|
||||
plant_died = add_output_port("Plant Died", PORT_TYPE_SIGNAL)
|
||||
seeds_planted = add_output_port("Seeds Planted", PORT_TYPE_SIGNAL)
|
||||
water_level = add_output_port("Water Level", PORT_TYPE_NUMBER)
|
||||
toxic_level = add_output_port("Toxins Level", PORT_TYPE_NUMBER)
|
||||
pests_level = add_output_port("Pests Level", PORT_TYPE_NUMBER)
|
||||
weeds_level = add_output_port("Weeds Level", PORT_TYPE_NUMBER)
|
||||
plant_health = add_output_port("Plant Health", PORT_TYPE_NUMBER)
|
||||
reagents_level = add_output_port("Reagents Level", PORT_TYPE_NUMBER)
|
||||
|
||||
/obj/item/circuit_component/hydroponics/register_usb_parent(atom/movable/parent)
|
||||
. = ..()
|
||||
if(istype(parent, /obj/machinery/hydroponics))
|
||||
attached_tray = parent
|
||||
RegisterSignal(attached_tray, COMSIG_HYDROTRAY_SET_SEED, .proc/on_set_seed)
|
||||
RegisterSignal(attached_tray, COMSIG_HYDROTRAY_SET_SELFSUSTAINING, .proc/on_set_selfsustaining)
|
||||
RegisterSignal(attached_tray, COMSIG_HYDROTRAY_SET_WEEDLEVEL, .proc/on_set_weedlevel)
|
||||
RegisterSignal(attached_tray, COMSIG_HYDROTRAY_SET_PESTLEVEL, .proc/on_set_pestlevel)
|
||||
RegisterSignal(attached_tray, COMSIG_HYDROTRAY_SET_WATERLEVEL, .proc/on_set_waterlevel)
|
||||
RegisterSignal(attached_tray, COMSIG_HYDROTRAY_SET_PLANT_HEALTH, .proc/on_set_plant_health)
|
||||
RegisterSignal(attached_tray, COMSIG_HYDROTRAY_SET_TOXIC, .proc/on_set_toxic_level)
|
||||
RegisterSignal(attached_tray, COMSIG_HYDROTRAY_SET_PLANT_STATUS, .proc/on_set_plant_status)
|
||||
RegisterSignal(attached_tray, COMSIG_HYDROTRAY_ON_HARVEST, .proc/on_harvest)
|
||||
RegisterSignal(attached_tray, COMSIG_HYDROTRAY_PLANT_DEATH, .proc/on_plant_death)
|
||||
var/list/reagents_holder_signals = list(
|
||||
COMSIG_REAGENTS_ADD_REAGENT,
|
||||
COMSIG_REAGENTS_REM_REAGENT,
|
||||
COMSIG_REAGENTS_NEW_REAGENT,
|
||||
COMSIG_REAGENTS_DEL_REAGENT,
|
||||
)
|
||||
RegisterSignal(attached_tray, reagents_holder_signals, .proc/update_reagents_level)
|
||||
|
||||
/obj/item/circuit_component/hydroponics/unregister_usb_parent(atom/movable/parent)
|
||||
attached_tray = null
|
||||
UnregisterSignal(parent, list(COMSIG_HYDROTRAY_SET_SEED, COMSIG_HYDROTRAY_SET_SELFSUSTAINING,
|
||||
COMSIG_HYDROTRAY_SET_WEEDLEVEL, COMSIG_HYDROTRAY_SET_PESTLEVEL, COMSIG_HYDROTRAY_SET_WATERLEVEL,
|
||||
COMSIG_HYDROTRAY_SET_PLANT_HEALTH, COMSIG_HYDROTRAY_SET_TOXIC, COMSIG_HYDROTRAY_SET_PLANT_STATUS,
|
||||
COMSIG_HYDROTRAY_ON_HARVEST, COMSIG_HYDROTRAY_PLANT_DEATH))
|
||||
if(parent.reagents)
|
||||
UnregisterSignal(parent.reagents, list(COMSIG_REAGENTS_ADD_REAGENT, COMSIG_REAGENTS_REM_REAGENT,
|
||||
COMSIG_REAGENTS_NEW_REAGENT, COMSIG_REAGENTS_DEL_REAGENT))
|
||||
return ..()
|
||||
|
||||
/obj/item/circuit_component/hydroponics/get_ui_notices()
|
||||
. = ..()
|
||||
. += create_ui_notice("Plant Status Index: \"[HYDROTRAY_NO_PLANT]\", \"[HYDROTRAY_PLANT_GROWING]\", \"[HYDROTRAY_PLANT_DEAD]\", \"[HYDROTRAY_PLANT_HARVESTABLE]\"", "orange", "info")
|
||||
|
||||
/obj/item/circuit_component/hydroponics/proc/on_set_seed(datum/source, obj/item/seeds/new_seed)
|
||||
SIGNAL_HANDLER
|
||||
seeds_planted.set_output(COMPONENT_SIGNAL)
|
||||
|
||||
/obj/item/circuit_component/hydroponics/proc/on_set_selfsustaining(datum/source, new_value)
|
||||
SIGNAL_HANDLER
|
||||
is_self_sustaining.set_output(new_value)
|
||||
|
||||
/obj/item/circuit_component/hydroponics/proc/on_set_weedlevel(datum/source, new_value)
|
||||
SIGNAL_HANDLER
|
||||
weeds_level.set_output(new_value)
|
||||
|
||||
/obj/item/circuit_component/hydroponics/proc/on_set_pestlevel(datum/source, new_value)
|
||||
SIGNAL_HANDLER
|
||||
pests_level.set_output(new_value)
|
||||
|
||||
/obj/item/circuit_component/hydroponics/proc/on_set_waterlevel(datum/source, new_value)
|
||||
SIGNAL_HANDLER
|
||||
water_level.set_output(new_value)
|
||||
|
||||
/obj/item/circuit_component/hydroponics/proc/on_set_plant_health(datum/source, new_value)
|
||||
SIGNAL_HANDLER
|
||||
plant_health.set_output(new_value)
|
||||
|
||||
/obj/item/circuit_component/hydroponics/proc/on_set_toxic_level(datum/source, new_value)
|
||||
SIGNAL_HANDLER
|
||||
toxic_level.set_output(new_value)
|
||||
|
||||
/obj/item/circuit_component/hydroponics/proc/on_set_plant_status(datum/source, new_value)
|
||||
SIGNAL_HANDLER
|
||||
plant_status.set_output(new_value)
|
||||
|
||||
/obj/item/circuit_component/hydroponics/proc/on_harvest(datum/source, product_amount)
|
||||
SIGNAL_HANDLER
|
||||
last_harvest.set_output(product_amount)
|
||||
plant_harvested.set_output(COMPONENT_SIGNAL)
|
||||
|
||||
/obj/item/circuit_component/hydroponics/proc/on_plant_death(datum/source)
|
||||
SIGNAL_HANDLER
|
||||
plant_died.set_output(COMPONENT_SIGNAL)
|
||||
|
||||
/obj/item/circuit_component/hydroponics/proc/update_reagents_level(datum/source)
|
||||
SIGNAL_HANDLER
|
||||
reagents_level.set_output(attached_tray.reagents.total_volume)
|
||||
|
||||
/obj/item/circuit_component/hydroponics/input_received(datum/port/input/port)
|
||||
if(attached_tray.anchored && attached_tray.powered())
|
||||
attached_tray.set_self_sustaining(!!selfsustaining_setting.value)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
/obj/machinery/hydroponics/proc/mutation_roll(mob/user)
|
||||
switch(rand(100))
|
||||
if(91 to 100)
|
||||
adjustHealth(-10)
|
||||
adjust_plant_health(-10)
|
||||
visible_message(span_warning("\The [myseed.plantname] starts to wilt and burn!"))
|
||||
return
|
||||
if(41 to 90)
|
||||
|
||||
@@ -690,19 +690,16 @@
|
||||
*/
|
||||
/datum/plant_gene/trait/invasive/proc/spread_seed(obj/machinery/hydroponics/target_tray, obj/machinery/hydroponics/origin_tray)
|
||||
if(target_tray.myseed) // Check if there's another seed in the next tray.
|
||||
if(target_tray.myseed.type == origin_tray.myseed.type && !target_tray.dead)
|
||||
if(target_tray.myseed.type == origin_tray.myseed.type && target_tray.plant_status != HYDROTRAY_PLANT_DEAD)
|
||||
return FALSE // It should not destroy its own kind.
|
||||
target_tray.visible_message(span_warning("The [target_tray.myseed.plantname] is overtaken by [origin_tray.myseed.plantname]!"))
|
||||
QDEL_NULL(target_tray.myseed)
|
||||
target_tray.myseed = origin_tray.myseed.Copy()
|
||||
target_tray.set_seed(origin_tray.myseed.Copy())
|
||||
target_tray.age = 0
|
||||
target_tray.dead = FALSE
|
||||
target_tray.plant_health = target_tray.myseed.endurance
|
||||
target_tray.set_plant_health(target_tray.myseed.endurance)
|
||||
target_tray.lastcycle = world.time
|
||||
target_tray.harvest = FALSE
|
||||
target_tray.weedlevel = 0 // Reset
|
||||
target_tray.pestlevel = 0 // Reset
|
||||
target_tray.update_appearance()
|
||||
target_tray.set_weedlevel(0, update_icon = FALSE) // Reset
|
||||
target_tray.set_pestlevel(0) // Reset
|
||||
target_tray.visible_message(span_warning("The [origin_tray.myseed.plantname] spreads!"))
|
||||
if(target_tray.myseed)
|
||||
target_tray.name = "[initial(target_tray.name)] ([target_tray.myseed.plantname])"
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
return !H.bee_friendly()
|
||||
if(istype(A, /obj/machinery/hydroponics))
|
||||
var/obj/machinery/hydroponics/Hydro = A
|
||||
if(Hydro.myseed && !Hydro.dead && !Hydro.recent_bee_visit)
|
||||
if(Hydro.myseed && Hydro.plant_status != HYDROTRAY_PLANT_DEAD && !Hydro.recent_bee_visit)
|
||||
wanted_objects |= hydroponicstypecache //so we only hunt them while they're alive/seeded/not visisted
|
||||
return TRUE
|
||||
return FALSE
|
||||
@@ -195,7 +195,7 @@
|
||||
generate_bee_visuals()
|
||||
|
||||
/mob/living/simple_animal/hostile/bee/proc/pollinate(obj/machinery/hydroponics/Hydro)
|
||||
if(!istype(Hydro) || !Hydro.myseed || Hydro.dead || Hydro.recent_bee_visit)
|
||||
if(!istype(Hydro) || !Hydro.myseed || Hydro.plant_status == HYDROTRAY_PLANT_DEAD || Hydro.recent_bee_visit)
|
||||
LoseTarget()
|
||||
return
|
||||
|
||||
@@ -206,9 +206,9 @@
|
||||
|
||||
var/growth = health //Health also means how many bees are in the swarm, roughly.
|
||||
//better healthier plants!
|
||||
Hydro.adjustHealth(growth*0.5)
|
||||
Hydro.adjust_plant_health(growth*0.5)
|
||||
if(prob(BEE_POLLINATE_PEST_CHANCE))
|
||||
Hydro.adjustPests(-10)
|
||||
Hydro.adjust_pestlevel(-10)
|
||||
if(prob(BEE_POLLINATE_YIELD_CHANCE))
|
||||
Hydro.myseed.adjust_yield(1)
|
||||
Hydro.yieldmod = 2
|
||||
|
||||
@@ -106,8 +106,8 @@ All effects don't start immediately, but rather get worse over time; the rate is
|
||||
/datum/reagent/consumable/ethanol/beer/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
if(chems.has_reagent(src, 1))
|
||||
mytray.adjustHealth(-round(chems.get_reagent_amount(src.type) * 0.05))
|
||||
mytray.adjustWater(round(chems.get_reagent_amount(src.type) * 0.7))
|
||||
mytray.adjust_plant_health(-round(chems.get_reagent_amount(src.type) * 0.05))
|
||||
mytray.adjust_waterlevel(round(chems.get_reagent_amount(src.type) * 0.7))
|
||||
|
||||
/datum/reagent/consumable/ethanol/beer/light
|
||||
name = "Light Beer"
|
||||
|
||||
@@ -373,7 +373,7 @@
|
||||
// Antitoxin binds plants pretty well. So the tox goes significantly down
|
||||
/datum/reagent/medicine/c2/multiver/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
mytray.adjustToxic(-(round(chems.get_reagent_amount(type) * 2)*normalise_creation_purity())) //0-2.66, 2 by default (0.75 purity).
|
||||
mytray.adjust_toxic(-(round(chems.get_reagent_amount(type) * 2)*normalise_creation_purity())) //0-2.66, 2 by default (0.75 purity).
|
||||
|
||||
#define issyrinormusc(A) (istype(A,/datum/reagent/medicine/c2/syriniver) || istype(A,/datum/reagent/medicine/c2/musiver)) //musc is metab of syrin so let's make sure we're not purging either
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@
|
||||
/datum/reagent/consumable/milk/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
if(chems.has_reagent(type, 1))
|
||||
mytray.adjustWater(round(chems.get_reagent_amount(type) * 0.3))
|
||||
mytray.adjust_waterlevel(round(chems.get_reagent_amount(type) * 0.3))
|
||||
if(myseed)
|
||||
myseed.adjust_potency(-chems.get_reagent_amount(type) * 0.5)
|
||||
|
||||
@@ -601,8 +601,8 @@
|
||||
/datum/reagent/consumable/sodawater/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
if(chems.has_reagent(type, 1))
|
||||
mytray.adjustWater(round(chems.get_reagent_amount(type) * 1))
|
||||
mytray.adjustHealth(round(chems.get_reagent_amount(type) * 0.1))
|
||||
mytray.adjust_waterlevel(round(chems.get_reagent_amount(type) * 1))
|
||||
mytray.adjust_plant_health(round(chems.get_reagent_amount(type) * 0.1))
|
||||
|
||||
/datum/reagent/consumable/sodawater/on_mob_life(mob/living/carbon/M, delta_time, times_fired)
|
||||
M.dizziness = max(M.dizziness - (5 * REM * delta_time), 0)
|
||||
|
||||
@@ -76,8 +76,8 @@
|
||||
/datum/reagent/drug/nicotine/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
if(chems.has_reagent(type, 1))
|
||||
mytray.adjustToxic(round(chems.get_reagent_amount(type)))
|
||||
mytray.adjustPests(-rand(1,2))
|
||||
mytray.adjust_toxic(round(chems.get_reagent_amount(type)))
|
||||
mytray.adjust_pestlevel(-rand(1,2))
|
||||
|
||||
/datum/reagent/drug/nicotine/on_mob_life(mob/living/carbon/M, delta_time, times_fired)
|
||||
if(DT_PROB(0.5, delta_time))
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
/datum/reagent/consumable/nutriment/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
if(chems.has_reagent(type, 1))
|
||||
mytray.adjustHealth(round(chems.get_reagent_amount(type) * 0.2))
|
||||
mytray.adjust_plant_health(round(chems.get_reagent_amount(type) * 0.2))
|
||||
|
||||
/datum/reagent/consumable/nutriment/on_mob_life(mob/living/carbon/M, delta_time, times_fired)
|
||||
if(DT_PROB(30, delta_time))
|
||||
@@ -204,8 +204,8 @@
|
||||
/datum/reagent/consumable/sugar/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
if(chems.has_reagent(type, 1))
|
||||
mytray.adjustWeeds(rand(1,2))
|
||||
mytray.adjustPests(rand(1,2))
|
||||
mytray.adjust_weedlevel(rand(1,2))
|
||||
mytray.adjust_pestlevel(rand(1,2))
|
||||
|
||||
/datum/reagent/consumable/sugar/overdose_start(mob/living/M)
|
||||
to_chat(M, span_userdanger("You go into hyperglycaemic shock! Lay off the twinkies!"))
|
||||
@@ -229,7 +229,7 @@
|
||||
/datum/reagent/consumable/virus_food/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
if(chems.has_reagent(type, 1))
|
||||
mytray.adjustHealth(-round(chems.get_reagent_amount(type) * 0.5))
|
||||
mytray.adjust_plant_health(-round(chems.get_reagent_amount(type) * 0.5))
|
||||
|
||||
/datum/reagent/consumable/soysauce
|
||||
name = "Soysauce"
|
||||
@@ -620,8 +620,8 @@
|
||||
if(myseed && prob(20))
|
||||
mytray.pollinate(1)
|
||||
else
|
||||
mytray.adjustWeeds(rand(1,2))
|
||||
mytray.adjustPests(rand(1,2))
|
||||
mytray.adjust_weedlevel(rand(1,2))
|
||||
mytray.adjust_pestlevel(rand(1,2))
|
||||
|
||||
/datum/reagent/consumable/honey/on_mob_life(mob/living/carbon/M, delta_time, times_fired)
|
||||
holder.add_reagent(/datum/reagent/consumable/sugar, 3 * REM * delta_time)
|
||||
|
||||
@@ -49,10 +49,10 @@
|
||||
/datum/reagent/medicine/adminordrazine/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
if(chems.has_reagent(type, 1))
|
||||
mytray.adjustWater(round(chems.get_reagent_amount(type) * 1))
|
||||
mytray.adjustHealth(round(chems.get_reagent_amount(type) * 1))
|
||||
mytray.adjustPests(-rand(1,5))
|
||||
mytray.adjustWeeds(-rand(1,5))
|
||||
mytray.adjust_waterlevel(round(chems.get_reagent_amount(type) * 1))
|
||||
mytray.adjust_plant_health(round(chems.get_reagent_amount(type) * 1))
|
||||
mytray.adjust_pestlevel(-rand(1,5))
|
||||
mytray.adjust_weedlevel(-rand(1,5))
|
||||
if(chems.has_reagent(type, 3))
|
||||
switch(rand(100))
|
||||
if(66 to 100)
|
||||
@@ -180,8 +180,8 @@
|
||||
// Healing
|
||||
/datum/reagent/medicine/cryoxadone/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
mytray.adjustHealth(round(chems.get_reagent_amount(type) * 3))
|
||||
mytray.adjustToxic(-round(chems.get_reagent_amount(type) * 3))
|
||||
mytray.adjust_plant_health(round(chems.get_reagent_amount(type) * 3))
|
||||
mytray.adjust_toxic(-round(chems.get_reagent_amount(type) * 3))
|
||||
|
||||
/datum/reagent/medicine/clonexadone
|
||||
name = "Clonexadone"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
/datum/reagent/blood/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray)
|
||||
. = ..()
|
||||
if(chems.has_reagent(type, 1))
|
||||
mytray.adjustPests(rand(2,3))
|
||||
mytray.adjust_pestlevel(rand(2,3))
|
||||
|
||||
/datum/reagent/blood/expose_mob(mob/living/exposed_mob, methods=TOUCH, reac_volume, show_message=TRUE, touch_protection=0)
|
||||
. = ..()
|
||||
@@ -93,7 +93,7 @@
|
||||
|
||||
/datum/reagent/blood/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray)
|
||||
. = ..()
|
||||
mytray.adjustPests(rand(2,3))
|
||||
mytray.adjust_pestlevel(rand(2,3))
|
||||
|
||||
/datum/reagent/liquidgibs
|
||||
name = "Liquid gibs"
|
||||
@@ -227,7 +227,7 @@
|
||||
///For weird backwards situations where water manages to get added to trays nutrients, as opposed to being snowflaked away like usual.
|
||||
/datum/reagent/water/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray)
|
||||
if(chems.has_reagent(src.type, 1))
|
||||
mytray.adjustWater(round(chems.get_reagent_amount(src.type) * 1))
|
||||
mytray.adjust_waterlevel(round(chems.get_reagent_amount(src.type) * 1))
|
||||
//You don't belong in this world, monster!
|
||||
chems.remove_reagent(/datum/reagent/water, chems.get_reagent_amount(src.type))
|
||||
|
||||
@@ -245,8 +245,8 @@
|
||||
// Holy water. Mostly the same as water, it also heals the plant a little with the power of the spirits. Also ALSO increases instability.
|
||||
/datum/reagent/water/holywater/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray)
|
||||
if(chems.has_reagent(type, 1))
|
||||
mytray.adjustWater(round(chems.get_reagent_amount(type) * 1))
|
||||
mytray.adjustHealth(round(chems.get_reagent_amount(type) * 0.1))
|
||||
mytray.adjust_waterlevel(round(chems.get_reagent_amount(type) * 1))
|
||||
mytray.adjust_plant_health(round(chems.get_reagent_amount(type) * 0.1))
|
||||
if(myseed)
|
||||
myseed.adjust_instability(round(chems.get_reagent_amount(type) * 0.15))
|
||||
|
||||
@@ -885,10 +885,10 @@
|
||||
/datum/reagent/chlorine/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
if(chems.has_reagent(src.type, 1))
|
||||
mytray.adjustHealth(-round(chems.get_reagent_amount(src.type) * 1))
|
||||
mytray.adjustToxic(round(chems.get_reagent_amount(src.type) * 1.5))
|
||||
mytray.adjustWater(-round(chems.get_reagent_amount(src.type) * 0.5))
|
||||
mytray.adjustWeeds(-rand(1,3))
|
||||
mytray.adjust_plant_health(-round(chems.get_reagent_amount(src.type) * 1))
|
||||
mytray.adjust_toxic(round(chems.get_reagent_amount(src.type) * 1.5))
|
||||
mytray.adjust_waterlevel(-round(chems.get_reagent_amount(src.type) * 0.5))
|
||||
mytray.adjust_weedlevel(-rand(1,3))
|
||||
// White Phosphorous + water -> phosphoric acid. That's not a good thing really.
|
||||
|
||||
|
||||
@@ -910,10 +910,10 @@
|
||||
/datum/reagent/fluorine/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
if(chems.has_reagent(src.type, 1))
|
||||
mytray.adjustHealth(-round(chems.get_reagent_amount(src.type) * 2))
|
||||
mytray.adjustToxic(round(chems.get_reagent_amount(src.type) * 2.5))
|
||||
mytray.adjustWater(-round(chems.get_reagent_amount(src.type) * 0.5))
|
||||
mytray.adjustWeeds(-rand(1,4))
|
||||
mytray.adjust_plant_health(-round(chems.get_reagent_amount(src.type) * 2))
|
||||
mytray.adjust_toxic(round(chems.get_reagent_amount(src.type) * 2.5))
|
||||
mytray.adjust_waterlevel(-round(chems.get_reagent_amount(src.type) * 0.5))
|
||||
mytray.adjust_weedlevel(-rand(1,4))
|
||||
|
||||
/datum/reagent/fluorine/on_mob_life(mob/living/carbon/M, delta_time, times_fired)
|
||||
M.adjustToxLoss(0.5*REM*delta_time, 0)
|
||||
@@ -942,9 +942,9 @@
|
||||
/datum/reagent/phosphorus/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
if(chems.has_reagent(src.type, 1))
|
||||
mytray.adjustHealth(-round(chems.get_reagent_amount(src.type) * 0.75))
|
||||
mytray.adjustWater(-round(chems.get_reagent_amount(src.type) * 0.5))
|
||||
mytray.adjustWeeds(-rand(1,2))
|
||||
mytray.adjust_plant_health(-round(chems.get_reagent_amount(src.type) * 0.75))
|
||||
mytray.adjust_waterlevel(-round(chems.get_reagent_amount(src.type) * 0.5))
|
||||
mytray.adjust_weedlevel(-rand(1,2))
|
||||
|
||||
/datum/reagent/lithium
|
||||
name = "Lithium"
|
||||
@@ -1052,8 +1052,8 @@
|
||||
. = ..()
|
||||
mytray.mutation_roll(user)
|
||||
if(chems.has_reagent(src.type, 1))
|
||||
mytray.adjustHealth(-round(chems.get_reagent_amount(src.type) * 1))
|
||||
mytray.adjustToxic(round(chems.get_reagent_amount(src.type) * 2))
|
||||
mytray.adjust_plant_health(-round(chems.get_reagent_amount(src.type) * 1))
|
||||
mytray.adjust_toxic(round(chems.get_reagent_amount(src.type) * 2))
|
||||
|
||||
/datum/reagent/uranium/radium
|
||||
name = "Radium"
|
||||
@@ -1069,8 +1069,8 @@
|
||||
/datum/reagent/uranium/radium/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
if(chems.has_reagent(src.type, 1))
|
||||
mytray.adjustHealth(-round(chems.get_reagent_amount(src.type) * 1))
|
||||
mytray.adjustToxic(round(chems.get_reagent_amount(src.type) * 1))
|
||||
mytray.adjust_plant_health(-round(chems.get_reagent_amount(src.type) * 1))
|
||||
mytray.adjust_toxic(round(chems.get_reagent_amount(src.type) * 1))
|
||||
|
||||
/datum/reagent/bluespace
|
||||
name = "Bluespace Dust"
|
||||
@@ -1319,7 +1319,7 @@
|
||||
. = ..()
|
||||
// Ammonia is bad ass.
|
||||
if(chems.has_reagent(src.type, 1))
|
||||
mytray.adjustHealth(round(chems.get_reagent_amount(src.type) * 0.12))
|
||||
mytray.adjust_plant_health(round(chems.get_reagent_amount(src.type) * 0.12))
|
||||
if(myseed && prob(10))
|
||||
myseed.adjust_yield(1)
|
||||
myseed.adjust_instability(1)
|
||||
@@ -1336,8 +1336,8 @@
|
||||
/datum/reagent/diethylamine/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
if(chems.has_reagent(src.type, 1))
|
||||
mytray.adjustHealth(round(chems.get_reagent_amount(src.type) * 1))
|
||||
mytray.adjustPests(-rand(1,2))
|
||||
mytray.adjust_plant_health(round(chems.get_reagent_amount(src.type) * 1))
|
||||
mytray.adjust_pestlevel(-rand(1,2))
|
||||
if(myseed)
|
||||
myseed.adjust_yield(round(chems.get_reagent_amount(src.type) * 1))
|
||||
myseed.adjust_instability(-round(chems.get_reagent_amount(src.type) * 1))
|
||||
@@ -1681,7 +1681,7 @@
|
||||
/datum/reagent/plantnutriment/left4zednutriment/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray)
|
||||
. = ..()
|
||||
if(myseed && chems.has_reagent(src.type, 1))
|
||||
mytray.adjustHealth(round(chems.get_reagent_amount(src.type) * 0.1))
|
||||
mytray.adjust_plant_health(round(chems.get_reagent_amount(src.type) * 0.1))
|
||||
myseed.adjust_instability(round(chems.get_reagent_amount(src.type) * 0.2))
|
||||
|
||||
/datum/reagent/plantnutriment/robustharvestnutriment
|
||||
@@ -2048,8 +2048,8 @@
|
||||
/datum/reagent/ash/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
if(chems.has_reagent(src.type, 1))
|
||||
mytray.adjustHealth(round(chems.get_reagent_amount(src.type) * 1))
|
||||
mytray.adjustWeeds(-1)
|
||||
mytray.adjust_plant_health(round(chems.get_reagent_amount(src.type) * 1))
|
||||
mytray.adjust_weedlevel(-1)
|
||||
|
||||
/datum/reagent/acetone
|
||||
name = "Acetone"
|
||||
@@ -2198,7 +2198,7 @@
|
||||
. = ..()
|
||||
if(chems.has_reagent(src.type, 1))
|
||||
var/salt = chems.get_reagent_amount(src.type)
|
||||
mytray.adjustHealth(round(salt * 0.18))
|
||||
mytray.adjust_plant_health(round(salt * 0.18))
|
||||
if(myseed)
|
||||
myseed.adjust_production(-round(salt/10)-prob(salt%10))
|
||||
myseed.adjust_potency(round(salt*1))
|
||||
|
||||
@@ -196,9 +196,9 @@
|
||||
. = ..()
|
||||
if(chems.has_reagent(type, 1))
|
||||
if(!(myseed.resistance_flags & FIRE_PROOF))
|
||||
mytray.adjustHealth(-round(chems.get_reagent_amount(type) * 6))
|
||||
mytray.adjustToxic(round(chems.get_reagent_amount(type) * 7))
|
||||
mytray.adjustWeeds(-rand(5,9)) //At least give them a small reward if they bother.
|
||||
mytray.adjust_plant_health(-round(chems.get_reagent_amount(type) * 6))
|
||||
mytray.adjust_toxic(round(chems.get_reagent_amount(type) * 7))
|
||||
mytray.adjust_weedlevel(-rand(5,9)) //At least give them a small reward if they bother.
|
||||
|
||||
/datum/reagent/napalm/on_mob_life(mob/living/carbon/M, delta_time, times_fired)
|
||||
M.adjust_fire_stacks(1 * REM * delta_time)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
/datum/reagent/toxin/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
if(chems.has_reagent(type, 1))
|
||||
mytray.adjustToxic(round(chems.get_reagent_amount(type) * 2))
|
||||
mytray.adjust_toxic(round(chems.get_reagent_amount(type) * 2))
|
||||
|
||||
/datum/reagent/toxin/on_mob_life(mob/living/carbon/M, delta_time, times_fired)
|
||||
if(toxpwr)
|
||||
@@ -66,7 +66,7 @@
|
||||
/datum/reagent/toxin/mutagen/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
mytray.mutation_roll(user)
|
||||
if(chems.has_reagent(type, 1))
|
||||
mytray.adjustToxic(3) //It is still toxic, mind you, but not to the same degree.
|
||||
mytray.adjust_toxic(3) //It is still toxic, mind you, but not to the same degree.
|
||||
|
||||
#define LIQUID_PLASMA_BP (50+T0C)
|
||||
|
||||
@@ -323,9 +323,9 @@
|
||||
/datum/reagent/toxin/plantbgone/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
if(chems.has_reagent(type, 1))
|
||||
mytray.adjustHealth(-round(chems.get_reagent_amount(type) * 10))
|
||||
mytray.adjustToxic(round(chems.get_reagent_amount(type) * 6))
|
||||
mytray.adjustWeeds(-rand(4,8))
|
||||
mytray.adjust_plant_health(-round(chems.get_reagent_amount(type) * 10))
|
||||
mytray.adjust_toxic(round(chems.get_reagent_amount(type) * 6))
|
||||
mytray.adjust_weedlevel(-rand(4,8))
|
||||
|
||||
/datum/reagent/toxin/plantbgone/expose_obj(obj/exposed_obj, reac_volume)
|
||||
. = ..()
|
||||
@@ -361,8 +361,8 @@
|
||||
if(!mytray)
|
||||
return
|
||||
if(chems.has_reagent(type, 1))
|
||||
mytray.adjustToxic(round(chems.get_reagent_amount(type) * 0.5))
|
||||
mytray.adjustWeeds(-rand(1,2))
|
||||
mytray.adjust_toxic(round(chems.get_reagent_amount(type) * 0.5))
|
||||
mytray.adjust_weedlevel(-rand(1,2))
|
||||
|
||||
/datum/reagent/toxin/pestkiller
|
||||
name = "Pest Killer"
|
||||
@@ -377,8 +377,8 @@
|
||||
if(!mytray)
|
||||
return
|
||||
if(chems.has_reagent(type, 1))
|
||||
mytray.adjustToxic(round(chems.get_reagent_amount(type) * 1))
|
||||
mytray.adjustPests(-rand(1,2))
|
||||
mytray.adjust_toxic(round(chems.get_reagent_amount(type) * 1))
|
||||
mytray.adjust_pestlevel(-rand(1,2))
|
||||
|
||||
/datum/reagent/toxin/pestkiller/expose_mob(mob/living/exposed_mob, methods=TOUCH, reac_volume)
|
||||
. = ..()
|
||||
@@ -398,8 +398,8 @@
|
||||
if(!mytray)
|
||||
return
|
||||
if(chems.has_reagent(type, 1))
|
||||
mytray.adjustToxic(round(chems.get_reagent_amount(type) * 0.1))
|
||||
mytray.adjustPests(-rand(1,2))
|
||||
mytray.adjust_toxic(round(chems.get_reagent_amount(type) * 0.1))
|
||||
mytray.adjust_pestlevel(-rand(1,2))
|
||||
|
||||
/datum/reagent/toxin/spore
|
||||
name = "Spore Toxin"
|
||||
@@ -1014,9 +1014,9 @@
|
||||
/datum/reagent/toxin/acid/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
if(chems.has_reagent(type, 1))
|
||||
mytray.adjustHealth(-round(chems.get_reagent_amount(type) * 1))
|
||||
mytray.adjustToxic(round(chems.get_reagent_amount(type) * 1.5))
|
||||
mytray.adjustWeeds(-rand(1,2))
|
||||
mytray.adjust_plant_health(-round(chems.get_reagent_amount(type) * 1))
|
||||
mytray.adjust_toxic(round(chems.get_reagent_amount(type) * 1.5))
|
||||
mytray.adjust_weedlevel(-rand(1,2))
|
||||
|
||||
/datum/reagent/toxin/acid/expose_mob(mob/living/carbon/exposed_carbon, methods=TOUCH, reac_volume)
|
||||
. = ..()
|
||||
@@ -1060,9 +1060,9 @@
|
||||
/datum/reagent/toxin/acid/fluacid/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user)
|
||||
. = ..()
|
||||
if(chems.has_reagent(type, 1))
|
||||
mytray.adjustHealth(-round(chems.get_reagent_amount(type) * 2))
|
||||
mytray.adjustToxic(round(chems.get_reagent_amount(type) * 3))
|
||||
mytray.adjustWeeds(-rand(1,4))
|
||||
mytray.adjust_plant_health(-round(chems.get_reagent_amount(type) * 2))
|
||||
mytray.adjust_toxic(round(chems.get_reagent_amount(type) * 3))
|
||||
mytray.adjust_weedlevel(-rand(1,4))
|
||||
|
||||
/datum/reagent/toxin/acid/fluacid/on_mob_life(mob/living/carbon/M, delta_time, times_fired)
|
||||
M.adjustFireLoss((current_cycle/15) * REM * normalise_creation_purity() * delta_time, 0)
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
var/obj/machinery/hydroponics/H = target
|
||||
if(!H.myseed)
|
||||
return
|
||||
if(!H.harvest)// So it's bit harder.
|
||||
if(H.plant_status != HYDROTRAY_PLANT_HARVESTABLE)// So it's bit harder.
|
||||
to_chat(user, span_alert("Plant needs to be ready to harvest to perform full data scan.")) //Because space dna is actually magic
|
||||
return
|
||||
if(plants[H.myseed.type])
|
||||
|
||||
@@ -42,13 +42,13 @@
|
||||
seed.set_potency(100) // Sets the seed potency to 100.
|
||||
seed.set_instability(0) // Sets the seed instability to 0, to prevent mutations.
|
||||
|
||||
tray.myseed = seed
|
||||
tray.set_seed(seed)
|
||||
seed.forceMove(tray)
|
||||
tray.name = tray.myseed ? "[initial(tray.name)] ([tray.myseed.plantname])" : initial(tray.name)
|
||||
|
||||
tray.plant_health = seed.endurance
|
||||
tray.set_plant_health(seed.endurance)
|
||||
tray.age = 20
|
||||
tray.harvest = TRUE
|
||||
tray.set_plant_status(HYDROTRAY_PLANT_HARVESTABLE)
|
||||
|
||||
/datum/unit_test/hydroponics_harvest/proc/test_seed(obj/machinery/hydroponics/tray, obj/item/seeds/seed, mob/living/carbon/user)
|
||||
tray.reagents.add_reagent(/datum/reagent/plantnutriment/eznutriment, 20)
|
||||
@@ -91,9 +91,8 @@
|
||||
TEST_ASSERT_EQUAL(found_vitamins, expected_vitamins * max_volume, "Hydroponics harvest from [saved_name] has a [expected_vitamins] vitamin gene (expecting [expected_nutriments * max_volume]) but only had [found_vitamins] units of vitamins inside.")
|
||||
|
||||
if(tray.myseed)
|
||||
tray.harvest = FALSE
|
||||
tray.age = 0
|
||||
tray.plant_health = 0
|
||||
tray.set_plant_health(0)
|
||||
|
||||
QDEL_NULL(tray.myseed)
|
||||
tray.set_seed(null)
|
||||
tray.name = tray.myseed ? "[initial(tray.name)] ([tray.myseed.plantname])" : initial(tray.name)
|
||||
|
||||
Reference in New Issue
Block a user