From dc1091a1a82c5ee5868cb40f15ba9891cea09de0 Mon Sep 17 00:00:00 2001 From: doom Date: Thu, 28 Sep 2023 22:54:52 -0700 Subject: [PATCH] ... --- code/controllers/subsystem/minimap.dm | 16 +++++++++++----- tgui/packages/tgui/interfaces/TacticalMap.tsx | 7 +++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 1429bb83b336..6a46d83e9ce5 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -570,6 +570,9 @@ SUBSYSTEM_DEF(minimaps) 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) user.client.register_map_obj(map_holder.map) @@ -616,9 +619,6 @@ SUBSYSTEM_DEF(minimaps) 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) - distribute_current_map_png(user) - current_map = get_current_tacmap_data(user, TRUE) return data @@ -646,10 +646,16 @@ SUBSYSTEM_DEF(minimaps) var/user = ui.user switch (action) + if ("menuSelect") + if(params["selection"] == "new canvas") + distribute_current_map_png(user) // not updating? + current_map = get_current_tacmap_data(user, TRUE) + + . = TRUE + if ("updateCanvas") + // forces state change toolbar_updated_selection = "export" - distribute_current_map_png(user) - current_map = get_current_tacmap_data(user, TRUE) updated_canvas = TRUE . = TRUE diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index b905e127d1e7..fb20958967fa 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -89,8 +89,11 @@ export const TacticalMap = (props, context) => { const [pageIndex, setPageIndex] = useLocalState(context, 'pageIndex', 0); const PageComponent = PAGES[pageIndex].component(); - const handleTacmapOnClick = (i) => { + const handleTacmapOnClick = (i, pageTitle) => { setPageIndex(i); + act('menuSelect', { + selection: pageTitle, + }); }; return ( @@ -114,7 +117,7 @@ export const TacticalMap = (props, context) => { color={data.isXeno ? 'purple' : 'blue'} selected={i === pageIndex} icon={page.icon} - onClick={() => handleTacmapOnClick(i)}> + onClick={() => handleTacmapOnClick(i, page.title)}> {page.title} );