Fixes up addictions reporting on scanners, and admin full heal (#54056)

This commit is contained in:
NightRed
2020-09-29 21:26:29 -05:00
committed by GitHub
parent 2aeb8ca7be
commit 48324f59c6
5 changed files with 51 additions and 12 deletions
+3 -2
View File
@@ -243,8 +243,9 @@
chemical_list += list(list("name" = bit.name, "volume" = round(bit.volume, 0.01)))
if(bit.overdosed)
overdose_list += list(list("name" = bit.name))
if(altPatient.reagents.addiction_list.len)
for(var/datum/reagent/R in altPatient.reagents.addiction_list)
var/list/addictions = altPatient.get_addiction_list()
if(addictions.len)
for(var/datum/reagent/R in addictions)
addict_list += list(list("name" = R.name))
if (altPatient.hallucinating())
hallucination_status = "Subject appears to be hallucinating. Suggested treatments: bedrest, mannitol or psicodine."
+5 -3
View File
@@ -429,10 +429,12 @@ GENE SCANNER
render_list += "<span class='notice ml-2'>[round(bit.volume, 0.001)] units of [bit.name][bit.overdosed ? "</span> - <span class='boldannounce'>OVERDOSING</span>" : ".</span>"]\n"
else
render_list += "<span class='notice ml-1'>Subject contains no reagents in their stomach.</span>\n"
if(M.reagents.addiction_list.len)
var/list/addictions = M.get_addiction_list()
if(addictions.len)
render_list += "<span class='boldannounce ml-1'>Subject is addicted to the following reagents:</span>\n"
for(var/datum/reagent/R in M.reagents.addiction_list)
render_list += "<span class='alert ml-2'>[R.name]</span>\n"
for(var/datum/reagent/reagent in addictions)
render_list += "<span class='alert ml-2'>[reagent.name]</span>\n"
else
render_list += "<span class='notice ml-1'>Subject is not addicted to any reagents.</span>\n"
+2 -1
View File
@@ -423,7 +423,8 @@
if(ishuman(M))
var/mob/living/carbon/human/H = M
people_on_station++
for(var/R in H.reagents.addiction_list)
var/list/addictions = H.get_addiction_list()
for(var/R in addictions)
if(istype(R, /datum/reagent/drug/methamphetamine))
people_on_crack++
if(0.25*people_on_station > people_on_crack)
+1 -6
View File
@@ -859,10 +859,6 @@
update_mobility()
/mob/living/carbon/fully_heal(admin_revive = FALSE)
if(reagents)
reagents.clear_reagents()
for(var/addi in reagents.addiction_list)
reagents.remove_addiction(addi)
for(var/O in internal_organs)
var/obj/item/organ/organ = O
organ.setOrganDamage(0)
@@ -881,8 +877,7 @@
for(var/obj/item/restraints/R in contents) //actually remove cuffs from inventory
qdel(R)
update_handcuffed()
if(reagents)
reagents.addiction_list = list()
clear_addictions()
cure_all_traumas(TRAUMA_RESILIENCE_MAGIC)
..()
+40
View File
@@ -168,6 +168,46 @@
/mob/living/proc/get_reagent_amount(reagent)
return reagents.get_reagent_amount(reagent)
/**
* Get a list of all chems the mob has that they are addicted to.
*
* This creates a ist of all chems the mob has within its body that it is addicted to.
* Returns list of reagents
*/
/mob/living/proc/get_addiction_list()
var/list/addictions = list()
var/obj/item/organ/stomach/belly = getorganslot(ORGAN_SLOT_STOMACH)
if(reagents.addiction_list.len)
for(var/datum/reagent/reagent in reagents.addiction_list)
addictions += reagent
if(belly?.reagents.addiction_list.len)
for(var/bile in belly.reagents.addiction_list)
addictions += bile
return addictions
/**
* Removes an addiction from the mob
*
* This will remove addiction to the passeed in chem from the mob
* vars:
* * addiction (reagent) the reagent to remove
*/
/mob/living/proc/remove_addiction(addiction)
reagents.remove_addiction(addiction)
var/obj/item/organ/stomach/belly = getorganslot(ORGAN_SLOT_STOMACH)
if(belly)
belly.reagents.remove_addiction(addiction)
/**
* Removes all addictions from the mob
*
* This will remove all addictions from the mob
*/
/mob/living/proc/clear_addictions()
var/list/addictions = get_addiction_list()
for(var/reagent in addictions)
remove_addiction(reagent)
//this updates all special effects: knockdown, druggy, stuttering, etc..
/mob/living/proc/handle_status_effects()