diff --git a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm index 53506e757b7..e0820a84864 100644 --- a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm +++ b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm @@ -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" diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index 06f7ecb4f7a..c9901acae9a 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -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" diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index d0a1c6916b1..19d0c1d0d8a 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -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() diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 0ff51c22788..80360837fcc 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -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 diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index 89a7e29a868..dbbe7490c76 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -123,8 +123,6 @@ . = ..() if(. && tail_style) update_tail_showing(!lying) - if(lying) - update_icon(TRUE) /mob/living/carbon/human/Move() . = ..() diff --git a/code/modules/mob/living/carbon/human/species/species_hud.dm b/code/modules/mob/living/carbon/human/species/species_hud.dm index 3087ec50acc..ac985b794c1 100644 --- a/code/modules/mob/living/carbon/human/species/species_hud.dm +++ b/code/modules/mob/living/carbon/human/species/species_hud.dm @@ -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), diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 4263d8a4bbf..ac7726a7101 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -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) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 8918aacb97b..16ef8b66ada 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -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() diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index 3e633dd6f84..7f05147cb29 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -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 diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index b53c08aa450..61222426755 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -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. diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index ab672e02204..914eda0b8f9 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -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. diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 8dafc6e19ea..cb11fb0be40 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -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) diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index a566eb1b1e3..799c9aa7192 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -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 diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index ebf48afa381..f951090e3ef 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -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() diff --git a/html/changelogs/mattatlas-nolaying.yml b/html/changelogs/mattatlas-nolaying.yml new file mode 100644 index 00000000000..1e078d59eeb --- /dev/null +++ b/html/changelogs/mattatlas-nolaying.yml @@ -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." diff --git a/icons/mob/screen/generic.dmi b/icons/mob/screen/generic.dmi index 64688467b37..01e5ffe0d24 100644 Binary files a/icons/mob/screen/generic.dmi and b/icons/mob/screen/generic.dmi differ