mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
Merge branch 'master' into movespeed_modifiers_take_two
This commit is contained in:
@@ -1,24 +1,38 @@
|
||||
#define SHORT 5/7
|
||||
#define TALL 7/5
|
||||
|
||||
/**
|
||||
# squish.dm
|
||||
*
|
||||
* It's an element that squishes things. After the duration passes, it reverses the transformation it squished with, taking into account if they are a different orientation than they started (read: rotationally-fluid)
|
||||
*
|
||||
* Normal squishes apply vertically, as if the target is being squished from above, but you can set reverse to TRUE if you want to squish them from the sides, like if they pancake into a wall from the East or West
|
||||
*/
|
||||
/datum/element/squish
|
||||
element_flags = ELEMENT_DETACH
|
||||
|
||||
/datum/element/squish/Attach(datum/target, duration)
|
||||
/datum/element/squish/Attach(datum/target, duration=20 SECONDS, reverse=FALSE)
|
||||
. = ..()
|
||||
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)
|
||||
var/was_lying = !(C.mobility_flags & MOBILITY_STAND)
|
||||
addtimer(CALLBACK(src, .proc/Detach, C, was_lying, reverse), duration)
|
||||
|
||||
C.transform = C.transform.Scale(TALL, SHORT)
|
||||
if(reverse)
|
||||
C.transform = C.transform.Scale(SHORT, TALL)
|
||||
else
|
||||
C.transform = C.transform.Scale(TALL, SHORT)
|
||||
|
||||
/datum/element/squish/Detach(mob/living/carbon/C, was_lying)
|
||||
/datum/element/squish/Detach(mob/living/carbon/C, was_lying, reverse)
|
||||
. = ..()
|
||||
if(istype(C))
|
||||
var/is_lying = (C.lying != 0)
|
||||
var/is_lying = !(C.mobility_flags & MOBILITY_STAND)
|
||||
|
||||
if(reverse)
|
||||
is_lying = !is_lying
|
||||
|
||||
if(was_lying == is_lying)
|
||||
C.transform = C.transform.Scale(SHORT, TALL)
|
||||
else
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Tool flash bespoke element
|
||||
*
|
||||
* Flashes the user when using this tool
|
||||
*/
|
||||
/datum/element/tool_flash
|
||||
element_flags = ELEMENT_BESPOKE
|
||||
id_arg_index = 2
|
||||
/// Strength of the flash
|
||||
var/flash_strength
|
||||
|
||||
/datum/element/tool_flash/Attach(datum/target, flash_strength)
|
||||
. = ..()
|
||||
if(!isitem(target))
|
||||
return ELEMENT_INCOMPATIBLE
|
||||
|
||||
src.flash_strength = flash_strength
|
||||
|
||||
RegisterSignal(target, COMSIG_TOOL_IN_USE, .proc/prob_flash)
|
||||
RegisterSignal(target, COMSIG_TOOL_START_USE, .proc/flash)
|
||||
|
||||
/datum/element/tool_flash/Detach(datum/source, force)
|
||||
. = ..()
|
||||
UnregisterSignal(source, list(COMSIG_TOOL_IN_USE, COMSIG_TOOL_START_USE))
|
||||
|
||||
/datum/element/tool_flash/proc/prob_flash(datum/source, mob/living/user)
|
||||
if(prob(90))
|
||||
return
|
||||
flash(source, user)
|
||||
|
||||
/datum/element/tool_flash/proc/flash(datum/source, mob/living/user)
|
||||
if(user && get_dist(get_turf(source), get_turf(user)) <= 1)
|
||||
user.flash_act(min(flash_strength,1))
|
||||
Reference in New Issue
Block a user