mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 18:02:57 +00:00
fixes
This commit is contained in:
@@ -34,6 +34,8 @@
|
||||
#define COMBAT_FLAGS_DEFAULT (COMBAT_FLAG_PARRY_CAPABLE | COMBAT_FLAG_BLOCK_CAPABLE)
|
||||
/// Default combat flags for everyone else (so literally everyone but humans).
|
||||
#define COMBAT_FLAGS_SPRINT_EXEMPT (COMBAT_FLAG_SPRINT_ACTIVE | COMBAT_FLAG_SPRINT_TOGGLED | COMBAT_FLAG_SPRINT_FORCED | COMBAT_FLAG_PARRY_CAPABLE | COMBAT_FLAG_BLOCK_CAPABLE)
|
||||
/// Default combat flags for those in stamina combat system
|
||||
#define COMBAT_FLAGS_STAMINA_COMBAT (COMBAT_FLAG_PARRY_CAPABLE | COMBAT_FLAG_BLOCK_CAPABLE | COMBAT_FLAG_STAMINA_BUFFER)
|
||||
|
||||
/// The user wants sprint mode on
|
||||
#define COMBAT_FLAG_SPRINT_TOGGLED (1<<0)
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
#define STAMINA_BUFFER_REGEN_PER_SECOND 1
|
||||
/// Stamina buffer regen multiplier while in combat mode
|
||||
#define STAMINA_BUFFER_REGEN_PER_SECOND_COMBAT 3
|
||||
/// Penalty time after an action (clickdelay counting action) ends for stamina buffer regeneration
|
||||
#define STAMINA_BUFFER_REGEN_ACTION_PENALTY_TIME 8
|
||||
/// Penalty regen multiplier
|
||||
#define STAMINA_BUFFER_REGEN_ACTION_PENALTY_FACTOR 0.5
|
||||
/// percent of regen to take away at stamcrit
|
||||
#define STAMINA_BUFFER_STAMCRIT_REGEN_PERCENT_PENALTY 0.5
|
||||
/// percent of capacity to take away at stamcrit
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
var/mob/living/L = usr
|
||||
to_chat(L, "<span class='notice'>You have <b>[L.getStaminaLoss()]</b> stamina loss.<br>\
|
||||
Your stamina buffer is currently [L.stamina_buffer]/[L.stamina_buffer_max], and recharges at [L.stamina_buffer_regen] and [L.stamina_buffer_regen_combat] (combat mode on) per second.<br>\
|
||||
Your stamina buffer will have its capacity reduced by up to [STAMINA_BUFFER_STAMCRIT_CAPACITY_PERCENT_PENALTY * 100] from stamina damage, up until stamcrit, and similarly will be impacted in regeneration by\
|
||||
[STAMINA_BUFFER_STAMCRIT_REGEN_PERCENT_PENALTY]% from said damage.\
|
||||
Your stamina buffer will have its capacity reduced by up to [STAMINA_BUFFER_STAMCRIT_CAPACITY_PERCENT_PENALTY * 100]% from stamina damage, up until stamcrit, and similarly will be impacted in regeneration by \
|
||||
[STAMINA_BUFFER_STAMCRIT_REGEN_PERCENT_PENALTY * 100]% from said damage.\
|
||||
<br>Your stamina buffer is <b>[round((L.stamina_buffer / L.stamina_buffer_max) * 100, 0.1)]%</b> full.</span>")
|
||||
|
||||
/obj/screen/staminas/update_icon_state()
|
||||
@@ -28,6 +28,18 @@
|
||||
else
|
||||
icon_state = "stamina[clamp(FLOOR(user.getStaminaLoss() /20, 1), 0, 6)]"
|
||||
|
||||
/obj/screen/staminas/update_overlays()
|
||||
var/mob/living/carbon/user = hud?.mymob
|
||||
if(!user)
|
||||
return
|
||||
var/percent = user.getStaminaLoss() / STAMINA_CRIT
|
||||
if((user.stat == DEAD) || (user.combat_flags & COMBAT_FLAG_HARD_STAMCRIT) || (user.hal_screwyhud in 1 to 2))
|
||||
. += list("stamina_alert3")
|
||||
else if(percent >= 0.85)
|
||||
. += list("stamina_alert2")
|
||||
else if(percent >= 0.7)
|
||||
. += list("stamina_alert1")
|
||||
|
||||
//stam buffer
|
||||
/obj/screen/staminabuffer
|
||||
icon = 'modular_citadel/icons/ui/screen_gen.dmi'
|
||||
@@ -37,26 +49,32 @@
|
||||
layer = ABOVE_HUD_LAYER + 0.1
|
||||
mouse_opacity = 0
|
||||
|
||||
/obj/screen/staminabuffer/update_icon_state()
|
||||
/obj/screen/staminabuffer/proc/mark_dirty()
|
||||
if(update_to_mob())
|
||||
START_PROCESSING(SShuds, src)
|
||||
|
||||
/obj/screen/staminabuffer/process()
|
||||
if(!update_to_mob())
|
||||
return PROCESS_KILL
|
||||
|
||||
/obj/screen/staminabuffer/Destroy()
|
||||
STOP_PROCESSING(SShuds, src)
|
||||
return ..()
|
||||
|
||||
/obj/screen/staminabuffer/proc/update_to_mob()
|
||||
var/mob/living/carbon/user = hud?.mymob
|
||||
if(!user)
|
||||
return
|
||||
user.UpdateStaminaBuffer(FALSE)
|
||||
if(!user?.client)
|
||||
return FALSE
|
||||
if(user.stat == DEAD || (user.combat_flags & COMBAT_FLAG_HARD_STAMCRIT) || (user.hal_screwyhud in 1 to 2))
|
||||
icon_state = "stambuffer0"
|
||||
return FALSE
|
||||
else if(user.hal_screwyhud == 5)
|
||||
icon_state = "stambuffer29"
|
||||
return FALSE
|
||||
else if(user.stamina_buffer >= user.stamina_buffer_max)
|
||||
icon_state = "staminabuffer29"
|
||||
return FALSE
|
||||
else
|
||||
icon_state = "stambuffer[FLOOR((user.stamina_buffer / user.stamina_buffer_max) * 29, 1)]"
|
||||
|
||||
/obj/screen/staminabuffer/update_overlays()
|
||||
. = ..()
|
||||
var/mob/living/carbon/user = hud?.mymob
|
||||
if(!user)
|
||||
return
|
||||
var/level = FLOOR((user.stamina_buffer / user.stamina_buffer_max) * 29, 1)
|
||||
if((user.stat == DEAD) || (user.combat_flags & COMBAT_FLAG_HARD_STAMCRIT) || (user.hal_screwyhud in 1 to 2) || (level <= 5))
|
||||
. += list("stamina_alert3")
|
||||
else if(level <= 8)
|
||||
. += list("stamina_alert2")
|
||||
else if(level <= 12)
|
||||
. += list("stamina_alert1")
|
||||
return TRUE
|
||||
|
||||
@@ -808,7 +808,7 @@
|
||||
hud_used.healthdoll.icon_state = "healthdoll_DEAD"
|
||||
|
||||
hud_used.staminas?.update_icon_state()
|
||||
hud_used.staminabuffer?.update_icon()
|
||||
hud_used.staminabuffer?.mark_dirty()
|
||||
|
||||
/mob/living/carbon/human/fully_heal(admin_revive = FALSE)
|
||||
if(admin_revive)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
buckle_lying = FALSE
|
||||
mob_biotypes = MOB_ORGANIC|MOB_HUMANOID
|
||||
/// Enable stamina combat
|
||||
combat_flags = COMBAT_FLAGS_DEFAULT | COMBAT_FLAG_UNARMED_PARRY
|
||||
combat_flags = COMBAT_FLAGS_STAMINA_COMBAT | COMBAT_FLAG_UNARMED_PARRY
|
||||
status_flags = CANSTUN|CANKNOCKDOWN|CANUNCONSCIOUS|CANPUSH|CANSTAGGER
|
||||
has_field_of_vision = FALSE //Handled by species.
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
return
|
||||
return FALSE
|
||||
stamina_buffer -= amount
|
||||
UpdateStaminaBuffer()
|
||||
return TRUE
|
||||
|
||||
/**
|
||||
@@ -22,12 +23,16 @@
|
||||
var/time = world.time - stamina_buffer_regen_last
|
||||
var/missing_stamina_percent = getStaminaLoss() / STAMINA_CRIT
|
||||
var/stamina_buffer_max = src.stamina_buffer_max * (1 - (missing_stamina_percent * STAMINA_BUFFER_STAMCRIT_CAPACITY_PERCENT_PENALTY))
|
||||
stamina_buffer_regen_last = world.time
|
||||
if(stamina_buffer > stamina_buffer_max)
|
||||
stamina_buffer = stamina_buffer_max
|
||||
return
|
||||
var/combat_mode = !SEND_SIGNAL(src, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE)
|
||||
stamina_buffer += min((stamina_buffer_max - stamina_buffer), (1 - (missing_stamina_percent * STAMINA_BUFFER_STAMCRIT_REGEN_PERCENT_PENALTY)) * (time * 0.1 * ((combat_mode? stamina_buffer_regen_combat : stamina_buffer_regen) * stamina_buffer_regen_mod)))
|
||||
hud_used?.staminabuffer?.update_icon()
|
||||
var/action_penalty = (((world.time - last_action) >= STAMINA_BUFFER_ACTION_PENALTY_TIME) && STAMINA_BUFFER_ACTION_PENALTY_FACTOR) || 1
|
||||
var/stamina_penalty = 1 - (missing_stamina_perent * STAMINA_BUFFER_STAMCRIT_REGEN_PERCENT_PENALTY)
|
||||
var/regen = (time * 0.1 * ((combat_mode? stamina_buffer_regen_combat : stamina_buffer_regen) * stamina_buffer_regen_mod)
|
||||
stamina_buffer += min((stamina_buffer_max - stamina_buffer), action_penalty * stamina_penalty * regen))
|
||||
hud_used?.staminabuffer?.mark_dirty()
|
||||
|
||||
/**
|
||||
* Boosts our stamina buffer by this much.
|
||||
@@ -36,3 +41,4 @@
|
||||
var/missing_stamina_percent = getStaminaLoss() / STAMINA_CRIT
|
||||
var/stamina_buffer_max = src.stamina_buffer_max * (1 - (missing_stamina_percent * STAMINA_BUFFER_STAMCRIT_CAPACITY_PERCENT_PENALTY))
|
||||
stamina_buffer += min(amount, stamina_buffer_max - stamina_buffer)
|
||||
hud_used?.staminabuffer?.mark_dirty()
|
||||
|
||||
@@ -65,7 +65,7 @@ Key procs
|
||||
/datum/movespeed_modifier/proc/apply_multiplicative(existing, mob/target)
|
||||
if(!complex_calculation || (multiplicative_slowdown > 0)) // we aren't limiting how much things can slowdown.. yet.
|
||||
return existing + multiplicative_slowdown
|
||||
var/current_tiles = 10 / existing
|
||||
var/current_tiles = 10 / max(existing, world.tick_lag)
|
||||
var/minimum_speed = 10 / min(current_tiles + max_tiles_per_second_boost, max(current_tiles, absolute_max_tiles_per_second))
|
||||
return max(minimum_speed, existing + multiplicative_slowdown)
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
/datum/movespeed_modifier/sprinting
|
||||
flags = IGNORE_NOSLOW
|
||||
blacklisted_movetypes = FLOATING
|
||||
priority = -100
|
||||
priority = 100
|
||||
|
||||
/// for speed reasons this is sorta copypasty.
|
||||
/datum/movespeed_modifier/sprinting/apply_multiplicative(existing, mob/target)
|
||||
@@ -135,16 +135,15 @@
|
||||
var/mob/living/L = target
|
||||
if(!(L.mobility_flags & MOBILITY_STAND))
|
||||
return
|
||||
var/static/datum/config_entry/number/movedelay/sprint_max_tiles_increase/SSMTI
|
||||
if(!SSMTI)
|
||||
SSMTI = CONFIG_GET_ENTRY(number/movedelay/sprint_max_tiles_increase)
|
||||
var/static/datum/config_entry/number/movedelay/sprint_max_tiles_increase/SMTI
|
||||
if(!SMTI)
|
||||
SMTI = CONFIG_GET_ENTRY(number/movedelay/sprint_max_tiles_increase)
|
||||
var/static/datum/config_entry/number/movedelay/sprint_speed_increase/SSI
|
||||
if(!SSI)
|
||||
SSI = CONFIG_GET_ENTRY(number/movedelay/sprint_speed_increase)
|
||||
var/static/datum/config_entry/number/movedelay/sprint_absolute_max_tiles/SAMT
|
||||
if(!SAMT)
|
||||
SAMT = CONFIG_GET_ENTRY(number/movedelay/sprint_absolute_max_tiles)
|
||||
var/current_tiles = 10 / existing
|
||||
var/minimum_speed = 10 / min(SAMT.config_entry_value, ((current_tiles) + SSMTI.config_entry_value))
|
||||
. = max(minimum_speed, (existing - SSI.config_entry_value))
|
||||
|
||||
var/current_tiles = 10 / max(existing, world.tick_lag)
|
||||
var/minimum_speed = 10 / min(max(SAMT.config_entry_value, current_tiles), current_tiles + SMTI.config_entry_value)
|
||||
. = min(., max(minimum_speed, existing - SSI.config_entry_value))
|
||||
|
||||
Reference in New Issue
Block a user