mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-06 15:32:25 +00:00
Fix space vine lag (#3452)
Fixes lag from plants processing forever instead of obeying the subsystem's tick interval. Also fixes a glitch where plants didn't continue to grow if not mature. Fixes #3451.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
if((locate(/obj/effect/plant) in floor.contents) || (locate(/obj/effect/dead_plant) in floor.contents) )
|
||||
continue
|
||||
if(floor.density)
|
||||
if(!isnull(seed.chems["pacid"]))
|
||||
if(seed.chems["pacid"])
|
||||
addtimer(CALLBACK(floor, /atom/.proc/ex_act, 3), rand(5, 25))
|
||||
continue
|
||||
if(!Adjacent(floor) || !floor.Enter(src))
|
||||
@@ -82,14 +82,15 @@
|
||||
//spread to 1-3 adjacent turfs depending on yield trait.
|
||||
var/max_spread = between(1, round(seed.get_trait(TRAIT_YIELD)*3/14), 3)
|
||||
|
||||
addtimer(CALLBACK(src, .proc/do_spread, spread_chance, max_spread), 1)
|
||||
do_spread(spread_chance, max_spread)
|
||||
|
||||
// We shouldn't have spawned if the controller doesn't exist.
|
||||
check_health()
|
||||
if(neighbors.len || health != max_health || buckled_mob)
|
||||
if(neighbors.len || health != max_health || buckled_mob || !is_mature())
|
||||
SSplants.add_plant(src)
|
||||
|
||||
/obj/effect/plant/proc/do_spread(spread_chance, max_spread)
|
||||
set waitfor = FALSE
|
||||
for(var/i in 1 to max_spread)
|
||||
if(prob(spread_chance))
|
||||
sleep(rand(3,5))
|
||||
@@ -105,8 +106,8 @@
|
||||
neighbor.neighbors -= target_turf
|
||||
|
||||
/obj/effect/plant/proc/do_move(turf/target, obj/effect/plant/child)
|
||||
child.loc = target
|
||||
child.update_icon()
|
||||
child.forceMove(target)
|
||||
child.queue_icon_update()
|
||||
|
||||
/obj/effect/plant/proc/die_off()
|
||||
// Kill off our plant.
|
||||
@@ -119,6 +120,6 @@
|
||||
neighbor.neighbors |= check_turf
|
||||
SSplants.add_plant(neighbor)
|
||||
|
||||
QDEL_IN(src, 1)
|
||||
qdel(src)
|
||||
|
||||
#undef NEIGHBOR_REFRESH_TIME
|
||||
|
||||
Reference in New Issue
Block a user