mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-26 18:21:56 +00:00
158 lines
5.3 KiB
Plaintext
158 lines
5.3 KiB
Plaintext
/datum/orbit_menu
|
|
var/mob/dead/observer/owner
|
|
|
|
/datum/orbit_menu/New(mob/dead/observer/new_owner)
|
|
if(!istype(new_owner))
|
|
qdel(src)
|
|
owner = new_owner
|
|
|
|
/datum/orbit_menu/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.observer_state)
|
|
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
|
if(!ui)
|
|
ui = new(user, src, ui_key, "Orbit", "Orbit", 700, 500, master_ui, state)
|
|
ui.open()
|
|
|
|
/datum/orbit_menu/ui_act(action, list/params, datum/tgui/ui)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
switch(action)
|
|
if("orbit")
|
|
var/ref = params["ref"]
|
|
|
|
var/atom/movable/poi = (locate(ref) in GLOB.mob_list) || (locate(ref) in GLOB.poi_list)
|
|
if(poi == null)
|
|
. = TRUE
|
|
return
|
|
owner.ManualFollow(poi)
|
|
. = TRUE
|
|
if("refresh")
|
|
update_static_data(owner, ui)
|
|
. = TRUE
|
|
|
|
/datum/orbit_menu/ui_static_data(mob/user)
|
|
var/list/data = list()
|
|
|
|
var/list/alive = list()
|
|
var/list/highlights = list()
|
|
var/list/antagonists = list()
|
|
var/list/dead = list()
|
|
var/list/ghosts = list()
|
|
var/list/misc = list()
|
|
var/list/npcs = list()
|
|
var/length_of_ghosts = length(get_observers())
|
|
|
|
var/list/pois = getpois(mobs_only = FALSE, skip_mindless = FALSE)
|
|
for(var/name in pois)
|
|
var/mob/M = pois[name]
|
|
if(name == null)
|
|
if(pois[name] && M.type)
|
|
stack_trace("getpois returned something under a null name. Type: [M.type]")
|
|
else
|
|
stack_trace("getpois returned a null value")
|
|
continue
|
|
|
|
var/list/serialized = list()
|
|
serialized["name"] = "[name]" // stringify it; If it's null or something - we'd like to know it and fix getpois()
|
|
if(serialized["name"] != name)
|
|
stack_trace("getpois returned something under a non-string name [name] - [pois[name]] - [M.type]")
|
|
continue
|
|
|
|
serialized["ref"] = "\ref[M]"
|
|
var/list/orbiters = M.get_orbiters_recursive()
|
|
if(length(orbiters) > 0)
|
|
serialized["orbiters"] = length(orbiters)
|
|
|
|
if(istype(M))
|
|
if(isnewplayer(M)) // People in the lobby screen; only have their ckey as a name.
|
|
continue
|
|
if(isobserver(M) && M.client)
|
|
ghosts += list(serialized)
|
|
else if(M.mind == null)
|
|
npcs += list(serialized)
|
|
else if(M.stat == DEAD)
|
|
dead += list(serialized)
|
|
else
|
|
if(length(orbiters) >= 0.2 * length_of_ghosts) // They're important if 20% of observers are watching them
|
|
highlights += list(serialized)
|
|
alive += list(serialized)
|
|
|
|
var/datum/mind/mind = M.mind
|
|
if(user.antagHUD)
|
|
/*
|
|
If a mind is many antags at once, we'll display all of them, each
|
|
under their own antag sub-section.
|
|
This is arguably better, than picking one of the antag datums at random.
|
|
|
|
list of antags that are datumised:
|
|
- traitor
|
|
- mindslaves/vampire thralls
|
|
- vampire
|
|
- changelings
|
|
*/
|
|
for(var/_A in mind.antag_datums)
|
|
var/datum/antagonist/A = _A
|
|
var/antag_serialized = serialized.Copy()
|
|
antag_serialized["antag"] = A.name
|
|
antagonists += list(antag_serialized)
|
|
|
|
// Not-very-datumized antags follow
|
|
// Associative list of antag name => whether this mind is this antag
|
|
var/list/other_antags = list()
|
|
if(SSticker && SSticker.mode)
|
|
other_antags += list(
|
|
"Blob" = (mind.special_role == SPECIAL_ROLE_BLOB),
|
|
"Cultist" = (mind in SSticker.mode.cult),
|
|
"Wizard" = (mind in SSticker.mode.wizards),
|
|
"Wizard's Apprentice" = (mind in SSticker.mode.apprentices),
|
|
"Nuclear Operative" = (mind in SSticker.mode.syndicates),
|
|
"Abductor" = (mind in SSticker.mode.abductors),
|
|
"Revolutionary" = (mind in SSticker.mode.revolutionaries),
|
|
"Head Revolutionary" = (mind in SSticker.mode.head_revolutionaries)
|
|
)
|
|
|
|
for(var/antag_name in other_antags)
|
|
var/is_antag = other_antags[antag_name]
|
|
if(!is_antag)
|
|
continue
|
|
var/antag_serialized = serialized.Copy()
|
|
antag_serialized["antag"] = antag_name
|
|
antagonists += list(antag_serialized)
|
|
|
|
// Player terror spiders (and other hostile player-controlled event mobs) have their own category to help see how much there are.
|
|
// Not in the above block because terrors can be known whether AHUD is on or not.
|
|
if(isterrorspider(M))
|
|
var/list/antag_serialized = serialized.Copy()
|
|
antag_serialized["antag"] = "Terror Spider"
|
|
antagonists += list(antag_serialized)
|
|
else if(istype(M, /mob/living/simple_animal/revenant))
|
|
var/list/antag_serialized = serialized.Copy()
|
|
antag_serialized["antag"] = "Revenant"
|
|
antagonists += list(antag_serialized)
|
|
else if(isalien(M))
|
|
var/list/antag_serialized = serialized.Copy()
|
|
antag_serialized["antag"] = "Xenomorph"
|
|
antagonists += list(antag_serialized)
|
|
else if(isdemon(M))
|
|
var/list/antag_serialized = serialized.Copy()
|
|
antag_serialized["antag"] = "Demon"
|
|
antagonists += list(antag_serialized)
|
|
else if(ismorph(M))
|
|
var/list/antag_serialized = serialized.Copy()
|
|
antag_serialized["antag"] = "Morph"
|
|
antagonists += list(antag_serialized)
|
|
else
|
|
if(length(orbiters) >= 0.2 * length_of_ghosts) // If a bunch of people are orbiting an object, like the nuke disk.
|
|
highlights += list(serialized)
|
|
misc += list(serialized)
|
|
|
|
data["antagonists"] = antagonists
|
|
data["highlights"] = highlights
|
|
data["alive"] = alive
|
|
data["dead"] = dead
|
|
data["ghosts"] = ghosts
|
|
data["misc"] = misc
|
|
data["npcs"] = npcs
|
|
return data
|