From 1f2597784fb933b09cdf0a0a352da305653fb9a6 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Sun, 5 Jan 2020 15:40:23 -0800 Subject: [PATCH] git commit death --- code/modules/mob/living/living.dm | 51 --- code/modules/mob/living/living_mobility.dm | 227 +++++++++++ code/modules/mob/living/status_procs.dm | 357 +++++++++++++++--- code/modules/mob/status_procs.dm | 263 +++---------- .../code/modules/mob/living/living.dm | 63 ---- tgstation.dme | 1 + 6 files changed, 594 insertions(+), 368 deletions(-) create mode 100644 code/modules/mob/living/living_mobility.dm diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 78542ab052..cbe57c2284 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -1035,57 +1035,6 @@ /mob/living/can_be_pulled() return ..() && !(buckled && buckled.buckle_prevents_pull) -//Updates canmove, lying and icons. Could perhaps do with a rename but I can't think of anything to describe it. -//Robots, animals and brains have their own version so don't worry about them -/mob/living/proc/update_canmove() - var/ko = IsKnockdown() || IsUnconscious() || (stat && (stat != SOFT_CRIT || pulledby)) || (HAS_TRAIT(src, TRAIT_DEATHCOMA)) - var/move_and_fall = stat == SOFT_CRIT && !pulledby - var/chokehold = pulledby && pulledby.grab_state >= GRAB_NECK - var/buckle_lying = !(buckled && !buckled.buckle_lying) - var/has_legs = get_num_legs() - var/has_arms = get_num_arms() - var/ignore_legs = get_leg_ignore() - var/pinned = resting && pulledby && pulledby.grab_state >= GRAB_AGGRESSIVE // Cit change - adds pinning for aggressive-grabbing people on the ground - if(ko || move_and_fall || IsStun() || chokehold) // Cit change - makes resting not force you to drop everything - drop_all_held_items() - unset_machine() - if(pulling) - stop_pulling() - else if(resting) //CIT CHANGE - makes resting make you stop pulling and interacting with machines - unset_machine() //CIT CHANGE - Ditto! - if(pulling) //CIT CHANGE - Ditto. - stop_pulling() //CIT CHANGE - Ditto... - else if(has_legs || ignore_legs) - lying = 0 - if (pulledby) - var/mob/living/L = pulledby - L.update_pull_movespeed() - if(buckled) - lying = 90*buckle_lying - else if(!lying) - if(resting) - lying = pick(90, 270) // Cit change - makes resting not force you to drop your held items - if(has_gravity()) // Cit change - Ditto - playsound(src, "bodyfall", 50, 1) // Cit change - Ditto! - else if(ko || move_and_fall || (!has_legs && !ignore_legs) || chokehold) - fall(forced = 1) - canmove = !(ko || recoveringstam || pinned || IsStun() || IsFrozen() || chokehold || buckled || (!has_legs && !ignore_legs && !has_arms)) //Cit change - makes it plausible to move while resting, adds pinning and stamina crit - density = !lying - if(lying) - if(layer == initial(layer)) //to avoid special cases like hiding larvas. - layer = LYING_MOB_LAYER //so mob lying always appear behind standing mobs - else - if(layer == LYING_MOB_LAYER) - layer = initial(layer) - update_transform() - if(!lying && lying_prev) - if(client) - client.move_delay = world.time + movement_delay() - lying_prev = lying - if(canmove && !intentionalresting && iscarbon(src) && client && client.prefs && client.prefs.autostand)//CIT CHANGE - adds autostanding as a preference - addtimer(CALLBACK(src, .proc/resist_a_rest, TRUE), 0) //CIT CHANGE - ditto - return canmove - /mob/living/proc/AddAbility(obj/effect/proc_holder/A) abilities.Add(A) A.on_gain(src) diff --git a/code/modules/mob/living/living_mobility.dm b/code/modules/mob/living/living_mobility.dm new file mode 100644 index 0000000000..dd546fb61c --- /dev/null +++ b/code/modules/mob/living/living_mobility.dm @@ -0,0 +1,227 @@ +//Stuff like mobility flag updates, resting updates, etc. + +//Force-set resting variable, without needing to resist/etc. +/mob/living/proc/set_resting(new_resting, silent = FALSE, updating = TRUE) + resting = new_resting + if(!silent) + to_chat(src, "You are now [resting? "resting" : "getting up"].") + update_resting(updating) + +/mob/living/proc/update_resting(update_mobility = TRUE) + if(update_mobility) + update_mobility() + +//Force mob to rest, does NOT do stamina damage. +//It's really not recommended to use this proc to give feedback, hence why silent is defaulting to true. +/mob/living/proc/KnockToFloor(disarm_items = FALSE, silent = TRUE, updating = TRUE) + if(!silent) + to_chat(src, "You are knocked to the floor!") + set_resting(TRUE, TRUE, updating) + if(disarm_items) + drop_all_held_items() + + + + + + +/mob/living/proc/lay_down() + set name = "Rest" + set category = "IC" + + if(client && client.prefs && client.prefs.autostand) + intentionalresting = !intentionalresting + to_chat(src, "You are now attempting to [intentionalresting ? "[!resting ? "lay down and ": ""]stay down" : "[resting ? "get up and ": ""]stay up"].") + if(intentionalresting && !resting) + resting = TRUE + update_canmove() + else + resist_a_rest() + else + if(!resting) + resting = TRUE + to_chat(src, "You are now laying down.") + update_canmove() + else + resist_a_rest() + +/mob/living/proc/resist_a_rest(automatic = FALSE, ignoretimer = FALSE) //Lets mobs resist out of resting. Major QOL change with combat reworks. + if(!resting || stat || attemptingstandup) + return FALSE + if(ignoretimer) + resting = FALSE + update_canmove() + return TRUE + else + var/totaldelay = 3 //A little bit less than half of a second as a baseline for getting up from a rest + if(getStaminaLoss() >= STAMINA_SOFTCRIT) + to_chat(src, "You're too exhausted to get up!") + return FALSE + attemptingstandup = TRUE + var/health_deficiency = max((maxHealth - (health - getStaminaLoss()))*0.5, 0) + if(!has_gravity()) + health_deficiency = health_deficiency*0.2 + totaldelay += health_deficiency + var/standupwarning = "[src] and everyone around them should probably yell at the dev team" + switch(health_deficiency) + if(-INFINITY to 10) + standupwarning = "[src] stands right up!" + if(10 to 35) + standupwarning = "[src] tries to stand up." + if(35 to 60) + standupwarning = "[src] slowly pushes [p_them()]self upright." + if(60 to 80) + standupwarning = "[src] weakly attempts to stand up." + if(80 to INFINITY) + standupwarning = "[src] struggles to stand up." + var/usernotice = automatic ? "You are now getting up. (Auto)" : "You are now getting up." + visible_message("[standupwarning]", usernotice, vision_distance = 5) + if(do_after(src, totaldelay, target = src)) + resting = FALSE + attemptingstandup = FALSE + update_canmove() + return TRUE + else + visible_message("[src] falls right back down.", "You fall right back down.") + attemptingstandup = FALSE + if(has_gravity()) + playsound(src, "bodyfall", 20, 1) + return FALSE + + +/* +//Updates canmove, lying and icons. Could perhaps do with a rename but I can't think of anything to describe it. +//Robots, animals and brains have their own version so don't worry about them +/mob/living/proc/update_mobility() + var/stat_softcrit = stat == SOFT_CRIT + var/stat_conscious = (stat == CONSCIOUS) || stat_softcrit + var/conscious = !IsUnconscious() && stat_conscious && !HAS_TRAIT(src, TRAIT_DEATHCOMA) + var/chokehold = pulledby && pulledby.grab_state >= GRAB_NECK + var/restrained = restrained() + var/has_legs = get_num_legs() + var/has_arms = get_num_arms() + var/paralyzed = IsParalyzed() + var/stun = IsStun() + var/knockdown = IsKnockdown() + var/ignore_legs = get_leg_ignore() + var/canmove = !IsImmobilized() && !stun && conscious && !paralyzed && !buckled && (!stat_softcrit || !pulledby) && !chokehold && !IsFrozen() && !IS_IN_STASIS(src) && (has_arms || ignore_legs || has_legs) + if(canmove) + mobility_flags |= MOBILITY_MOVE + else + mobility_flags &= ~MOBILITY_MOVE + var/canstand_involuntary = conscious && !stat_softcrit && !knockdown && !chokehold && !paralyzed && (ignore_legs || has_legs) && !(buckled && buckled.buckle_lying) + var/canstand = canstand_involuntary && !resting + + var/should_be_lying = !canstand + if(buckled) + if(buckled.buckle_lying != -1) + should_be_lying = buckled.buckle_lying + + if(should_be_lying) + mobility_flags &= ~MOBILITY_STAND + if(buckled) + if(buckled.buckle_lying != -1) + lying = buckled.buckle_lying + if(!lying) //force them on the ground + lying = pick(90, 270) + else + mobility_flags |= MOBILITY_STAND + lying = 0 + + if(should_be_lying || restrained || incapacitated()) + mobility_flags &= ~(MOBILITY_UI|MOBILITY_PULL) + else + mobility_flags |= MOBILITY_UI|MOBILITY_PULL + + + + var/canitem = !paralyzed && !stun && conscious && !chokehold && !restrained && has_arms + if(canitem) + mobility_flags |= (MOBILITY_USE | MOBILITY_PICKUP | MOBILITY_STORAGE) + else + mobility_flags &= ~(MOBILITY_USE | MOBILITY_PICKUP | MOBILITY_STORAGE) + if(!(mobility_flags & MOBILITY_USE)) + drop_all_held_items() + if(!(mobility_flags & MOBILITY_PULL)) + if(pulling) + stop_pulling() + if(!(mobility_flags & MOBILITY_UI)) + unset_machine() + density = !lying + if(lying) + if(!lying_prev) + fall(!canstand_involuntary) + if(layer == initial(layer)) //to avoid special cases like hiding larvas. + layer = LYING_MOB_LAYER //so mob lying always appear behind standing mobs + else + if(layer == LYING_MOB_LAYER) + layer = initial(layer) + update_transform() + lying_prev = lying + + // Movespeed mods based on arms/legs quantity + if(!get_leg_ignore()) + var/limbless_slowdown = 0 + // These checks for <2 should be swapped out for something else if we ever end up with a species with more than 2 + if(has_legs < 2) + limbless_slowdown += 6 - (has_legs * 3) + if(!has_legs && has_arms < 2) + limbless_slowdown += 6 - (has_arms * 3) + if(limbless_slowdown) + add_movespeed_modifier(MOVESPEED_ID_LIVING_LIMBLESS, update=TRUE, priority=100, override=TRUE, multiplicative_slowdown=limbless_slowdown, movetypes=GROUND) + else + remove_movespeed_modifier(MOVESPEED_ID_LIVING_LIMBLESS, update=TRUE) +*/ + +//Updates canmove, lying and icons. Could perhaps do with a rename but I can't think of anything to describe it. +//Robots, animals and brains have their own version so don't worry about them +/mob/living/proc/update_canmove() +/* + var/ko = IsKnockdown() || IsUnconscious() || (stat && (stat != SOFT_CRIT || pulledby)) || (HAS_TRAIT(src, TRAIT_DEATHCOMA)) + var/move_and_fall = stat == SOFT_CRIT && !pulledby + var/chokehold = pulledby && pulledby.grab_state >= GRAB_NECK + var/buckle_lying = !(buckled && !buckled.buckle_lying) + var/has_legs = get_num_legs() + var/has_arms = get_num_arms() + var/ignore_legs = get_leg_ignore() + var/pinned = resting && pulledby && pulledby.grab_state >= GRAB_AGGRESSIVE // Cit change - adds pinning for aggressive-grabbing people on the ground + if(ko || move_and_fall || IsStun() || chokehold) // Cit change - makes resting not force you to drop everything + drop_all_held_items() + unset_machine() + if(pulling) + stop_pulling() + else if(resting) //CIT CHANGE - makes resting make you stop pulling and interacting with machines + unset_machine() //CIT CHANGE - Ditto! + if(pulling) //CIT CHANGE - Ditto. + stop_pulling() //CIT CHANGE - Ditto... + else if(has_legs || ignore_legs) + lying = 0 + if (pulledby) + var/mob/living/L = pulledby + L.update_pull_movespeed() + if(buckled) + lying = 90*buckle_lying + else if(!lying) + if(resting) + lying = pick(90, 270) // Cit change - makes resting not force you to drop your held items + if(has_gravity()) // Cit change - Ditto + playsound(src, "bodyfall", 50, 1) // Cit change - Ditto! + else if(ko || move_and_fall || (!has_legs && !ignore_legs) || chokehold) + fall(forced = 1) + canmove = !(ko || recoveringstam || pinned || IsStun() || IsFrozen() || chokehold || buckled || (!has_legs && !ignore_legs && !has_arms)) //Cit change - makes it plausible to move while resting, adds pinning and stamina crit + density = !lying + if(lying) + if(layer == initial(layer)) //to avoid special cases like hiding larvas. + layer = LYING_MOB_LAYER //so mob lying always appear behind standing mobs + else + if(layer == LYING_MOB_LAYER) + layer = initial(layer) + update_transform() + if(!lying && lying_prev) + if(client) + client.move_delay = world.time + movement_delay() + lying_prev = lying + if(canmove && !intentionalresting && iscarbon(src) && client && client.prefs && client.prefs.autostand)//CIT CHANGE - adds autostanding as a preference + addtimer(CALLBACK(src, .proc/resist_a_rest, TRUE), 0) //CIT CHANGE - ditto + return canmove +*/ diff --git a/code/modules/mob/living/status_procs.dm b/code/modules/mob/living/status_procs.dm index facc86da46..6ed81b7aeb 100644 --- a/code/modules/mob/living/status_procs.dm +++ b/code/modules/mob/living/status_procs.dm @@ -2,19 +2,38 @@ //The effects include: stun, knockdown, unconscious, sleeping, resting, jitteriness, dizziness, // eye damage, eye_blind, eye_blurry, druggy, TRAIT_BLIND trait, and TRAIT_NEARSIGHT trait. +// YEEHAW GAMERS STAMINA REWORK PROC GETS TO BE FIRST +// amount = strength +// updating = update mobility etc etc +// ignore_castun = same logic as Paralyze() in general +// override_duration = If this is set, does Paralyze() for this duration. +// override_stam = If this is set, does this amount of stamina damage. +/mob/living/proc/DefaultCombatKnockdown(amount, updating = TRUE, ignore_canstun = FALSE, override_duration, override_stam) + if(!iscarbon(src)) + return Paralyze(amount, updating, ignore_canstun) + if(istype(buckled, /obj/vehicle/ridden)) + buckled.unbuckle_mob(src) + var/drop_items = amount > 80 //80 is cutoff for old item dropping behavior + var/stamdmg = isnull(override_stam)? (amount * 0.25) : override_stam + KnockToFloor(drop_items, TRUE, updating) + adjustStaminaLoss(stamdmg) + if(!isnull(override_duration)) + Paralyze(override_duration) ////////////////////////////// STUN //////////////////////////////////// -/mob/living/IsStun() //If we're stunned +/mob/living/proc/_MOBILITYFLAGTEMPORARY_IsStun() //If we're stunned return has_status_effect(STATUS_EFFECT_STUN) -/mob/living/proc/AmountStun() //How many deciseconds remain in our stun +/mob/living/proc/_MOBILITYFLAGTEMPORARY_AmountStun() //How many deciseconds remain in our stun var/datum/status_effect/incapacitating/stun/S = IsStun() if(S) return S.duration - world.time return 0 -/mob/living/proc/Stun(amount, updating = TRUE, ignore_canstun = FALSE) //Can't go below remaining duration +/mob/living/proc/_MOBILITYFLAGTEMPORARY_Stun(amount, updating = TRUE, ignore_canstun = FALSE) //Can't go below remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_STUN, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) + return if(((status_flags & CANSTUN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) if(absorb_stun(amount, ignore_canstun)) return @@ -25,7 +44,9 @@ S = apply_status_effect(STATUS_EFFECT_STUN, amount, updating) return S -/mob/living/proc/SetStun(amount, updating = TRUE, ignore_canstun = FALSE) //Sets remaining duration +/mob/living/proc/_MOBILITYFLAGTEMPORARY_SetStun(amount, updating = TRUE, ignore_canstun = FALSE) //Sets remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_STUN, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) + return if(((status_flags & CANSTUN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) var/datum/status_effect/incapacitating/stun/S = IsStun() if(amount <= 0) @@ -40,7 +61,9 @@ S = apply_status_effect(STATUS_EFFECT_STUN, amount, updating) return S -/mob/living/proc/AdjustStun(amount, updating = TRUE, ignore_canstun = FALSE) //Adds to remaining duration +/mob/living/proc/_MOBILITYFLAGTEMPORARY_AdjustStun(amount, updating = TRUE, ignore_canstun = FALSE) //Adds to remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_STUN, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) + return if(((status_flags & CANSTUN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) if(absorb_stun(amount, ignore_canstun)) return @@ -53,34 +76,38 @@ ///////////////////////////////// KNOCKDOWN ///////////////////////////////////// -/mob/living/IsKnockdown() //If we're knocked down +/mob/living/proc/_MOBILITYFLAGTEMPORARY_IsKnockdown() //If we're knocked down return has_status_effect(STATUS_EFFECT_KNOCKDOWN) -/mob/living/proc/AmountKnockdown() //How many deciseconds remain in our knockdown +/mob/living/proc/_MOBILITYFLAGTEMPORARY_AmountKnockdown() //How many deciseconds remain in our knockdown var/datum/status_effect/incapacitating/knockdown/K = IsKnockdown() if(K) return K.duration - world.time return 0 -/mob/living/proc/Knockdown(amount, updating = TRUE, ignore_canknockdown = FALSE, override_hardstun, override_stamdmg) //Can't go below remaining duration - if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canknockdown) - if(absorb_stun(isnull(override_hardstun)? amount : override_hardstun, ignore_canknockdown)) +/mob/living/proc/_MOBILITYFLAGTEMPORARY_Knockdown(amount, updating = TRUE, ignore_canstun = FALSE) //Can't go below remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_KNOCKDOWN, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) + return + if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) + if(absorb_stun(amount, ignore_canstun)) return var/datum/status_effect/incapacitating/knockdown/K = IsKnockdown() if(K) - K.duration = max(world.time + (isnull(override_hardstun)? amount : override_hardstun), K.duration) - else if((amount || override_hardstun) > 0) - K = apply_status_effect(STATUS_EFFECT_KNOCKDOWN, amount, updating, override_hardstun, override_stamdmg) + K.duration = max(world.time + amount, K.duration) + else if(amount > 0) + K = apply_status_effect(STATUS_EFFECT_KNOCKDOWN, amount, updating) return K -/mob/living/proc/SetKnockdown(amount, updating = TRUE, ignore_canknockdown = FALSE) //Sets remaining duration - if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canknockdown) +/mob/living/proc/_MOBILITYFLAGTEMPORARY_SetKnockdown(amount, updating = TRUE, ignore_canstun = FALSE) //Sets remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_KNOCKDOWN, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) + return + if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) var/datum/status_effect/incapacitating/knockdown/K = IsKnockdown() if(amount <= 0) if(K) qdel(K) else - if(absorb_stun(amount, ignore_canknockdown)) + if(absorb_stun(amount, ignore_canstun)) return if(K) K.duration = world.time + amount @@ -88,9 +115,11 @@ K = apply_status_effect(STATUS_EFFECT_KNOCKDOWN, amount, updating) return K -/mob/living/proc/AdjustKnockdown(amount, updating = TRUE, ignore_canknockdown = FALSE) //Adds to remaining duration - if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canknockdown) - if(absorb_stun(amount, ignore_canknockdown)) +/mob/living/proc/_MOBILITYFLAGTEMPORARY_AdjustKnockdown(amount, updating = TRUE, ignore_canstun = FALSE) //Adds to remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_KNOCKDOWN, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) + return + if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) + if(absorb_stun(amount, ignore_canstun)) return var/datum/status_effect/incapacitating/knockdown/K = IsKnockdown() if(K) @@ -99,6 +128,230 @@ K = apply_status_effect(STATUS_EFFECT_KNOCKDOWN, amount, updating) return K +///////////////////////////////// IMMOBILIZED //////////////////////////////////// +/mob/living/proc/IsImmobilized() //If we're immobilized + return has_status_effect(STATUS_EFFECT_IMMOBILIZED) + +/mob/living/proc/AmountImmobilized() //How many deciseconds remain in our Immobilized status effect + var/datum/status_effect/incapacitating/immobilized/I = IsImmobilized() + if(I) + return I.duration - world.time + return 0 + +/mob/living/proc/Immobilize(amount, updating = TRUE, ignore_canstun = FALSE) //Can't go below remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_IMMOBILIZE, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) + return + if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) + if(absorb_stun(amount, ignore_canstun)) + return + var/datum/status_effect/incapacitating/immobilized/I = IsImmobilized() + if(I) + I.duration = max(world.time + amount, I.duration) + else if(amount > 0) + I = apply_status_effect(STATUS_EFFECT_IMMOBILIZED, amount, updating) + return I + +/mob/living/proc/SetImmobilized(amount, updating = TRUE, ignore_canstun = FALSE) //Sets remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_IMMOBILIZE, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) + return + if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) + var/datum/status_effect/incapacitating/immobilized/I = IsImmobilized() + if(amount <= 0) + if(I) + qdel(I) + else + if(absorb_stun(amount, ignore_canstun)) + return + if(I) + I.duration = world.time + amount + else + I = apply_status_effect(STATUS_EFFECT_IMMOBILIZED, amount, updating) + return I + +/mob/living/proc/AdjustImmobilized(amount, updating = TRUE, ignore_canstun = FALSE) //Adds to remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_IMMOBILIZE, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) + return + if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) + if(absorb_stun(amount, ignore_canstun)) + return + var/datum/status_effect/incapacitating/immobilized/I = IsImmobilized() + if(I) + I.duration += amount + else if(amount > 0) + I = apply_status_effect(STATUS_EFFECT_IMMOBILIZED, amount, updating) + return I + +///////////////////////////////// PARALYZED ////////////////////////////////// +/mob/living/proc/IsParalyzed() //If we're immobilized + return has_status_effect(STATUS_EFFECT_PARALYZED) + +/mob/living/proc/AmountParalyzed() //How many deciseconds remain in our Paralyzed status effect + var/datum/status_effect/incapacitating/paralyzed/P = IsParalyzed(FALSE) + if(P) + return P.duration - world.time + return 0 + +/mob/living/proc/Paralyze(amount, updating = TRUE, ignore_canstun = FALSE) //Can't go below remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_PARALYZE, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) + return + if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) + if(absorb_stun(amount, ignore_canstun)) + return + var/datum/status_effect/incapacitating/paralyzed/P = IsParalyzed(FALSE) + if(P) + P.duration = max(world.time + amount, P.duration) + else if(amount > 0) + P = apply_status_effect(STATUS_EFFECT_PARALYZED, amount, updating) + return P + +/mob/living/proc/SetParalyzed(amount, updating = TRUE, ignore_canstun = FALSE) //Sets remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_PARALYZE, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) + return + if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) + var/datum/status_effect/incapacitating/paralyzed/P = IsParalyzed(FALSE) + if(amount <= 0) + if(P) + qdel(P) + else + if(absorb_stun(amount, ignore_canstun)) + return + if(P) + P.duration = world.time + amount + else + P = apply_status_effect(STATUS_EFFECT_PARALYZED, amount, updating) + return P + +/mob/living/proc/AdjustParalyzed(amount, updating = TRUE, ignore_canstun = FALSE) //Adds to remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_PARALYZE, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) + return + if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) + if(absorb_stun(amount, ignore_canstun)) + return + var/datum/status_effect/incapacitating/paralyzed/P = IsParalyzed(FALSE) + if(P) + P.duration += amount + else if(amount > 0) + P = apply_status_effect(STATUS_EFFECT_PARALYZED, amount, updating) + return P + +//Blanket +/mob/living/proc/AllImmobility(amount, updating) + Paralyze(amount, FALSE) + Knockdown(amount, FALSE) + Stun(amount, FALSE) + Immobilize(amount, FALSE) + if(updating) + update_mobility() + +/mob/living/proc/SetAllImmobility(amount, updating) + SetParalyzed(amount, FALSE) + SetKnockdown(amount, FALSE) + SetStun(amount, FALSE) + SetImmobilized(amount, FALSE) + if(updating) + update_mobility() + +/mob/living/proc/AdjustAllImmobility(amount, updating) + AdjustParalyzed(amount, FALSE) + AdjustKnockdown(amount, FALSE) + AdjustStun(amount, FALSE) + AdjustImmobilized(amount, FALSE) + if(updating) + update_mobility() + +//////////////////UNCONSCIOUS +/mob/living/proc/_MOBILITYFLAGTEMPORARY_IsUnconscious() //If we're unconscious + return has_status_effect(STATUS_EFFECT_UNCONSCIOUS) + +/mob/living/proc/_MOBILITYFLAGTEMPORARY_AmountUnconscious() //How many deciseconds remain in our unconsciousness + var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious() + if(U) + return U.duration - world.time + return 0 + +/mob/living/proc/_MOBILITYFLAGTEMPORARY_Unconscious(amount, updating = TRUE, ignore_canstun = FALSE) //Can't go below remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_UNCONSCIOUS, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) + return + if(((status_flags & CANUNCONSCIOUS) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) + var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious() + if(U) + U.duration = max(world.time + amount, U.duration) + else if(amount > 0) + U = apply_status_effect(STATUS_EFFECT_UNCONSCIOUS, amount, updating) + return U + +/mob/living/proc/_MOBILITYFLAGTEMPORARY_SetUnconscious(amount, updating = TRUE, ignore_canstun = FALSE) //Sets remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_UNCONSCIOUS, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) + return + if(((status_flags & CANUNCONSCIOUS) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) + var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious() + if(amount <= 0) + if(U) + qdel(U) + else if(U) + U.duration = world.time + amount + else + U = apply_status_effect(STATUS_EFFECT_UNCONSCIOUS, amount, updating) + return U + +/mob/living/proc/_MOBILITYFLAGTEMPORARY_AdjustUnconscious(amount, updating = TRUE, ignore_canstun = FALSE) //Adds to remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_UNCONSCIOUS, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) + return + if(((status_flags & CANUNCONSCIOUS) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun) + var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious() + if(U) + U.duration += amount + else if(amount > 0) + U = apply_status_effect(STATUS_EFFECT_UNCONSCIOUS, amount, updating) + return U + +/////////////////////////////////// SLEEPING //////////////////////////////////// + +/mob/living/proc/_MOBILITYFLAGTEMPORARY_IsSleeping() //If we're asleep + return has_status_effect(STATUS_EFFECT_SLEEPING) + +/mob/living/proc/_MOBILITYFLAGTEMPORARY_AmountSleeping() //How many deciseconds remain in our sleep + var/datum/status_effect/incapacitating/sleeping/S = IsSleeping() + if(S) + return S.duration - world.time + return 0 + +/mob/living/proc/_MOBILITYFLAGTEMPORARY_Sleeping(amount, updating = TRUE, ignore_canstun = FALSE) //Can't go below remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_SLEEP, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) + return + if((!HAS_TRAIT(src, TRAIT_SLEEPIMMUNE)) || ignore_canstun) + var/datum/status_effect/incapacitating/sleeping/S = IsSleeping() + if(S) + S.duration = max(world.time + amount, S.duration) + else if(amount > 0) + S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount, updating) + return S + +/mob/living/proc/_MOBILITYFLAGTEMPORARY_SetSleeping(amount, updating = TRUE, ignore_canstun = FALSE) //Sets remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_SLEEP, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) + return + if((!HAS_TRAIT(src, TRAIT_SLEEPIMMUNE)) || ignore_canstun) + var/datum/status_effect/incapacitating/sleeping/S = IsSleeping() + if(amount <= 0) + if(S) + qdel(S) + else if(S) + S.duration = world.time + amount + else + S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount, updating) + return S + +/mob/living/proc/_MOBILITYFLAGTEMPORARY_AdjustSleeping(amount, updating = TRUE, ignore_canstun = FALSE) //Adds to remaining duration + if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_SLEEP, amount, updating, ignore_canstun) & COMPONENT_NO_STUN) + return + if((!HAS_TRAIT(src, TRAIT_SLEEPIMMUNE)) || ignore_canstun) + var/datum/status_effect/incapacitating/sleeping/S = IsSleeping() + if(S) + S.duration += amount + else if(amount > 0) + S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount, updating) + return S + ///////////////////////////////// FROZEN ///////////////////////////////////// /mob/living/proc/IsFrozen() @@ -119,8 +372,10 @@ "visible_message" = message, "self_message" = self_message, "examine_message" = examine_message) /mob/living/proc/absorb_stun(amount, ignoring_flag_presence) - if(!amount || amount <= 0 || stat || ignoring_flag_presence || !islist(stun_absorption)) + if(amount < 0 || stat || ignoring_flag_presence || !islist(stun_absorption)) return FALSE + if(!amount) + amount = 0 var/priority_absorb_key var/highest_priority for(var/i in stun_absorption) @@ -128,20 +383,20 @@ priority_absorb_key = stun_absorption[i] highest_priority = priority_absorb_key["priority"] if(priority_absorb_key) - if(priority_absorb_key["visible_message"] || priority_absorb_key["self_message"]) - if(priority_absorb_key["visible_message"] && priority_absorb_key["self_message"]) - visible_message("[src][priority_absorb_key["visible_message"]]", "[priority_absorb_key["self_message"]]") - else if(priority_absorb_key["visible_message"]) - visible_message("[src][priority_absorb_key["visible_message"]]") - else if(priority_absorb_key["self_message"]) - to_chat(src, "[priority_absorb_key["self_message"]]") - priority_absorb_key["stuns_absorbed"] += amount + if(amount) //don't spam up the chat for continuous stuns + if(priority_absorb_key["visible_message"] || priority_absorb_key["self_message"]) + if(priority_absorb_key["visible_message"] && priority_absorb_key["self_message"]) + visible_message("[src][priority_absorb_key["visible_message"]]", "[priority_absorb_key["self_message"]]") + else if(priority_absorb_key["visible_message"]) + visible_message("[src][priority_absorb_key["visible_message"]]") + else if(priority_absorb_key["self_message"]) + to_chat(src, "[priority_absorb_key["self_message"]]") + priority_absorb_key["stuns_absorbed"] += amount return TRUE /////////////////////////////////// DISABILITIES //////////////////////////////////// - /mob/living/proc/add_quirk(quirktype, spawn_effects) //separate proc due to the way these ones are handled - if(has_quirk(quirktype)) + if(HAS_TRAIT(src, quirktype)) return var/datum/quirk/T = quirktype var/qname = initial(T.name) @@ -162,20 +417,23 @@ if(Q.type == quirktype) return TRUE return FALSE + /////////////////////////////////// TRAIT PROCS //////////////////////////////////// -/mob/living/proc/cure_blind(list/sources) - REMOVE_TRAIT(src, TRAIT_BLIND, sources) +/mob/living/proc/cure_blind(source) + REMOVE_TRAIT(src, TRAIT_BLIND, source) if(!HAS_TRAIT(src, TRAIT_BLIND)) - adjust_blindness(-1) + update_blindness() /mob/living/proc/become_blind(source) - if(!HAS_TRAIT(src, TRAIT_BLIND)) - blind_eyes(1) - ADD_TRAIT(src, TRAIT_BLIND, source) + if(!HAS_TRAIT(src, TRAIT_BLIND)) // not blind already, add trait then overlay + ADD_TRAIT(src, TRAIT_BLIND, source) + update_blindness() + else + ADD_TRAIT(src, TRAIT_BLIND, source) -/mob/living/proc/cure_nearsighted(list/sources) - REMOVE_TRAIT(src, TRAIT_NEARSIGHT, sources) +/mob/living/proc/cure_nearsighted(source) + REMOVE_TRAIT(src, TRAIT_NEARSIGHT, source) if(!HAS_TRAIT(src, TRAIT_NEARSIGHT)) clear_fullscreen("nearsighted") @@ -184,8 +442,8 @@ overlay_fullscreen("nearsighted", /obj/screen/fullscreen/impaired, 1) ADD_TRAIT(src, TRAIT_NEARSIGHT, source) -/mob/living/proc/cure_husk(list/sources) - REMOVE_TRAIT(src, TRAIT_HUSK, sources) +/mob/living/proc/cure_husk(source) + REMOVE_TRAIT(src, TRAIT_HUSK, source) if(!HAS_TRAIT(src, TRAIT_HUSK)) REMOVE_TRAIT(src, TRAIT_DISFIGURED, "husk") update_body() @@ -193,14 +451,15 @@ /mob/living/proc/become_husk(source) if(!HAS_TRAIT(src, TRAIT_HUSK)) + ADD_TRAIT(src, TRAIT_HUSK, source) ADD_TRAIT(src, TRAIT_DISFIGURED, "husk") update_body() - . = TRUE - ADD_TRAIT(src, TRAIT_HUSK, source) + else + ADD_TRAIT(src, TRAIT_HUSK, source) -/mob/living/proc/cure_fakedeath(list/sources) - REMOVE_TRAIT(src, TRAIT_FAKEDEATH, sources) - REMOVE_TRAIT(src, TRAIT_DEATHCOMA, sources) +/mob/living/proc/cure_fakedeath(source) + REMOVE_TRAIT(src, TRAIT_FAKEDEATH, source) + REMOVE_TRAIT(src, TRAIT_DEATHCOMA, source) if(stat != DEAD) tod = null update_stat() @@ -212,13 +471,13 @@ emote("deathgasp") ADD_TRAIT(src, TRAIT_FAKEDEATH, source) ADD_TRAIT(src, TRAIT_DEATHCOMA, source) - tod = STATION_TIME_TIMESTAMP("hh:mm:ss") + tod = station_time_timestamp() update_stat() -/mob/living/proc/unignore_slowdown(list/sources) - REMOVE_TRAIT(src, TRAIT_IGNORESLOWDOWN, sources) +/mob/living/proc/unignore_slowdown(source) + REMOVE_TRAIT(src, TRAIT_IGNORESLOWDOWN, source) update_movespeed(FALSE) /mob/living/proc/ignore_slowdown(source) ADD_TRAIT(src, TRAIT_IGNORESLOWDOWN, source) - update_movespeed(FALSE) \ No newline at end of file + update_movespeed(FALSE) diff --git a/code/modules/mob/status_procs.dm b/code/modules/mob/status_procs.dm index 17311daec2..8fb14b8dd1 100644 --- a/code/modules/mob/status_procs.dm +++ b/code/modules/mob/status_procs.dm @@ -3,222 +3,80 @@ //The effects include: stun, knockdown, unconscious, sleeping, resting, jitteriness, dizziness, ear damage, // eye damage, eye_blind, eye_blurry, druggy, TRAIT_BLIND trait, and TRAIT_NEARSIGHT trait. -/////////////////////////////////// STUN //////////////////////////////////// - -/mob/proc/IsStun() //non-living mobs shouldn't be stunned - return FALSE - -/////////////////////////////////// KNOCKDOWN //////////////////////////////////// - -/mob/proc/IsKnockdown() //non-living mobs shouldn't be knocked down - return FALSE - -/////////////////////////////////// UNCONSCIOUS //////////////////////////////////// - -/mob/proc/IsUnconscious() //non-living mobs shouldn't be unconscious - return FALSE - -/mob/living/IsUnconscious() //If we're unconscious - return has_status_effect(STATUS_EFFECT_UNCONSCIOUS) - -/mob/living/proc/AmountUnconscious() //How many deciseconds remain in our unconsciousness - var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious() - if(U) - return U.duration - world.time - return 0 - -/mob/living/proc/Unconscious(amount, updating = TRUE, ignore_canunconscious = FALSE) //Can't go below remaining duration - if(((status_flags & CANUNCONSCIOUS) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canunconscious) - var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious() - if(U) - U.duration = max(world.time + amount, U.duration) - else if(amount > 0) - U = apply_status_effect(STATUS_EFFECT_UNCONSCIOUS, amount, updating) - return U - -/mob/living/proc/SetUnconscious(amount, updating = TRUE, ignore_canunconscious = FALSE) //Sets remaining duration - if(((status_flags & CANUNCONSCIOUS) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canunconscious) - var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious() - if(amount <= 0) - if(U) - qdel(U) - else if(U) - U.duration = world.time + amount - else - U = apply_status_effect(STATUS_EFFECT_UNCONSCIOUS, amount, updating) - return U - -/mob/living/proc/AdjustUnconscious(amount, updating = TRUE, ignore_canunconscious = FALSE) //Adds to remaining duration - if(((status_flags & CANUNCONSCIOUS) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canunconscious) - var/datum/status_effect/incapacitating/unconscious/U = IsUnconscious() - if(U) - U.duration += amount - else if(amount > 0) - U = apply_status_effect(STATUS_EFFECT_UNCONSCIOUS, amount, updating) - return U - -/////////////////////////////////// SLEEPING //////////////////////////////////// - -/mob/proc/IsSleeping() //non-living mobs shouldn't be sleeping either - return FALSE - -/mob/living/IsSleeping() //If we're asleep - return has_status_effect(STATUS_EFFECT_SLEEPING) - -/mob/living/proc/AmountSleeping() //How many deciseconds remain in our sleep - var/datum/status_effect/incapacitating/sleeping/S = IsSleeping() - if(S) - return S.duration - world.time - return 0 - -/mob/living/proc/Sleeping(amount, updating = TRUE, ignore_sleepimmune = FALSE) //Can't go below remaining duration - if((!HAS_TRAIT(src, TRAIT_SLEEPIMMUNE)) || ignore_sleepimmune) - var/datum/status_effect/incapacitating/sleeping/S = IsSleeping() - if(S) - S.duration = max(world.time + amount, S.duration) - else if(amount > 0) - S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount, updating) - return S - -/mob/living/proc/SetSleeping(amount, updating = TRUE, ignore_sleepimmune = FALSE) //Sets remaining duration - if((!HAS_TRAIT(src, TRAIT_SLEEPIMMUNE)) || ignore_sleepimmune) - var/datum/status_effect/incapacitating/sleeping/S = IsSleeping() - if(amount <= 0) - if(S) - qdel(S) - else if(S) - S.duration = world.time + amount - else - S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount, updating) - return S - -/mob/living/proc/AdjustSleeping(amount, updating = TRUE, ignore_sleepimmune = FALSE) //Adds to remaining duration - if((!HAS_TRAIT(src, TRAIT_SLEEPIMMUNE)) || ignore_sleepimmune) - var/datum/status_effect/incapacitating/sleeping/S = IsSleeping() - if(S) - S.duration += amount - else if(amount > 0) - S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount, updating) - return S - -/////////////////////////////////// RESTING //////////////////////////////////// - -/mob/proc/Resting(amount) - resting = max(max(resting,amount),0) - -/mob/living/Resting(amount) - ..() - update_canmove() - -/mob/proc/SetResting(amount) - resting = max(amount,0) - -/mob/living/SetResting(amount) - ..() - update_canmove() - -/mob/proc/AdjustResting(amount) - resting = max(resting + amount,0) - -/mob/living/AdjustResting(amount) - ..() - update_canmove() - -/////////////////////////////////// JITTERINESS //////////////////////////////////// - +///Set the jitter of a mob /mob/proc/Jitter(amount) jitteriness = max(jitteriness,amount,0) -/////////////////////////////////// DIZZINESS //////////////////////////////////// - +/** + * Set the dizzyness of a mob to a passed in amount + * + * Except if dizziness is already higher in which case it does nothing + */ /mob/proc/Dizzy(amount) dizziness = max(dizziness,amount,0) -/////////////////////////////////// EYE_BLIND //////////////////////////////////// +///FOrce set the dizzyness of a mob +/mob/proc/set_dizziness(amount) + dizziness = max(amount, 0) +///Blind a mobs eyes by amount /mob/proc/blind_eyes(amount) - if(amount>0) - var/old_eye_blind = eye_blind - eye_blind = max(eye_blind, amount) - if(!old_eye_blind) - if(stat == CONSCIOUS || stat == SOFT_CRIT) - throw_alert("blind", /obj/screen/alert/blind) - overlay_fullscreen("blind", /obj/screen/fullscreen/blind) + adjust_blindness(amount) +/** + * Adjust a mobs blindness by an amount + * + * Will apply the blind alerts if needed + */ /mob/proc/adjust_blindness(amount) - if(amount>0) - var/old_eye_blind = eye_blind - eye_blind += amount - if(!old_eye_blind) - if(stat == CONSCIOUS || stat == SOFT_CRIT) - throw_alert("blind", /obj/screen/alert/blind) - overlay_fullscreen("blind", /obj/screen/fullscreen/blind) - else if(eye_blind) - var/blind_minimum = 0 - if((stat != CONSCIOUS && stat != SOFT_CRIT)) - blind_minimum = 1 - if(isliving(src)) - var/mob/living/L = src - if(HAS_TRAIT(L, TRAIT_BLIND)) - blind_minimum = 1 - eye_blind = max(eye_blind+amount, blind_minimum) - if(!eye_blind) - clear_alert("blind") - clear_fullscreen("blind") - + var/old_eye_blind = eye_blind + eye_blind = max(0, eye_blind + amount) + if(!old_eye_blind || !eye_blind && !HAS_TRAIT(src, TRAIT_BLIND)) + update_blindness() +/** + * Force set the blindness of a mob to some level + */ /mob/proc/set_blindness(amount) - if(amount>0) - var/old_eye_blind = eye_blind - eye_blind = amount - if(client && !old_eye_blind) - if(stat == CONSCIOUS || stat == SOFT_CRIT) - throw_alert("blind", /obj/screen/alert/blind) - overlay_fullscreen("blind", /obj/screen/fullscreen/blind) - else if(eye_blind) - var/blind_minimum = 0 - if(stat != CONSCIOUS && stat != SOFT_CRIT) - blind_minimum = 1 - if(isliving(src)) - var/mob/living/L = src - if(HAS_TRAIT(L, TRAIT_BLIND)) - blind_minimum = 1 - eye_blind = blind_minimum - if(!eye_blind) - clear_alert("blind") - clear_fullscreen("blind") - -/////////////////////////////////// EYE_BLURRY //////////////////////////////////// + var/old_eye_blind = eye_blind + eye_blind = max(amount, 0) + if(!old_eye_blind || !eye_blind && !HAS_TRAIT(src, TRAIT_BLIND)) + update_blindness() +/// proc that adds and removes blindness overlays when necessary +/mob/proc/update_blindness() + if(stat == UNCONSCIOUS || HAS_TRAIT(src, TRAIT_BLIND) || eye_blind) // UNCONSCIOUS or has blind trait, or has temporary blindness + if(stat == CONSCIOUS || stat == SOFT_CRIT) + throw_alert("blind", /obj/screen/alert/blind) + overlay_fullscreen("blind", /obj/screen/fullscreen/blind) + // You are blind why should you be able to make out details like color, only shapes near you + add_client_colour(/datum/client_colour/monochrome/blind) + else // CONSCIOUS no blind trait, no blindness + clear_alert("blind") + clear_fullscreen("blind") + remove_client_colour(/datum/client_colour/monochrome/blind) +/** + * Make the mobs vision blurry + */ /mob/proc/blur_eyes(amount) if(amount>0) - var/old_eye_blurry = eye_blurry eye_blurry = max(amount, eye_blurry) - if(!old_eye_blurry) - add_eyeblur() //Citadel edit blurry eye memes entailed. syncs beware - else if(eye_blurry > 0) - update_eyeblur() + update_eye_blur() +/** + * Adjust the current blurriness of the mobs vision by amount + */ /mob/proc/adjust_blurriness(amount) - var/old_eye_blurry = eye_blurry eye_blurry = max(eye_blurry+amount, 0) - if(amount>0) - if(!old_eye_blurry) - add_eyeblur() - else if(eye_blurry > 0) - update_eyeblur() - else if(old_eye_blurry && !eye_blurry) - remove_eyeblur() + update_eye_blur() +///Set the mobs blurriness of vision to an amount /mob/proc/set_blurriness(amount) - var/old_eye_blurry = eye_blurry eye_blurry = max(amount, 0) - if(amount>0) - if(!old_eye_blurry) - add_eyeblur() - else if(eye_blurry > 0) - update_eyeblur() - else if(old_eye_blurry) - remove_eyeblur() + update_eye_blur() + +/mob/proc/update_eye_blur() + remove_eyeblur() + add_eyeblur() /mob/proc/add_eyeblur() if(!client) @@ -228,10 +86,6 @@ GW.add_filter("blurry_eyes", 2, EYE_BLUR(CLAMP(eye_blurry*0.1,0.6,3))) F.add_filter("blurry_eyes", 2, EYE_BLUR(CLAMP(eye_blurry*0.1,0.6,3))) -/mob/proc/update_eyeblur() - remove_eyeblur() - add_eyeblur() - /mob/proc/remove_eyeblur() if(!client) return @@ -240,24 +94,23 @@ GW.remove_filter("blurry_eyes") F.remove_filter("blurry_eyes") -/////////////////////////////////// DRUGGY //////////////////////////////////// - +///Adjust the drugginess of a mob /mob/proc/adjust_drugginess(amount) return +///Set the drugginess of a mob /mob/proc/set_drugginess(amount) return -/////////////////////////////////// GROSSED OUT //////////////////////////////////// - +///Adjust the disgust level of a mob /mob/proc/adjust_disgust(amount) return +///Set the disgust level of a mob /mob/proc/set_disgust(amount) return -/////////////////////////////////// TEMPERATURE //////////////////////////////////// - +///Adjust the body temperature of a mob, with min/max settings /mob/proc/adjust_bodytemperature(amount,min_temp=0,max_temp=INFINITY) if(bodytemperature >= min_temp && bodytemperature <= max_temp) bodytemperature = CLAMP(bodytemperature + amount,min_temp,max_temp) diff --git a/modular_citadel/code/modules/mob/living/living.dm b/modular_citadel/code/modules/mob/living/living.dm index 513a80cae0..854294e4e0 100644 --- a/modular_citadel/code/modules/mob/living/living.dm +++ b/modular_citadel/code/modules/mob/living/living.dm @@ -47,69 +47,6 @@ pseudo_z_axis = newloc.get_fake_z() pixel_z = pseudo_z_axis -/mob/living/proc/lay_down() - set name = "Rest" - set category = "IC" - - if(client && client.prefs && client.prefs.autostand) - intentionalresting = !intentionalresting - to_chat(src, "You are now attempting to [intentionalresting ? "[!resting ? "lay down and ": ""]stay down" : "[resting ? "get up and ": ""]stay up"].") - if(intentionalresting && !resting) - resting = TRUE - update_canmove() - else - resist_a_rest() - else - if(!resting) - resting = TRUE - to_chat(src, "You are now laying down.") - update_canmove() - else - resist_a_rest() - -/mob/living/proc/resist_a_rest(automatic = FALSE, ignoretimer = FALSE) //Lets mobs resist out of resting. Major QOL change with combat reworks. - if(!resting || stat || attemptingstandup) - return FALSE - if(ignoretimer) - resting = FALSE - update_canmove() - return TRUE - else - var/totaldelay = 3 //A little bit less than half of a second as a baseline for getting up from a rest - if(getStaminaLoss() >= STAMINA_SOFTCRIT) - to_chat(src, "You're too exhausted to get up!") - return FALSE - attemptingstandup = TRUE - var/health_deficiency = max((maxHealth - (health - getStaminaLoss()))*0.5, 0) - if(!has_gravity()) - health_deficiency = health_deficiency*0.2 - totaldelay += health_deficiency - var/standupwarning = "[src] and everyone around them should probably yell at the dev team" - switch(health_deficiency) - if(-INFINITY to 10) - standupwarning = "[src] stands right up!" - if(10 to 35) - standupwarning = "[src] tries to stand up." - if(35 to 60) - standupwarning = "[src] slowly pushes [p_them()]self upright." - if(60 to 80) - standupwarning = "[src] weakly attempts to stand up." - if(80 to INFINITY) - standupwarning = "[src] struggles to stand up." - var/usernotice = automatic ? "You are now getting up. (Auto)" : "You are now getting up." - visible_message("[standupwarning]", usernotice, vision_distance = 5) - if(do_after(src, totaldelay, target = src)) - resting = FALSE - attemptingstandup = FALSE - update_canmove() - return TRUE - else - visible_message("[src] falls right back down.", "You fall right back down.") - attemptingstandup = FALSE - if(has_gravity()) - playsound(src, "bodyfall", 20, 1) - return FALSE - /mob/living/carbon/update_stamina() var/total_health = getStaminaLoss() if(total_health) diff --git a/tgstation.dme b/tgstation.dme index 7e7d69d6f1..37118e133f 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -2106,6 +2106,7 @@ #include "code\modules\mob\living\living.dm" #include "code\modules\mob\living\living_defense.dm" #include "code\modules\mob\living\living_defines.dm" +#include "code\modules\mob\living\living_mobility.dm" #include "code\modules\mob\living\living_movement.dm" #include "code\modules\mob\living\login.dm" #include "code\modules\mob\living\logout.dm"