[MIRROR] Fixes chem and addiction scans, null checks for addiction_list (#1826)

* Fixes chem and addiction scans, null checks for addiction_list (#55105)

So #54797 changed addiction_list to instantiate as a null instead of a list. Turns out a few things relied on the list existing!
Things like health analyser/medical kiosk chem and addiction scans broke, and smokers would no longer get addicted!
Made a few places check if addiction_list is null before continuing.

(Lemon's note, refactored some code to make it cleaner/removed some unneeded loop typechecks)

* Fixes chem and addiction scans, null checks for addiction_list

Co-authored-by: prodirus <44090982+prodirus@users.noreply.github.com>
This commit is contained in:
SkyratBot
2020-11-25 13:56:15 +01:00
committed by GitHub
co-authored by prodirus
parent 8cddcf1887
commit 384d439381
4 changed files with 23 additions and 19 deletions
+2 -2
View File
@@ -579,7 +579,7 @@
if (!reagent_type)
reagent_type = pick(drug_list)
reagent_instance = new reagent_type()
H.reagents.addiction_list.Add(reagent_instance)
LAZYADD(H.reagents.addiction_list, reagent_instance)
var/current_turf = get_turf(quirk_holder)
if (!drug_container_type)
drug_container_type = /obj/item/storage/pill_bottle
@@ -628,7 +628,7 @@
reagent_instance = new reagent_type()
else
reagent_instance.addiction_stage = 0
H.reagents.addiction_list += reagent_instance
LAZYADD(H.reagents.addiction_list, reagent_instance)
to_chat(quirk_holder, "<span class='danger'>You thought you kicked it, but you suddenly feel like you need [reagent_instance.name] again...</span>")
/datum/quirk/junkie/smoker