Files
Bubberstation/code/datums/elements/nerfed_pulling.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

54 lines
1.8 KiB
Plaintext

/// This living will be slower when pulling/moving anything in the given typecache
/datum/element/nerfed_pulling
element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY
id_arg_index = 2
/// The typecache of things that shouldn't be easily movable
var/list/typecache
/datum/element/nerfed_pulling/Attach(datum/target, list/typecache)
. = ..()
if (!isliving(target))
return ELEMENT_INCOMPATIBLE
src.typecache = typecache
RegisterSignal(target, COMSIG_LIVING_PUSHING_MOVABLE, PROC_REF(on_push_movable))
RegisterSignal(target, COMSIG_LIVING_UPDATING_PULL_MOVESPEED, PROC_REF(on_updating_pull_movespeed))
/datum/element/nerfed_pulling/Detach(mob/living/source)
source.remove_movespeed_modifier(/datum/movespeed_modifier/nerfed_bump)
source.remove_movespeed_modifier(/datum/movespeed_modifier/nerfed_pull)
UnregisterSignal(source, list(COMSIG_LIVING_PUSHING_MOVABLE, COMSIG_LIVING_UPDATING_PULL_MOVESPEED))
return ..()
/datum/element/nerfed_pulling/proc/on_push_movable(mob/living/source, atom/movable/being_pushed)
SIGNAL_HANDLER
if (!will_slow_down(being_pushed))
return
source.add_movespeed_modifier(/datum/movespeed_modifier/nerfed_bump)
addtimer(CALLBACK(source, /mob/proc/remove_movespeed_modifier, /datum/movespeed_modifier/nerfed_bump), 1 SECONDS, TIMER_OVERRIDE | TIMER_UNIQUE)
/datum/element/nerfed_pulling/proc/on_updating_pull_movespeed(mob/living/source)
SIGNAL_HANDLER
if (!will_slow_down(source.pulling))
source.remove_movespeed_modifier(/datum/movespeed_modifier/nerfed_pull)
return
source.add_movespeed_modifier(/datum/movespeed_modifier/nerfed_pull)
/datum/element/nerfed_pulling/proc/will_slow_down(datum/input)
return !isnull(input) && typecache[input.type]
/datum/movespeed_modifier/nerfed_pull
multiplicative_slowdown = 5.5
/datum/movespeed_modifier/nerfed_bump
multiplicative_slowdown = 5.5