diff --git a/baystation12.dme b/baystation12.dme
index 58390516d65..fe045833b49 100644
--- a/baystation12.dme
+++ b/baystation12.dme
@@ -298,6 +298,7 @@
#include "code\game\machinery\Beacon.dm"
#include "code\game\machinery\bees_apiary.dm"
#include "code\game\machinery\bees_items.dm"
+#include "code\game\machinery\biogenerator.dm"
#include "code\game\machinery\buttons.dm"
#include "code\game\machinery\cell_charger.dm"
#include "code\game\machinery\cloning.dm"
diff --git a/code/game/machinery/biogenerator.dm b/code/game/machinery/biogenerator.dm
index 4609b2b3bf0..263f797a95d 100644
--- a/code/game/machinery/biogenerator.dm
+++ b/code/game/machinery/biogenerator.dm
@@ -1,231 +1,226 @@
-/obj/machinery/biogenerator
- name = "Biogenerator"
- desc = ""
- icon = 'icons/obj/biogenerator.dmi'
- icon_state = "biogen-stand"
- density = 1
- anchored = 1
- use_power = 1
- idle_power_usage = 40
- var/processing = 0
- var/obj/item/weapon/reagent_containers/glass/beaker = null
- var/points = 0
- var/menustat = "menu"
-
- New()
- ..()
- var/datum/reagents/R = new/datum/reagents(1000)
- reagents = R
- R.my_atom = src
- beaker = new /obj/item/weapon/reagent_containers/glass/beaker/large(src)
-
- l_color = "#7BF9FF"
- power_change()
- ..()
- if(!(stat & (BROKEN|NOPOWER)))
- SetLuminosity(2)
- else
- SetLuminosity(0)
-
- on_reagent_change() //When the reagents change, change the icon as well.
- update_icon()
-
- update_icon()
- if(!src.beaker)
- icon_state = "biogen-empty"
- else if(!src.processing)
- icon_state = "biogen-stand"
- else
- icon_state = "biogen-work"
- return
-
-/obj/machinery/biogenerator/attackby(var/obj/item/O as obj, var/mob/user as mob)
- if(istype(O, /obj/item/weapon/reagent_containers/glass))
- if(beaker)
- user << "\red The biogenerator is already loaded."
- else
- user.before_take_item(O)
- O.loc = src
- beaker = O
- updateUsrDialog()
- else if(processing)
- user << "\red The biogenerator is currently processing."
- else if(istype(O, /obj/item/weapon/storage/bag/plants))
- var/i = 0
- for(var/obj/item/weapon/reagent_containers/food/snacks/grown/G in contents)
- i++
- if(i >= 10)
- user << "\red The biogenerator is already full! Activate it."
- else
- for(var/obj/item/weapon/reagent_containers/food/snacks/grown/G in O.contents)
- G.loc = src
- i++
- if(i >= 10)
- user << "\blue You fill the biogenerator to its capacity."
- break
- if(i<10)
- user << "\blue You empty the plant bag into the biogenerator."
-
-
- else if(!istype(O, /obj/item/weapon/reagent_containers/food/snacks/grown))
- user << "\red You cannot put this in [src.name]"
- else
- var/i = 0
- for(var/obj/item/weapon/reagent_containers/food/snacks/grown/G in contents)
- i++
- if(i >= 10)
- user << "\red The biogenerator is full! Activate it."
- else
- user.before_take_item(O)
- O.loc = src
- user << "\blue You put [O.name] in [src.name]"
- update_icon()
- return
-
-/obj/machinery/biogenerator/interact(mob/user as mob)
- if(stat & BROKEN)
- return
- user.set_machine(src)
- var/dat = "
BiogeneratorBiogenerator:
"
- if (processing)
- dat += "Biogenerator is processing! Please wait..."
- else
- dat += "Biomass: [points] points.
"
- switch(menustat)
- if("menu")
- if (beaker)
- dat += "Activate Biogenerator!
"
- dat += "Detach Container
"
- dat += "Food
"
- dat += "10 milk (20)
"
- dat += "Slab of meat (50)
"
- dat += "Nutrient
"
- dat += "E-Z-Nutrient (10) | x5
"
- dat += "Left 4 Zed (20) | x5
"
- dat += "Robust Harvest (25) | x5
"
- dat += "Leather
"
- dat += "Wallet (100)
"
- dat += "Botanical gloves (250)
"
- dat += "Utility belt (300)
"
- dat += "Leather Satchel (400)
"
- //dat += "Other
"
- //dat += "Monkey (500)
"
- else
- dat += "
No beaker inside. Please insert a beaker.
"
- if("nopoints")
- dat += "You do not have biomass to create products.
Please, put growns into reactor and activate it.
"
- dat += "Return to menu"
- if("complete")
- dat += "Operation complete.
"
- dat += "Return to menu"
- if("void")
- dat += "Error: No growns inside.
Please, put growns into reactor.
"
- dat += "Return to menu"
- user << browse(dat, "window=biogenerator")
- onclose(user, "biogenerator")
- return
-
-/obj/machinery/biogenerator/attack_hand(mob/user as mob)
- interact(user)
-
-/obj/machinery/biogenerator/proc/activate()
- if (usr.stat != 0)
- return
- if (src.stat != 0) //NOPOWER etc
- return
- if(src.processing)
- usr << "\red The biogenerator is in the process of working."
- return
- var/S = 0
- for(var/obj/item/weapon/reagent_containers/food/snacks/grown/I in contents)
- S += 5
- if(I.reagents.get_reagent_amount("nutriment") < 0.1)
- points += 1
- else points += I.reagents.get_reagent_amount("nutriment")*10
- del(I)
- if(S)
- processing = 1
- update_icon()
- updateUsrDialog()
- playsound(get_turf(src), 'sound/machines/blender.ogg', 50, 1)
- use_power(S*30)
- sleep(S+15)
- processing = 0
- update_icon()
- else
- menustat = "void"
- return
-
-/obj/machinery/biogenerator/proc/create_product(var/item,var/cost)
- if(cost > points)
- menustat = "nopoints"
- return 0
- processing = 1
- update_icon()
- updateUsrDialog()
- points -= cost
- sleep(30)
- switch(item)
- if("milk")
- beaker.reagents.add_reagent("milk",10)
- if("meat")
- new/obj/item/weapon/reagent_containers/food/snacks/meat(src.loc)
- if("ez")
- new/obj/item/nutrient/ez(src.loc)
- if("l4z")
- new/obj/item/nutrient/l4z(src.loc)
- if("rh")
- new/obj/item/nutrient/rh(src.loc)
- if("ez5") //It's not an elegant method, but it's safe and easy. -Cheridan
- new/obj/item/nutrient/ez(src.loc)
- new/obj/item/nutrient/ez(src.loc)
- new/obj/item/nutrient/ez(src.loc)
- new/obj/item/nutrient/ez(src.loc)
- new/obj/item/nutrient/ez(src.loc)
- if("l4z5")
- new/obj/item/nutrient/l4z(src.loc)
- new/obj/item/nutrient/l4z(src.loc)
- new/obj/item/nutrient/l4z(src.loc)
- new/obj/item/nutrient/l4z(src.loc)
- new/obj/item/nutrient/l4z(src.loc)
- if("rh5")
- new/obj/item/nutrient/rh(src.loc)
- new/obj/item/nutrient/rh(src.loc)
- new/obj/item/nutrient/rh(src.loc)
- new/obj/item/nutrient/rh(src.loc)
- new/obj/item/nutrient/rh(src.loc)
- if("wallet")
- new/obj/item/weapon/storage/wallet(src.loc)
- if("gloves")
- new/obj/item/clothing/gloves/botanic_leather(src.loc)
- if("tbelt")
- new/obj/item/weapon/storage/belt/utility(src.loc)
- if("satchel")
- new/obj/item/weapon/storage/backpack/satchel(src.loc)
- if("monkey")
- new/mob/living/carbon/monkey(src.loc)
- processing = 0
- menustat = "complete"
- update_icon()
- return 1
-
-/obj/machinery/biogenerator/Topic(href, href_list)
- if(stat & BROKEN) return
- if(usr.stat || usr.restrained()) return
- if(!in_range(src, usr)) return
-
- usr.set_machine(src)
-
- switch(href_list["action"])
- if("activate")
- activate()
- if("detach")
- if(beaker)
- beaker.loc = src.loc
- beaker = null
- update_icon()
- if("create")
- create_product(href_list["item"],text2num(href_list["cost"]))
- if("menu")
- menustat = "menu"
+/obj/machinery/biogenerator
+ name = "Biogenerator"
+ desc = ""
+ icon = 'icons/obj/biogenerator.dmi'
+ icon_state = "biogen-stand"
+ density = 1
+ anchored = 1
+ use_power = 1
+ idle_power_usage = 40
+ var/processing = 0
+ var/obj/item/weapon/reagent_containers/glass/beaker = null
+ var/points = 0
+ var/menustat = "menu"
+
+ New()
+ ..()
+ var/datum/reagents/R = new/datum/reagents(1000)
+ reagents = R
+ R.my_atom = src
+ beaker = new /obj/item/weapon/reagent_containers/glass/beaker/large(src)
+
+ on_reagent_change() //When the reagents change, change the icon as well.
+ update_icon()
+
+ update_icon()
+ if(!src.beaker)
+ icon_state = "biogen-empty"
+ else if(!src.processing)
+ icon_state = "biogen-stand"
+ else
+ icon_state = "biogen-work"
+ return
+
+/obj/machinery/biogenerator/attackby(var/obj/item/O as obj, var/mob/user as mob)
+ if(istype(O, /obj/item/weapon/reagent_containers/glass))
+ if(beaker)
+ user << "\red The biogenerator is already loaded."
+ else
+ user.before_take_item(O)
+ O.loc = src
+ beaker = O
+ updateUsrDialog()
+ else if(processing)
+ user << "\red The biogenerator is currently processing."
+ else if(istype(O, /obj/item/weapon/storage/bag/plants))
+ var/i = 0
+ for(var/obj/item/weapon/reagent_containers/food/snacks/grown/G in contents)
+ i++
+ if(i >= 10)
+ user << "\red The biogenerator is already full! Activate it."
+ else
+ for(var/obj/item/weapon/reagent_containers/food/snacks/grown/G in O.contents)
+ G.loc = src
+ i++
+ if(i >= 10)
+ user << "\blue You fill the biogenerator to its capacity."
+ break
+ if(i<10)
+ user << "\blue You empty the plant bag into the biogenerator."
+
+
+ else if(!istype(O, /obj/item/weapon/reagent_containers/food/snacks/grown))
+ user << "\red You cannot put this in [src.name]"
+ else
+ var/i = 0
+ for(var/obj/item/weapon/reagent_containers/food/snacks/grown/G in contents)
+ i++
+ if(i >= 10)
+ user << "\red The biogenerator is full! Activate it."
+ else
+ user.before_take_item(O)
+ O.loc = src
+ user << "\blue You put [O.name] in [src.name]"
+ update_icon()
+ return
+
+/obj/machinery/biogenerator/interact(mob/user as mob)
+ if(stat & BROKEN)
+ return
+ user.set_machine(src)
+ var/dat = "BiogeneratorBiogenerator:
"
+ if (processing)
+ dat += "Biogenerator is processing! Please wait..."
+ else
+ dat += "Biomass: [points] points.
"
+ switch(menustat)
+ if("menu")
+ if (beaker)
+ dat += "Activate Biogenerator!
"
+ dat += "Detach Container
"
+ dat += "Food
"
+ dat += "10 milk (20)
"
+ dat += "Slab of meat (50)
"
+ dat += "Nutrient
"
+ dat += "E-Z-Nutrient (10) | x5
"
+ dat += "Left 4 Zed (20) | x5
"
+ dat += "Robust Harvest (25) | x5
"
+ dat += "Leather
"
+ dat += "Wallet (100)
"
+ dat += "Botanical gloves (250)
"
+ dat += "Utility belt (300)
"
+ dat += "Leather Satchel (400)
"
+ dat += "Cash Bag (400)
"
+ //dat += "Other
"
+ //dat += "Monkey (500)
"
+ else
+ dat += "
No beaker inside. Please insert a beaker.
"
+ if("nopoints")
+ dat += "You do not have biomass to create products.
Please, put growns into reactor and activate it.
"
+ dat += "Return to menu"
+ if("complete")
+ dat += "Operation complete.
"
+ dat += "Return to menu"
+ if("void")
+ dat += "Error: No growns inside.
Please, put growns into reactor.
"
+ dat += "Return to menu"
+ user << browse(dat, "window=biogenerator")
+ onclose(user, "biogenerator")
+ return
+
+/obj/machinery/biogenerator/attack_hand(mob/user as mob)
+ interact(user)
+
+/obj/machinery/biogenerator/proc/activate()
+ if (usr.stat != 0)
+ return
+ if (src.stat != 0) //NOPOWER etc
+ return
+ if(src.processing)
+ usr << "\red The biogenerator is in the process of working."
+ return
+ var/S = 0
+ for(var/obj/item/weapon/reagent_containers/food/snacks/grown/I in contents)
+ S += 5
+ if(I.reagents.get_reagent_amount("nutriment") < 0.1)
+ points += 1
+ else points += I.reagents.get_reagent_amount("nutriment")*10
+ del(I)
+ if(S)
+ processing = 1
+ update_icon()
+ updateUsrDialog()
+ playsound(src.loc, 'sound/machines/blender.ogg', 50, 1)
+ use_power(S*30)
+ sleep(S+15)
+ processing = 0
+ update_icon()
+ else
+ menustat = "void"
+ return
+
+/obj/machinery/biogenerator/proc/create_product(var/item,var/cost)
+ if(cost > points)
+ menustat = "nopoints"
+ return 0
+ processing = 1
+ update_icon()
+ updateUsrDialog()
+ points -= cost
+ sleep(30)
+ switch(item)
+ if("milk")
+ beaker.reagents.add_reagent("milk",10)
+ if("meat")
+ new/obj/item/weapon/reagent_containers/food/snacks/meat(src.loc)
+ if("ez")
+ new/obj/item/weapon/reagent_containers/glass/fertilizer/ez(src.loc)
+ if("l4z")
+ new/obj/item/weapon/reagent_containers/glass/fertilizer/l4z(src.loc)
+ if("rh")
+ new/obj/item/weapon/reagent_containers/glass/fertilizer/rh(src.loc)
+ if("ez5") //It's not an elegant method, but it's safe and easy. -Cheridan
+ new/obj/item/weapon/reagent_containers/glass/fertilizer/ez(src.loc)
+ new/obj/item/weapon/reagent_containers/glass/fertilizer/ez(src.loc)
+ new/obj/item/weapon/reagent_containers/glass/fertilizer/ez(src.loc)
+ new/obj/item/weapon/reagent_containers/glass/fertilizer/ez(src.loc)
+ new/obj/item/weapon/reagent_containers/glass/fertilizer/ez(src.loc)
+ if("l4z5")
+ new/obj/item/weapon/reagent_containers/glass/fertilizer/l4z(src.loc)
+ new/obj/item/weapon/reagent_containers/glass/fertilizer/l4z(src.loc)
+ new/obj/item/weapon/reagent_containers/glass/fertilizer/l4z(src.loc)
+ new/obj/item/weapon/reagent_containers/glass/fertilizer/l4z(src.loc)
+ new/obj/item/weapon/reagent_containers/glass/fertilizer/l4z(src.loc)
+ if("rh5")
+ new/obj/item/weapon/reagent_containers/glass/fertilizer/rh(src.loc)
+ new/obj/item/weapon/reagent_containers/glass/fertilizer/rh(src.loc)
+ new/obj/item/weapon/reagent_containers/glass/fertilizer/rh(src.loc)
+ new/obj/item/weapon/reagent_containers/glass/fertilizer/rh(src.loc)
+ new/obj/item/weapon/reagent_containers/glass/fertilizer/rh(src.loc)
+ if("wallet")
+ new/obj/item/weapon/storage/wallet(src.loc)
+ if("gloves")
+ new/obj/item/clothing/gloves/botanic_leather(src.loc)
+ if("tbelt")
+ new/obj/item/weapon/storage/belt/utility(src.loc)
+ if("satchel")
+ new/obj/item/weapon/storage/backpack/satchel(src.loc)
+ if("cashbag")
+ new/obj/item/weapon/storage/bag/cash(src.loc)
+ if("monkey")
+ new/mob/living/carbon/monkey(src.loc)
+ processing = 0
+ menustat = "complete"
+ update_icon()
+ return 1
+
+/obj/machinery/biogenerator/Topic(href, href_list)
+ if(stat & BROKEN) return
+ if(usr.stat || usr.restrained()) return
+ if(!in_range(src, usr)) return
+
+ usr.set_machine(src)
+
+ switch(href_list["action"])
+ if("activate")
+ activate()
+ if("detach")
+ if(beaker)
+ beaker.loc = src.loc
+ beaker = null
+ update_icon()
+ if("create")
+ create_product(href_list["item"],text2num(href_list["cost"]))
+ if("menu")
+ menustat = "menu"
updateUsrDialog()
diff --git a/code/game/machinery/hydroponics.dm b/code/game/machinery/hydroponics.dm
index b451cd3b67e..2f55f68cb7b 100644
--- a/code/game/machinery/hydroponics.dm
+++ b/code/game/machinery/hydroponics.dm
@@ -6,6 +6,8 @@
icon_state = "hydrotray3"
density = 1
anchored = 1
+ flags = OPENCONTAINER
+
var/draw_warnings = 1 //Set to 0 to stop it from drawing the alert lights.
// Plant maintenance vars.
@@ -30,98 +32,101 @@
var/lastcycle = 0 // Cycle timing/tracking var.
var/cycledelay = 150 // Delay per cycle.
var/closed_system // If set, the tray will attempt to take atmos from a pipe.
- var/force_update
// Seed details/line data.
var/datum/seed/seed = null // The currently planted seed
- // Reagent information for attackby(), consider moving this to a controller along
+ // Reagent information for process(), consider moving this to a controller along
// with cycle information under 'mechanical concerns' at some point.
- // For all following lists, when called in attackby() the relevant value will be increased
- // by 1,val if val>0 or decreased by 1,val if val<0.
-
var/global/list/toxic_reagents = list(
- "anti_toxin" = -2,
- "toxin" = 2,
- "fluorine" = 2.5,
- "chlorine" = 1.5,
- "sacid" = 1.5,
- "pacid" = 3,
- "plantbgone" = 3,
- "cryoxadone" = -3,
- "radium" = 2
+ "anti_toxin" = -2,
+ "toxin" = 2,
+ "fluorine" = 2.5,
+ "chlorine" = 1.5,
+ "sacid" = 1.5,
+ "pacid" = 3,
+ "plantbgone" = 3,
+ "cryoxadone" = -3,
+ "radium" = 2
)
var/global/list/nutrient_reagents = list(
- "milk" = 0.1,
- "beer" = 0.25,
- "phosphorus" = 0.1,
- "sugar" = 0.1,
- "sodawater" = 0.1,
- "ammonia" = 1,
- "diethylamine" = 2,
- "nutriment" = 1,
- "adminordrazine" = 1
+ "milk" = 0.1,
+ "beer" = 0.25,
+ "phosphorus" = 0.1,
+ "sugar" = 0.1,
+ "sodawater" = 0.1,
+ "ammonia" = 1,
+ "diethylamine" = 2,
+ "nutriment" = 1,
+ "adminordrazine" = 1,
+ "eznutrient" = 1,
+ "robustharvest" = 1,
+ "left4zed" = 1
)
var/global/list/weedkiller_reagents = list(
- "fluorine" = -4,
- "chlorine" = -3,
- "phosphorus" = -2,
- "sugar" = 2,
- "sacid" = -2,
- "pacid" = -4,
- "plantbgone" = -8,
+ "fluorine" = -4,
+ "chlorine" = -3,
+ "phosphorus" = -2,
+ "sugar" = 2,
+ "sacid" = -2,
+ "pacid" = -4,
+ "plantbgone" = -8,
"adminordrazine" = -5
)
var/global/list/pestkiller_reagents = list(
- "sugar" = 2,
- "diethylamine" = -2,
+ "sugar" = 2,
+ "diethylamine" = -2,
"adminordrazine" = -5
)
- var/global/list/beneficial_reagents = list(
- "beer" = -0.05,
- "fluorine" = -2,
- "chlorine" = -1,
- "phosphorus" = -0.75,
- "sodawater" = 0.1,
- "sacid" = -1,
- "pacid" = -2,
- "plantbgone" = -2,
- "cryoxadone" = 3,
- "ammonia" = 0.5,
- "diethylamine" = 1,
- "nutriment" = 0.5,
- "radium" = -1.5,
- "adminordrazine" = 1
- )
var/global/list/water_reagents = list(
- "adminordrazine" = 1,
- "milk" = 0.9,
- "beer" = 0.7,
- "flourine" = -0.5,
- "chlorine" = -0.5,
- "phosphorus" = -0.5,
- "water" = 1,
- "sodawater" = 1,
+ "water" = 1,
+ "adminordrazine" = 1,
+ "milk" = 0.9,
+ "beer" = 0.7,
+ "flourine" = -0.5,
+ "chlorine" = -0.5,
+ "phosphorus" = -0.5,
+ "water" = 1,
+ "sodawater" = 1,
+ )
+
+ // Beneficial reagents also have values for modifying yield_mod and mut_mod (in that order).
+ var/global/list/beneficial_reagents = list(
+ "beer" = list( -0.05, 0, 0 ),
+ "fluorine" = list( -2, 0, 0 ),
+ "chlorine" = list( -1, 0, 0 ),
+ "phosphorus" = list( -0.75, 0, 0 ),
+ "sodawater" = list( 0.1, 0, 0 ),
+ "sacid" = list( -1, 0, 0 ),
+ "pacid" = list( -2, 0, 0 ),
+ "plantbgone" = list( -2, 0, 0.2 ),
+ "cryoxadone" = list( 3, 0, 0 ),
+ "ammonia" = list( 0.5, 0, 0 ),
+ "diethylamine" = list( 1, 0, 0 ),
+ "nutriment" = list( 0.5, 1, 0 ),
+ "radium" = list( -1.5, 0, 0.2 ),
+ "adminordrazine" = list( 1, 1, 1 ),
+ "robustharvest" = list( 0, 0.2, 0 ),
+ "left4zed" = list( 0, 0, 0.2 )
)
// Mutagen list specifies minimum value for the mutation to take place, rather
// than a bound as the lists above specify.
var/global/list/mutagenic_reagents = list(
- "radium" = 8,
- "mutagen" = 3
+ "radium" = list(8,3),
+ "mutagen" = list(3,8)
)
/obj/machinery/portable_atmospherics/hydroponics/New()
..()
+ create_reagents(200)
connect()
update_icon()
+ if(closed_system)
+ flags &= ~OPENCONTAINER
/obj/machinery/portable_atmospherics/hydroponics/bullet_act(var/obj/item/projectile/Proj)
- //Don't act on seeds like dionaea that shouldn't change.
- if(seed && seed.immutable > 0)
- return
-
//Override for somatoray projectiles.
if(istype(Proj ,/obj/item/projectile/energy/floramut) && prob(20))
mutate(1)
@@ -142,12 +147,13 @@
/obj/machinery/portable_atmospherics/hydroponics/process()
- // Update values every cycle rather than every process() tick.
- if(force_update)
- force_update = 0
- else if(world.time < (lastcycle + cycledelay))
- return
+ //Do this even if we're not ready for a plant cycle.
+ if(seed && !dead)
+ process_reagents()
+ // Update values every cycle rather than every process() tick.
+ if(world.time < (lastcycle + cycledelay))
+ return
lastcycle = world.time
// Weeds like water and nutrients, there's a chance the weed population will increase.
@@ -169,11 +175,6 @@
// Advance plant age.
if(prob(25)) age += 1 * HYDRO_SPEED_MULTIPLIER
- //Highly mutable plants have a chance of mutating every tick.
- if(seed.immutable == -1)
- var/mut_prob = rand(1,100)
- if(mut_prob <= 5) mutate(mut_prob == 1 ? 2 : 1)
-
// Maintain tray nutrient and water levels.
if(seed.nutrient_consumption > 0 && nutrilevel > 0 && prob(25))
nutrilevel -= max(0,seed.nutrient_consumption * HYDRO_SPEED_MULTIPLIER)
@@ -201,9 +202,9 @@
// If atmos input is not there, grab from turf.
if(!environment)
if(istype(T))
- environment = T.air
- if(!environment)
- return
+ environment = T.return_air()
+
+ if(!environment) return
/*
// Handle gas consumption.
@@ -219,6 +220,9 @@
if(missing_gas > 0)
health -= missing_gas * HYDRO_SPEED_MULTIPLIER
+ if(!environment) //We're in a crate or nullspace, bail out.
+ return
+
// Process it.
var/pressure = environment.return_pressure()
if(pressure < seed.lowkpa_tolerance || pressure > seed.highkpa_tolerance)
@@ -231,7 +235,7 @@
if(seed.exude_gasses && seed.exude_gasses.len)
var/datum/gas_mixture/exuded = new
for(var/gas in seed.exude_gasses)
- exuded.adjust_gas(gas,seed.exude_gasses[gas*seed.potency],1) //This will need adjustment since it produces moles.
+ exuded.adjust_gas(gas,seed.exude_gasses[gas*seed.potency],1) //This will need balancing since it produces moles.
loc.assume_air(exuded)
*/
// Handle light requirements.
@@ -283,18 +287,67 @@
pestlevel = 0
// If enough time (in cycles, not ticks) has passed since the plant was harvested, we're ready to harvest again.
- else if(seed.products && seed.products.len && age > seed.production && \
- (age - lastproduce) > seed.production && (!harvest && !dead))
-
+ else if(seed.products && seed.products.len && age > seed.production && (age - lastproduce) > seed.production && (!harvest && !dead))
harvest = 1
lastproduce = age
- if(prob(5)) // On each tick, there's a 5 percent chance the pest population will increase
+ if(prob(3)) // On each tick, there's a chance the pest population will increase
pestlevel += 1 * HYDRO_SPEED_MULTIPLIER
+
check_level_sanity()
update_icon()
return
+//Process reagents being input into the tray.
+/obj/machinery/portable_atmospherics/hydroponics/proc/process_reagents()
+ if(dead || !seed || !reagents) return
+
+ if(reagents.total_volume <= 0)
+ return
+
+ for(var/datum/reagent/R in reagents.reagent_list)
+
+ var/reagent_total = reagents.get_reagent_amount(R.id)
+
+ //Handle some general level adjustments.
+ if(toxic_reagents[R.id])
+ toxins += toxic_reagents[R.id] * reagent_total
+ if(nutrient_reagents[R.id])
+ nutrilevel += nutrient_reagents[R.id] * reagent_total
+ if(weedkiller_reagents[R.id])
+ weedlevel += weedkiller_reagents[R.id] * reagent_total
+ if(pestkiller_reagents[R.id])
+ pestlevel += pestkiller_reagents[R.id] * reagent_total
+
+ // Beneficial reagents have a few impacts along with health buffs.
+ if(beneficial_reagents[R.id])
+ health += beneficial_reagents[R.id][1] * reagent_total
+ yield_mod += beneficial_reagents[R.id][2] * reagent_total
+ mutation_mod += beneficial_reagents[R.id][3] * reagent_total
+
+ // Mutagen is distinct from the previous types and mostly has a chance of proccing a mutation.
+ if(mutagenic_reagents[R.id])
+ var/reagent_min_value = mutagenic_reagents[R.id][1]
+ var/reagent_value = mutagenic_reagents[R.id][2]+mutation_mod
+
+ if(reagent_total >= reagent_min_value)
+ if(prob(min(reagent_total*reagent_value,100)))
+ mutate(reagent_total > 10 ? 2 : 1)
+
+ // Handle water and water refilling.
+ var/water_added = 0
+ if(water_reagents[R.id])
+ var/water_input = water_reagents[R.id] * reagent_total
+ water_added += water_input
+ waterlevel += water_input
+
+ if(water_added > 0)
+ toxins -= round(water_added/4)
+
+ reagents.clear_reagents()
+ check_level_sanity()
+ update_icon()
+
//Harvests the product of a plant.
/obj/machinery/portable_atmospherics/hydroponics/proc/harvest(var/mob/user)
@@ -447,7 +500,6 @@
weedlevel = max(0,min(weedlevel,10))
toxins = max(0,min(toxins,10))
-
/obj/machinery/portable_atmospherics/hydroponics/proc/mutate_species()
var/previous_plant = seed.display_name
@@ -472,168 +524,26 @@
/obj/machinery/portable_atmospherics/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob)
- if(istype(O, /obj/item/weapon/wirecutters) || istype(O, /obj/item/weapon/scalpel))
+ if (O.is_open_container())
+ return 0
- if(!seed)
- user << "There is nothing to take a sample from in \the [src]."
- return
-
- seed.harvest(user,yield_mod,1)
- health -= (rand(1,5)*10)
- check_level_sanity()
-
- force_update = 1
- process()
-
- return
-
- else if (istype(O, /obj/item/weapon/reagent_containers/glass))
- var/b_amount = O.reagents.get_reagent_amount("water")
- if(b_amount > 0 && waterlevel < 100)
- if(b_amount + waterlevel > 100)
- b_amount = 100 - waterlevel
- O.reagents.remove_reagent("water", b_amount)
- waterlevel += b_amount
- playsound(loc, 'sound/effects/slosh.ogg', 25, 1)
- user << "You fill \the [src] with [round(b_amount,0.1)] units of water."
-
- // The more water you put in, the more diluted the toxins become.
- toxins -= round(b_amount/4)
-
- else if(waterlevel >= 100)
- user << "\red \The [src] is already full."
- else
- user << "\red \The [O] is not filled with water."
-
- check_level_sanity()
- update_icon()
-
- // Nutrient fluid replacement. TODO: Consider rolling this into a proper reagent-processing proc.
- else if ( istype(O, /obj/item/nutrient) )
- var/obj/item/nutrient/nutrient = O
- user.u_equip(O)
- nutrilevel = 10
- yield_mod = nutrient.yieldmod
- mutation_mod = nutrient.mutmod
- user << "You replace the nutrient solution in the [src]."
- del(O)
- update_icon()
-
- // Syringe stuff
- else if(istype(O, /obj/item/weapon/reagent_containers/syringe))
+ if(istype(O, /obj/item/weapon/reagent_containers/syringe))
var/obj/item/weapon/reagent_containers/syringe/S = O
- if(seed)
- // Injecting into the plant.
- if (S.mode == 1)
- if(!S.reagents.total_volume)
- user << "\red [O] is empty."
- return
-
- user << "\red You inject the [seed.display_name] with a chemical solution."
-
- // Uuuuuugh this whole chunk is going to be awful. TODO: condense it down somehow.
- // Run through the various reagents in the lists and apply their effects as needed.
- for(var/datum/reagent/R in S.reagents.reagent_list)
-
- var/reagent_value = 0
-
- if(toxic_reagents[R.id])
- reagent_value = toxic_reagents[R.id]
- if(reagent_value > 0)
- if(reagent_value < 1)
- toxins += reagent_value
- else
- toxins += round(S.reagents.get_reagent_amount(R.id)*rand(1,reagent_value))
- else
- if(reagent_value > -1)
- toxins += reagent_value
- else
- toxins -= abs(round(S.reagents.get_reagent_amount(R.id)*rand(1,abs(reagent_value))))
-
- if(nutrient_reagents[R.id])
- reagent_value = nutrient_reagents[R.id]
- if(reagent_value > 0)
- if(reagent_value < 1)
- nutrilevel += reagent_value
- else
- nutrilevel += round(S.reagents.get_reagent_amount(R.id)*rand(1,reagent_value))
- else
- if(reagent_value > -1)
- nutrilevel += reagent_value
- else
- nutrilevel -= abs(round(S.reagents.get_reagent_amount(R.id)*rand(1,abs(reagent_value))))
-
- if(weedkiller_reagents[R.id])
- reagent_value = weedkiller_reagents[R.id]
- if(reagent_value > 0)
- if(reagent_value < 1)
- weedlevel += reagent_value
- else
- weedlevel += round(S.reagents.get_reagent_amount(R.id)*rand(1,reagent_value))
- else
- if(reagent_value > -1)
- weedlevel += reagent_value
- else
- weedlevel -= abs(round(S.reagents.get_reagent_amount(R.id)*rand(1,abs(reagent_value))))
-
- if(pestkiller_reagents[R.id])
- reagent_value = pestkiller_reagents[R.id]
- if(reagent_value > 0)
- if(reagent_value < 1)
- pestlevel += reagent_value
- else
- pestlevel += round(S.reagents.get_reagent_amount(R.id)*rand(1,reagent_value))
- else
- if(reagent_value > -1)
- pestlevel += reagent_value
- else
- pestlevel -= abs(round(S.reagents.get_reagent_amount(R.id)*rand(1,abs(reagent_value))))
-
- if(beneficial_reagents[R.id])
- reagent_value = beneficial_reagents[R.id]
- if(reagent_value > 0)
- if(reagent_value < 1)
- health += reagent_value
- else
- health += round(S.reagents.get_reagent_amount(R.id)*rand(1,reagent_value))
- else
- if(reagent_value > -1)
- health += reagent_value
- else
- health -= abs(round(S.reagents.get_reagent_amount(R.id)*rand(1,abs(reagent_value))))
-
- if(water_reagents[R.id])
- reagent_value = water_reagents[R.id]
- if(reagent_value > 0)
- if(reagent_value < 1)
- waterlevel += reagent_value
- else
- waterlevel += round(S.reagents.get_reagent_amount(R.id)*rand(1,reagent_value))
- else
- if(reagent_value > -1)
- waterlevel += reagent_value
- else
- waterlevel -= abs(round(S.reagents.get_reagent_amount(R.id)*rand(1,abs(reagent_value))))
-
- // Mutagen is distinct from the previous types and mostly has a chance of proccing a mutation.
- if(mutagenic_reagents[R.id])
- var/reagent_total = S.reagents.get_reagent_amount(R.id)
- reagent_value = mutagenic_reagents[R.id]+mutation_mod
- if(reagent_total >= reagent_value)
- if(prob(min(reagent_total*reagent_value,100)))
- mutate(reagent_total > 10 ? 2 : 1)
-
- S.reagents.clear_reagents()
-
+ if (S.mode == 1)
+ if(seed)
+ return ..()
else
- user << "You can't get any extract out of this plant."
+ user << "There's no plant in the tray to inject."
+ return 1
else
- user << "There's nothing to inject the solution into."
-
- check_level_sanity()
- update_icon()
+ if(seed)
+ //Leaving this in in case we want to extract from plants later.
+ user << "You can't get any extract out of this plant."
+ else
+ user << "There's nothing in the tray to draw something from."
+ return 1
else if (istype(O, /obj/item/seeds))
@@ -663,8 +573,7 @@
seed = S.seed //Grab the seed datum.
dead = 0
age = 1
- //Snowflakey, maybe move this to the seed datum
- health = (istype(S, /obj/item/seeds/cutting) ? round(seed.endurance/rand(2,5)) : seed.endurance)
+ health = seed.endurance
lastcycle = world.time
del(O)
@@ -784,6 +693,7 @@
usr << "[src] is \red filled with weeds!"
if(pestlevel >= 5)
usr << "[src] is \red filled with tiny worms!"
+
if(!istype(src,/obj/machinery/portable_atmospherics/hydroponics/soil))
var/turf/T = loc
@@ -819,6 +729,11 @@
closed_system = !closed_system
usr << "You [closed_system ? "close" : "open"] the tray's lid."
+ if(closed_system)
+ flags &= ~OPENCONTAINER
+ else
+ flags |= OPENCONTAINER
+
update_icon()
/obj/machinery/portable_atmospherics/hydroponics/soil
diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm
index 63e28537abc..60d917d275f 100644
--- a/code/game/machinery/vending.dm
+++ b/code/game/machinery/vending.dm
@@ -801,7 +801,7 @@
product_ads = "We like plants!;Don't you want some?;The greenest thumbs ever.;We like big plants.;Soft soil..."
icon_state = "nutri"
icon_deny = "nutri-deny"
- products = list(/obj/item/nutrient/ez = 35,/obj/item/nutrient/l4z = 25,/obj/item/nutrient/rh = 15,/obj/item/weapon/plantspray/pests = 20,
+ products = list(/obj/item/weapon/reagent_containers/glass/fertilizer/ez = 35,/obj/item/weapon/reagent_containers/glass/fertilizer/l4z = 25,/obj/item/weapon/reagent_containers/glass/fertilizer/rh = 15,/obj/item/weapon/plantspray/pests = 20,
/obj/item/weapon/reagent_containers/syringe = 5,/obj/item/weapon/storage/bag/plants = 5)
contraband = list(/obj/item/weapon/reagent_containers/glass/bottle/ammonia = 10,/obj/item/weapon/reagent_containers/glass/bottle/diethylamine = 5)
diff --git a/code/modules/clothing/suits/jobs.dm b/code/modules/clothing/suits/jobs.dm
index d08793b3215..2651e6d2082 100644
--- a/code/modules/clothing/suits/jobs.dm
+++ b/code/modules/clothing/suits/jobs.dm
@@ -21,7 +21,7 @@
item_state = "apron"
blood_overlay_type = "armor"
body_parts_covered = UPPER_TORSO|LOWER_TORSO
- allowed = list (/obj/item/weapon/reagent_containers/spray/plantbgone,/obj/item/device/analyzer/plant_analyzer,/obj/item/seeds,/obj/item/nutrient,/obj/item/weapon/minihoe)
+ allowed = list (/obj/item/weapon/reagent_containers/spray/plantbgone,/obj/item/device/analyzer/plant_analyzer,/obj/item/seeds,/obj/item/weapon/reagent_containers/glass/fertilizer,/obj/item/weapon/minihoe)
species_fit = list("Vox")
sprite_sheets = list(
"Vox" = 'icons/mob/species/vox/suit.dmi'
diff --git a/code/modules/hydroponics/hydro_tools.dm b/code/modules/hydroponics/hydro_tools.dm
index 82e0ca33eee..1d977b55310 100644
--- a/code/modules/hydroponics/hydro_tools.dm
+++ b/code/modules/hydroponics/hydro_tools.dm
@@ -266,39 +266,44 @@
// Nutrient defines for hydroponics
// *************************************
-/obj/item/nutrient
- name = "bottle of nutrient"
+/obj/item/weapon/reagent_containers/glass/fertilizer
+ name = "fertilizer bottle"
+ desc = "A small glass bottle. Can hold up to 10 units."
icon = 'icons/obj/chemical.dmi'
icon_state = "bottle16"
- flags = FPRINT | TABLEPASS
+ flags = FPRINT | TABLEPASS | OPENCONTAINER
+ possible_transfer_amounts = null
w_class = 2.0
- var/mutmod = 0
- var/yieldmod = 0
- New()
- src.pixel_x = rand(-5.0, 5)
- src.pixel_y = rand(-5.0, 5)
-/obj/item/nutrient/ez
+ var/fertilizer //Reagent contained, if any.
+
+ //Like a shot glass!
+ amount_per_transfer_from_this = 10
+ volume = 10
+
+/obj/item/weapon/reagent_containers/glass/fertilizer/New()
+ ..()
+
+ src.pixel_x = rand(-5.0, 5)
+ src.pixel_y = rand(-5.0, 5)
+
+ if(fertilizer)
+ reagents.add_reagent(fertilizer,10)
+
+/obj/item/weapon/reagent_containers/glass/fertilizer/ez
name = "bottle of E-Z-Nutrient"
- icon = 'icons/obj/chemical.dmi'
icon_state = "bottle16"
- flags = FPRINT | TABLEPASS
- mutmod = 1
- yieldmod = 1
+ fertilizer = "eznutrient"
-/obj/item/nutrient/l4z
+/obj/item/weapon/reagent_containers/glass/fertilizer/l4z
name = "bottle of Left 4 Zed"
- icon = 'icons/obj/chemical.dmi'
icon_state = "bottle18"
- flags = FPRINT | TABLEPASS
- mutmod = 2
+ fertilizer = "left4zed"
-/obj/item/nutrient/rh
+/obj/item/weapon/reagent_containers/glass/fertilizer/rh
name = "bottle of Robust Harvest"
- icon = 'icons/obj/chemical.dmi'
icon_state = "bottle15"
- flags = FPRINT | TABLEPASS
- yieldmod = 2
+ fertilizer = "robustharvest"
//Hatchets and things to kill kudzu
/obj/item/weapon/hatchet
diff --git a/code/modules/hydroponics/seed_datums.dm b/code/modules/hydroponics/seed_datums.dm
index fa5af7c78c7..b7c87c14364 100644
--- a/code/modules/hydroponics/seed_datums.dm
+++ b/code/modules/hydroponics/seed_datums.dm
@@ -59,8 +59,8 @@ proc/populate_seed_list()
//Tolerances.
var/requires_nutrients = 1 // The plant can starve.
var/nutrient_consumption = 0.25 // Plant eats this much per tick.
- var/requires_water = 1 // The plant can become dehydrated.
- var/water_consumption = 3 // Plant drinks this much per tick.
+ var/requires_water = 3 // The plant can become dehydrated.
+ var/water_consumption = 1 // Plant drinks this much per tick.
var/ideal_heat = 293 // Preferred temperature in Kelvin.
var/heat_tolerance = 20 // Departure from ideal that is survivable.
var/ideal_light = 8 // Preferred light level in luminosity.
@@ -83,7 +83,7 @@ proc/populate_seed_list()
var/spread = 0 // 0 limits plant to tray, 1 = creepers, 2 = vines.
var/carnivorous = 0 // 0 = none, 1 = eat pests in tray, 2 = eat living things (when a vine).
var/parasite = 0 // 0 = no, 1 = gain health from weed level.
- var/immutable = 0 // If set, plant will never mutate. If -1, plant has a chance of mutating during process().
+ var/immutable= 0 // If set, plant will never mutate.
var/alter_temp // If set, the plant will periodically alter local temp by this amount.
// Cosmetics.
@@ -99,13 +99,13 @@ proc/populate_seed_list()
//Returns a key corresponding to an entry in the global seed list.
/datum/seed/proc/get_mutant_variant()
- if(!mutants || !mutants.len || immutable > 0) return 0
+ if(!mutants || !mutants.len || immutable) return 0
return pick(mutants)
//Mutates the plant overall (randomly).
/datum/seed/proc/mutate(var/degree,var/turf/source_turf)
- if(!degree || immutable > 0) return
+ if(!degree || immutable) return
source_turf.visible_message("\blue \The [display_name] quivers!")
@@ -179,7 +179,7 @@ proc/populate_seed_list()
//Mutates a specific trait/set of traits.
/datum/seed/proc/apply_gene(var/datum/plantgene/gene)
- if(!gene || !gene.values || immutable > 0) return
+ if(!gene || !gene.values || immutable) return
switch(gene.genetype)
@@ -345,7 +345,7 @@ proc/populate_seed_list()
return (P ? P : 0)
//Place the plant products at the feet of the user.
-/datum/seed/proc/harvest(var/mob/user,var/yield_mod,var/harvest_sample)
+/datum/seed/proc/harvest(var/mob/user,var/yield_mod)
if(!user)
return
@@ -356,7 +356,7 @@ proc/populate_seed_list()
if(!got_product)
user << "\red You fail to harvest anything useful."
else
- user << "You [harvest_sample ? "take a sample" : "harvest"] from the [display_name]."
+ user << "You harvest from the [display_name]."
//This may be a new line. Update the global if it is.
if(name == "new line" || !(name in seed_types))
@@ -364,12 +364,6 @@ proc/populate_seed_list()
name = "[uid]"
seed_types[name] = src
- if(harvest_sample)
- var/obj/item/seeds/seeds = new(get_turf(user))
- seeds.seed_type = name
- seeds.update_seed()
- return
-
var/total_yield
if(isnull(yield_mod) || yield_mod < 1)
yield_mod = 0
@@ -402,7 +396,7 @@ proc/populate_seed_list()
// be put into the global datum list until the product is harvested, though.
/datum/seed/proc/diverge(var/modified)
- if(immutable > 0) return
+ if(immutable) return
//Set up some basic information.
var/datum/seed/new_seed = new
@@ -1407,4 +1401,4 @@ proc/populate_seed_list()
maturation = 1
production = 1
yield = 1
- potency = 1
+ potency = 1
\ No newline at end of file
diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm
index a10a78c6ca6..6c0467d677b 100644
--- a/code/modules/reagents/Chemistry-Reagents.dm
+++ b/code/modules/reagents/Chemistry-Reagents.dm
@@ -2835,6 +2835,28 @@ datum
color = "#7F8400" // rgb: 127, 132, 0
+ //Reagents used for plant fertilizers.
+ toxin/fertilizer
+ name = "fertilizer"
+ id = "fertilizer"
+ description = "A chemical mix good for growing plants with."
+ reagent_state = LIQUID
+// toxpwr = 0.2 //It's not THAT poisonous.
+ color = "#664330" // rgb: 102, 67, 48
+
+ toxin/fertilizer/eznutrient
+ name = "EZ Nutrient"
+ id = "eznutrient"
+
+ toxin/fertilizer/left4zed
+ name = "Left-4-Zed"
+ id = "left4zed"
+
+ toxin/fertilizer/robustharvest
+ name = "Robust Harvest"
+ id = "robustharvest"
+
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////// DRINKS BELOW, Beer is up there though, along with cola. Cap'n Pete's Cuban Spiced Rum////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////