Skip to content

Commit

Permalink
/tg/ Status Effects Prelude E - Living Status Effects Refactor (#4885)
Browse files Browse the repository at this point in the history
# About the pull request

Another bit of #4828 to prepare for /tg/ status

Simply refactors most mob status to apply to /mob/living instead of /mob
and untangles some related logic

There's bit of a crutch in update_canmove but all that is going away in
the full PR

No player facing changes
  • Loading branch information
fira authored Nov 13, 2023
1 parent a4b8501 commit feba0a8
Show file tree
Hide file tree
Showing 17 changed files with 359 additions and 343 deletions.
2 changes: 1 addition & 1 deletion code/_onclick/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
if(xeno.stat != DEAD) // If the Xeno is alive, fight back
var/mob/living/carbon/carbon_user = user
if(!carbon_user || !carbon_user.ally_of_hivenumber(xeno.hivenumber))
user.KnockDown(rand(xeno.caste.tacklestrength_min, xeno.caste.tacklestrength_max))
carbon_user.KnockDown(rand(xeno.caste.tacklestrength_min, xeno.caste.tacklestrength_max))
playsound(user.loc, 'sound/weapons/pierce.ogg', 25, TRUE)
user.visible_message(SPAN_WARNING("\The [user] tried to unstrap \the [back_item] from [xeno] but instead gets a tail swipe to the head!"))
return
Expand Down
8 changes: 4 additions & 4 deletions code/datums/ammo/xeno.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

neuro_callback = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(apply_neuro))

/proc/apply_neuro(mob/M, power, insta_neuro)
/proc/apply_neuro(mob/living/M, power, insta_neuro)
if(skillcheck(M, SKILL_ENDURANCE, SKILL_ENDURANCE_MAX) && !insta_neuro)
M.visible_message(SPAN_DANGER("[M] withstands the neurotoxin!"))
return //endurance 5 makes you immune to weak neurotoxin
Expand Down Expand Up @@ -69,7 +69,7 @@
M.adjust_effect(1 * power, WEAKEN) // KD them a bit more
M.visible_message(SPAN_DANGER("[M] falls prone."))

/proc/apply_scatter_neuro(mob/M)
/proc/apply_scatter_neuro(mob/living/M)
if(ishuman(M))
var/mob/living/carbon/human/H = M
if(skillcheck(M, SKILL_ENDURANCE, SKILL_ENDURANCE_MAX))
Expand Down Expand Up @@ -317,7 +317,7 @@
shrapnel_type = /obj/item/shard/shrapnel/bone_chips
shrapnel_chance = 60

/datum/ammo/xeno/bone_chips/on_hit_mob(mob/M, obj/projectile/P)
/datum/ammo/xeno/bone_chips/on_hit_mob(mob/living/M, obj/projectile/P)
if(iscarbon(M))
var/mob/living/carbon/C = M
if((HAS_FLAG(C.status_flags, XENO_HOST) && HAS_TRAIT(C, TRAIT_NESTED)) || C.stat == DEAD)
Expand Down Expand Up @@ -347,7 +347,7 @@
damage = 10
shrapnel_chance = 0

/datum/ammo/xeno/bone_chips/spread/runner/on_hit_mob(mob/M, obj/projectile/P)
/datum/ammo/xeno/bone_chips/spread/runner/on_hit_mob(mob/living/M, obj/projectile/P)
if(iscarbon(M))
var/mob/living/carbon/C = M
if((HAS_FLAG(C.status_flags, XENO_HOST) && HAS_TRAIT(C, TRAIT_NESTED)) || C.stat == DEAD)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/morgue.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
else
. = ..()

/obj/structure/morgue/relaymove(mob/user)
/obj/structure/morgue/relaymove(mob/living/user)
if(user.is_mob_incapacitated())
return
if(exit_stun)
Expand Down
12 changes: 8 additions & 4 deletions code/modules/admin/player_panel/actions/general.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@
name = "Toggle Sleeping"

/datum/player_action/mob_sleep/act(client/user, mob/target, list/params)
if(!istype(target, /mob/living))
return TRUE
var/mob/living/living = target

if (!params["sleep"]) //if they're already slept, set their sleep to zero and remove the icon
target.sleeping = 0
target.RemoveSleepingIcon()
living.sleeping = 0
living.RemoveSleepingIcon()
else
target.sleeping = 9999999 //if they're not, sleep them and add the sleep icon, so other marines nearby know not to mess with them.
target.AddSleepingIcon()
living.sleeping = 9999999 //if they're not, sleep them and add the sleep icon, so other marines nearby know not to mess with them.
living.AddSleepingIcon()

message_admins("[key_name_admin(user)] toggled sleep on [key_name_admin(target)].")

Expand Down
7 changes: 6 additions & 1 deletion code/modules/admin/player_panel/player_panel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,12 @@
. = list()
.["mob_name"] = targetMob.name

.["mob_sleeping"] = targetMob.sleeping
if(istype(targetMob, /mob/living))
var/mob/living/livingTarget = targetMob
.["mob_sleeping"] = livingTarget.sleeping
else
.["mob_sleeping"] = 0

.["mob_frozen"] = targetMob.frozen

.["mob_speed"] = targetMob.speed
Expand Down
21 changes: 13 additions & 8 deletions code/modules/mob/hear_say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
if(!client && !(mind && mind.current != src))
return

if(stat == UNCONSCIOUS)
hear_sleep(src, message, src == speaker, Adjacent(speaker))
return

var/style = "body"
var/comm_paygrade = ""

Expand Down Expand Up @@ -67,9 +63,6 @@
if(!client && !(mind && mind.current != src))
return

if(stat == UNCONSCIOUS)
hear_sleep(src, message, FALSE, FALSE)
return
var/comm_paygrade = ""

var/track = null
Expand Down Expand Up @@ -207,7 +200,19 @@
M.show_message(message)
src.show_message(message)

/mob/proc/hear_sleep(mob/speaker = null, message, hearing_self = FALSE, proximity_flag = FALSE)
/mob/living/hear_say(message, verb, datum/language/language, alt_name, italics, mob/speaker, sound/speech_sound, sound_vol)
if(client && mind && stat == UNCONSCIOUS)
hear_sleep(src, message, src == speaker, Adjacent(speaker))
return
return ..()

/mob/living/hear_radio(message, verb, datum/language/language, part_a, part_b, mob/speaker, hard_to_hear, vname, command, no_paygrade)
if(client && mind && stat == UNCONSCIOUS)
hear_sleep(src, message, FALSE, FALSE)
return
return ..()

/mob/living/proc/hear_sleep(mob/speaker = null, message, hearing_self = FALSE, proximity_flag = FALSE)
var/heard = ""

if(sdisabilities & DISABILITY_DEAF || ear_deaf)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,11 @@
set name = "Sleep"
set category = "IC"

if(usr.sleeping)
if(sleeping)
to_chat(usr, SPAN_DANGER("You are already sleeping"))
return
if(alert(src,"You sure you want to sleep for a while?","Sleep","Yes","No") == "Yes")
usr.sleeping = 20 //Short nap
sleeping = 20 //Short nap


/mob/living/carbon/Collide(atom/movable/AM)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/emote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
key_third_person = "faints"
message = "faints!"

/datum/emote/living/carbon/human/faint/run_emote(mob/user, params, type_override, intentional)
/datum/emote/living/carbon/human/faint/run_emote(mob/living/carbon/human/user, params, type_override, intentional)
. = ..()
user.sleeping += 10

Expand Down
8 changes: 8 additions & 0 deletions code/modules/mob/living/living_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,11 @@

/// This is what the value is changed to when the mob dies. Actual BMV definition in atom/movable.
var/dead_black_market_value = 0

var/dazed = 0
var/knocked_out = 0
var/stunned = 0
var/knocked_down = 0
var/slowed = 0 // X_SLOW_AMOUNT
var/superslowed = 0 // X_SUPERSLOW_AMOUNT
var/sleeping = 0
Loading

0 comments on commit feba0a8

Please sign in to comment.