Fixes bugs with vines and potency.

This commit is contained in:
Zuhayr
2015-02-22 18:36:06 +10:30
parent 23b93e7540
commit 6c121e8e33
3 changed files with 18 additions and 16 deletions
+8 -9
View File
@@ -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;x<target_to_process;x++)
if(!plant_queue.len)
break
var/obj/effect/plant/plant = pick(plant_queue)
if(!istype(plant))
world << "<span class='danger'>Null or non-plant entry in plant controller queue.</span>"
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)
@@ -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("<span class='notice'>Event: Spacevines spawned at [T.loc] ([T.x],[T.y],[T.z])</span>")
@@ -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)
@@ -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()