diff --git a/code/modules/hydroponics/hydro_tray.dm b/code/modules/hydroponics/hydro_tray.dm index 15feae5a88..9349e8f9e9 100644 --- a/code/modules/hydroponics/hydro_tray.dm +++ b/code/modules/hydroponics/hydro_tray.dm @@ -32,6 +32,7 @@ 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 // Set this to bypass the cycle time check. // Seed details/line data. var/datum/seed/seed = null // The currently planted seed @@ -127,6 +128,10 @@ /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) @@ -152,7 +157,9 @@ process_reagents() // Update values every cycle rather than every process() tick. - if(world.time < (lastcycle + cycledelay)) + if(force_update) + force_update = 0 + else if(world.time < (lastcycle + cycledelay)) return lastcycle = world.time @@ -175,6 +182,11 @@ // 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) @@ -286,7 +298,8 @@ 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 @@ -526,7 +539,22 @@ if (O.is_open_container()) return 0 - if(istype(O, /obj/item/weapon/reagent_containers/syringe)) + if(istype(O, /obj/item/weapon/wirecutters) || istype(O, /obj/item/weapon/scalpel)) + + 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/syringe)) var/obj/item/weapon/reagent_containers/syringe/S = O @@ -572,7 +600,9 @@ seed = S.seed //Grab the seed datum. dead = 0 age = 1 - health = seed.endurance + //Snowflakey, maybe move this to the seed datum + health = (istype(S, /obj/item/seeds/cutting) ? round(seed.endurance/rand(2,5)) : seed.endurance) + lastcycle = world.time del(O) diff --git a/code/modules/hydroponics/seed_datums.dm b/code/modules/hydroponics/seed_datums.dm index b7c87c1436..f1d12a1a6a 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 = 3 // The plant can become dehydrated. - var/water_consumption = 1 // Plant drinks this much per tick. + var/requires_water = 1 // The plant can become dehydrated. + var/water_consumption = 3 // 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. + var/immutable = 0 // If set, plant will never mutate. If -1, plant is highly mutable. 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) return 0 + if(!mutants || !mutants.len || immutable > 0) return 0 return pick(mutants) //Mutates the plant overall (randomly). /datum/seed/proc/mutate(var/degree,var/turf/source_turf) - if(!degree || immutable) return + if(!degree || immutable > 0) 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) return + if(!gene || !gene.values || immutable > 0) 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) +/datum/seed/proc/harvest(var/mob/user,var/yield_mod,var/harvest_sample) 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 from the [display_name]." + user << "You [harvest_sample ? "take a sample" : "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,6 +364,12 @@ 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 @@ -396,7 +402,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) return + if(immutable > 0) return //Set up some basic information. var/datum/seed/new_seed = new