mirror of
https://github.com/KabKebab/GS13.git
synced 2026-03-29 15:43:14 +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
|
||||
@@ -477,6 +477,7 @@
|
||||
#include "code\datums\elements\flavor_text.dm"
|
||||
#include "code\datums\elements\ghost_role_eligibility.dm"
|
||||
#include "code\datums\elements\mob_holder.dm"
|
||||
#include "code\datums\elements\squish.dm"
|
||||
#include "code\datums\elements\swimming.dm"
|
||||
#include "code\datums\elements\wuv.dm"
|
||||
#include "code\datums\helper_datums\events.dm"
|
||||
|
||||
Reference in New Issue
Block a user