Collapses the lying down intent into normal resting. (#21967)

Instead of middle clicking to lie down, you now simply rest. You can
also now do it with your gun in your hand. Removes all code related to
bespoke lying down.

To-do:

- [x] Add a signal to make firearm accuracies update on lying down.

---------

Co-authored-by: Matt Atlas <liermattia@gmail.com>
This commit is contained in:
Matt Atlas
2026-03-09 21:47:47 +00:00
committed by GitHub
co-authored by Matt Atlas
parent 20e1b8b37a
commit 1beef3d476
16 changed files with 82 additions and 70 deletions
@@ -123,8 +123,6 @@
. = ..()
if(. && tail_style)
update_tail_showing(!lying)
if(lying)
update_icon(TRUE)
/mob/living/carbon/human/Move()
. = ..()
@@ -81,7 +81,7 @@
/datum/hud_data/diona
has_hydration = FALSE
has_internals = FALSE
has_m_intent = TRUE
has_m_intent = FALSE
gear = list(
"i_clothing" = list("loc" = ui_iclothing, "name" = "uniform", "slot" = slot_w_uniform, "state" = "center", "toggle" = 1),
"o_clothing" = list("loc" = ui_oclothing, "name" = "suit", "slot" = slot_wear_suit, "state" = "suit", "toggle" = 1),
@@ -105,11 +105,11 @@ There are several things that need to be remembered:
var/previous_damage_appearance // store what the body last looked like, so we only have to update it if something changed
// Updates overlays from overlays_raw.
/mob/living/carbon/human/update_icon(var/forceDirUpdate = FALSE)
/mob/living/carbon/human/update_icon()
if (QDELETED(src))
return // No point.
var/update_lying = (lying_prev != lying) || forceDirUpdate || size_multiplier != 1
var/update_lying = (lying_prev != lying) || size_multiplier != 1
var/draw_specific_icon = (!lying || species.prone_icon)
if(update_lying && draw_specific_icon)
@@ -155,45 +155,11 @@ There are several things that need to be remembered:
else
M.Turn(-90)
M.Translate(1,-6)
animate(src, transform = M, time = (forceDirUpdate ? 0 : ANIM_LYING_TIME))
if(istype(src.l_hand, /obj/item/gun) && lying)
HeldObjectDirTransform(slot_l_hand, src.dir)
if(istype(src.r_hand, /obj/item/gun) && lying)
HeldObjectDirTransform(slot_r_hand, src.dir)
animate(src, transform = M, time = ANIM_LYING_TIME)
UpdateOverlays()
lying_prev = lying
/mob/living/carbon/human/proc/HeldObjectDirTransform(var/hand = slot_l_hand, var/direction)
var/layer = null
if(hand == slot_r_hand)
update_inv_r_hand(FALSE)
layer = R_HAND_LAYER
else
update_inv_l_hand(FALSE)
layer = L_HAND_LAYER
switch(direction)
if(EAST)
TransformLayerIcon(layer, -90)
if(WEST)
TransformLayerIcon(layer, 90)
if(NORTH)
TransformLayerIcon(layer, 0)
if(SOUTH)
TransformLayerIcon(layer, 180)
/mob/living/carbon/human/proc/TransformLayerIcon(var/layer, var/rotation = 0)
var/image/item_image = overlays_raw[layer]
var/matrix/item_transform = matrix()
item_transform.Turn(rotation)
animate(item_image, transform = item_transform)
overlays_raw[layer] = item_image
update_icon()
//DAMAGE OVERLAYS
//constructs damage icon for each organ from mask * damage field and saves it in our overlays_raw list (as a list of icons).
/mob/living/carbon/human/UpdateDamageIcon(var/update_icons = 1)
+1
View File
@@ -797,6 +797,7 @@ default behaviour is:
last_special = world.time
resting = !resting
to_chat(src, SPAN_NOTICE("You are now [resting ? "resting" : "getting up"]."))
SEND_SIGNAL(src, COMSIG_MOB_RESTED)
update_canmove()
update_icon()
@@ -68,7 +68,6 @@
/// Maximum stamina. We start taking oxyloss when this runs out while sprinting
var/max_stamina = 100
var/sprint_speed_factor = 0.4
var/lying_speed_factor = 0
var/sprint_cost_factor = 1
var/stamina_recovery = 1
/// When move intent is walk, movedelay is clamped to this value as a lower bound
@@ -428,6 +428,8 @@
icon_state = resting ? "[chassis]_rest" : "[chassis]"
to_chat(src, SPAN_NOTICE("You are now [resting ? "resting" : "getting up"]."))
SEND_SIGNAL(src, COMSIG_MOB_RESTED)
canmove = !resting
//Overriding this will stop a number of headaches down the track.
@@ -980,6 +980,8 @@
to_chat(src, SPAN_NOTICE("You are now [resting ? "resting" : "getting up"]."))
SEND_SIGNAL(src, COMSIG_MOB_RESTED)
update_icon()
//Todo: add snowflakey shit to it.
+5 -6
View File
@@ -890,17 +890,16 @@
anchored = TRUE
canmove = FALSE
lying = FALSE
else if(m_intent == M_LAY && !MOB_IS_INCAPACITATED(INCAPACITATION_DEFAULT))
lying = TRUE
lying_is_intentional = TRUE
canmove = TRUE
lying_is_intentional = FALSE
else if(sleeping)
lying = resting || (stat == DEAD) || (MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKDOWN) && !(H?.species?.sleeps_upright)) // Vaurca, IPCs and Diona sleep standing up, unless they were already lying down
lying_is_intentional = FALSE
canmove = !MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKOUT) && !weakened
else
lying = resting || (stat == DEAD) || MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKDOWN) && !recently_slept
lying_is_intentional = FALSE
var/incapacitated = (stat == DEAD) || MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKDOWN)
lying = incapacitated || resting && !recently_slept
if(!incapacitated)
lying_is_intentional = TRUE
canmove = !MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKOUT) && !weakened
if(lying)
-2
View File
@@ -308,8 +308,6 @@
if (H.m_intent == M_RUN && (H.status_flags & GODMODE || H.species.handle_sprint_cost(H, tally, TRUE))) //This will return false if we collapse from exhaustion
sprint_tally = tally
tally = (tally / (1 + H.sprint_speed_factor)) * GLOB.config.run_delay_multiplier
else if (H.m_intent == M_LAY && (H.status_flags & GODMODE || H.species.handle_sprint_cost(H, tally, TRUE)))
tally = (tally / (1 + H.lying_speed_factor)) * GLOB.config.lying_delay_multiplier
else
tally = max(tally * GLOB.config.walk_delay_multiplier, H.min_walk_delay) //clamp walking speed if its limited
else
+5
View File
@@ -908,6 +908,9 @@
var/mob/living/living_user = user
living_user.stop_aiming(src)
// so that mobs don't rest with the gun already wielded to bypass the firing delay updates
UnregisterSignal(user, COMSIG_MOB_RESTED)
queue_icon_update()
//Unwields the item when dropped, deletes the offhand
update_maptext()
@@ -922,6 +925,8 @@
..()
queue_icon_update()
addtimer(CALLBACK(src, PROC_REF(update_maptext)), 1)
// so that mobs don't rest with the gun already wielded to bypass the firing delay updates
RegisterSignal(user, COMSIG_MOB_RESTED, PROC_REF(update_firing_delays))
if(is_wieldable)
unwield()