Files
Bubberstation/code/controllers/subsystem/augury.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

89 lines
2.4 KiB
Plaintext

SUBSYSTEM_DEF(augury)
name = "Augury"
flags = SS_NO_INIT
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
var/list/watchers = list()
var/list/doombringers = list()
var/list/observers_given_action = list()
/datum/controller/subsystem/augury/stat_entry(msg)
msg = "W:[watchers.len]|D:[length(doombringers)]"
return ..()
/datum/controller/subsystem/augury/proc/register_doom(atom/A, severity)
doombringers[A] = severity
RegisterSignal(A, COMSIG_PARENT_QDELETING, PROC_REF(unregister_doom))
/datum/controller/subsystem/augury/proc/unregister_doom(atom/A)
SIGNAL_HANDLER
UnregisterSignal(A, COMSIG_PARENT_QDELETING)
doombringers -= A
/datum/controller/subsystem/augury/fire()
var/biggest_doom = null
var/biggest_threat = null
for(var/db in doombringers)
var/datum/d = db
if(!d || QDELETED(d))
doombringers -= d
continue
var/threat = doombringers[d]
if((biggest_threat == null) || (biggest_threat < threat))
biggest_doom = d
biggest_threat = threat
if(doombringers.len)
for(var/i in GLOB.player_list)
if(isobserver(i) && (!(observers_given_action[i])))
var/datum/action/innate/augury/A = new
A.Grant(i)
observers_given_action[i] = TRUE
else
for(var/i in observers_given_action)
if(observers_given_action[i] && isobserver(i))
var/mob/dead/observer/O = i
for(var/datum/action/innate/augury/A in O.actions)
qdel(A)
observers_given_action -= i
for(var/w in watchers)
if(!w)
watchers -= w
continue
var/mob/dead/observer/O = w
if(biggest_doom && (!O.orbiting || O.orbiting.parent != biggest_doom))
O.ManualFollow(biggest_doom)
/datum/action/innate/augury
name = "Auto Follow Debris"
icon_icon = 'icons/obj/meteor.dmi'
button_icon_state = "flaming"
background_icon_state = ACTION_BUTTON_DEFAULT_BACKGROUND
/datum/action/innate/augury/Destroy()
if(owner)
SSaugury.watchers -= owner
return ..()
/datum/action/innate/augury/Activate()
SSaugury.watchers += owner
to_chat(owner, span_notice("You are now auto-following debris."))
active = TRUE
UpdateButtons()
/datum/action/innate/augury/Deactivate()
SSaugury.watchers -= owner
to_chat(owner, span_notice("You are no longer auto-following debris."))
active = FALSE
UpdateButtons()
/datum/action/innate/augury/UpdateButton(atom/movable/screen/movable/action_button/button, status_only = FALSE, force)
..()
if(active)
button.icon_state = "template_active"
else
button.icon_state = "template"