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
@@ -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)