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
@@ -43,6 +43,9 @@
/// From /mob/living/verb/execute_resist(). Resisting.
#define COMSIG_MOB_RESISTED "mob_resist"
/// Sent when a mob rests.
#define COMSIG_MOB_RESTED "mob_rested"
/// From /obj/item/organ/external/take_damage. Updates the limb's colour matrix. Very laggy, so we do it on reaction to stuff.
#define COMSIG_UPDATE_LIMB_IMAGE "update_limb_image"
-1
View File
@@ -91,7 +91,6 @@
//movement intents
#define M_WALK "walk"
#define M_RUN "run"
#define M_LAY "lay" // Intentional lying only! To not confuse with the state (variable with the same name on the mob, but not necessarity intentional)
// Limbs and robotic stuff.
#define BP_L_FOOT "l_foot"
+2 -19
View File
@@ -491,8 +491,6 @@
if(user.m_intent == M_RUN)
icon_state = "running"
else if(user.m_intent == M_LAY)
icon_state = "lying"
else
icon_state = "walking"
@@ -521,25 +519,10 @@
if(M_WALK)
if(!(usr.get_species() in BLACKLIST_SPECIES_RUNNING))
usr.m_intent = M_RUN
if(M_LAY)
// No funny "haha i get the bonuses then stand up"
var/obj/item/gun/gun_in_hand = C.get_type_in_hands(/obj/item/gun)
if(gun_in_hand?.wielded)
to_chat(C, SPAN_WARNING("You cannot wield and stand up!"))
return
if(C.lying_is_intentional)
usr.m_intent = M_WALK
if(modifiers["button"] == "middle")
C.lay_down()
if(modifiers["button"] == "middle" && !C.lying) // See /mob/proc/update_canmove() for more logic on the lying FSM
// You want this bonus weapon or not? Wield it when you are lying, not before!
var/obj/item/gun/gun_in_hand = C.get_type_in_hands(/obj/item/gun)
if(gun_in_hand?.wielded)
to_chat(C, SPAN_WARNING("You cannot wield and lie down!"))
return
C.m_intent = M_LAY
// this works in conjunction with M_LAY to make the mob stand up or lie down instantly
C.update_canmove()
C.update_icon()
-1
View File
@@ -298,7 +298,6 @@ GLOBAL_LIST_EMPTY(gamemode_cache)
//Unversal modifiers
var/walk_speed = 0
var/walk_delay_multiplier = 1
var/lying_delay_multiplier = 4
var/run_delay_multiplier = 1
var/vehicle_delay_multiplier = 1
@@ -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()
+58
View File
@@ -0,0 +1,58 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# - (fixes bugs)
# wip
# - (work in progress)
# qol
# - (quality of life)
# soundadd
# - (adds a sound)
# sounddel
# - (removes a sound)
# rscadd
# - (adds a feature)
# rscdel
# - (removes a feature)
# imageadd
# - (adds an image or sprite)
# imagedel
# - (removes an image or sprite)
# spellcheck
# - (fixes spelling or grammar)
# experiment
# - (experimental change)
# balance
# - (balance changes)
# code_imp
# - (misc internal code change)
# refactor
# - (refactors code)
# config
# - (makes a change to the config files)
# admin
# - (makes changes to administrator tools)
# server
# - (miscellaneous changes to server)
#################################
# Your name.
author: MattAtlas
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit.
# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog.
changes:
- refactor: "Laying down no longer exists as a separate movement intent, you can now simply rest with your weapon in your hand. Middle clicking the walk/run intent icon now functions as a rest macro."
Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 KiB

After

Width:  |  Height:  |  Size: 158 KiB