From 072377dfd5cbb233d774841a353b0d2b959e4376 Mon Sep 17 00:00:00 2001 From: doom Date: Thu, 28 Sep 2023 20:58:41 -0700 Subject: [PATCH] tacmap announcement refactor --- code/_globalvars/misc.dm | 2 +- code/controllers/subsystem/minimap.dm | 40 +++++++++++-------- .../computer/groundside_operations.dm | 2 +- code/modules/client/client_procs.dm | 5 +++ code/modules/mob/living/carbon/human/human.dm | 4 +- html/statbrowser.js | 8 ++++ tgui/packages/tgui/interfaces/DrawnMap.js | 8 ++++ tgui/packages/tgui/interfaces/TacticalMap.tsx | 33 ++++++++------- 8 files changed, 67 insertions(+), 35 deletions(-) diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index a8887812c7c6..ce1c64d4ada6 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -26,7 +26,7 @@ GLOBAL_VAR_INIT(minimum_exterior_lighting_alpha, 255) GLOBAL_DATUM_INIT(item_to_box_mapping, /datum/item_to_box_mapping, init_item_to_box_mapping()) //global tacmap for action button access -GLOBAL_DATUM(tacmap_datum, /datum/tacmap) +GLOBAL_DATUM(tacmap_datum, /datum/tacmap/status_tab_view) /// Offset for the Operation time GLOBAL_VAR_INIT(time_offset, setup_offset()) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index e659c70137c6..444afee25695 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -355,7 +355,7 @@ SUBSYSTEM_DEF(minimaps) if(asset_type) map_list = GLOB.xeno_flat_tacmap_png_asset else - map_list = GLOB.uscm_svg_overlay + map_list = GLOB.xeno_svg_overlay if(map_list.len == 0) @@ -569,6 +569,7 @@ SUBSYSTEM_DEF(minimaps) ui = SStgui.try_update_ui(user, src, ui) if(!ui) current_map = get_current_tacmap_data(user, TRUE) + current_svg = get_current_tacmap_data(user, FALSE) if(!current_map) distribute_current_map_png(user) current_map = get_current_tacmap_data(user, TRUE) @@ -607,6 +608,7 @@ SUBSYSTEM_DEF(minimaps) data["canDraw"] = FALSE data["canViewHome"] = FALSE data["isXeno"] = FALSE + data["currentMapName"] = SSmapping.configs?[GROUND_MAP].map_name var/mob/living/carbon/xenomorph/xeno_user if(isxeno(user)) @@ -620,6 +622,16 @@ SUBSYSTEM_DEF(minimaps) return data +/datum/tacmap/status_tab_view/ui_static_data(mob/user) + var/list/data = list() + + data["currentMapName"] = SSmapping.configs?[GROUND_MAP].map_name + data["canDraw"] = FALSE + data["canViewHome"] = FALSE + data["isXeno"] = FALSE + + return data + /datum/tacmap/ui_close(mob/user) . = ..() updated_canvas = FALSE @@ -668,33 +680,27 @@ SUBSYSTEM_DEF(minimaps) if ("selectAnnouncement") - if(!params["image"]) - return - var/outgoing_message = stripped_multiline_input(user, "Optional message to announce with the tactical map", "Tactical Map Announcement", "") - if(!outgoing_message) + if(!istype(params["image"], /list)) return + store_current_svg_coords(user, params["image"]) current_svg = get_current_tacmap_data(user, FALSE) - var/signed - var/mob/living/carbon/xenomorph/xeno toolbar_updated_selection = "export" if(isxeno(user)) - xeno = user - xeno_announcement(outgoing_message, xeno.hivenumber) + var/mob/living/carbon/xenomorph/xeno = user + xeno_maptext("The Queen has updated your hive mind map", "You sense something unusual...", xeno.hivenumber) COOLDOWN_START(GLOB, xeno_canvas_cooldown, canvas_cooldown_time) else - var/mob/living/carbon/human/H = user - var/obj/item/card/id/id = H.wear_id - if(istype(id)) - var/paygrade = get_paygrades(id.paygrade, FALSE, H.gender) - signed = "[paygrade] [id.registered_name]" - marine_announcement(outgoing_message, "Tactical Map Announcement", signature = signed) + var/mob/living/carbon/human/human_leader = user + for(var/datum/squad/current_squad in RoleAuthority.squads) + current_squad.send_maptext("Tactical map update in progres...", "Tactical Map:") + + human_leader.visible_message(SPAN_BOLDNOTICE("Tactical map update in progres...")) COOLDOWN_START(GLOB, uscm_canvas_cooldown, canvas_cooldown_time) - message_admins("[key_name(user)] has made a tactical map announcement.") - log_announcement("[key_name(user)] has announced the following: [outgoing_message]") + message_admins("[key_name(user)] has updated the tactical map") updated_canvas = FALSE . = TRUE diff --git a/code/game/machinery/computer/groundside_operations.dm b/code/game/machinery/computer/groundside_operations.dm index 8b5d7338b036..4578f5a1a18a 100644 --- a/code/game/machinery/computer/groundside_operations.dm +++ b/code/game/machinery/computer/groundside_operations.dm @@ -29,7 +29,7 @@ // global tacmap for marines to access through an action button. // dumb implementation for testing, fix later. - var/datum/tacmap/uscm_tacmap + var/datum/tacmap/status_tab_view/uscm_tacmap GLOB.tacmap_datum = new(uscm_tacmap, minimap_type) return ..() diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index 316ffa4e8df5..dc99ae4a9de2 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -164,6 +164,11 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list( else if(href_list["medals_panel"]) GLOB.medals_panel.tgui_interact(mob) + else if(href_list["MapView"]) + if(isxeno(mob)) + return + GLOB.tacmap_datum.tgui_interact(mob) + //NOTES OVERHAUL if(href_list["add_merit_info"]) var/key = href_list["add_merit_info"] diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index c9092ed479b9..bdce3c35f29c 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -115,7 +115,9 @@ . += "Primary Objective: [html_decode(assigned_squad.primary_objective)]" if(assigned_squad.secondary_objective) . += "Secondary Objective: [html_decode(assigned_squad.secondary_objective)]" - + if(faction == FACTION_MARINE) + . += "Tactical Map:" + . += html_decode("Click To View Tactical Map") if(mobility_aura) . += "Active Order: MOVE" if(protection_aura) diff --git a/html/statbrowser.js b/html/statbrowser.js index 81bd8cdf9c8d..c403f10db5b2 100644 --- a/html/statbrowser.js +++ b/html/statbrowser.js @@ -358,6 +358,14 @@ function draw_status() { document .getElementById("statcontent") .appendChild(document.createElement("br")); + } else if ( + // hardcoded for testing purposes .includes() seems to be breaking things for some reason. + status_tab_parts[i] == + "Click To View Tactical Map" + ) { + var maplink = document.createElement("a"); + maplink.innerHTML = status_tab_parts[i]; + document.getElementById("statcontent").appendChild(maplink); } else { var div = document.createElement("div"); div.textContent = status_tab_parts[i]; diff --git a/tgui/packages/tgui/interfaces/DrawnMap.js b/tgui/packages/tgui/interfaces/DrawnMap.js index db715c08c573..e14e0d62dcfe 100644 --- a/tgui/packages/tgui/interfaces/DrawnMap.js +++ b/tgui/packages/tgui/interfaces/DrawnMap.js @@ -5,7 +5,14 @@ export class DrawnMap extends Component { super(props); this.containerRef = createRef(); this.flatImgSrc = this.props.flatImage; + this.backupImgSrc = this.props.backupImage; this.svg = this.props.svgData; + this.backupImg = null; + } + + onComponentDidMout() { + this.backupImg = new Image(); + this.backupImg.src = backupImgSrc; } parseSvgData(svgDataArray) { @@ -35,6 +42,7 @@ export class DrawnMap extends Component { }}> {this.backupImg} { return (
{data.flatImage ? ( - + ) : ( 'Please wait for a new tacmap announcement' )}