Mature mob-plants have a chance of self-harvesting if the tray lid is not closed.

This commit is contained in:
Zuhayr
2015-01-31 12:11:33 +10:30
parent 0e93c1cf7b
commit 8790bfd014
3 changed files with 22 additions and 10 deletions

View File

@@ -7,7 +7,7 @@
flags = OPENCONTAINER
volume = 100
var/mechanical = 1 //Set to 0 to stop it from drawing the alert lights.
var/mechanical = 1 // Set to 0 to stop it from drawing the alert lights.
// Plant maintenance vars.
var/waterlevel = 100 // Water (max 100)
@@ -300,6 +300,10 @@
if(prob(3)) // On each tick, there's a chance the pest population will increase
pestlevel += 0.1 * HYDRO_SPEED_MULTIPLIER
// Some seeds will self-harvest if you don't keep a lid on them.
if(seed && seed.can_self_harvest && harvest && !closed_system && prob(5))
harvest()
check_level_sanity()
update_icon()
return
@@ -360,14 +364,17 @@
/obj/machinery/portable_atmospherics/hydroponics/proc/harvest(var/mob/user)
//Harvest the product of the plant,
if(!seed || !harvest || !user)
if(!seed || !harvest)
return
if(closed_system)
user << "You can't harvest from the plant while the lid is shut."
if(user) user << "You can't harvest from the plant while the lid is shut."
return
seed.harvest(user,yield_mod)
if(user)
seed.harvest(user,yield_mod)
else
seed.harvest(get_turf(src),yield_mod)
// Reset values.
harvest = 0

View File

@@ -84,6 +84,7 @@ proc/populate_seed_list()
var/display_name // Prettier name.
var/roundstart // If set, seed will not display variety number.
var/mysterious // Only used for the random seed packets.
var/can_self_harvest = 0 // Mostly used for living mobs.
var/growth_stages = 0 // Number of stages the plant passes through before it is mature.
var/list/traits = list() // Initialized in New()
var/list/products // Possible fruit/other product paths.
@@ -660,9 +661,9 @@ proc/populate_seed_list()
got_product = 1
if(!force_amount && !got_product && !harvest_sample)
user << "<span class='danger'>You fail to harvest anything useful.</span>"
if(istype(user)) user << "<span class='danger'>You fail to harvest anything useful.</span>"
else
user << "You [harvest_sample ? "take a sample" : "harvest"] from the [display_name]."
if(istype(user)) 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))
@@ -728,6 +729,7 @@ proc/populate_seed_list()
new_seed.name = "new line"
new_seed.uid = 0
new_seed.roundstart = 0
new_seed.can_self_harvest = can_self_harvest
//Copy over everything else.
if(products) new_seed.products = products.Copy()
@@ -979,6 +981,7 @@ proc/populate_seed_list()
display_name = "killer tomato plant"
products = list(/mob/living/simple_animal/tomato)
mutants = null
can_self_harvest = 1
/datum/seed/tomato/killer/New()
..()
@@ -1190,6 +1193,7 @@ proc/populate_seed_list()
display_name = "walking mushrooms"
products = list(/mob/living/simple_animal/mushroom)
mutants = null
can_self_harvest = 1
/datum/seed/mushroom/plump/walking/New()
..()
@@ -1810,6 +1814,7 @@ proc/populate_seed_list()
seed_noun = "nodes"
display_name = "replicant pods"
products = list(/mob/living/carbon/alien/diona)
can_self_harvest = 1
/datum/seed/diona/New()
..()

View File

@@ -15,8 +15,8 @@
var/obj/effect/plant/parent
var/datum/seed/seed
var/floor = 0
var/spread_chance = 40
var/spread_into_adjacent = 60
var/spread_chance = 100 //40
var/spread_into_adjacent = 100 //60
var/evolve_chance = 2
var/last_tick = 0
var/hibernating = 0
@@ -27,8 +27,8 @@
/obj/effect/plant/New(var/newloc, var/datum/seed/newseed)
..()
if(!newseed)
newseed = DEFAULT_SEED
if(!istype(newseed))
newseed = seed_types[DEFAULT_SEED]
seed = newseed
if(!seed)
del(src)