LARP Expansion Pack DLC - Tactical lying down (#15952)

* Initial implementation

* Commented code

* More work for directional handling

* Initial wielding accuracy integration

* Final touchups

* Changelog

* Linter plz

* Alright you prefer this?

* Update code/_onclick/hud/screen_objects.dm

Co-authored-by: Matt Atlas <mattiathebest2000@hotmail.it>

* Update code/_onclick/hud/screen_objects.dm

Co-authored-by: Matt Atlas <mattiathebest2000@hotmail.it>

* Small fix

* and this too

* Diona now have the icon back, but it's locked to walk and lay down

* Fix buckling direction

* Fucking merge conflicts resolution editor highlighter

---------

Co-authored-by: Matt Atlas <mattiathebest2000@hotmail.it>
This commit is contained in:
Fluffy
2023-09-03 15:48:07 +02:00
committed by GitHub
parent 3bab5267b9
commit 326ea5cbaf
15 changed files with 178 additions and 30 deletions
+1
View File
@@ -91,6 +91,7 @@
//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"
+29 -1
View File
@@ -454,9 +454,13 @@
if (user.m_intent == M_RUN)
icon_state = "running"
else if (user.m_intent == M_LAY)
icon_state = "lying"
else
icon_state = "walking"
#define BLACKLIST_SPECIES_RUNNING list(SPECIES_DIONA, SPECIES_DIONA_COEUS)
/obj/screen/movement_intent/Click(location, control, params)
if(!usr)
return 1
@@ -477,7 +481,29 @@
if(M_RUN)
usr.m_intent = M_WALK
if(M_WALK)
usr.m_intent = M_RUN
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.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
else if(istype(usr, /mob/living/simple_animal/hostile/morph))
var/mob/living/simple_animal/hostile/morph/M = usr
switch(usr.m_intent)
@@ -488,6 +514,8 @@
M.update_speed()
update_move_icon(usr)
#undef BLACKLIST_SPECIES_RUNNING
// Hand slots are special to handle the handcuffs overlay
/obj/screen/inventory/hand
var/image/handcuff_overlay
+1
View File
@@ -256,6 +256,7 @@ var/list/gamemode_cache = list()
//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
@@ -24,7 +24,7 @@
icon = 'icons/obj/structure/beds.dmi'
icon_state = "bed"
anchored = TRUE
buckle_dir = SOUTH
buckle_dir = EAST
buckle_lying = 1
build_amt = 2
var/material/padding_material
@@ -118,6 +118,8 @@
. = ..()
if(. && tail_style)
update_tail_showing(1)
if(lying)
update_icon(forceDirUpdate = TRUE)
/mob/living/carbon/human/Move()
. = ..()
@@ -62,7 +62,7 @@
/datum/hud_data/diona
has_hydration = FALSE
has_internals = FALSE
has_m_intent = FALSE
has_m_intent = TRUE
gear = list(
"i_clothing" = list("loc" = ui_iclothing, "name" = "uniform", "slot" = slot_w_uniform, "state" = "center", "toggle" = 1),
"o_clothing" = list("loc" = ui_shoes, "name" = "suit", "slot" = slot_wear_suit, "state" = "suit", "toggle" = 1),
@@ -110,4 +110,4 @@
"id" = list("loc" = ui_id, "name" = "id", "slot" = slot_wear_id, "state" = "id"),
"storage1" = list("loc" = ui_storage1, "name" = "left pocket", "slot" = slot_l_store, "state" = "pocket"),
"storage2" = list("loc" = ui_storage2, "name" = "right pocket", "slot" = slot_r_store, "state" = "pocket")
)
)
@@ -102,8 +102,10 @@ There are several things that need to be remembered:
var/list/overlays_raw[TOTAL_LAYERS] // Our set of "raw" overlays that can be modified, but cannot be directly applied to the mob without preprocessing.
var/previous_damage_appearance // store what the body last looked like, so we only have to update it if something changed
#define UPDATE_ICON_IGNORE_DIRECTION_UPDATE -1
// Updates overlays from overlays_raw.
/mob/living/carbon/human/update_icon()
/mob/living/carbon/human/update_icon(var/forceDirUpdate = FALSE)
if (QDELING(src))
return // No point.
@@ -135,14 +137,28 @@ There are several things that need to be remembered:
add_overlay(ovr)
if (lying_prev != lying || size_multiplier != 1)
if (((lying_prev != lying) || forceDirUpdate || size_multiplier != 1) && forceDirUpdate != UPDATE_ICON_IGNORE_DIRECTION_UPDATE)
if(lying && !species.prone_icon) //Only rotate them if we're not drawing a specific icon for being prone.
var/matrix/M = matrix()
M.Turn(90)
switch(src.dir)
if(NORTH,EAST)
M.Turn(90)
else
M.Turn(-90)
M.Scale(size_multiplier)
M.Translate(1,-6)
animate(src, transform = M, time = ANIM_LYING_TIME)
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)
else
update_inv_l_hand(FALSE)
update_inv_r_hand(FALSE)
update_icon(UPDATE_ICON_IGNORE_DIRECTION_UPDATE)
var/matrix/M = matrix()
M.Scale(size_multiplier)
M.Translate(0, 16*(size_multiplier-1))
@@ -151,6 +167,37 @@ There are several things that need to be remembered:
compile_overlays()
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(UPDATE_ICON_IGNORE_DIRECTION_UPDATE)
#undef UPDATE_ICON_IGNORE_DIRECTION_UPDATE
//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)
@@ -1152,7 +1199,7 @@ There are several things that need to be remembered:
overlays_raw[L_HAND_LAYER] = null
if(update_icons)
update_icon()
update_icon(forceDirUpdate = TRUE)
/mob/living/carbon/human/update_inv_r_hand(var/update_icons=1)
if (QDELING(src))
@@ -1188,7 +1235,7 @@ There are several things that need to be remembered:
overlays_raw[R_HAND_LAYER] = null
if(update_icons)
update_icon()
update_icon(forceDirUpdate = TRUE)
/mob/living/carbon/human/update_inv_wrists(var/update_icons=1)
if (QDELING(src))
+2 -1
View File
@@ -52,6 +52,7 @@
var/stamina = 0
var/max_stamina = 100//Maximum stamina. We start taking oxyloss when this runs out while sprinting
var/sprint_speed_factor = 0.4
var/lying_speed_factor = 0
var/sprint_cost_factor = 1
var/stamina_recovery = 1
var/min_walk_delay = 0//When move intent is walk, movedelay is clamped to this value as a lower bound
@@ -73,4 +74,4 @@
var/limb_breaking = FALSE // used to limit people from queuing up limb-breaks
var/list/obj/aura/auras //Basically a catch-all aura/force-field thing.
var/named = FALSE //Affects renaming animals and monkey species. Set to TRUE for animals with unique names, such as station pets. Doesn't affect any other mob.
var/named = FALSE //Affects renaming animals and monkey species. Set to TRUE for animals with unique names, such as station pets. Doesn't affect any other mob.
+24 -14
View File
@@ -836,40 +836,50 @@
lying = TRUE
break
else if(!resting && cannot_stand() && can_stand_overridden())
lying = 0
canmove = 1
lying = FALSE
lying_is_intentional = FALSE
canmove = TRUE
else
if(istype(buckled_to, /obj/vehicle))
var/obj/vehicle/V = buckled_to
if(is_physically_disabled())
lying = 1
canmove = 0
lying = TRUE
lying_is_intentional = FALSE
canmove = FALSE
pixel_y = V.mob_offset_y - 5
else
if(buckled_to.buckle_lying != -1) lying = buckled_to.buckle_lying
canmove = 1
lying_is_intentional = FALSE
canmove = TRUE
pixel_y = V.mob_offset_y
else if(buckled_to)
anchored = 1
canmove = 0
anchored = TRUE
canmove = FALSE
if(isobj(buckled_to))
if(buckled_to.buckle_lying != -1)
lying = buckled_to.buckle_lying
lying_is_intentional = FALSE
if(buckled_to.buckle_movable)
anchored = 0
canmove = 1
anchored = FALSE
canmove = TRUE
else if(captured)
anchored = 1
canmove = 0
lying = 0
anchored = TRUE
canmove = FALSE
lying = FALSE
else if(m_intent == M_LAY && !incapacitated())
lying = TRUE
lying_is_intentional = TRUE
canmove = TRUE
else
lying = MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKDOWN)
lying_is_intentional = FALSE
canmove = !MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKOUT)
if(lying)
density = 0
if(l_hand) unEquip(l_hand)
if(r_hand) unEquip(r_hand)
if(!lying_is_intentional)
if(l_hand) unEquip(l_hand)
if(r_hand) unEquip(r_hand)
else
density = initial(density)
+3 -2
View File
@@ -93,8 +93,9 @@
var/sleeping = 0 //Carbon
var/sleeping_msg_debounce = FALSE //Carbon - Used to show a message once every time someone falls asleep.
var/resting = 0 //Carbon
var/lying = 0
var/lying_prev = 0
var/lying = 0 // Is the mob lying down?
var/lying_prev = 0 // Was the mob lying down before?
var/lying_is_intentional = FALSE // Is the mob lying down intentionally? (eg. a manouver)
var/canmove = 1
//Allows mobs to move through dense areas without restriction. For instance, in space or out of holder objects.
var/incorporeal_move = INCORPOREAL_DISABLE
+2
View File
@@ -313,6 +313,8 @@
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)) * 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)) * config.lying_delay_multiplier
else
tally = max(tally * config.walk_delay_multiplier, H.min_walk_delay) //clamp walking speed if its limited
else
+10 -3
View File
@@ -756,6 +756,7 @@
update_icon()
update_held_icon()
/obj/item/gun/proc/wield()
wielded = TRUE
update_firing_delays()
@@ -766,14 +767,17 @@
update_icon()
update_held_icon()
#define LYING_DOWN_FIRE_DELAY_AND_RECOIL_STAT_MULTIPLIER 0.9 //If the mob is intentionally lying down, apply this as a bonus to the fire delay and recoil
#define LYING_DOWN_ACCURACY_STAT_MULTIPLIER 1.1 //If the mob is intentionally lying down, apply this as a bonus to accuracy
/obj/item/gun/proc/update_firing_delays()
if(wielded)
if(fire_delay_wielded)
fire_delay = fire_delay_wielded
fire_delay = usr.lying_is_intentional ? (fire_delay_wielded * LYING_DOWN_FIRE_DELAY_AND_RECOIL_STAT_MULTIPLIER) : fire_delay_wielded
if(recoil_wielded)
recoil = recoil_wielded
recoil = usr.lying_is_intentional ? (recoil_wielded * LYING_DOWN_FIRE_DELAY_AND_RECOIL_STAT_MULTIPLIER) : recoil_wielded
if(accuracy_wielded)
accuracy = accuracy_wielded
accuracy = usr.lying_is_intentional ? (accuracy_wielded * LYING_DOWN_ACCURACY_STAT_MULTIPLIER) : accuracy_wielded
else
if(fire_delay_wielded)
fire_delay = initial(fire_delay)
@@ -782,6 +786,9 @@
if(accuracy_wielded)
accuracy = initial(accuracy)
#undef LYING_DOWN_FIRE_DELAY_AND_RECOIL_STAT_MULTIPLIER
#undef LYING_DOWN_ACCURACY_STAT_MULTIPLIER
/obj/item/gun/mob_can_equip(mob/user, slot, disable_warning, ignore_blocked)
//Cannot equip wielded items.
if(wielded)
@@ -0,0 +1,48 @@
################################
# 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
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
# balance
# admin
# backend
# security
# refactor
#################################
# Your name.
author: FluffyGhost
# 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, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- rscadd: "Ability to lie down intentionally, useful to make it harder to get shot."
- rscadd: "Tactical lying down is now toggable with a middle mouse button on the walk/run icon."
- rscadd: "Lying down tactically let you retain your weapons and items in hand, and operate them."
- rscadd: "While lying down tactically AND wielding, you get a 10% bonus on precision, recoil and fire speed."
- rscadd: "While lying down tactically, you get a large speed penalty bonus."
- rscadd: "You have to unwield any weapon you might have in hand before tactically lying down or standing up from a tactical lying down."
- rscadd: "Human and playable species mobs now change orientation, while lying down, depending on the direction they're facing."
- imageadd: "Added tactical lying down icons."
Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 KiB

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 50 KiB