Airlock open delay audit (#69905)

About The Pull Request

A: Mineral doors no longer take 6 SECONDS to open if you bump anything beforehand. Holy shit why would you do this.
B: Airlocks no longer require you to have not bumped anything in a second, lowered to 0.3 seconds. This is safe because I've moved shock immunity to its own logic. This should make opening doors feel less horrible
Why It's Good For The Game

Feels better.
Changelog

cl
balance: Airlocks will open on bump in series much faster now. As a tradeoff, you're immune to shocks from them for a second after you last got shocked by one.
fix: Mineral doors will no longer take 6 WHOLE SECONDS to open if you've bumped something else recently
/cl
This commit is contained in:
LemonInTheDark
2022-09-27 20:09:46 +13:00
committed by GitHub
parent d283c72834
commit cee07f804c
4 changed files with 15 additions and 9 deletions
+1
View File
@@ -184,6 +184,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_SHOCKIMMUNE "shock_immunity"
/// Are we immune to specifically tesla / SM shocks?
#define TRAIT_TESLA_SHOCKIMMUNE "tesla_shock_immunity"
#define TRAIT_AIRLOCK_SHOCKIMMUNE "airlock_shock_immunity"
/// Is this atom being actively shocked? Used to prevent repeated shocks.
#define TRAIT_BEING_SHOCKED "shocked"
#define TRAIT_STABLEHEART "stable_heart"
+5
View File
@@ -436,6 +436,8 @@
/obj/machinery/door/airlock/proc/shock(mob/living/user, prb)
if(!istype(user) || !hasPower()) // unpowered, no shock
return FALSE
if(HAS_TRAIT(user, TRAIT_AIRLOCK_SHOCKIMMUNE)) // Be a bit more clever man come on
return FALSE
if(!COOLDOWN_FINISHED(src, shockCooldown))
return FALSE //Already shocked someone recently?
if(!prob(prb))
@@ -444,6 +446,9 @@
var/check_range = TRUE
if(electrocute_mob(user, get_area(src), src, 1, check_range))
COOLDOWN_START(src, shockCooldown, 1 SECONDS)
// Provides timed airlock shock immunity, to prevent overly cheesy deathtraps
ADD_TRAIT(user, TRAIT_AIRLOCK_SHOCKIMMUNE, REF(src))
addtimer(TRAIT_CALLBACK_REMOVE(user, TRAIT_AIRLOCK_SHOCKIMMUNE, REF(src)), 1 SECONDS)
return TRUE
else
return FALSE
+4 -2
View File
@@ -153,8 +153,10 @@
return
if(isliving(AM))
var/mob/living/M = AM
if(world.time - M.last_bumped <= 10)
return //Can bump-open one airlock per second. This is to prevent shock spam.
//Can bump-open maybe 3 airlocks per second. This is to prevent weird mass door openings
//While keeping things feeling snappy
if(world.time - M.last_bumped <= 0.3 SECONDS)
return
M.last_bumped = world.time
if(HAS_TRAIT(M, TRAIT_HANDS_BLOCKED) && !check_access(null) && !emergency)
return
@@ -76,13 +76,11 @@
if(isSwitchingStates || !anchored)
return
if(isliving(user))
var/mob/living/M = user
if(world.time - M.last_bumped <= 60)
return //NOTE do we really need that?
if(M.client)
if(iscarbon(M))
var/mob/living/carbon/C = M
if(!C.handcuffed)
var/mob/living/matters = user
if(matters.client)
if(iscarbon(matters))
var/mob/living/carbon/carbon_user = matters
if(!carbon_user.handcuffed)
SwitchState()
else
SwitchState()