Skip to content

Commit

Permalink
tacmap announcement refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
doom committed Sep 29, 2023
1 parent 15abb6d commit 072377d
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 35 deletions.
2 changes: 1 addition & 1 deletion code/_globalvars/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
40 changes: 23 additions & 17 deletions code/controllers/subsystem/minimap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/groundside_operations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..()

Expand Down
5 changes: 5 additions & 0 deletions code/modules/client/client_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
4 changes: 3 additions & 1 deletion code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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("<a href='?MapView=1'>Click To View Tactical Map</a>")
if(mobility_aura)
. += "Active Order: MOVE"
if(protection_aura)
Expand Down
8 changes: 8 additions & 0 deletions html/statbrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] ==
"<a href='?MapView=1'>Click To View Tactical Map</a>"
) {
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];
Expand Down
8 changes: 8 additions & 0 deletions tgui/packages/tgui/interfaces/DrawnMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -35,6 +42,7 @@ export class DrawnMap extends Component {
}}>
<img
src={this.flatImgSrc}
alt={this.backupImg}
style={{
position: 'absolute',
zIndex: 0,
Expand Down
33 changes: 18 additions & 15 deletions tgui/packages/tgui/interfaces/TacticalMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface TacMapProps {
canDraw: number;
isXeno: boolean;
flatImage: string;
currentMapName: string;
mapRef: any;
currentMenu: string;
worldtime: any;
Expand Down Expand Up @@ -50,20 +51,18 @@ const PAGES = [
},
];

const themes = [
{
'theme': 'default',
'button-color': 'black',
},
{
'theme': 'crtblue',
'button-color': 'blue',
},
{
'theme': 'xeno',
'button-color': 'purple',
},
];
const mapPngs = {
'LV-624': 'https://cm-ss13.com/w/images/6/6f/LV624.png',
'Ice Colony': 'https://cm-ss13.com/w/images/1/18/Map_icecolony.png',
'Whiskey Outpost': 'https://cm-ss13.com/w/images/7/78/Whiskey_outpost.png',
'Solaris Ridge': 'https://cm-ss13.com/w/images/9/9e/Solaris_Ridge.png',
'Fiorina Science Annex':
'https://cm-ss13.com/w/images/e/e0/Prison_Station_Science_Annex.png',
'Trijent Dam': 'https://cm-ss13.com/w/images/9/92/Trijent_Dam.png',
'Sorokyne Strata': 'https://cm-ss13.com/w/images/2/21/Sorokyne_Wiki_Map.jpg',
'Kutjevo Refinery': 'https://cm-ss13.com/w/images/0/0d/Kutjevo_a1.jpg',
"LV-522 Chance's Claim": 'https://cm-ss13.com/w/images/b/bb/C_claim.png',
};

const colorOptions = [
'black',
Expand Down Expand Up @@ -159,7 +158,11 @@ const OldMapPanel = (props, context) => {
return (
<Section fill justify="center" align="center" fontSize="30px">
{data.flatImage ? (
<DrawnMap svgData={data.svgData} flatImage={data.flatImage} />
<DrawnMap
svgData={data.svgData}
flatImage={data.flatImage}
backupImage={mapPngs[data.currentMapName]}
/>
) : (
'Please wait for a new tacmap announcement'
)}
Expand Down

0 comments on commit 072377d

Please sign in to comment.