Fix some issues with SSplants processing (#3417)

Fixes some issues where plants would not get removed from their processing list properly.
This commit is contained in:
Lohikar
2017-09-09 19:00:05 +03:00
committed by Erki
parent c5a7bc0361
commit ac2ed66cef
4 changed files with 42 additions and 16 deletions
@@ -67,11 +67,10 @@
var/last_biolum = null
/obj/effect/plant/Destroy()
if(SSplants)
STOP_PROCESSING(SSplants, src)
SSplants.remove_plant(src)
for(var/obj/effect/plant/neighbor in range(1,src))
if (!QDELETED(neighbor))
START_PROCESSING(SSplants, neighbor)
SSplants.add_plant(neighbor)
return ..()
/obj/effect/plant/single
@@ -129,7 +128,7 @@
/obj/effect/plant/proc/post_initialize()
set_dir(calc_dir())
update_icon()
START_PROCESSING(SSplants, src)
SSplants.add_plant(src)
// Some plants eat through plating.
if(islist(seed.chems) && !isnull(seed.chems["pacid"]))
var/turf/T = get_turf(src)
@@ -239,9 +238,9 @@
/obj/effect/plant/attackby(var/obj/item/weapon/W, var/mob/user)
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
START_PROCESSING(SSplants, src)
SSplants.add_plant(src)
if(istype(W, /obj/item/weapon/wirecutters) || istype(W, /obj/item/weapon/scalpel))
if(iswirecutter(W) || istype(W, /obj/item/weapon/scalpel))
if(sampled)
user << "<span class='warning'>\The [src] has already been sampled recently.</span>"
return
@@ -23,6 +23,10 @@
if(!Adjacent(floor) || !floor.Enter(src))
continue
neighbors |= floor
if (neighbors.len)
SSplants.add_plant(src)
// Update all of our friends.
var/turf/T = get_turf(src)
for(var/obj/effect/plant/neighbor in range(1,src))
@@ -82,8 +86,8 @@
// We shouldn't have spawned if the controller doesn't exist.
check_health()
if(neighbors.len || health != max_health)
START_PROCESSING(SSplants, src)
if(neighbors.len || health != max_health || buckled_mob)
SSplants.add_plant(src)
/obj/effect/plant/proc/do_spread(spread_chance, max_spread)
for(var/i in 1 to max_spread)
@@ -113,7 +117,7 @@
continue
for(var/obj/effect/plant/neighbor in check_turf.contents)
neighbor.neighbors |= check_turf
START_PROCESSING(SSplants, neighbor)
SSplants.add_plant(neighbor)
QDEL_IN(src, 1)