mirror of
https://github.com/KabKebab/GS13.git
synced 2026-04-02 01:21:01 +01:00
Return of the squish element
This commit is contained in:
28
code/datums/elements/squish.dm
Normal file
28
code/datums/elements/squish.dm
Normal file
@@ -0,0 +1,28 @@
|
||||
#define SHORT 5/7
|
||||
#define TALL 7/5
|
||||
|
||||
/datum/element/squish
|
||||
element_flags = ELEMENT_DETACH
|
||||
|
||||
/datum/element/squish/Attach(datum/target, duration)
|
||||
. = ..()
|
||||
if(!iscarbon(target))
|
||||
return ELEMENT_INCOMPATIBLE
|
||||
|
||||
var/mob/living/carbon/C = target
|
||||
var/was_lying = (C.lying != 0)
|
||||
addtimer(CALLBACK(src, .proc/Detach, C, was_lying), duration)
|
||||
|
||||
C.transform = C.transform.Scale(TALL, SHORT)
|
||||
|
||||
/datum/element/squish/Detach(mob/living/carbon/C, was_lying)
|
||||
. = ..()
|
||||
if(istype(C))
|
||||
var/is_lying = (C.lying != 0)
|
||||
if(was_lying == is_lying)
|
||||
C.transform = C.transform.Scale(SHORT, TALL)
|
||||
else
|
||||
C.transform = C.transform.Scale(TALL, SHORT)
|
||||
|
||||
#undef SHORT
|
||||
#undef TALL
|
||||
Reference in New Issue
Block a user