Skip to content

Commit

Permalink
Notes towards a general posture system.
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 committed May 1, 2024
1 parent de7f81b commit 5168c25
Show file tree
Hide file tree
Showing 95 changed files with 348 additions and 236 deletions.
2 changes: 1 addition & 1 deletion code/_helpers/icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ The _flatIcons list is a cache for generated icon files.

if(ismob(A))
var/mob/M = A
if(M.lying)
if(M.current_posture.prone)
atom_icon.BecomeLying()

var/x_offset = (A.x - target_x) * world.icon_size
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
if(HAS_STATUS(owner, STAT_STUN))
return 0
if(check_flags & AB_CHECK_LYING)
if(owner.lying)
if(owner.current_posture.prone)
return 0
if(check_flags & AB_CHECK_ALIVE)
if(owner.stat)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/ai/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
if(H.shock_stage >= 40 && prob(3))
H.emote(/decl/emote/audible/scream)

if(!H.restrained() && H.lying && H.shock_stage >= 60 && prob(3))
if(!H.restrained() && H.current_posture.prone && H.shock_stage >= 60 && prob(3))
H.custom_emote("thrashes in agony")

if(!H.restrained() && H.shock_stage < 40 && prob(3))
Expand Down
2 changes: 1 addition & 1 deletion code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@
climbers.Cut(1,2)

for(var/mob/living/M in get_turf(src))
if(M.lying) return //No spamming this on people.
if(M.current_posture.prone) return //No spamming this on people.

SET_STATUS_MAX(M, STAT_WEAK, 3)
to_chat(M, SPAN_DANGER("You topple as \the [src] moves under you!"))
Expand Down
10 changes: 5 additions & 5 deletions code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
var/buckle_allow_rotation = 0
var/buckle_layer_above = FALSE
var/buckle_dir = 0
var/buckle_lying = -1 // bed-like behavior, forces mob.lying = buckle_lying if != -1
var/buckle_lying = -1 // bed-like behavior, forces mob to lie or stand if buckle_lying != -1
var/buckle_pixel_shift // ex. @'{"x":0,"y":0,"z":0}' //where the buckled mob should be pixel shifted to, or null for no pixel shift control
var/buckle_require_restraints = 0 // require people to be cuffed before being able to buckle. eg: pipes
var/buckle_require_same_tile = FALSE
Expand Down Expand Up @@ -383,7 +383,7 @@
M.facing_dir = null
if(!buckle_allow_rotation)
M.set_dir(buckle_dir ? buckle_dir : dir)
M.UpdateLyingBuckledAndVerbStatus()
M.update_posture()
M.update_floating()
buckled_mob = M

Expand All @@ -398,7 +398,7 @@
. = buckled_mob
buckled_mob.buckled = null
buckled_mob.anchored = initial(buckled_mob.anchored)
buckled_mob.UpdateLyingBuckledAndVerbStatus()
buckled_mob.update_posture()
buckled_mob.update_floating()
buckled_mob = null
post_buckle_mob(.)
Expand Down Expand Up @@ -435,7 +435,7 @@
if(buckled == buckling)
var/decl/pronouns/G = buckled.get_pronouns()
visible_message(
SPAN_NOTICE("\The [buckled] buckles [G.him][G.self] to \the [src]."),
SPAN_NOTICE("\The [buckled] buckles [G.self] to \the [src]."),
SPAN_NOTICE("You buckle yourself to \the [src]."),
SPAN_NOTICE("You hear metal clanking.")
)
Expand All @@ -459,7 +459,7 @@
if(buckled == buckling)
var/decl/pronouns/G = buckled.get_pronouns()
visible_message(
SPAN_NOTICE("\The [buckled] unbuckled [G.him][G.self] from \the [src]!"),
SPAN_NOTICE("\The [buckled] unbuckled [G.self] from \the [src]!"),
SPAN_NOTICE("You unbuckle yourself from \the [src]."),
SPAN_NOTICE("You hear metal clanking.")
)
Expand Down
4 changes: 2 additions & 2 deletions code/game/atoms_movable_grabs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@

// Anchored check so we can operate switches etc on grab intent without getting grab failure msgs.
// NOTE: /mob/living overrides this to return FALSE in favour of using default_grab_interaction
if(isliving(user) && user.a_intent == I_GRAB && !user.lying && !anchored)
if(isliving(user) && user.a_intent == I_GRAB && !user.current_posture.prone && !anchored)
return try_make_grab(user)
return ..()

/atom/movable/proc/try_make_grab(mob/living/user, defer_hand = FALSE)
if(istype(user) && CanPhysicallyInteract(user) && !user.lying)
if(istype(user) && CanPhysicallyInteract(user) && !user.current_posture.prone)
if(user == buckled_mob)
return give_control_grab(buckled_mob)
return user.make_grab(src, defer_hand = defer_hand)
Expand Down
8 changes: 4 additions & 4 deletions code/game/machinery/OpTable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@
return FALSE

/obj/machinery/optable/proc/check_victim()
if(!victim || !victim.lying || victim.loc != loc)
if(!victim || !victim.current_posture.prone || victim.loc != loc)
suppressing = FALSE
victim = null
for(var/mob/living/carbon/human/H in loc)
if(H.lying)
if(H.current_posture.prone)
victim = H
break
if(victim)
Expand All @@ -107,7 +107,7 @@
SPAN_NOTICE("You climb on \the [src]."))
else
visible_message(SPAN_NOTICE("\The [target] has been laid on \the [src] by \the [user]."))
target.resting = 1
target.set_posture(/decl/posture/lying)
target.dropInto(loc)
add_fingerprint(user)
update_icon()
Expand All @@ -119,7 +119,7 @@

/obj/machinery/optable/proc/check_table(mob/living/patient)
check_victim()
if(src.victim && get_turf(victim) == get_turf(src) && victim.lying)
if(src.victim && get_turf(victim) == get_turf(src) && victim.current_posture.prone)
to_chat(usr, "<span class='warning'>\The [src] is already occupied!</span>")
return FALSE
if(patient.buckled)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/cryopod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
clear_control_computer()
if(occupant)
occupant.forceMove(loc)
occupant.resting = 1
occupant.set_posture(/decl/posture/lying)
. = ..()

/obj/machinery/cryopod/Initialize()
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/portable_turret.dm
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ var/global/list/turret_icons
return TURRET_NOT_TARGET

if(check_synth) //If it's set to attack all non-silicons, target them!
if(L.lying)
if(L.current_posture.prone)
return lethal ? TURRET_SECONDARY_TARGET : TURRET_NOT_TARGET
return TURRET_PRIORITY_TARGET

Expand All @@ -458,7 +458,7 @@ var/global/list/turret_icons
if(assess_perp(L) < 4)
return TURRET_NOT_TARGET //if threat level < 4, keep going

if(L.lying) //if the perp is lying down, it's still a target but a less-important target
if(L.current_posture.prone) //if the perp is lying down, it's still a target but a less-important target
return lethal ? TURRET_SECONDARY_TARGET : TURRET_NOT_TARGET

return TURRET_PRIORITY_TARGET //if the perp has passed all previous tests, congrats, it is now a "shoot-me!" nominee
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/weapons/grenades/explosive.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
for(var/mob/living/M in T)
//lying on a frag grenade while the grenade is on the ground causes you to absorb most of the shrapnel.
//you will most likely be dead, but others nearby will be spared the fragments that hit you instead.
if(M.lying && isturf(src.loc))
if(M.current_posture.prone && isturf(src.loc))
P.attack_mob(M, 0, 5)
else if(!M.lying && src.loc != get_turf(src)) //if it's not on the turf, it must be in the mob!
else if(!M.current_posture.prone && src.loc != get_turf(src)) //if it's not on the turf, it must be in the mob!
P.attack_mob(M, 0, 25) //you're holding a grenade, dude!
else
P.attack_mob(M, 0, 100) //otherwise, allow a decent amount of fragments to pass
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/traps.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
/obj/item/beartrap/proc/attack_mob(mob/L)

var/target_zone
if(L.lying)
if(L.current_posture.prone)
target_zone = ran_zone()
else
target_zone = pick(BP_L_FOOT, BP_R_FOOT, BP_L_LEG, BP_R_LEG)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/flaps.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

var/mob/living/M = A
if(istype(M))
if(M.lying)
if(M.current_posture.prone)
return ..()
for(var/mob_type in mobs_can_pass)
if(istype(A, mob_type))
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/tables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@
var/chance = 20
if(ismob(P.original) && get_turf(P.original) == cover)
var/mob/M = P.original
if (M.lying)
if (M.current_posture.prone)
chance += 20 //Lying down lets you catch less bullets
if(is_flipped)
if(get_dir(loc, from) == dir) //Flipped tables catch mroe bullets
Expand Down
2 changes: 1 addition & 1 deletion code/game/sound.dm
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ var/global/const/FALLOFF_SOUNDS = 0.5
S.environment = DIZZY
else if (M.stat == UNCONSCIOUS)
S.environment = UNDERWATER
else if (T?.is_flooded(M.lying))
else if (T?.is_flooded(M.current_posture.prone))
S.environment = UNDERWATER
else
var/area/A = get_area(src)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/ZAS/Airflow.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Contains helper procs for airflow, called by /connection_group.
if(buckled)
to_chat(src, SPAN_NOTICE("Air suddenly rushes past you!"))
return FALSE
if(!lying)
if(!current_posture.prone)
to_chat(src, SPAN_DANGER("The sudden rush of air knocks you over!"))
SET_STATUS_MAX(src, STAT_WEAK, 5)
last_airflow_stun = world.time
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/secrets/fun_secrets/waddle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

/datum/extension/waddle/proc/waddle()
var/mob/living/L = holder
if(!istype(L) || L.incapacitated() || L.lying)
if(!istype(L) || L.incapacitated() || L.current_posture.prone)
return
animate(L, pixel_z = 4, time = 0)
animate(pixel_z = 0, transform = turn(matrix(), pick(-12, 0, 12)), time=2)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/clothing/spacesuits/rig/modules/modules.dm
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@
to_chat(usr, "<span class='warning'>The suit is not initialized.</span>")
return 0

if(usr.lying || usr.incapacitated(INCAPACITATION_DISRUPTED))
if(usr.current_posture.prone || usr.incapacitated(INCAPACITATION_DISRUPTED))
to_chat(usr, "<span class='warning'>You cannot use the suit in this state.</span>")
return 0

if(holder.wearer && holder.wearer.lying)
if(holder.wearer && holder.wearer.current_posture.prone)
to_chat(usr, "<span class='warning'>The suit cannot function while the wearer is prone.</span>")
return 0

Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/spacesuits/rig/rig.dm
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@
if(!ai_can_move_suit(user, check_user_module = 1))
return
wearer.lay_down()
to_chat(user, "<span class='notice'>\The [wearer] is now [wearer.resting ? "resting" : "getting up"].</span>")
to_chat(user, "<span class='notice'>\The [wearer] is now [wearer.current_posture.prone ? "resting" : "getting up"].</span>")

/obj/item/rig/proc/forced_move(var/direction, var/mob/user)
if(malfunctioning)
Expand Down
3 changes: 0 additions & 3 deletions code/modules/mechs/mech_life.dm
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/mob/living/exosuit/handle_disabilities()
return

/mob/living/exosuit/update_lying()
lying = FALSE // Prevent carp from proning us

/mob/living/exosuit/handle_regular_status_updates()

if(!body && !QDELETED(src))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/death.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
set_stat(DEAD)
adjust_stamina(-100)
reset_plane_and_layer()
UpdateLyingBuckledAndVerbStatus()
update_posture()
if(!gibbed)
clear_status_effects()

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/grab/grab_object.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

var/mob/living/affecting_mob = get_affecting_mob()
if(affecting_mob)
affecting_mob.UpdateLyingBuckledAndVerbStatus()
affecting_mob.update_posture()
if(ishuman(affecting_mob))
var/mob/living/carbon/human/H = affecting_mob
var/obj/item/uniform = H.get_equipped_item(slot_w_uniform_str)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/grab/normal/grab_normal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

var/mob/living/affecting = G.get_affecting_mob()
var/mob/living/assailant = G.assailant
if(affecting && A && A == affecting && !affecting.lying)
if(affecting && A && A == affecting && !affecting.current_posture.prone)

affecting.visible_message(SPAN_DANGER("\The [assailant] is trying to pin \the [affecting] to the ground!"))
if(do_mob(assailant, affecting, action_cooldown - 1))
Expand Down Expand Up @@ -147,7 +147,7 @@
if(!attacker.skill_check(SKILL_COMBAT, SKILL_BASIC))
return

if(target.lying)
if(target.current_posture.prone)
return

var/damage = 20
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/grab/normal/norm_aggressive.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
if(G.target_zone in list(BP_L_HAND, BP_R_HAND))
affecting_mob.drop_held_items()
// Keeps those who are on the ground down
if(affecting_mob.lying)
if(affecting_mob.current_posture.prone)
SET_STATUS_MAX(affecting_mob, STAT_WEAK, 4)

/decl/grab/normal/aggressive/can_upgrade(var/obj/item/grab/G)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/grab/normal/norm_kill.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
if(!istype(affecting))
return
affecting.drop_held_items()
if(affecting.lying)
if(affecting.current_posture.prone)
SET_STATUS_MAX(affecting, STAT_WEAK, 4)
affecting.take_damage(OXY, 1)
affecting.apply_effect(STUTTER, 5) //It will hamper your voice, being choked and all.
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/grab/normal/norm_neck.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
if(!istype(affecting))
return
affecting.drop_held_items()
if(affecting.lying)
if(affecting.current_posture.prone)
SET_STATUS_MAX(affecting, STAT_WEAK, 4)
affecting.take_damage(OXY, 1)
4 changes: 2 additions & 2 deletions code/modules/mob/living/bot/secbot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
/mob/living/bot/secbot/handleAdjacentTarget()
var/mob/living/carbon/human/H = target
var/threat = check_threat(target)
if(awaiting_surrender < SECBOT_WAIT_TIME && istype(H) && !H.lying && threat < SECBOT_THREAT_ATTACK)
if(awaiting_surrender < SECBOT_WAIT_TIME && istype(H) && !H.current_posture.prone && threat < SECBOT_THREAT_ATTACK)
if(awaiting_surrender == -1)
begin_arrest(target, threat)
++awaiting_surrender
Expand All @@ -204,7 +204,7 @@
return FALSE

var/mob/living/carbon/human/H = M
if(istype(H) && H.lying)
if(istype(H) && H.current_posture.prone)
cuff_target(H)
return TRUE

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/brain/brain.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
/mob/living/brain/say_understands(var/other)
. = ishuman(other) || (is_in_interface() && issilicon(other)) || ..()

/mob/living/brain/UpdateLyingBuckledAndVerbStatus()
/mob/living/brain/update_posture()
return

/mob/living/brain/isSynthetic()
Expand Down
6 changes: 3 additions & 3 deletions code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@
if(show_ssd && ssd_check())
M.visible_message("<span class='notice'>[M] shakes [src] trying to wake [t_him] up!</span>", \
"<span class='notice'>You shake [src], but they do not respond... Maybe they have S.S.D?</span>")
else if(lying ||HAS_STATUS(src, STAT_ASLEEP) || player_triggered_sleeping)
else if(current_posture.prone ||HAS_STATUS(src, STAT_ASLEEP) || player_triggered_sleeping)
player_triggered_sleeping = 0
ADJ_STATUS(src, STAT_ASLEEP, -5)
if(!HAS_STATUS(src, STAT_ASLEEP))
resting = FALSE
set_posture(/decl/posture/lying)
M.visible_message("<span class='notice'>[M] shakes [src] trying to wake [t_him] up!</span>", \
"<span class='notice'>You shake [src] trying to wake [t_him] up!</span>")
else
Expand Down Expand Up @@ -201,7 +201,7 @@
..()

/mob/living/carbon/slip(slipped_on, stun_duration = 8)
if(has_gravity() && !buckled && !lying)
if(has_gravity() && !buckled && !current_posture.prone)
to_chat(src, SPAN_DANGER("You slipped on [slipped_on]!"))
playsound(loc, 'sound/misc/slip.ogg', 50, 1, -3)
SET_STATUS_MAX(src, STAT_WEAK, stun_duration)
Expand Down
5 changes: 2 additions & 3 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@
old_turf.AddTracks(species.get_move_trail(src), bloodDNA, 0, dir, bloodcolor) // Going

/mob/living/carbon/human/proc/has_footsteps()
if(species.silent_steps || buckled || lying || throwing)
if(species.silent_steps || buckled || current_posture.prone || throwing)
return //people flying, lying down or sitting do not step

var/obj/item/shoes = get_equipped_item(slot_shoes_str)
Expand Down Expand Up @@ -1319,5 +1319,4 @@
playsound(T, footsound, volume, 1, range)

/mob/living/get_overlay_state_modifier()
return get_bodytype()?.get_overlay_state_modifier_for_mob(src)

return null
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/human_attackhand.dm
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
if(prob(80))
hit_zone = ran_zone(hit_zone, target = src)
if(prob(15) && hit_zone != BP_CHEST) // Missed!
if(!src.lying)
if(!src.current_posture.prone)
attack_message = "\The [H] attempted to strike \the [src], but missed!"
else
var/decl/pronouns/G = get_pronouns()
Expand Down
Loading

0 comments on commit 5168c25

Please sign in to comment.