From ba54cd81d56d41cc4ee0eb9a35385ce6fe870a59 Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Tue, 14 Feb 2017 23:50:19 -0800 Subject: [PATCH] Adds a few patches to borer to not fling datums to the GC --- code/game/gamemodes/miniantags/borer/borer.dm | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/code/game/gamemodes/miniantags/borer/borer.dm b/code/game/gamemodes/miniantags/borer/borer.dm index 075e0e7a09b..16f59d335f8 100644 --- a/code/game/gamemodes/miniantags/borer/borer.dm +++ b/code/game/gamemodes/miniantags/borer/borer.dm @@ -392,10 +392,10 @@ content += "" for(var/datum in typesof(/datum/borer_chem)) - var/datum/borer_chem/C = new datum() - var/datum/reagent/R = chemical_reagents_list[C.chemname] - if(C.chemname) - content += "" + var/datum/borer_chem/C = datum + var/datum/reagent/R = chemical_reagents_list[initial(C.chemname)] + if(initial(C.chemname)) + content += "" content += "
[R.name] ([C.chemuse])

[C.chemdesc]

[R.name] ([initial(C.chemuse)])

[initial(C.chemdesc)]

" @@ -417,19 +417,17 @@ return var/topic_chem = href_list["borer_use_chem"] - var/datum/borer_chem/C + var/datum/borer_chem/C = null for(var/datum in typesof(/datum/borer_chem)) - var/datum/borer_chem/test = new datum() - if(test.chemname == topic_chem) - C = test + var/datum/borer_chem/test = datum + if(initial(test.chemname) == topic_chem) + C = new test() break - var/datum/reagent/R = chemical_reagents_list[C.chemname] - if(!istype(C, /datum/borer_chem)) - return if(!C || !host || controlling || !src || stat) return + var/datum/reagent/R = chemical_reagents_list[C.chemname] if(chemicals < C.chemuse) to_chat(src, "You need [C.chemuse] chemicals stored to secrete [R.name]!") return @@ -439,6 +437,9 @@ chemicals -= C.chemuse log_game("[src]/([src.ckey]) has injected [R.name] into their host [host]/([host.ckey])") + // This is used because we use a static set of datums to determine what chems are available, + // instead of a table or something. Thus, when we instance it, we can safely delete it + qdel(C) ..() /mob/living/simple_animal/borer/verb/hide_borer() @@ -448,6 +449,7 @@ if(host) to_chat(usr, "You cannot do this while you're inside a host.") + return if(stat != CONSCIOUS) return @@ -702,7 +704,7 @@ B.detatch() else - to_chat(src, "ERROR NO BORER OR BRAINMOB DETECTED IN THIS MOB, THIS IS A BUG !") + log_runtime(EXCEPTION("Missing borer or missing host brain upon borer release."), src) //Check for brain worms in head. /mob/proc/has_brain_worms()