From 6c121e8e335ef6c7859e83888100c3dca945a4ff Mon Sep 17 00:00:00 2001 From: Zuhayr Date: Sun, 22 Feb 2015 18:36:06 +1030 Subject: [PATCH] Fixes bugs with vines and potency. --- code/modules/hydroponics/seed_controller.dm | 17 ++++++++--------- code/modules/hydroponics/spreading/spreading.dm | 15 +++++++++------ .../hydroponics/spreading/spreading_growth.dm | 2 +- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/code/modules/hydroponics/seed_controller.dm b/code/modules/hydroponics/seed_controller.dm index aff41c8253..e914ce7c3d 100644 --- a/code/modules/hydroponics/seed_controller.dm +++ b/code/modules/hydroponics/seed_controller.dm @@ -1,8 +1,8 @@ // Attempts to offload processing for the spreading plants from the MC. // Processes vines/spreading plants. -#define PLANTS_PER_TICK 100 -#define PLANT_TICK_TIME 50 +#define PLANTS_PER_TICK 500 // Cap on number of plant segments processed. +#define PLANT_TICK_TIME 25 // Number of ticks between the plant processor cycling. // Debug for testing seed genes. /client/proc/show_plant_genes() @@ -85,10 +85,10 @@ var/global/datum/controller/plants/plant_controller // Set in New(). var/list/plant_traits = ALL_GENES while(plant_traits && plant_traits.len) var/gene_tag = pick(plant_traits) - var/gene_mask = "[num2hex(rand(0,255))]" + var/gene_mask = "[uppertext(num2hex(rand(0,255)))]" while(gene_mask in used_masks) - gene_mask = "[num2hex(rand(0,255))]" + gene_mask = "[uppertext(num2hex(rand(0,255)))]" used_masks += gene_mask plant_traits -= gene_tag @@ -128,18 +128,17 @@ var/global/datum/controller/plants/plant_controller // Set in New(). else processed = 0 if(plant_queue.len) - var/target_to_process = min(plant_queue.len,PLANT_TICK_TIME) + var/target_to_process = min(plant_queue.len,plants_per_tick) for(var/x=0;xNull or non-plant entry in plant controller queue." - break plant_queue -= plant - sleep(1) // Stagger processing out so previous tick can resolve (overlapping plant segments etc) + if(!istype(plant)) + continue plant.process() processed++ + sleep(1) // Stagger processing out so previous tick can resolve (overlapping plant segments etc) sleep(max(1,(plant_tick_time-processed))) /datum/controller/plants/proc/add_plant(var/obj/effect/plant/plant) diff --git a/code/modules/hydroponics/spreading/spreading.dm b/code/modules/hydroponics/spreading/spreading.dm index 6fae4283b3..22dbabe275 100644 --- a/code/modules/hydroponics/spreading/spreading.dm +++ b/code/modules/hydroponics/spreading/spreading.dm @@ -14,8 +14,8 @@ if(turfs.len) //Pick a turf to spawn at if we can var/turf/simulated/floor/T = pick(turfs) var/datum/seed/seed = plant_controller.create_random_seed(1) - seed.set_trait(TRAIT_SPREAD,2) // So it will function properly as vines. - seed.set_trait(TRAIT_POTENCY,rand(40,50)) // Guarantee a wide spread and powerful effects. + seed.set_trait(TRAIT_SPREAD,2) // So it will function properly as vines. + seed.set_trait(TRAIT_POTENCY,rand(70,100)) // Guarantee a wide spread and powerful effects. new /obj/effect/plant(T,seed) message_admins("Event: Spacevines spawned at [T.loc] ([T.x],[T.y],[T.z])") @@ -63,6 +63,8 @@ /obj/effect/plant/Del() if(plant_controller) plant_controller.remove_plant(src) + for(var/obj/effect/plant/neighbor in range(1,src)) + plant_controller.add_plant(neighbor) ..() /obj/effect/plant/single spread_chance = 0 @@ -156,10 +158,11 @@ /obj/effect/plant/proc/refresh_icon() var/growth = min(max_growth,round(health/growth_threshold)) var/at_fringe = get_dist(src,parent) - if(at_fringe >= (spread_distance-3)) - max_growth-- - if(at_fringe >= (spread_distance-2)) - max_growth-- + if(spread_distance > 5) + if(at_fringe >= (spread_distance-3)) + max_growth-- + if(at_fringe >= (spread_distance-2)) + max_growth-- max_growth = max(1,max_growth) if(growth_type > 0) switch(growth_type) diff --git a/code/modules/hydroponics/spreading/spreading_growth.dm b/code/modules/hydroponics/spreading/spreading_growth.dm index 2b3c6b85cd..0729b2b343 100644 --- a/code/modules/hydroponics/spreading/spreading_growth.dm +++ b/code/modules/hydroponics/spreading/spreading_growth.dm @@ -73,7 +73,7 @@ // We shouldn't have spawned if the controller doesn't exist. check_health() - if(neighbors.len && health == max_health) + if(neighbors.len || health != max_health) plant_controller.add_plant(src) /obj/effect/plant/proc/die_off()