Files
Bubberstation/code/datums/elements/tenacious.dm
AnturK 4d6a8bc537 515 Compatibility (#71161)
Makes the code compatible with 515.1594+

Few simple changes and one very painful one.
Let's start with the easy:
* puts call behind `LIBCALL` define, so call_ext is properly used in 515
* Adds `NAMEOF_STATIC(_,X)` macro for nameof in static definitions since
src is now invalid there.
* Fixes tgui and devserver. From 515 onward the tmp3333{procid} cache
directory is not appened to base path in browser controls so we don't
check for it in base js and put the dev server dummy window file in
actual directory not the byond root.
* Renames the few things that had /final/ in typepath to ultimate since
final is a new keyword

And the very painful change:
`.proc/whatever` format is no longer valid, so we're replacing it with
new nameof() function. All this wrapped in three new macros.
`PROC_REF(X)`,`TYPE_PROC_REF(TYPE,X)`,`GLOBAL_PROC_REF(X)`. Global is
not actually necessary but if we get nameof that does not allow globals
it would be nice validation.
This is pretty unwieldy but there's no real alternative.
If you notice anything weird in the commits let me know because majority
was done with regex replace.

@tgstation/commit-access Since the .proc/stuff is pretty big change.

Co-authored-by: san7890 <the@san7890.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2022-11-15 03:50:11 +00:00

33 lines
1.1 KiB
Plaintext

/**
* tenacious element; which makes the parent move faster while crawling
*
* Used by sparring sect!
*/
/datum/element/tenacious
/datum/element/tenacious/Attach(datum/target)
. = ..()
if(!ishuman(target))
return COMPONENT_INCOMPATIBLE
var/mob/living/carbon/human/valid_target = target
on_stat_change(valid_target, new_stat = valid_target.stat) //immediately try adding movement bonus if they're in soft crit
RegisterSignal(target, COMSIG_MOB_STATCHANGE, PROC_REF(on_stat_change))
ADD_TRAIT(target, TRAIT_TENACIOUS, ELEMENT_TRAIT(type))
/datum/element/tenacious/Detach(datum/target)
UnregisterSignal(target, COMSIG_MOB_STATCHANGE)
REMOVE_TRAIT(target, TRAIT_TENACIOUS, ELEMENT_TRAIT(type))
return ..()
///signal called by the stat of the target changing
/datum/element/tenacious/proc/on_stat_change(mob/living/carbon/human/target, new_stat)
SIGNAL_HANDLER
if(new_stat == SOFT_CRIT)
target.balloon_alert(target, "your tenacity kicks in")
target.add_movespeed_modifier(/datum/movespeed_modifier/tenacious)
else
target.balloon_alert(target, "your tenacity wears off")
target.remove_movespeed_modifier(/datum/movespeed_modifier/tenacious)