---
code/modules/cm_marines/overwatch.dm | 1020 ++++++++---------
.../tgui/interfaces/OverwatchConsole.js | 756 ++++++++++++
2 files changed, 1231 insertions(+), 545 deletions(-)
create mode 100644 tgui/packages/tgui/interfaces/OverwatchConsole.js
diff --git a/code/modules/cm_marines/overwatch.dm b/code/modules/cm_marines/overwatch.dm
index 070cf1f6c1cf..26de42ad99ec 100644
--- a/code/modules/cm_marines/overwatch.dm
+++ b/code/modules/cm_marines/overwatch.dm
@@ -1,3 +1,5 @@
+#define MAX_SAVED_COORDINATES 3
+
#define HIDE_ALMAYER 2
#define HIDE_GROUND 1
#define HIDE_NONE 0
@@ -28,10 +30,18 @@
var/datum/tacmap/tacmap
var/minimap_type = MINIMAP_FLAG_USCM
+
+ ///List of saved coordinates, format of ["x", "y", "comment"]
+ var/list/saved_coordinates = list()
+ ///Currently selected UI theme
+ var/ui_theme = "crtblue"
+
+
/obj/structure/machinery/computer/overwatch/Initialize()
. = ..()
tacmap = new(src, minimap_type)
+
/obj/structure/machinery/computer/overwatch/Destroy()
QDEL_NULL(tacmap)
return ..()
@@ -57,437 +67,345 @@
to_chat(user, SPAN_WARNING("You don't have the training to use [src]."))
return
- user.set_interaction(src)
- var/dat = ""
+ tgui_interact(user)
- if(!operator)
- dat += "
Operator: ----------
"
- else
- dat += "
Operator: [operator.name]
"
- dat += " Stop Overwatch
"
- dat += "
"
-
- switch(state)
- if(0) // Base menu
- dat += get_base_menu_text()
- if(1) //Info screen.
- dat += get_info_screen_text()
- if(2)
- dat += get_supply_drop_menu_text()
- if(3)
- dat += get_orbital_bombardment_control_text()
-
- show_browser(user, dat, "Overwatch Console", "overwatch", "size=550x550")
- return
+/obj/structure/machinery/computer/overwatch/get_examine_text(mob/user)
+ . = ..()
-/obj/structure/machinery/computer/overwatch/proc/get_base_menu_text()
- var/dat = ""
+ . += SPAN_NOTICE("Alt-Click this machine to change the UI theme.")
- if(!current_squad) //No squad has been set yet. Pick one.
- dat += "Current Squad: ----------
"
- return dat;
+/obj/structure/machinery/computer/overwatch/clicked(mob/user, list/mods)
- dat += "Current Squad: [current_squad.name] Squad "
- dat += "Message Squad
"
- dat += "Toggle Tactical Map"
- dat += "
"
- if(current_squad.squad_leader)
- dat += "Squad Leader: [current_squad.squad_leader.name] "
- dat += "MSG "
- dat += "CHANGE SQUAD LEADER
"
- else
- dat += "Squad Leader: NONE ASSIGN SQUAD LEADER
"
+ if(!ishuman(user))
+ return ..()
+ if(mods["alt"]) //Changing UI theme
+ var/list/possible_options = list("Blue"= "crtblue", "Green" = "crtgreen", "Yellow" = "crtyellow", "Red" = "crtred")
+ var/chosen_theme = tgui_input_list(user, "Choose a UI theme:", "UI Theme", list("Blue", "Green", "Yellow", "Red"))
+ if(possible_options[chosen_theme])
+ ui_theme = possible_options[chosen_theme]
+ return TRUE
+ . = ..()
- dat += "Primary Objective: "
- if(current_squad.primary_objective)
- dat += "Check Set
"
- else
- dat += "NONE! Set
"
- dat += "Secondary Objective: "
- if(current_squad.secondary_objective)
- dat += "Check Set
"
- else
- dat += "NONE! Set
"
- dat += "
"
- dat += "Report a marine for insubordination
"
- dat += "Transfer a marine to another squad
"
-
- dat += "Supply Drop Control
"
- dat += "Orbital Bombardment Control
"
- dat += "Squad Monitor
"
- dat += "
"
- dat += "Refresh"
-
- return dat
-
-/obj/structure/machinery/computer/overwatch/proc/get_info_screen_text()
- var/dat = ""
-
- dat += {"
-
- "}
+/obj/structure/machinery/computer/overwatch/ui_static_data(mob/user)
+ var/list/data = list()
+ data["mapRef"] = tacmap.map_holder.map_ref
+ return data
+
+/obj/structure/machinery/computer/overwatch/tgui_interact(mob/user, datum/tgui/ui)
+
+ if(!tacmap.map_holder)
+ var/level = SSmapping.levels_by_trait(tacmap.targeted_ztrait)
+ if(!level[1])
+ return
+ tacmap.map_holder = SSminimaps.fetch_tacmap_datum(level[1], tacmap.allowed_flags)
+
+ ui = SStgui.try_update_ui(user, src, ui)
+ if(!ui)
+ user.client.register_map_obj(tacmap.map_holder.map)
+ ui = new(user, src, "OverwatchConsole", "Overwatch Console")
+ ui.open()
+
+/obj/structure/machinery/computer/overwatch/ui_data(mob/user)
+ var/list/data = list()
+
+ data["theme"] = ui_theme
if(!current_squad)
- dat += "No Squad selected!
"
- else
- var/leader_text = ""
- var/leader_count = 0
- var/tl_text = ""
- var/tl_count = 0
- var/spec_text = ""
- var/spec_count = 0
- var/medic_text = ""
- var/medic_count = 0
- var/engi_text = ""
- var/engi_count = 0
- var/smart_text = ""
- var/smart_count = 0
- var/marine_text = ""
- var/marine_count = 0
- var/misc_text = ""
- var/living_count = 0
-
- var/conscious_text = ""
- var/unconscious_text = ""
- var/dead_text = ""
-
- var/SL_z //z level of the Squad Leader
- if(current_squad.squad_leader)
- var/turf/SL_turf = get_turf(current_squad.squad_leader)
- SL_z = SL_turf.z
-
-
- for(var/X in current_squad.marines_list)
- if(!X)
- continue //just to be safe
- var/mob_name = "unknown"
- var/mob_state = ""
- var/role = "unknown"
- var/act_sl = ""
- var/fteam = ""
- var/dist = "???"
- var/area_name = "???"
- var/mob/living/carbon/human/H
-
- var/is_filtered = FALSE
- if(X && ("\ref[X]" in marine_filter))
- is_filtered = TRUE
-
- if(ishuman(X))
- H = X
- mob_name = H.real_name
- var/area/A = get_area(H)
- var/turf/M_turf = get_turf(H)
- if(!M_turf)
- continue
- if(A)
- area_name = sanitize_area(A.name)
-
- switch(z_hidden)
- if(HIDE_ALMAYER)
- if(is_mainship_level(M_turf.z))
- continue
- if(HIDE_GROUND)
- if(is_ground_level(M_turf.z))
- continue
-
- if(H.job)
- role = H.job
- else if(istype(H.wear_id, /obj/item/card/id)) //decapitated marine is mindless,
- var/obj/item/card/id/ID = H.wear_id //we use their ID to get their role.
- if(ID.rank) role = ID.rank
-
- if(current_squad.squad_leader)
- if(H == current_squad.squad_leader)
- dist = "N/A"
- if(current_squad.name == SQUAD_SOF)
- if(H.job == JOB_MARINE_RAIDER_CMD)
- act_sl = " (direct command)"
- else if(H.job != JOB_MARINE_RAIDER_SL)
- act_sl = " (acting TL)"
- else if(H.job != JOB_SQUAD_LEADER)
- act_sl = " (acting SL)"
- else if(M_turf && (M_turf.z == SL_z))
- dist = "[get_dist(H, current_squad.squad_leader)] ([dir2text_short(get_dir(current_squad.squad_leader, H))])"
-
- if(is_filtered && marine_filter_enabled)
- continue
-
- switch(H.stat)
- if(CONSCIOUS)
- mob_state = "Conscious"
- living_count++
- conscious_text += "[mob_name] | [role][act_sl] | [mob_state] | [area_name] | [dist] | [is_filtered ? "Show" : "Hide"] |
"
-
- if(UNCONSCIOUS)
- mob_state = "Unconscious"
- living_count++
- unconscious_text += "[mob_name] | [role][act_sl] | [mob_state] | [area_name] | [dist] | [is_filtered ? "Show" : "Hide"] |
"
-
- if(DEAD)
- if(dead_hidden)
- continue
- mob_state = SET_CLASS("DEAD", INTERFACE_RED)
- dead_text += "[mob_name] | [role][act_sl] | [mob_state] | [area_name] | [dist] | [is_filtered ? "Show" : "Hide"] |
"
-
- if(!istype(H.head, /obj/item/clothing/head/helmet/marine))
- mob_state += SET_CLASS(" (NO HELMET)", INTERFACE_ORANGE)
-
- if(!H.key || !H.client)
- if(H.stat != DEAD)
- mob_state += " (SSD)"
-
-
- if(H.assigned_fireteam)
- fteam = " [H.assigned_fireteam]"
-
- else //listed marine was deleted or gibbed, all we have is their name
- if(dead_hidden)
- continue
- if(z_hidden) //gibbed marines are neither on the colony nor on the almayer
- continue
- for(var/datum/data/record/t in GLOB.data_core.general)
- if(t.fields["name"] == X)
- role = t.fields["real_rank"]
- break
- mob_state = SET_CLASS("DEAD", INTERFACE_RED)
- mob_name = X
-
- dead_text += "[mob_name] | [role][act_sl] | [mob_state] | [area_name] | [dist] | [is_filtered ? "Show" : "Hide"] |
"
-
-
- var/marine_infos = "[mob_name] | [role][act_sl][fteam] | [mob_state] | [area_name] | [dist] | [is_filtered ? "Show" : "Hide"] |
"
- switch(role)
- if(JOB_SQUAD_LEADER)
- leader_text += marine_infos
- leader_count++
- if(JOB_SQUAD_TEAM_LEADER)
- tl_text += marine_infos
- tl_count++
- if(JOB_SQUAD_SPECIALIST)
- spec_text += marine_infos
- spec_count++
- if(JOB_SQUAD_MEDIC)
- medic_text += marine_infos
- medic_count++
- if(JOB_SQUAD_ENGI)
- engi_text += marine_infos
- engi_count++
- if(JOB_SQUAD_SMARTGUN)
- smart_text += marine_infos
- smart_count++
- if(JOB_SQUAD_MARINE)
- marine_text += marine_infos
- marine_count++
- else
- misc_text += marine_infos
-
- dat += "[leader_count ? "Squad Leader Deployed" : SET_CLASS("No Squad Leader Deployed!", INTERFACE_RED)]
"
- dat += "Fireteam Leaders: [tl_count ? "[tl_count]" : SET_CLASS("No Fireteam Leaders Deployed!", INTERFACE_RED)]
"
- dat += "[spec_count ? "Squad Specialist Deployed" : SET_CLASS("No Specialist Deployed!", INTERFACE_RED)]
"
- dat += "[smart_count ? "Squad Smartgunner Deployed" : SET_CLASS("No Smartgunner Deployed!", INTERFACE_RED)]
"
- dat += "Squad Hospital Corpsmen: [medic_count] Deployed | Squad Combat Technicians: [engi_count] Deployed
"
- dat += "Squad Riflemen: [marine_count] Deployed
"
- dat += "Total: [current_squad.marines_list.len] Deployed
"
- dat += "Marines alive: [living_count]
"
- dat += "Search: "
- dat += ""
- dat += "Name | Role | State | Location | SL Distance | Filter |
"
- if(!living_marines_sorting)
- dat += leader_text + tl_text + spec_text + medic_text + engi_text + smart_text + marine_text + misc_text
- else
- dat += conscious_text + unconscious_text + dead_text
- dat += "
"
- dat += "
"
- dat += "Refresh
"
- dat += "Change Sorting Method
"
- dat += "[dead_hidden ? "Show Dead Marines" : "Hide Dead Marines" ]
"
- dat += "[marine_filter_enabled ? "Disable Marine Filter" : "Enable Marine Filter"]
"
- dat += "Change Locations Ignored
"
- dat += "
Back