fixes smoking and similar incremental dosage systems for addiction.

Signed-off-by: Aquilar <20759278+Aquilar@users.noreply.github.com>
This commit is contained in:
Aquilar
2020-05-02 13:43:05 +08:00
parent 66d56e858e
commit dd8ddd3a5d
2 changed files with 21 additions and 22 deletions
+11 -15
View File
@@ -299,21 +299,17 @@
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
switch(R.addiction_stage)
if(1)
update_flags |= R.addiction_act_stage1(M)
if(2)
update_flags |= R.addiction_act_stage2(M)
if(3)
update_flags |= R.addiction_act_stage3(M)
if(4)
update_flags |= R.addiction_act_stage4(M)
if(5)
update_flags |= R.addiction_act_stage5(M)
switch(R.addiction_stage)
if(1)
update_flags |= R.addiction_act_stage1(M)
if(2)
update_flags |= R.addiction_act_stage2(M)
if(3)
update_flags |= R.addiction_act_stage3(M)
if(4)
update_flags |= R.addiction_act_stage4(M)
if(5)
update_flags |= R.addiction_act_stage5(M)
if(prob(20) && (world.timeofday > (R.last_addiction_dose + ADDICTION_TIME))) //Each addiction lasts 8 minutes before it can end
to_chat(M, "<span class='notice'>You no longer feel reliant on [R.name]!</span>")
addiction_list.Remove(R)
+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