mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-12 09:54:03 +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>
79 lines
2.3 KiB
Plaintext
79 lines
2.3 KiB
Plaintext
/* This is an attempt to make some easily reusable "particle" type effect, to stop the code
|
|
constantly having to be rewritten. An item like the jetpack that uses the ion_trail_follow system, just has one
|
|
defined, then set up when it is created with New(). Then this same system can just be reused each time
|
|
it needs to create more trails.A beaker could have a steam_trail_follow system set up, then the steam
|
|
would spawn and follow the beaker, even if it is carried or thrown.
|
|
*/
|
|
|
|
|
|
/obj/effect/particle_effect
|
|
name = "particle effect"
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
pass_flags = PASSTABLE | PASSGRILLE
|
|
anchored = TRUE
|
|
|
|
/obj/effect/particle_effect/Initialize(mapload)
|
|
. = ..()
|
|
GLOB.cameranet.updateVisibility(src)
|
|
|
|
/obj/effect/particle_effect/Destroy()
|
|
GLOB.cameranet.updateVisibility(src)
|
|
return ..()
|
|
|
|
// Prevents effects from getting registered for SSspacedrift
|
|
/obj/effect/particle_effect/newtonian_move(direction, instant = FALSE, start_delay = 0)
|
|
return TRUE
|
|
|
|
/datum/effect_system
|
|
var/number = 3
|
|
var/cardinals_only = FALSE
|
|
var/turf/location
|
|
var/atom/holder
|
|
var/effect_type
|
|
var/total_effects = 0
|
|
var/autocleanup = FALSE //will delete itself after use
|
|
|
|
/datum/effect_system/Destroy()
|
|
holder = null
|
|
location = null
|
|
return ..()
|
|
|
|
/datum/effect_system/proc/set_up(number = 3, cardinals_only = FALSE, location)
|
|
src.number = min(number, 10)
|
|
src.cardinals_only = cardinals_only
|
|
src.location = get_turf(location)
|
|
|
|
/datum/effect_system/proc/attach(atom/atom)
|
|
holder = atom
|
|
|
|
/datum/effect_system/proc/start()
|
|
if(QDELETED(src))
|
|
return
|
|
for(var/i in 1 to number)
|
|
if(total_effects > 20)
|
|
return
|
|
generate_effect()
|
|
|
|
/datum/effect_system/proc/generate_effect()
|
|
if(holder)
|
|
location = get_turf(holder)
|
|
var/obj/effect/effect = new effect_type(location)
|
|
total_effects++
|
|
var/direction
|
|
if(cardinals_only)
|
|
direction = pick(GLOB.cardinals)
|
|
else
|
|
direction = pick(GLOB.alldirs)
|
|
var/step_amt = pick(1,2,3)
|
|
var/step_delay = 5
|
|
|
|
var/datum/move_loop/loop = SSmove_manager.move(effect, direction, step_delay, timeout = step_delay * step_amt, priority = MOVEMENT_ABOVE_SPACE_PRIORITY)
|
|
RegisterSignal(loop, COMSIG_PARENT_QDELETING, PROC_REF(decrement_total_effect))
|
|
|
|
/datum/effect_system/proc/decrement_total_effect(datum/source)
|
|
SIGNAL_HANDLER
|
|
total_effects--
|
|
if(!autocleanup || total_effects > 0)
|
|
return
|
|
QDEL_IN(src, 2 SECONDS)
|