Fixes Garbage Collection issues with Xenobiology (#20190)

* xenobio gc fixes

* requested changes

* requested changes
This commit is contained in:
Ryan
2023-03-08 20:42:44 +01:00
committed by GitHub
parent 850acd85b3
commit feef0ea814
7 changed files with 97 additions and 94 deletions
@@ -1,6 +1,10 @@
/mob/living/simple_animal/slime/death(gibbed)
if(stat == DEAD)
return
if(buckled)
Feedstop(silent = TRUE) //releases ourselves from the mob we fed on.
if(!gibbed)
if(is_adult)
var/mob/living/simple_animal/slime/M = new(loc, colour)
@@ -18,9 +22,6 @@
update_name()
return
if(buckled)
Feedstop(silent = TRUE) //releases ourselves from the mob we fed on.
set_stat(DEAD) //Temporarily set to dead for icon updates
regenerate_icons()
set_stat(CONSCIOUS)
@@ -351,6 +351,7 @@
discipline_slime(M)
/mob/living/simple_animal/slime/attackby(obj/item/I, mob/living/user, params)
if(stat == DEAD && surgeries.len)
if(user.a_intent == INTENT_HELP || user.a_intent == INTENT_DISARM)
@@ -362,6 +363,7 @@
++Friends[user]
else
Friends[user] = 1
RegisterSignal(user, COMSIG_PARENT_QDELETING, PROC_REF(clear_friend))
to_chat(user, "<span class='notice'>You feed the slime the plasma. It chirps happily.</span>")
var/obj/item/stack/sheet/mineral/plasma/S = I
S.use(1)
@@ -381,50 +383,12 @@
force_effect = round(I.force / 2)
if(prob(10 + force_effect))
discipline_slime(user)
/* if(istype(I, /obj/item/storage/bag/bio))
var/obj/item/storage/P = I
if(!effectmod)
to_chat(user, "<span class='warning'>The slime is not currently being mutated.</span>")
return
var/hasOutput = FALSE //Have we outputted text?
var/hasFound = FALSE //Have we found an extract to be added?
for(var/obj/item/slime_extract/S in P.contents)
if(S.effectmod == effectmod)
SEND_SIGNAL(P, COMSIG_TRY_STORAGE_TAKE, S, get_turf(src), TRUE)
qdel(S)
applied++
hasFound = TRUE
if(applied >= SLIME_EXTRACT_CROSSING_REQUIRED)
to_chat(user, "<span class='notice'>You feed the slime as many of the extracts from the bag as you can, and it mutates!</span>")
playsound(src, 'sound/effects/attackblob.ogg', 50, TRUE)
spawn_corecross()
hasOutput = TRUE
break
if(!hasOutput)
if(!hasFound)
to_chat(user, "<span class='warning'>There are no extracts in the bag that this slime will accept!</span>")
else
to_chat(user, "<span class='notice'>You feed the slime some extracts from the bag.</span>")
playsound(src, 'sound/effects/attackblob.ogg', 50, TRUE)
return */
..()
/*
/mob/living/simple_animal/slime/proc/spawn_corecross()
var/static/list/crossbreeds = subtypesof(/obj/item/slimecross)
visible_message("<span class='danger'>[src] shudders, its mutated core consuming the rest of its body!</span>")
playsound(src, 'sound/magic/smoke.ogg', 50, TRUE)
var/crosspath
for(var/X in crossbreeds)
var/obj/item/slimecross/S = X
if(initial(S.colour) == colour && initial(S.effect) == effectmod)
crosspath = S
break
if(crosspath)
new crosspath(loc)
else
visible_message("<span class='warning'>The mutated core shudders, and collapses into a puddle, unable to maintain its form.</span>")
qdel(src)
*/
/mob/living/simple_animal/slime/proc/clear_friend(mob/living/friend)
UnregisterSignal(friend, COMSIG_PARENT_QDELETING)
Friends -= friend
/mob/living/simple_animal/slime/water_act(volume, temperature, source, method = REAGENT_TOUCH)
. = ..()
var/water_damage = rand(10, 15) * volume
@@ -170,6 +170,9 @@
to_chat(src, "<i>I must be conscious to do this...</i>")
return
if(istype(loc, /obj/machinery/computer/camera_advanced/xenobio))
return //no you cannot split while you're in the matrix (this prevents GC issues and slimes disappearing)
var/list/babies = list()
var/new_nutrition = round(nutrition * 0.9)
var/new_powerlevel = round(powerlevel / 4)
@@ -187,7 +190,7 @@
M.set_nutrition(new_nutrition) //Player slimes are more robust at spliting. Once an oversight of poor copypasta, now a feature!
M.powerlevel = new_powerlevel
if(i != 1)
step_away(M,src)
step_away(M, get_turf(src))
M.Friends = Friends.Copy()
babies += M
M.mutation_chance = clamp(mutation_chance+(rand(5,-5)),0,100)