diff --git a/code/__HELPERS/_lists.dm b/code/__HELPERS/_lists.dm index 847e3f79ed6..c2e2660daff 100644 --- a/code/__HELPERS/_lists.dm +++ b/code/__HELPERS/_lists.dm @@ -15,7 +15,7 @@ #define LAZYREMOVE(L, I) if(L) { L -= I; if(!length(L)) { L = null; } } #define LAZYADD(L, I) if(!L) { L = list(); } L += I; #define LAZYOR(L, I) if(!L) { L = list(); } L |= I; -#define LAZYFIND(L, V) L ? L.Find(V) : 0 +#define LAZYFIND(L, V) (L ? L.Find(V) : 0) #define LAZYACCESS(L, I) (L ? (isnum(I) ? (I > 0 && I <= length(L) ? L[I] : null) : L[I]) : null) #define LAZYSET(L, K, V) if(!L) { L = list(); } L[K] = V; #define LAZYLEN(L) length(L) diff --git a/code/datums/traits/negative.dm b/code/datums/traits/negative.dm index 88cccd3115f..a73a447fa37 100644 --- a/code/datums/traits/negative.dm +++ b/code/datums/traits/negative.dm @@ -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, "You thought you kicked it, but you suddenly feel like you need [reagent_instance.name] again...") /datum/quirk/junkie/smoker diff --git a/code/game/machinery/medical_kiosk.dm b/code/game/machinery/medical_kiosk.dm index 4057428e0a6..4726a4e797b 100644 --- a/code/game/machinery/medical_kiosk.dm +++ b/code/game/machinery/medical_kiosk.dm @@ -213,16 +213,17 @@ var/brain_status = "Brain patterns normal." if(LAZYLEN(altPatient.get_traumas())) var/list/trauma_text = list() - for(var/datum/brain_trauma/B in altPatient.get_traumas()) + for(var/t in altPatient.get_traumas()) + var/datum/brain_trauma/trauma = t var/trauma_desc = "" - switch(B.resilience) + switch(trauma.resilience) if(TRAUMA_RESILIENCE_SURGERY) trauma_desc += "severe " if(TRAUMA_RESILIENCE_LOBOTOMY) trauma_desc += "deep-rooted " if(TRAUMA_RESILIENCE_MAGIC, TRAUMA_RESILIENCE_ABSOLUTE) trauma_desc += "permanent " - trauma_desc += B.scan_desc + trauma_desc += trauma.scan_desc trauma_text += trauma_desc trauma_status = "Cerebral traumas detected: patient appears to be suffering from [english_list(trauma_text)]." @@ -231,11 +232,12 @@ var/addict_list = list() var/hallucination_status = "Patient is not hallucinating." - if(altPatient?.reagents?.reagent_list.len) //Chemical Analysis details. - for(var/datum/reagent/R in altPatient.reagents.reagent_list) - chemical_list += list(list("name" = R.name, "volume" = round(R.volume, 0.01))) - if(R.overdosed) - overdose_list += list(list("name" = R.name)) + if(altPatient.reagents.reagent_list.len) //Chemical Analysis details. + for(var/r in altPatient.reagents.reagent_list) + var/datum/reagent/reagent = r + chemical_list += list(list("name" = reagent.name, "volume" = round(reagent.volume, 0.01))) + if(reagent.overdosed) + overdose_list += list(list("name" = reagent.name)) var/obj/item/organ/stomach/belly = altPatient.getorganslot(ORGAN_SLOT_STOMACH) if(belly?.reagents.reagent_list.len) //include the stomach contents if it exists for(var/bile in belly.reagents.reagent_list) @@ -246,9 +248,9 @@ var/bit_vol = bit.volume - belly.food_reagents[bit.type] if(bit_vol > 0) chemical_list += list(list("name" = bit.name, "volume" = round(bit_vol, 0.01))) - if(altPatient?.reagents?.addiction_list.len) - for(var/datum/reagent/R in altPatient.reagents.addiction_list) - addict_list += list(list("name" = R.name)) + for(var/a in altPatient.reagents.addiction_list) + var/datum/reagent/addiction = a + addict_list += list(list("name" = addiction.name)) if (altPatient.hallucinating()) hallucination_status = "Subject appears to be hallucinating. Suggested treatments: bedrest, mannitol or psicodine." diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index fc190be1b67..2274fea61a6 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -428,8 +428,9 @@ GENE SCANNER var/render_list = list() if(M.reagents.reagent_list.len) render_list += "Subject contains the following reagents in their blood:\n" - for(var/datum/reagent/R in M.reagents.reagent_list) - render_list += "[round(R.volume, 0.001)] units of [R.name][R.overdosed ? " - OVERDOSING" : "."]\n" + for(var/r in M.reagents.reagent_list) + var/datum/reagent/reagent = r + render_list += "[round(reagent.volume, 0.001)] units of [reagent.name][reagent.overdosed ? " - OVERDOSING" : "."]\n" else render_list += "Subject contains no reagents in their blood.\n" var/obj/item/organ/stomach/belly = M.getorganslot(ORGAN_SLOT_STOMACH) @@ -447,10 +448,11 @@ GENE SCANNER else render_list += "Subject contains no reagents in their stomach.\n" - if(M.reagents.addiction_list.len) + if(LAZYLEN(M.reagents.addiction_list)) render_list += "Subject is addicted to the following reagents:\n" - for(var/datum/reagent/R in M.reagents.addiction_list) - render_list += "[R.name]\n" + for(var/a in M.reagents.addiction_list) + var/datum/reagent/addiction = a + render_list += "[addiction.name]\n" else render_list += "Subject is not addicted to any reagents.\n"