diff --git a/code/__DEFINES/minimap.dm b/code/__DEFINES/minimap.dm index 282462ad60d3..71d0ed8e7445 100644 --- a/code/__DEFINES/minimap.dm +++ b/code/__DEFINES/minimap.dm @@ -16,11 +16,6 @@ GLOBAL_LIST_INIT(all_minimap_flags, bitfield2list(MINIMAP_FLAG_ALL)) -//Theme defines for tacmap -#define DEFAULT_MINIMAP_THEME 0 -#define USCM_MINIMAP_THEME 1 -#define XENO_MINIMAP_THEME 2 - //Turf colors #define MINIMAP_SOLID "#ebe5e5ee" #define MINIMAP_DOOR "#451e5eb8" diff --git a/code/_globalvars/global_lists.dm b/code/_globalvars/global_lists.dm index 3492d0bebe39..5c1a28aa6bdf 100644 --- a/code/_globalvars/global_lists.dm +++ b/code/_globalvars/global_lists.dm @@ -9,7 +9,11 @@ GLOBAL_LIST_EMPTY(CMBFaxes) GLOBAL_LIST_EMPTY(GeneralFaxes) //Inter-machine faxes GLOBAL_LIST_EMPTY(fax_contents) //List of fax contents to maintain it even if source paper is deleted -//flat tacmap and svg for viewing minimap drawings +//datum containing only the flat tacmap png asset +GLOBAL_LIST_EMPTY(uscm_flat_tacmap_png_asset) +GLOBAL_LIST_EMPTY(xeno_flat_tacmap_png_asset) + +//datum containing flat tacmap and svg (snapshot in time with svg overlay) for viewing minimap drawings GLOBAL_LIST_EMPTY(uscm_flat_tacmap) GLOBAL_LIST_EMPTY(xeno_flat_tacmap) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 504fb4b239f4..c385cb9f26db 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -338,31 +338,34 @@ SUBSYSTEM_DEF(minimaps) hashed_minimaps[hash] = map return map -/datum/tacmap/proc/get_current_map(mob/user) - var/datum/svg_overlay/selected_svg + +/datum/tacmap/proc/get_current_map(mob/user, png_asset_only = FALSE) var/list/map_list if(ishuman(user)) - map_list = GLOB.uscm_flat_tacmap + if(png_asset_only) + map_list = GLOB.uscm_flat_tacmap_png_asset + else + map_list = GLOB.uscm_flat_tacmap else if(!isxeno(user)) - return selected_svg - map_list = GLOB.xeno_flat_tacmap + return + if(png_asset_only) + map_list = GLOB.uscm_flat_tacmap_png_asset + else + map_list = GLOB.xeno_flat_tacmap if(map_list.len == 0) - return selected_svg - - selected_svg = map_list[map_list.len] + return - return selected_svg + return map_list[map_list.len] /datum/tacmap/proc/distribute_current_map_png(mob/user) if(!COOLDOWN_FINISHED(src, flatten_map_cooldown)) return var/icon/flat_map = getFlatIcon(map_holder.map) if(!flat_map) - to_chat(user, SPAN_WARNING("The tacmap filckers and then shuts off, a critical error has occured")) // uh oh spaghettio + to_chat(user, SPAN_WARNING("The tacmap filckers and then shuts off, a critical error has occured")) // tf2heavy: "Oh, this is bad!" return - overlay.flat_tacmap = flat_map var/user_faction var/mob/living/carbon/xenomorph/xeno if(isxeno(user)) @@ -380,9 +383,12 @@ SUBSYSTEM_DEF(minimaps) faction_clients += client else if(client_mob.faction == user_faction) faction_clients += client - - overlay.flat_tacmap = icon2html(overlay.flat_tacmap, faction_clients, sourceonly = TRUE) COOLDOWN_START(src, flatten_map_cooldown, flatten_map_cooldown_time) + var/flat_tacmap_png = icon2html(flat_map, faction_clients, sourceonly = TRUE) + if(user_faction == FACTION_MARINE) + GLOB.uscm_flat_tacmap_png_asset += flat_tacmap_png + else + GLOB.xeno_flat_tacmap_png_asset += flat_tacmap_png /datum/controller/subsystem/minimaps/proc/fetch_tacmap_datum(zlevel, flags) @@ -508,36 +514,19 @@ SUBSYSTEM_DEF(minimaps) COOLDOWN_DECLARE(canvas_cooldown) COOLDOWN_DECLARE(flatten_map_cooldown) - // current flattened map and svg overlay for viewing - var/datum/svg_overlay/current_map + //tacmap holder for holding the minimap + var/datum/tacmap_holder/map_holder - // empty map icon without layered blips. - var/base_map_png_asset // boolean value to keep track if the canvas has been updated or not, the value is used in tgui state. var/updated_canvas = FALSE - // theme color for tgui - var/theme = DEFAULT_MINIMAP_THEME - - //tacmap holder for holding the minimap - var/datum/tacmap_holder/map_holder + var/datum/svg_overlay/current_map - // datum containing the svg and flat map to be stored globally - var/datum/svg_overlay/overlay /datum/tacmap/New(atom/source, minimap_type) allowed_flags = minimap_type owner = source - switch(minimap_type) - if(MINIMAP_FLAG_USCM) - theme = USCM_MINIMAP_THEME - return - if(MINIMAP_FLAG_XENO) - theme = XENO_MINIMAP_THEME - return - theme = DEFAULT_MINIMAP_THEME - /datum/tacmap/Destroy() map_holder = null owner = null @@ -560,11 +549,6 @@ SUBSYSTEM_DEF(minimaps) /datum/tacmap/ui_data(mob/user) var/list/data = list() - // empty map dmi image used as the background for the canvas - data["imageSrc"] = base_map_png_asset - data["canDraw"] = FALSE - data["canViewHome"] = FALSE - //flat image of most recently announced tacmap data["flatImage"] = null data["svgData"] = null @@ -573,7 +557,6 @@ SUBSYSTEM_DEF(minimaps) data["flatImage"] = current_map.flat_tacmap data["svgData"] = current_map.svg_data - data["themeId"] = theme data["mapRef"] = map_holder.map_ref data["toolbarColorSelection"] = toolbar_color_selection data["toolbarUpdatedSelection"] = toolbar_updated_selection @@ -582,17 +565,24 @@ SUBSYSTEM_DEF(minimaps) data["nextCanvasTime"] = canvas_cooldown_time data["updatedCanvas"] = updated_canvas + return data + +/datum/tacmap/ui_static_data(mob/user) + var/list/data = list() + + data["canDraw"] = FALSE + data["canViewHome"] = FALSE + data["isXeno"] = FALSE + var/mob/living/carbon/xenomorph/xeno_user if(isxeno(user)) xeno_user = user + data["isXeno"] = TRUE + data["canViewHome"] = TRUE + if(ishuman(user) && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT) || isqueen(user) && xeno_user.hivenumber == XENO_HIVE_NORMAL) data["canDraw"] = TRUE data["canViewHome"] = TRUE - if(!current_map) - data["flatImage"] = icon2html(map_holder.map, user, sourceonly = TRUE) - else if(xeno_user.hivenumber == XENO_HIVE_NORMAL && !isqueen(xeno_user)) - data["canViewHome"] = TRUE - data["canDraw"] = FALSE return data @@ -613,13 +603,7 @@ SUBSYSTEM_DEF(minimaps) if ("menuSelect") if(params["selection"] == "new canvas") distribute_current_map_png(user) - . = TRUE - - if ("clearCanvas") - if(toolbar_updated_selection == "clear") - toolbar_updated_selection = toolbar_color_selection - return - toolbar_updated_selection = "clear" + current_map = get_current_map(user) . = TRUE if ("updateCanvas") @@ -629,6 +613,13 @@ SUBSYSTEM_DEF(minimaps) updated_canvas = TRUE . = TRUE + if ("clearCanvas") + if(toolbar_updated_selection == "clear") + toolbar_updated_selection = toolbar_color_selection + return + toolbar_updated_selection = "clear" + . = TRUE + if ("undoChange") if(toolbar_updated_selection == "undo") toolbar_updated_selection = toolbar_color_selection @@ -644,21 +635,22 @@ SUBSYSTEM_DEF(minimaps) if ("selectAnnouncement") - overlay.svg_data = params["image"] - - toolbar_updated_selection = "export" + var/current_map_asset = get_current_map(user, TRUE) + var/datum/svg_overlay/svg_overlay = new(params["image"], current_map_asset) var/outgoing_message = stripped_multiline_input(user, "Optional message to announce with the tactical map", "Tactical Map Announcement", "") + if(!outgoing_message) + return var/signed - var/mob/living/carbon/xenomorph/xeno + toolbar_updated_selection = "export" if(isxeno(user)) xeno = user xeno_announcement(outgoing_message, xeno.hivenumber) - GLOB.xeno_flat_tacmap += overlay + GLOB.xeno_flat_tacmap += svg_overlay else - GLOB.uscm_flat_tacmap += overlay + GLOB.uscm_flat_tacmap += svg_overlay var/mob/living/carbon/human/H = user var/obj/item/card/id/id = H.wear_id if(istype(id)) @@ -669,7 +661,7 @@ SUBSYSTEM_DEF(minimaps) message_admins("[key_name(user)] has made a tactical map announcement.") log_announcement("[key_name(user)] has announced the following: [outgoing_message]") updated_canvas = FALSE - qdel(overlay) + qdel(svg_overlay) . = TRUE /datum/tacmap/ui_status(mob/user) @@ -711,3 +703,7 @@ SUBSYSTEM_DEF(minimaps) /datum/svg_overlay var/svg_data var/flat_tacmap + +/datum/svg_overlay/New(svg_data, flat_tacmap) + src.svg_data = svg_data + src.flat_tacmap = flat_tacmap diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/queen/queen_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/queen/queen_powers.dm index 6d9e9b3b6384..23da1ce65903 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/queen/queen_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/queen/queen_powers.dm @@ -698,8 +698,5 @@ set name = "View Xeno Tacmap" set desc = "This opens a tactical map, where you can see where every xenomorph is." set category = "Alien" - if(isqueen(src)) - hive.queen_tacmap.tgui_interact(src) - else - hive.tacmap.tgui_interact(src) + hive.tacmap.tgui_interact(src) diff --git a/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm b/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm index f944aef9ad99..a74fa7413804 100644 --- a/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm +++ b/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm @@ -363,7 +363,6 @@ /// This number divides the total xenos counted for slots to give the max number of lesser drones var/playable_lesser_drones_max_divisor = 3 - var/datum/tacmap/xeno/queen_tacmap var/datum/tacmap/xeno/tacmap var/minimap_type = MINIMAP_FLAG_XENO @@ -373,7 +372,6 @@ mark_ui = new(src) faction_ui = new(src) tacmap = new(src, minimap_type) - queen_tacmap = new(src, minimap_type) if(!internal_faction) internal_faction = name if(hivenumber != XENO_HIVE_NORMAL) diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 7e1be28a8bc7..93b73be75087 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -11,8 +11,9 @@ interface TacMapProps { updatedCanvas: boolean; themeId: number; svgData: any; - canViewHome: boolean; - canDraw: boolean; + canViewHome: number; + canDraw: number; + isXeno: boolean; flatImage: string; mapRef: any; currentMenu: string; @@ -36,7 +37,7 @@ const PAGES = [ component: () => OldMapPanel, icon: 'eye', canAccess: () => { - return true; + return 1; }, }, { @@ -44,7 +45,7 @@ const PAGES = [ component: () => DrawMapPanel, icon: 'paintbrush', canAccess: (data) => { - return data.canDraw || data.canViewHome; + return data.canDraw; }, }, ]; @@ -97,7 +98,7 @@ export const TacticalMap = (props, context) => { }; return ( - +
{ {PAGES.map((page, i) => { - if (page.canAccess && !page.canAccess(data)) { + if (page.canAccess(data) === 0) { return; } return ( handleTacmapOnClick(i, page.title)}> @@ -136,6 +137,7 @@ const ViewMapPanel = (props, context) => { const { data } = useBackend(context); return (
+ {data.canViewHome === 1 && { }} class="TacticalMap" /> + }
); }; @@ -154,7 +157,7 @@ const OldMapPanel = (props, context) => { {data.flatImage ? ( ) : ( - 'No Tactical Map Announcement Found' + 'Please wait for a new tacmap announcement' )}
);