scope creep lmao
This commit is contained in:
@@ -280,45 +280,23 @@
|
||||
R.handle_reactions()
|
||||
return amount
|
||||
|
||||
/datum/reagents/proc/metabolize(mob/living/carbon/C, can_overdose = FALSE, liverless = FALSE)
|
||||
/**
|
||||
* Triggers metabolizing for all the reagents in this holder
|
||||
*
|
||||
* Arguments:
|
||||
* * mob/living/carbon/carbon - The mob to metabolize in, if null it uses [/datum/reagents/var/my_atom]
|
||||
* * delta_time - the time in server seconds between proc calls (when performing normally it will be 2)
|
||||
* * times_fired - the number of times the owner's life() tick has been called aka The number of times SSmobs has fired
|
||||
* * can_overdose - Allows overdosing
|
||||
* * liverless - Stops reagents that aren't set as [/datum/reagent/var/self_consuming] from metabolizing
|
||||
*/
|
||||
/datum/reagents/proc/metabolize(mob/living/carbon/owner, delta_time, times_fired, can_overdose = FALSE, liverless = FALSE)
|
||||
var/list/cached_reagents = reagent_list
|
||||
var/list/cached_addictions = addiction_list
|
||||
if(C)
|
||||
expose_temperature(C.bodytemperature, 0.25)
|
||||
var/need_mob_update = 0
|
||||
for(var/reagent in cached_reagents)
|
||||
var/datum/reagent/R = reagent
|
||||
if(QDELETED(R.holder))
|
||||
continue
|
||||
if(liverless && !R.self_consuming) //need to be metabolized
|
||||
continue
|
||||
if(!C)
|
||||
C = R.holder.my_atom
|
||||
if(!R.metabolizing)
|
||||
R.metabolizing = TRUE
|
||||
R.on_mob_metabolize(C)
|
||||
if(C && R)
|
||||
if(C.reagent_check(R) != 1)
|
||||
if(can_overdose)
|
||||
if(R.overdose_threshold)
|
||||
if(R.volume > R.overdose_threshold && !R.overdosed)
|
||||
R.overdosed = 1
|
||||
var/turf/CT = get_turf(C)
|
||||
log_reagent("OVERDOSE START: [key_name(C)] at [AREACOORD(CT)] started overdosing on [R.volume] units of [R].")
|
||||
need_mob_update += R.overdose_start(C)
|
||||
if(R.addiction_threshold)
|
||||
if(R.volume > R.addiction_threshold && !is_type_in_list(R, cached_addictions))
|
||||
var/datum/reagent/new_reagent = new R.type()
|
||||
cached_addictions.Add(new_reagent)
|
||||
if(R.overdosed)
|
||||
need_mob_update += R.overdose_process(C)
|
||||
if(is_type_in_list(R,cached_addictions))
|
||||
for(var/addiction in cached_addictions)
|
||||
var/datum/reagent/A = addiction
|
||||
if(istype(R, A))
|
||||
A.addiction_stage = -15 // you're satisfied for a good while.
|
||||
need_mob_update += R.on_mob_life(C)
|
||||
|
||||
if(owner)
|
||||
expose_temperature(owner.bodytemperature, 0.25)
|
||||
var/need_mob_update = FALSE
|
||||
for(var/datum/reagent/reagent as anything in cached_reagents)
|
||||
need_mob_update += metabolize_reagent(owner, reagent, delta_time, times_fired, can_overdose, liverless)
|
||||
if(can_overdose)
|
||||
if(addiction_tick == 6)
|
||||
addiction_tick = 1
|
||||
@@ -339,12 +317,77 @@
|
||||
else
|
||||
SEND_SIGNAL(C, COMSIG_CLEAR_MOOD_EVENT, "[R.type]_overdose")
|
||||
addiction_tick++
|
||||
if(C && need_mob_update) //some of the metabolized reagents had effects on the mob that requires some updates.
|
||||
C.updatehealth()
|
||||
C.update_mobility()
|
||||
C.update_stamina()
|
||||
if(owner && need_mob_update) //some of the metabolized reagents had effects on the mob that requires some updates.
|
||||
owner.updatehealth()
|
||||
owner.update_mobility
|
||||
owner.update_stamina()
|
||||
update_total()
|
||||
|
||||
/*
|
||||
* Metabolises a single reagent for a target owner carbon mob. See above.
|
||||
*
|
||||
* Arguments:
|
||||
* * mob/living/carbon/owner - The mob to metabolize in, if null it uses [/datum/reagents/var/my_atom]
|
||||
* * delta_time - the time in server seconds between proc calls (when performing normally it will be 2)
|
||||
* * times_fired - the number of times the owner's life() tick has been called aka The number of times SSmobs has fired
|
||||
* * can_overdose - Allows overdosing
|
||||
* * liverless - Stops reagents that aren't set as [/datum/reagent/var/self_consuming] from metabolizing
|
||||
*/
|
||||
/datum/reagents/proc/metabolize_reagent(mob/living/carbon/owner, datum/reagent/reagent, delta_time, times_fired, can_overdose = FALSE, liverless = FALSE)
|
||||
var/need_mob_update = FALSE
|
||||
if(QDELETED(reagent.holder))
|
||||
return FALSE
|
||||
|
||||
if(!owner)
|
||||
owner = reagent.holder.my_atom
|
||||
|
||||
if(owner && reagent)
|
||||
if(!owner.reagent_check(reagent, delta_time, times_fired) != TRUE)
|
||||
return
|
||||
if(liverless && !reagent.self_consuming) //need to be metabolized
|
||||
return
|
||||
if(!reagent.metabolizing)
|
||||
reagent.metabolizing = TRUE
|
||||
reagent.on_mob_metabolize(owner)
|
||||
if(can_overdose)
|
||||
if(reagent.overdose_threshold)
|
||||
if(reagent.volume >= reagent.overdose_threshold && !reagent.overdosed)
|
||||
reagent.overdosed = TRUE
|
||||
need_mob_update += reagent.overdose_start(owner)
|
||||
log_game("[key_name(owner)] has started overdosing on [reagent.name] at [reagent.volume] units.")
|
||||
|
||||
// for(var/addiction in reagent.addiction_types)
|
||||
// owner.mind?.add_addiction_points(addiction, reagent.addiction_types[addiction] * REAGENTS_METABOLISM)
|
||||
if(R.addiction_threshold)
|
||||
if(R.volume > R.addiction_threshold && !is_type_in_list(R, cached_addictions))
|
||||
var/datum/reagent/new_reagent = new R.type()
|
||||
cached_addictions.Add(new_reagent)
|
||||
if(is_type_in_list(R,cached_addictions))
|
||||
for(var/addiction in cached_addictions)
|
||||
var/datum/reagent/A = addiction
|
||||
if(istype(R, A))
|
||||
A.addiction_stage = -15 // you're satisfied for a good while.
|
||||
|
||||
if(reagent.overdosed)
|
||||
need_mob_update += reagent.overdose_process(owner, delta_time, times_fired)
|
||||
|
||||
need_mob_update += reagent.on_mob_life(owner, delta_time, times_fired)
|
||||
return need_mob_update
|
||||
|
||||
/// Signals that metabolization has stopped, triggering the end of trait-based effects
|
||||
/datum/reagents/proc/end_metabolization(mob/living/carbon/C, keep_liverless = TRUE)
|
||||
var/list/cached_reagents = reagent_list
|
||||
for(var/datum/reagent/reagent as anything in cached_reagents)
|
||||
if(QDELETED(reagent.holder))
|
||||
continue
|
||||
if(keep_liverless && reagent.self_consuming) //Will keep working without a liver
|
||||
continue
|
||||
if(!C)
|
||||
C = reagent.holder.my_atom
|
||||
if(reagent.metabolizing)
|
||||
reagent.metabolizing = FALSE
|
||||
reagent.on_mob_end_metabolize(C)
|
||||
|
||||
/datum/reagents/proc/remove_addiction(datum/reagent/R)
|
||||
to_chat(my_atom, "<span class='notice'>You feel like you've gotten over your need for [R.name].</span>")
|
||||
SEND_SIGNAL(my_atom, COMSIG_CLEAR_MOOD_EVENT, "[R.type]_overdose")
|
||||
@@ -354,21 +397,6 @@
|
||||
addiction_list.Remove(R)
|
||||
qdel(R)
|
||||
|
||||
//Signals that metabolization has stopped, triggering the end of trait-based effects
|
||||
/datum/reagents/proc/end_metabolization(mob/living/carbon/C, keep_liverless = TRUE)
|
||||
var/list/cached_reagents = reagent_list
|
||||
for(var/reagent in cached_reagents)
|
||||
var/datum/reagent/R = reagent
|
||||
if(QDELETED(R.holder))
|
||||
continue
|
||||
if(keep_liverless && R.self_consuming) //Will keep working without a liver
|
||||
continue
|
||||
if(!C)
|
||||
C = R.holder.my_atom
|
||||
if(R.metabolizing)
|
||||
R.metabolizing = FALSE
|
||||
R.on_mob_end_metabolize(C)
|
||||
|
||||
/datum/reagents/proc/conditional_update_move(atom/A, Running = 0)
|
||||
var/list/cached_reagents = reagent_list
|
||||
for(var/reagent in cached_reagents)
|
||||
|
||||
@@ -164,62 +164,55 @@
|
||||
|
||||
/datum/reagent/drug/methamphetamine
|
||||
name = "Methamphetamine"
|
||||
description = "Reduces stun times by about 300%, and allows the user to quickly recover stamina while dealing a small amount of Brain damage. If overdosed the subject will move randomly, laugh randomly, drop items and suffer from Toxin and Brain damage. If addicted the subject will constantly jitter and drool, before becoming dizzy and losing motor control and eventually suffer heavy toxin damage."
|
||||
description = "Reduces stun times by about 300%, speeds the user up, and allows the user to quickly recover stamina while dealing a small amount of Brain damage. If overdosed the subject will move randomly, laugh randomly, drop items and suffer from Toxin and Brain damage. If addicted the subject will constantly jitter and drool, before becoming dizzy and losing motor control and eventually suffer heavy toxin damage."
|
||||
reagent_state = LIQUID
|
||||
color = "#FAFAFA"
|
||||
overdose_threshold = 20
|
||||
addiction_threshold = 10
|
||||
metabolization_rate = 0.75 * REAGENTS_METABOLISM
|
||||
var/brain_damage = TRUE
|
||||
var/jitter = TRUE
|
||||
var/confusion = TRUE
|
||||
pH = 5
|
||||
ph = 5
|
||||
chemical_flags = REAGENT_CAN_BE_SYNTHESIZED
|
||||
addiction_threshold = 10
|
||||
value = REAGENT_VALUE_UNCOMMON
|
||||
|
||||
/datum/reagent/drug/methamphetamine/on_mob_metabolize(mob/living/L)
|
||||
..()
|
||||
ADD_TRAIT(L, TRAIT_IGNOREDAMAGESLOWDOWN, type)
|
||||
L.update_movespeed()
|
||||
ADD_TRAIT(L, TRAIT_TASED_RESISTANCE, type)
|
||||
L.add_movespeed_modifier(/datum/movespeed_modifier/reagent/meth)
|
||||
|
||||
/datum/reagent/drug/methamphetamine/on_mob_end_metabolize(mob/living/L)
|
||||
REMOVE_TRAIT(L, TRAIT_IGNOREDAMAGESLOWDOWN, type)
|
||||
L.update_movespeed()
|
||||
REMOVE_TRAIT(L, TRAIT_TASED_RESISTANCE, type)
|
||||
L.remove_movespeed_modifier(/datum/movespeed_modifier/reagent/meth)
|
||||
..()
|
||||
|
||||
/datum/reagent/drug/methamphetamine/on_mob_life(mob/living/carbon/M)
|
||||
/datum/reagent/drug/methamphetamine/on_mob_life(mob/living/carbon/M, delta_time, times_fired)
|
||||
var/high_message = pick("You feel hyper.", "You feel like you need to go faster.", "You feel like you can run the world.")
|
||||
if(prob(5))
|
||||
to_chat(M, "<span class='notice'>[high_message]</span>")
|
||||
M.AdjustAllImmobility(-40, 0)
|
||||
M.AdjustUnconscious(-40, 0)
|
||||
M.adjustStaminaLoss(-7.5 * REM, 0)
|
||||
if(jitter)
|
||||
M.Jitter(2)
|
||||
if(brain_damage)
|
||||
M.adjustOrganLoss(ORGAN_SLOT_BRAIN, rand(1,4))
|
||||
M.heal_overall_damage(2, 2)
|
||||
if(prob(5))
|
||||
if(DT_PROB(2.5, delta_time))
|
||||
to_chat(M, span_notice("[high_message]"))
|
||||
SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "tweaking", /datum/mood_event/stimulant_medium, name)
|
||||
M.AdjustStun(-40 * REM * delta_time)
|
||||
M.AdjustKnockdown(-40 * REM * delta_time)
|
||||
M.AdjustUnconscious(-40 * REM * delta_time)
|
||||
M.AdjustParalyzed(-40 * REM * delta_time)
|
||||
M.AdjustImmobilized(-40 * REM * delta_time)
|
||||
M.adjustStaminaLoss(-2 * REM * delta_time, 0)
|
||||
M.Jitter(2 * REM * delta_time)
|
||||
M.adjustOrganLoss(ORGAN_SLOT_BRAIN, rand(1, 4) * REM * delta_time)
|
||||
if(DT_PROB(2.5, delta_time))
|
||||
M.emote(pick("twitch", "shiver"))
|
||||
..()
|
||||
. = 1
|
||||
. = TRUE
|
||||
|
||||
/datum/reagent/drug/methamphetamine/overdose_process(mob/living/M)
|
||||
if(CHECK_MOBILITY(M, MOBILITY_MOVE) && !ismovable(M.loc))
|
||||
for(var/i in 1 to 4)
|
||||
/datum/reagent/drug/methamphetamine/overdose_process(mob/living/M, delta_time, times_fired)
|
||||
if(!HAS_TRAIT(M, TRAIT_IMMOBILIZED) && !ismovable(M.loc))
|
||||
for(var/i in 1 to round(4 * REM * delta_time, 1))
|
||||
step(M, pick(GLOB.cardinals))
|
||||
if(prob(20))
|
||||
if(DT_PROB(10, delta_time))
|
||||
M.emote("laugh")
|
||||
if(prob(33))
|
||||
M.visible_message("<span class='danger'>[M]'s hands flip out and flail everywhere!</span>")
|
||||
if(DT_PROB(18, delta_time))
|
||||
M.visible_message(span_danger("[M]'s hands flip out and flail everywhere!"))
|
||||
M.drop_all_held_items()
|
||||
..()
|
||||
M.adjustToxLoss(1, 0)
|
||||
M.adjustOrganLoss(ORGAN_SLOT_BRAIN, pick(0.5, 0.6, 0.7, 0.8, 0.9, 1))
|
||||
. = 1
|
||||
M.adjustToxLoss(1 * REM * delta_time, 0)
|
||||
M.adjustOrganLoss(ORGAN_SLOT_BRAIN, (rand(5, 10) / 10) * REM * delta_time)
|
||||
. = TRUE
|
||||
|
||||
/datum/reagent/drug/methamphetamine/addiction_act_stage1(mob/living/M)
|
||||
M.Jitter(5)
|
||||
|
||||
Reference in New Issue
Block a user