Reorder spacevine change turf

qdel spacevines lead to them calling changeturf, lead to them being
qdeleted lead to them calling changeturf etc etc

This way the turf is changed before the vines are deleted, so the
changeturf calls should not be hit.

Further protection is added in the form of checking if that vine is
actually in the process of being qdeleted, which limits the recursion to
the maximum of how many vines are on the tile
This commit is contained in:
oranges
2016-12-14 07:45:37 +00:00
parent 25a97a0f08
commit 29298dfee9
@@ -211,7 +211,9 @@
ChangeTurf(src.baseturf)
/turf/open/floor/vines/ChangeTurf(turf/open/floor/T)
for(var/obj/structure/spacevine/SV in src)
qdel(SV)
. = ..()
//Do this *after* the turf has changed as qdel in spacevines will call changeturf again if it hasn't
for(var/obj/structure/spacevine/SV in src)
if(!qdestroying(SV))//Helps avoid recursive loops
qdel(SV)
UpdateAffectingLights()