Reworks skittish quirk to be automatic (#56048)

* Reworks skittish quirk to be automatic

🆑 coiax
tweak: The Skittish quirk will now cause you to automatically dive into
a locker/crate if you move into it while it is closed. Walk to avoid
this behaviour.
/🆑

This makes the quirk more useful, while also making it more thematic,
since the "diving into" behaviour can't be disabled, only supressed by
walking.

The cost is unchanged, as the quirk in its current form is overcosted at
2 points.

The emergent effect of skittish people diving into closets when caught
into explosions is definitely a feature, and not a bug.

* Reworks skittish into a element

Skittish is now an element attached to mobs, when the TRAIT_SKITTISH is
added, rather than code that runs on every single Bump of a closet.

Some crates that don't function like normal crates, like the "loot
mastermind" crate, or the wooden crate than can only be deconstructed,
are not divable into.
This commit is contained in:
coiax
2021-01-23 02:28:38 -08:00
committed by GitHub
parent 125d73301d
commit 5ea2c1dfb4
7 changed files with 89 additions and 40 deletions
@@ -37,6 +37,8 @@
var/delivery_icon = "deliverycloset" //which icon to use when packagewrapped. null to be unwrappable.
var/anchorable = TRUE
var/icon_welded = "welded"
/// Whether a skittish person can dive inside this closet. Disable if opening the closet causes "bad things" to happen or that it leads to a logical inconsistency.
var/divable = TRUE
/obj/structure/closet/Initialize(mapload)
@@ -102,10 +104,9 @@
. += "<span class='notice'>The parts are <b>welded</b> together.</span>"
else if(secure && !opened)
. += "<span class='notice'>Alt-click to [locked ? "unlock" : "lock"].</span>"
if(isliving(user))
var/mob/living/L = user
if(HAS_TRAIT(L, TRAIT_SKITTISH))
. += "<span class='notice'>Ctrl-Shift-click [src] to jump inside.</span>"
if(HAS_TRAIT(user, TRAIT_SKITTISH) && divable)
. += "<span class='notice'>If you bump into [p_them()] while running, you will jump inside.</span>"
/obj/structure/closet/CanAllowThrough(atom/movable/mover, turf/target)
. = ..()
@@ -448,13 +449,6 @@
else
togglelock(user)
/obj/structure/closet/CtrlShiftClick(mob/living/user)
if(!HAS_TRAIT(user, TRAIT_SKITTISH))
return ..()
if(!user.canUseTopic(src, BE_CLOSE) || !isturf(user.loc))
return
dive_into(user)
/obj/structure/closet/proc/togglelock(mob/living/user, silent)
if(secure && !broken)
if(allowed(user))
@@ -522,24 +516,3 @@
/obj/structure/closet/return_temperature()
return
/obj/structure/closet/proc/dive_into(mob/living/user)
var/turf/T1 = get_turf(user)
var/turf/T2 = get_turf(src)
if(!opened)
if(locked)
togglelock(user, TRUE)
if(!open(user))
to_chat(user, "<span class='warning'>It won't budge!</span>")
return
step_towards(user, T2)
T1 = get_turf(user)
if(T1 == T2)
user.set_resting(TRUE) //so people can jump into crates without slamming the lid on their head
if(!close(user))
to_chat(user, "<span class='warning'>You can't get [src] to close!</span>")
user.set_resting(FALSE)
return
user.set_resting(FALSE)
togglelock(user)
T1.visible_message("<span class='warning'>[user] dives into [src]!</span>")
@@ -12,6 +12,9 @@
open_sound_volume = 25
close_sound_volume = 50
// Stops people from "diving into" a crate you can't open normally
divable = FALSE
/obj/structure/closet/crate/large/attack_hand(mob/user)
add_fingerprint(user)
if(manifest)