mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 04:27:35 +01:00
Observer Orbit menu is now fancy TGUI (#14810)
* Observer menu is now fancy TGUI * Review comments. * Actually, let's show more of the antags in the selection.
This commit is contained in:
@@ -29,6 +29,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
|
||||
var/data_hud_seen = FALSE //this should one of the defines in __DEFINES/hud.dm
|
||||
var/ghost_orbit = GHOST_ORBIT_CIRCLE
|
||||
var/health_scan = FALSE //does the ghost have health scanner mode on? by default it should be off
|
||||
var/datum/orbit_menu/orbit_menu
|
||||
|
||||
/mob/dead/observer/New(mob/body=null, flags=1)
|
||||
set_invisibility(GLOB.observer_default_invisibility)
|
||||
@@ -93,6 +94,9 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
|
||||
GLOB.ghost_images -= ghostimage
|
||||
QDEL_NULL(ghostimage)
|
||||
updateallghostimages()
|
||||
if(orbit_menu)
|
||||
SStgui.close_uis(orbit_menu)
|
||||
QDEL_NULL(orbit_menu)
|
||||
return ..()
|
||||
|
||||
/mob/dead/observer/examine(mob/user)
|
||||
@@ -378,10 +382,10 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
H.remove_hud_from(usr)
|
||||
if(!M.antagHUD)
|
||||
to_chat(usr, "AntagHud Toggled ON")
|
||||
M.antagHUD = 1
|
||||
M.antagHUD = TRUE
|
||||
else
|
||||
to_chat(usr, "AntagHud Toggled OFF")
|
||||
M.antagHUD = 0
|
||||
M.antagHUD = FALSE
|
||||
|
||||
/mob/dead/observer/proc/dead_tele()
|
||||
set category = "Ghost"
|
||||
@@ -415,9 +419,10 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
set name = "Orbit" // "Haunt"
|
||||
set desc = "Follow and orbit a mob."
|
||||
|
||||
var/list/mobs = getpois(FALSE, TRUE, TRUE, TRUE)
|
||||
var/datum/async_input/A = input_autocomplete_async(usr, "Please, select a mob: ", mobs)
|
||||
A.on_close(CALLBACK(src, .proc/ManualFollow))
|
||||
if(!orbit_menu)
|
||||
orbit_menu = new(src)
|
||||
|
||||
orbit_menu.tgui_interact(src)
|
||||
|
||||
// This is the ghost's follow verb with an argument
|
||||
/mob/dead/observer/proc/ManualFollow(atom/movable/target)
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/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/tgui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/tgui_state/state = GLOB.tgui_observer_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "Orbit", "Orbit", 800, 600, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/datum/orbit_menu/tgui_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_tgui_static_data(owner, ui)
|
||||
. = TRUE
|
||||
|
||||
/datum/orbit_menu/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
return data
|
||||
|
||||
/datum/orbit_menu/tgui_static_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
var/list/alive = list()
|
||||
var/list/antagonists = list()
|
||||
var/list/dead = list()
|
||||
var/list/ghosts = list()
|
||||
var/list/misc = list()
|
||||
var/list/npcs = list()
|
||||
|
||||
var/list/pois = getpois(mobs_only=TRUE)
|
||||
for(var/name in pois)
|
||||
var/list/serialized = list()
|
||||
serialized["name"] = name
|
||||
|
||||
var/poi = pois[name]
|
||||
|
||||
serialized["ref"] = "\ref[poi]"
|
||||
|
||||
var/mob/M = poi
|
||||
if(istype(M))
|
||||
if (isobserver(M))
|
||||
ghosts += list(serialized)
|
||||
else if(M.stat == DEAD)
|
||||
dead += list(serialized)
|
||||
else if(M.mind == null)
|
||||
npcs += list(serialized)
|
||||
else
|
||||
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.
|
||||
|
||||
// Traitors - the only antags in `.antag_datums` at the time of writing.
|
||||
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)
|
||||
|
||||
if(mind.changeling)
|
||||
var/antag_serialized = serialized.Copy()
|
||||
antag_serialized["antag"] = "Changeling"
|
||||
antagonists += list(antag_serialized)
|
||||
|
||||
if(mind.vampire)
|
||||
var/antag_serialized = serialized.Copy()
|
||||
antag_serialized["antag"] = "Vampire"
|
||||
antagonists += list(antag_serialized)
|
||||
|
||||
// Other antags are not in the list, mostly because I don't know their code well enough,
|
||||
// and am not sure how to extract the "is this is an antag?" Info easily.
|
||||
// If you are annoyed by this - datumize them and put under `.antag_datums`!
|
||||
|
||||
else
|
||||
misc += list(serialized)
|
||||
|
||||
data["alive"] = alive
|
||||
data["antagonists"] = antagonists
|
||||
data["dead"] = dead
|
||||
data["ghosts"] = ghosts
|
||||
data["misc"] = misc
|
||||
data["npcs"] = npcs
|
||||
return data
|
||||
@@ -114,8 +114,9 @@
|
||||
|
||||
var/move_on_shuttle = 1 // Can move on the shuttle.
|
||||
|
||||
var/has_enabled_antagHUD = 0
|
||||
var/antagHUD = 0
|
||||
|
||||
var/has_enabled_antagHUD = 0 // Whether antagHUD was ever enabled. Not a true boolean - sometimes it is set to 2, because reasons.
|
||||
var/antagHUD = FALSE // Whether AntagHUD is active right now
|
||||
var/can_change_intents = 1 //all mobs can change intents by default.
|
||||
|
||||
//Generic list for proc holders. Only way I can see to enable certain verbs/procs. Should be modified if needed.
|
||||
|
||||
Reference in New Issue
Block a user