Merge pull request #13181 from Aquilar/smokingfix

fixes smoking and similar incremental dosage systems for addiction.
This commit is contained in:
Fox McCloud
2020-05-02 01:58:34 -04:00
committed by GitHub
2 changed files with 11 additions and 11 deletions
+1 -4
View File
@@ -299,10 +299,7 @@
if(R.addiction_stage < 5)
if(prob(5))
R.addiction_stage++
if(M.reagents.has_reagent(R.id))
R.last_addiction_dose = world.timeofday
R.addiction_stage = 1
else
if(world.timeofday > R.last_addiction_dose) //time check so addiction act doesn't play over and over. Allows incremental dosages to work.
switch(R.addiction_stage)
if(1)
update_flags |= R.addiction_act_stage1(M)
+10 -7
View File
@@ -54,15 +54,9 @@
if(method == REAGENT_INGEST) //Yes, even Xenos can get addicted to drugs.
var/can_become_addicted = M.reagents.reaction_check(M, src)
if(can_become_addicted)
if(is_type_in_list(src, M.reagents.addiction_list))
to_chat(M, "<span class='notice'>You feel slightly better, but for how long?</span>")
for(var/A in M.reagents.addiction_list)
var/datum/reagent/AD = A
if(AD && istype(AD, src))
AD.last_addiction_dose = world.timeofday
AD.addiction_stage = 1
to_chat(M, "<span class='notice'>You feel slightly better, but for how long?</span>") //sate_addiction handles this now, but kept this for the feed back.
return TRUE
/datum/reagent/proc/reaction_obj(obj/O, volume)
@@ -76,6 +70,7 @@
var/total_depletion_rate = metabolization_rate * M.metabolism_efficiency * M.digestion_ratio // Cache it
handle_addiction(M, total_depletion_rate)
sate_addiction(M)
holder.remove_reagent(id, total_depletion_rate) //By default it slowly disappears.
return STATUS_UPDATE_NONE
@@ -91,6 +86,14 @@
new_reagent.last_addiction_dose = world.timeofday
M.reagents.addiction_list.Add(new_reagent)
/datum/reagent/proc/sate_addiction(mob/living/M) //reagents sate their own withdrawals
if(is_type_in_list(src, M.reagents.addiction_list))
for(var/A in M.reagents.addiction_list)
var/datum/reagent/AD = A
if(AD && istype(AD, src))
AD.last_addiction_dose = world.timeofday
AD.addiction_stage = 1
/datum/reagent/proc/on_mob_death(mob/living/M) //use this to have chems have a "death-triggered" effect
return