mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-29 11:02:05 +00:00
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>
58 lines
2.0 KiB
Plaintext
58 lines
2.0 KiB
Plaintext
|
|
/*
|
|
This component attaches to mobs, and makes their pulls !strong!
|
|
Basically, the items they pull cannot be pulled (except by the puller)
|
|
*/
|
|
/datum/component/strong_pull
|
|
var/atom/movable/strongpulling
|
|
|
|
/datum/component/strong_pull/Initialize()
|
|
if(!isliving(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
|
|
/datum/component/strong_pull/Destroy(force, silent)
|
|
if(strongpulling)
|
|
lose_strong_grip()
|
|
return ..()
|
|
|
|
/datum/component/strong_pull/RegisterWithParent()
|
|
. = ..()
|
|
RegisterSignal(parent, COMSIG_LIVING_START_PULL, PROC_REF(on_pull))
|
|
|
|
/**
|
|
* Called when the parent grabs something, adds signals to the object to reject interactions
|
|
*/
|
|
/datum/component/strong_pull/proc/on_pull(datum/source, atom/movable/pulled, state, force)
|
|
SIGNAL_HANDLER
|
|
strongpulling = pulled
|
|
RegisterSignal(strongpulling, COMSIG_ATOM_CAN_BE_PULLED, PROC_REF(reject_further_pulls))
|
|
RegisterSignal(strongpulling, COMSIG_ATOM_NO_LONGER_PULLED, PROC_REF(on_no_longer_pulled))
|
|
if(istype(strongpulling, /obj/structure/closet) && !istype(strongpulling, /obj/structure/closet/body_bag))
|
|
var/obj/structure/closet/grabbed_closet = strongpulling
|
|
grabbed_closet.strong_grab = TRUE
|
|
|
|
/**
|
|
* Signal for rejecting further grabs
|
|
*/
|
|
/datum/component/strong_pull/proc/reject_further_pulls(datum/source, mob/living/puller)
|
|
SIGNAL_HANDLER
|
|
if(puller != parent) //for increasing grabs, you need to have a valid pull. thus, parent should be able to pull the same object again
|
|
return COMSIG_ATOM_CANT_PULL
|
|
|
|
/*
|
|
* Unregisters signals and stops any buffs to pulling.
|
|
*/
|
|
/datum/component/strong_pull/proc/lose_strong_grip()
|
|
UnregisterSignal(strongpulling, list(COMSIG_ATOM_CAN_BE_PULLED, COMSIG_ATOM_NO_LONGER_PULLED))
|
|
if(istype(strongpulling, /obj/structure/closet))
|
|
var/obj/structure/closet/ungrabbed_closet = strongpulling
|
|
ungrabbed_closet.strong_grab = FALSE
|
|
strongpulling = null
|
|
|
|
/**
|
|
* Called when the hooked object is no longer pulled and removes the strong grip.
|
|
*/
|
|
/datum/component/strong_pull/proc/on_no_longer_pulled(datum/source, atom/movable/last_puller)
|
|
SIGNAL_HANDLER
|
|
lose_strong_grip()
|