scope creep lmao

This commit is contained in:
silicons
2021-06-28 12:29:18 -07:00
parent 392111dc74
commit a73ca4be46
12 changed files with 281 additions and 119 deletions
+11 -11
View File
@@ -1,6 +1,6 @@
/mob/living/carbon/BiologicalLife(seconds, times_fired)
//Reagent processing needs to come before breathing, to prevent edge cases.
handle_organs()
handle_organs(seconds, times_fired)
. = ..() // if . is false, we are dead.
if(stat == DEAD)
stop_sound_channel(CHANNEL_HEARTBEAT)
@@ -23,7 +23,7 @@
handle_brain_damage()
if(stat != DEAD)
handle_liver()
handle_liver(seconds, times_fired)
if(stat != DEAD)
handle_corruption()
@@ -378,25 +378,25 @@
/mob/living/carbon/proc/handle_blood()
return
/mob/living/carbon/proc/handle_bodyparts()
/mob/living/carbon/proc/handle_bodyparts(seconds, times_fired)
for(var/I in bodyparts)
var/obj/item/bodypart/BP = I
if(BP.needs_processing)
. |= BP.on_life()
. |= BP.on_life(seconds, times_fired)
/mob/living/carbon/proc/handle_organs()
/mob/living/carbon/proc/handle_organs(seconds, times_fired)
if(stat != DEAD)
for(var/V in internal_organs)
var/obj/item/organ/O = V
if(O)
O.on_life()
O.on_life(seconds, times_fired)
else
if(reagents.has_reagent(/datum/reagent/toxin/formaldehyde, 1) || reagents.has_reagent(/datum/reagent/preservahyde, 1)) // No organ decay if the body contains formaldehyde. Or preservahyde.
return
for(var/V in internal_organs)
var/obj/item/organ/O = V
if(O)
O.on_death() //Needed so organs decay while inside the body.
O.on_death(seconds, times_fired) //Needed so organs decay while inside the body.
/mob/living/carbon/handle_diseases()
for(var/thing in diseases)
@@ -687,16 +687,16 @@ GLOBAL_LIST_INIT(ballmer_windows_me_msg, list("Yo man, what if, we like, uh, put
//LIVER//
/////////
/mob/living/carbon/proc/handle_liver()
/mob/living/carbon/proc/handle_liver(seconds, times_fired)
var/obj/item/organ/liver/liver = getorganslot(ORGAN_SLOT_LIVER)
if((!dna && !liver) || (NOLIVER in dna.species.species_traits))
return
if(!liver || liver.organ_flags & ORGAN_FAILING)
liver_failure()
liver_failure(seconds, times_fired)
/mob/living/carbon/proc/liver_failure()
/mob/living/carbon/proc/liver_failure(seconds, times_fired)
reagents.end_metabolization(src, keep_liverless = TRUE) //Stops trait-based effects on reagents, to prevent permanent buffs
reagents.metabolize(src, can_overdose=FALSE, liverless = TRUE)
reagents.metabolize(src, seconds, times_fired, can_overdose=FALSE, liverless = TRUE)
if(HAS_TRAIT(src, TRAIT_STABLELIVER))
return
adjustToxLoss(4, TRUE, TRUE)
+27 -7
View File
@@ -2,17 +2,37 @@
blacklisted_movetypes = (FLYING|FLOATING)
/datum/movespeed_modifier/reagent/stimulants
multiplicative_slowdown = -0.55
/datum/movespeed_modifier/reagent/ephedrine
multiplicative_slowdown = -0.5
/datum/movespeed_modifier/reagent/pepperspray
multiplicative_slowdown = 0.25
/datum/movespeed_modifier/reagent/monkey_energy
multiplicative_slowdown = -0.35
/datum/movespeed_modifier/reagent/changelinghaste
multiplicative_slowdown = -2
multiplicative_slowdown = -0.8
/datum/movespeed_modifier/reagent/skooma
multiplicative_slowdown = -1
/datum/movespeed_modifier/reagent/methamphetamine
multiplicative_slowdown = -0.65
/datum/movespeed_modifier/reagent/nitryl
multiplicative_slowdown = -1
multiplicative_slowdown = -0.65
/datum/movespeed_modifier/reagent/meth
multiplicative_slowdown = -0.5
absolute_max_tiles_per_second = 11
/datum/movespeed_modifier/reagent/freon
multiplicative_slowdown = 1.6
/datum/movespeed_modifier/reagent/halon
multiplicative_slowdown = 1.8
/datum/movespeed_modifier/reagent/lenturi
multiplicative_slowdown = 1.5
/datum/movespeed_modifier/reagent/nuka_cola
multiplicative_slowdown = -0.35
/datum/movespeed_modifier/reagent/nooartrium
multiplicative_slowdown = 2
+85 -57
View File
@@ -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)
+1 -1
View File
@@ -188,7 +188,7 @@
needs_processing = .
//Return TRUE to get whatever mob this is in to update health.
/obj/item/bodypart/proc/on_life()
/obj/item/bodypart/proc/on_life(seconds, times_fired)
if(stam_heal_tick && stamina_dam > DAMAGE_PRECISION) //DO NOT update health here, it'll be done in the carbon's life.
if(heal_damage(brute = 0, burn = 0, stamina = (stam_heal_tick * (disabled ? 2 : 1)), only_robotic = FALSE, only_organic = FALSE, updating_health = FALSE))
. |= BODYPART_LIFE_UPDATE_HEALTH
+2 -2
View File
@@ -25,7 +25,7 @@
var/cachedmoveCalc = 1
food_reagents = list(/datum/reagent/consumable/nutriment = 5, /datum/reagent/iron = 5)
/obj/item/organ/liver/on_life()
/obj/item/organ/liver/on_life(seconds, times_fired)
. = ..()
if(!. || !owner)//can't process reagents with a failing liver
return
@@ -40,7 +40,7 @@
damage += (thisamount*toxLethality)
//metabolize reagents
owner.reagents.metabolize(owner, can_overdose=TRUE)
owner.reagents.metabolize(owner, seconds, times_fired, can_overdose=TRUE)
if(damage > 10 && prob(damage/3))//the higher the damage the higher the probability
to_chat(owner, "<span class='warning'>You feel a dull pain in your abdomen.</span>")
@@ -92,18 +92,18 @@
on_death() //Kinda hate doing it like this, but I really don't want to call process directly.
//Sources; life.dm process_organs
/obj/item/organ/proc/on_death() //Runs when outside AND inside.
/obj/item/organ/proc/on_death(seconds, times_fired) //Runs when outside AND inside.
decay()
//Applys the slow damage over time decay
/obj/item/organ/proc/decay()
/obj/item/organ/proc/decay(seconds, times_fired)
if(!can_decay())
STOP_PROCESSING(SSobj, src)
return
is_cold()
if(organ_flags & ORGAN_FROZEN)
return
applyOrganDamage(maxHealth * decay_factor)
applyOrganDamage(maxHealth * decay_factor * (seconds * 0.5))
/obj/item/organ/proc/can_decay()
if(CHECK_BITFIELD(organ_flags, ORGAN_NO_SPOIL | ORGAN_SYNTHETIC | ORGAN_FAILING))
@@ -151,7 +151,7 @@
organ_flags &= ~ORGAN_FROZEN
return FALSE
/obj/item/organ/proc/on_life() //repair organ damage if the organ is not failing or synthetic
/obj/item/organ/proc/on_life(seconds, times_fired) //repair organ damage if the organ is not failing or synthetic
if(organ_flags & ORGAN_FAILING || !owner)
return FALSE
if(organ_flags & ORGAN_SYNTHETIC_EMP) //Synthetic organ has been emped, is now failing.
+1 -1
View File
@@ -11,7 +11,7 @@
/datum/unit_test/metabolization/proc/test_reagent(mob/living/carbon/C, reagent_type)
C.reagents.add_reagent(reagent_type, 10)
C.reagents.metabolize(C, can_overdose = TRUE)
C.reagents.metabolize(C, SSMOBS_DT, 1, can_overdose = TRUE)
C.reagents.clear_reagents()
/datum/unit_test/metabolization/Destroy()