From 98fd3a2aa08b34920bf26267f7587e5cf62ac0c6 Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 19 May 2023 05:17:19 -0400 Subject: [PATCH 001/161] added drawing functionality to tactical maps --- code/controllers/subsystem/minimap.dm | 55 +++++- tgui/packages/tgui/interfaces/CanvasLayer.js | 178 ++++++++++++++++++ tgui/packages/tgui/interfaces/TacticalMap.tsx | 118 ++++++++++-- 3 files changed, 336 insertions(+), 15 deletions(-) create mode 100644 tgui/packages/tgui/interfaces/CanvasLayer.js diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 77eb5147ab3c..b4cc65a24c3e 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -442,7 +442,10 @@ SUBSYSTEM_DEF(minimaps) var/targeted_ztrait = ZTRAIT_GROUND var/atom/owner + // used in cic tactical maps for drawing on the canvas, defaults to blue. + var/toolbar_selection = "blue" var/datum/tacmap_holder/map_holder + var/img_ref /datum/tacmap/New(atom/source, minimap_type) allowed_flags = minimap_type @@ -462,15 +465,63 @@ SUBSYSTEM_DEF(minimaps) ui = SStgui.try_update_ui(user, src, ui) if(!ui) + + // this is not the right way to do this, this should also not go here. I was debugging. + var/icon/map_icon = icon(map_holder.map.icon) // change this to flatten, also make sure to get all the toplayered icons as well + img_ref = icon2html(map_icon, user, sourceonly = TRUE) + user.client.register_map_obj(map_holder.map) ui = new(user, src, "TacticalMap") ui.open() -/datum/tacmap/ui_static_data(mob/user) + +/datum/tacmap/ui_data(mob/user) var/list/data = list() - data["mapRef"] = map_holder.map_ref + // data["mapRef"] = map_holder.map_ref + data["imageSrc"] = img_ref + data["toolbarSelection"] = toolbar_selection return data +/datum/tacmap/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state){ + . = ..() + if(.) + return + + switch (action) + if ("clearCanvas") // boiler plate code. + toolbar_selection = "clear" + . = TRUE + + if ("undoChange") + toolbar_selection = "undo" + . = TRUE + + if ("selectRed") + toolbar_selection = "red" + . = TRUE + + if ("selectOrange") + toolbar_selection = "orange" + . = TRUE + + if ("selectBlue") + toolbar_selection = "blue" + . = TRUE + + if ("selectPurple") + toolbar_selection = "purple" + . = TRUE + + if ("selectGreen") + toolbar_selection = "green" + . = TRUE + + if ("selectAnnouncement") + // params["image"] <- "should" be of type png returned from tgui + . = TRUE + +} + /datum/tacmap/ui_status(mob/user) if(!(isatom(owner))) return UI_INTERACTIVE diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js new file mode 100644 index 000000000000..a8b491ab2599 --- /dev/null +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -0,0 +1,178 @@ +import { Component, createRef } from 'inferno'; + +// this file should probably not be in interfaces, should move it later. +export class CanvasLayer extends Component { + constructor(props) { + super(props); + this.canvasRef = createRef(); + + // color selection + // using this.state prevents unpredictable behavior + this.state = { + selection: this.props.selection, + }; + + // needs to be of type png of jpg + this.img = null + this.imageSrc = this.props.imageSrc + + // stores the stacked lines + this.lineStack = []; + + // stores the individual line drawn + this.currentLine = []; + + this.ctx = null + this.isPainting = false; + this.lastX = null; + this.lastY = null; + + } + + componentDidMount() { + this.ctx = this.canvasRef.current.getContext("2d"); + this.ctx.lineWidth = 2; + this.ctx.lineCap = 'round'; + + this.img = new Image(); + + // hardcoded value for testing pngs + // this.img.src = "https://cm-ss13.com/wiki/images/6/6f/LV624.png" + + this.img.src = this.imageSrc + + this.drawCanvas(); + + this.canvasRef.current.addEventListener('mousedown', this.handleMouseDown); + this.canvasRef.current.addEventListener('mousemove', this.handleMouseMove); + this.canvasRef.current.addEventListener('mouseup', this.handleMouseUp); + + } + + componentWillUnmount() { + this.canvasRef.current.removeEventListener('mousedown', this.handleMouseDown); + this.canvasRef.current.removeEventListener('mousemove', this.handleMouseMove); + this.canvasRef.current.removeEventListener('mouseup', this.handleMouseUp); + } + + handleMouseDown = (e) => { + this.isPainting = true; + + const rect = this.canvasRef.current.getBoundingClientRect(); + const x = e.clientX - rect.left; + const y = e.clientY - rect.top; + + this.ctx.beginPath(); + this.ctx.moveTo(this.lastX, this.lastY); + this.lastX = x; + this.lastY = y; + } + + handleMouseMove = (e) => { + if(!this.isPainting || !this.state.selection) + return; + + // defaults to black sometimes, it's a bug I think maybe. + this.ctx.strokeStyle = this.state.selection; + + const rect = this.canvasRef.current.getBoundingClientRect(); + const x = e.clientX - rect.left; + const y = e.clientY - rect.top; + + if (this.lastX !== null && this.lastY !== null) { + this.ctx.moveTo(this.lastX, this.lastY); + this.ctx.lineTo(x, y); + this.ctx.stroke(); + this.currentLine.push([this.lastX, this.lastY, x, y, this.state.selection]); + } + + this.lastX = x; + this.lastY = y; + } + + handleMouseUp = () => { + this.isPainting = false; + this.lineStack.push([...this.currentLine]) + this.currentLine = []; + this.ctx.beginPath(); + } + + handleSelectionChange = (prevSelection) => { + const { selection } = this.props; + + if (prevSelection !== selection) { + if (selection === 'clear') { + this.ctx.clearRect(0, 0, this.canvasRef.current.width, this.canvasRef.current.height); + this.ctx.drawImage(this.img, 0, 0, this.canvasRef.current.width, this.canvasRef.current.height); + + this.lineStack = []; + return; + } + + if (selection === 'undo') { + if (this.lineStack.length === 0) { + return; + } + const line = this.lineStack[this.lineStack.length - 1]; + + // selects last color before line is yeeted, this is buggy sometimes. + const prevColor = line[0][4]; + this.lineStack.pop(); + + this.ctx.clearRect(0, 0, this.canvasRef.current.width, this.canvasRef.current.height); + this.ctx.drawImage(this.img, 0, 0, this.canvasRef.current.width, this.canvasRef.current.height); + this.ctx.globalCompositeOperation = "source-over"; + + this.lineStack.forEach((currentLine) => { + currentLine.forEach(([lastX, lastY, x, y, colorSelection]) => { + this.ctx.strokeStyle = colorSelection; + this.ctx.beginPath(); + this.ctx.moveTo(lastX, lastY); + this.ctx.lineTo(x, y); + this.ctx.stroke(); + }); + }); + + this.setState({ selection: prevColor }); + return; + } + // this has barely been tested, and might be unfunctional, also a better way to do this according to paul. + if (selection === 'export') { + const exportDrawnImage = new Image(); + exportDrawnImage.src = this.canvasRef.current.toDataURL(); + exportDrawnImage.onload = () => { + onImageExport(exportDrawnImage); + }; + return + } + + } + this.setState({ selection: selection }); + }; + + componentDidUpdate(prevProps) { + if (prevProps.selection !== this.props.selection) { + this.handleSelectionChange(prevProps.selection); + } + } + + drawCanvas() { + this.img.onload = () => { // this onload may or may not be causing problems. + this.ctx.drawImage(this.img, 0, 0, this.canvasRef.current.width, this.canvasRef.current.height); + }; + } + + render() { + return ( + + ); + } +} diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 01ba483acf27..ee8839696791 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -1,24 +1,116 @@ import { useBackend } from '../backend'; -import { ByondUi } from '../components'; +import { Button, Section, Stack } from '../components'; import { Window } from '../layouts'; - +import { CanvasLayer } from './CanvasLayer' +// byondUI map ref was removed for testing purposes, could be added as a separate tab. interface TacMapProps { - mapRef: string; + // mapRef: string; + toolbarSelection: string; + imageSrc: string; + exportedTacMapImage: any; } export const TacticalMap = (props, context) => { const { data, act } = useBackend(context); + + // maybe this is the right way of doing this, maybe not, idk. + const handleTacMapExport = (image: any) => { + data.exportedTacMapImage = image + }; + return ( - + - +
+ + +
+
+ + +
- ); -}; + );} From b5b868321175df630be6c79917bcc5fde6a8edc6 Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 19 May 2023 15:01:55 -0400 Subject: [PATCH 002/161] removed redundant check --- tgui/packages/tgui/interfaces/CanvasLayer.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index a8b491ab2599..223636b7a2c1 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -100,7 +100,6 @@ export class CanvasLayer extends Component { handleSelectionChange = (prevSelection) => { const { selection } = this.props; - if (prevSelection !== selection) { if (selection === 'clear') { this.ctx.clearRect(0, 0, this.canvasRef.current.width, this.canvasRef.current.height); this.ctx.drawImage(this.img, 0, 0, this.canvasRef.current.width, this.canvasRef.current.height); @@ -146,7 +145,6 @@ export class CanvasLayer extends Component { return } - } this.setState({ selection: selection }); }; From f458c8ff34845ca6aa78b9ba46ea040c21a321a2 Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 19 May 2023 15:22:50 -0400 Subject: [PATCH 003/161] linter --- tgui/packages/tgui/interfaces/CanvasLayer.js | 23 ++++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index 223636b7a2c1..91c945608f4f 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -13,8 +13,8 @@ export class CanvasLayer extends Component { }; // needs to be of type png of jpg - this.img = null - this.imageSrc = this.props.imageSrc + this.img = null; + this.imageSrc = this.props.imageSrc; // stores the stacked lines this.lineStack = []; @@ -22,7 +22,7 @@ export class CanvasLayer extends Component { // stores the individual line drawn this.currentLine = []; - this.ctx = null + this.ctx = null; this.isPainting = false; this.lastX = null; this.lastY = null; @@ -39,7 +39,7 @@ export class CanvasLayer extends Component { // hardcoded value for testing pngs // this.img.src = "https://cm-ss13.com/wiki/images/6/6f/LV624.png" - this.img.src = this.imageSrc + this.img.src = this.imageSrc; this.drawCanvas(); @@ -69,8 +69,9 @@ export class CanvasLayer extends Component { } handleMouseMove = (e) => { - if(!this.isPainting || !this.state.selection) + if(!this.isPainting || !this.state.selection) { return; + } // defaults to black sometimes, it's a bug I think maybe. this.ctx.strokeStyle = this.state.selection; @@ -84,20 +85,22 @@ export class CanvasLayer extends Component { this.ctx.lineTo(x, y); this.ctx.stroke(); this.currentLine.push([this.lastX, this.lastY, x, y, this.state.selection]); + } this.lastX = x; this.lastY = y; + } handleMouseUp = () => { this.isPainting = false; - this.lineStack.push([...this.currentLine]) + this.lineStack.push([...this.currentLine]); this.currentLine = []; this.ctx.beginPath(); } - handleSelectionChange = (prevSelection) => { + handleSelectionChange = () => { const { selection } = this.props; if (selection === 'clear') { @@ -106,11 +109,13 @@ export class CanvasLayer extends Component { this.lineStack = []; return; + } if (selection === 'undo') { if (this.lineStack.length === 0) { return; + } const line = this.lineStack[this.lineStack.length - 1]; @@ -142,7 +147,7 @@ export class CanvasLayer extends Component { exportDrawnImage.onload = () => { onImageExport(exportDrawnImage); }; - return + return; } this.setState({ selection: selection }); @@ -150,7 +155,7 @@ export class CanvasLayer extends Component { componentDidUpdate(prevProps) { if (prevProps.selection !== this.props.selection) { - this.handleSelectionChange(prevProps.selection); + this.handleSelectionChange(); } } From eaeca2483ade43bf8df8bc1c548a50d263844607 Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 19 May 2023 16:25:05 -0400 Subject: [PATCH 004/161] more linter --- tgui/packages/tgui/interfaces/CanvasLayer.js | 2 +- tgui/packages/tgui/interfaces/TacticalMap.tsx | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index 91c945608f4f..25629e3c2ef6 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -171,7 +171,7 @@ export class CanvasLayer extends Component { ref={this.canvasRef} style={{ height: "100%", // causes discrepency between mouse and drawing line, fix later. - width: "100%" + width: "100%", }} width={650} height={590} diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index ee8839696791..67ceafe70029 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -1,7 +1,8 @@ import { useBackend } from '../backend'; import { Button, Section, Stack } from '../components'; import { Window } from '../layouts'; -import { CanvasLayer } from './CanvasLayer' +import { CanvasLayer } from './CanvasLayer'; + // byondUI map ref was removed for testing purposes, could be added as a separate tab. interface TacMapProps { // mapRef: string; @@ -15,15 +16,14 @@ export const TacticalMap = (props, context) => { // maybe this is the right way of doing this, maybe not, idk. const handleTacMapExport = (image: any) => { - data.exportedTacMapImage = image + data.exportedTacMapImage = image; }; return (
- - +
@@ -34,7 +34,7 @@ export const TacticalMap = (props, context) => { color="grey" content="Announce" className="text-center" - onClick={() => act('selectAnnouncement', { image: data.exportedTacMapImage})} + onClick={() => act('selectAnnouncement', { image: data.exportedTacMapImage })} /> @@ -113,4 +113,5 @@ export const TacticalMap = (props, context) => {
- );} + ); + }; From be6d103d931ca61ce034429cb1ae27b11a325cf1 Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 19 May 2023 16:54:28 -0400 Subject: [PATCH 005/161] l-i-n-t-e-r --- tgui/packages/tgui/interfaces/TacticalMap.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 67ceafe70029..bebcef92bd95 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -23,7 +23,7 @@ export const TacticalMap = (props, context) => {
- +
From 2a18885a0d83e813797c9872f528ec1790f8c891 Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 19 May 2023 17:23:42 -0400 Subject: [PATCH 006/161] prettier format --- tgui/packages/tgui/interfaces/CanvasLayer.js | 193 +++++++++++------- tgui/packages/tgui/interfaces/TacticalMap.tsx | 42 ++-- 2 files changed, 138 insertions(+), 97 deletions(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index 25629e3c2ef6..8fb6bd20bd3f 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -26,11 +26,10 @@ export class CanvasLayer extends Component { this.isPainting = false; this.lastX = null; this.lastY = null; - } componentDidMount() { - this.ctx = this.canvasRef.current.getContext("2d"); + this.ctx = this.canvasRef.current.getContext('2d'); this.ctx.lineWidth = 2; this.ctx.lineCap = 'round'; @@ -46,12 +45,17 @@ export class CanvasLayer extends Component { this.canvasRef.current.addEventListener('mousedown', this.handleMouseDown); this.canvasRef.current.addEventListener('mousemove', this.handleMouseMove); this.canvasRef.current.addEventListener('mouseup', this.handleMouseUp); - } componentWillUnmount() { - this.canvasRef.current.removeEventListener('mousedown', this.handleMouseDown); - this.canvasRef.current.removeEventListener('mousemove', this.handleMouseMove); + this.canvasRef.current.removeEventListener( + 'mousedown', + this.handleMouseDown + ); + this.canvasRef.current.removeEventListener( + 'mousemove', + this.handleMouseMove + ); this.canvasRef.current.removeEventListener('mouseup', this.handleMouseUp); } @@ -66,89 +70,113 @@ export class CanvasLayer extends Component { this.ctx.moveTo(this.lastX, this.lastY); this.lastX = x; this.lastY = y; - } + }; handleMouseMove = (e) => { - if(!this.isPainting || !this.state.selection) { - return; - } - - // defaults to black sometimes, it's a bug I think maybe. - this.ctx.strokeStyle = this.state.selection; - - const rect = this.canvasRef.current.getBoundingClientRect(); - const x = e.clientX - rect.left; - const y = e.clientY - rect.top; + if (!this.isPainting || !this.state.selection) { + return; + } - if (this.lastX !== null && this.lastY !== null) { - this.ctx.moveTo(this.lastX, this.lastY); - this.ctx.lineTo(x, y); - this.ctx.stroke(); - this.currentLine.push([this.lastX, this.lastY, x, y, this.state.selection]); + // defaults to black sometimes, it's a bug I think maybe. + this.ctx.strokeStyle = this.state.selection; - } + const rect = this.canvasRef.current.getBoundingClientRect(); + const x = e.clientX - rect.left; + const y = e.clientY - rect.top; - this.lastX = x; - this.lastY = y; + if (this.lastX !== null && this.lastY !== null) { + this.ctx.moveTo(this.lastX, this.lastY); + this.ctx.lineTo(x, y); + this.ctx.stroke(); + this.currentLine.push([ + this.lastX, + this.lastY, + x, + y, + this.state.selection, + ]); + } - } + this.lastX = x; + this.lastY = y; + }; handleMouseUp = () => { this.isPainting = false; this.lineStack.push([...this.currentLine]); this.currentLine = []; this.ctx.beginPath(); - } + }; handleSelectionChange = () => { const { selection } = this.props; - if (selection === 'clear') { - this.ctx.clearRect(0, 0, this.canvasRef.current.width, this.canvasRef.current.height); - this.ctx.drawImage(this.img, 0, 0, this.canvasRef.current.width, this.canvasRef.current.height); + if (selection === 'clear') { + this.ctx.clearRect( + 0, + 0, + this.canvasRef.current.width, + this.canvasRef.current.height + ); + this.ctx.drawImage( + this.img, + 0, + 0, + this.canvasRef.current.width, + this.canvasRef.current.height + ); + + this.lineStack = []; + return; + } - this.lineStack = []; + if (selection === 'undo') { + if (this.lineStack.length === 0) { return; - } - - if (selection === 'undo') { - if (this.lineStack.length === 0) { - return; - - } - const line = this.lineStack[this.lineStack.length - 1]; - - // selects last color before line is yeeted, this is buggy sometimes. - const prevColor = line[0][4]; - this.lineStack.pop(); - - this.ctx.clearRect(0, 0, this.canvasRef.current.width, this.canvasRef.current.height); - this.ctx.drawImage(this.img, 0, 0, this.canvasRef.current.width, this.canvasRef.current.height); - this.ctx.globalCompositeOperation = "source-over"; - - this.lineStack.forEach((currentLine) => { - currentLine.forEach(([lastX, lastY, x, y, colorSelection]) => { - this.ctx.strokeStyle = colorSelection; - this.ctx.beginPath(); - this.ctx.moveTo(lastX, lastY); - this.ctx.lineTo(x, y); - this.ctx.stroke(); - }); + const line = this.lineStack[this.lineStack.length - 1]; + + // selects last color before line is yeeted, this is buggy sometimes. + const prevColor = line[0][4]; + this.lineStack.pop(); + + this.ctx.clearRect( + 0, + 0, + this.canvasRef.current.width, + this.canvasRef.current.height + ); + this.ctx.drawImage( + this.img, + 0, + 0, + this.canvasRef.current.width, + this.canvasRef.current.height + ); + this.ctx.globalCompositeOperation = 'source-over'; + + this.lineStack.forEach((currentLine) => { + currentLine.forEach(([lastX, lastY, x, y, colorSelection]) => { + this.ctx.strokeStyle = colorSelection; + this.ctx.beginPath(); + this.ctx.moveTo(lastX, lastY); + this.ctx.lineTo(x, y); + this.ctx.stroke(); }); + }); - this.setState({ selection: prevColor }); - return; - } - // this has barely been tested, and might be unfunctional, also a better way to do this according to paul. - if (selection === 'export') { - const exportDrawnImage = new Image(); - exportDrawnImage.src = this.canvasRef.current.toDataURL(); - exportDrawnImage.onload = () => { - onImageExport(exportDrawnImage); - }; - return; - } + this.setState({ selection: prevColor }); + return; + } + // this has barely been tested, and might be unfunctional, also a better way to do this according to paul. + if (selection === 'export') { + const exportDrawnImage = new Image(); + exportDrawnImage.src = this.canvasRef.current.toDataURL(); + exportDrawnImage.onload = () => { + onImageExport(exportDrawnImage); + }; + return; + } this.setState({ selection: selection }); }; @@ -160,22 +188,29 @@ export class CanvasLayer extends Component { } drawCanvas() { - this.img.onload = () => { // this onload may or may not be causing problems. - this.ctx.drawImage(this.img, 0, 0, this.canvasRef.current.width, this.canvasRef.current.height); - }; + this.img.onload = () => { + // this onload may or may not be causing problems. + this.ctx.drawImage( + this.img, + 0, + 0, + this.canvasRef.current.width, + this.canvasRef.current.height + ); + }; } render() { return ( - + ); } } diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index bebcef92bd95..8a8372e1005c 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -23,20 +23,26 @@ export const TacticalMap = (props, context) => {
- +
- -
); }; + From a2de250ad04b6a8995bab7776c139ceebb6da641 Mon Sep 17 00:00:00 2001 From: DOOM Date: Fri, 30 Jun 2023 07:15:07 -0400 Subject: [PATCH 010/161] guh --- code/controllers/subsystem/minimap.dm | 4 ++++ tgui/packages/tgui/interfaces/TacticalMap.tsx | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 48f5ae65209f..9d5f16afb855 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -498,6 +498,10 @@ SUBSYSTEM_DEF(minimaps) data["updatedCanvas"] = updated_canvas return data +/datum/tacmap/ui_close(mob/user) + . = ..() + updated_canvas = FALSE + /datum/tacmap/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state){ . = ..() if(.) diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index bd505130b511..d97bbd89a759 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -104,7 +104,7 @@ export const TacticalMap = (props, context) => { />
- + {timeLeft > 0 && ( Date: Fri, 30 Jun 2023 15:57:53 -0400 Subject: [PATCH 011/161] hacky, fix later. --- tgui/packages/tgui/interfaces/CanvasLayer.js | 4 +-- tgui/packages/tgui/interfaces/TacticalMap.tsx | 27 ++++++++++++++++--- .../tgui/styles/interfaces/TacticalMap.scss | 4 +++ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index 1ef975497cea..5ae319c01bd5 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -31,7 +31,7 @@ export class CanvasLayer extends Component { componentDidMount() { this.ctx = this.canvasRef.current.getContext('2d'); - this.ctx.lineWidth = 2; + this.ctx.lineWidth = 4; this.ctx.lineCap = 'round'; this.img = new Image(); @@ -172,7 +172,7 @@ export class CanvasLayer extends Component { if (selection === 'export') { - this.props.onImageExport(String(this.canvasRef.current.toDataURL("image/jpeg", 0.4))); + this.props.onImageExport(String(this.canvasRef.current.toDataURL("image/jpeg", 0.5))); return; } diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index d97bbd89a759..e144edf45653 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -36,17 +36,34 @@ export const TacticalMap = (props, context) => { 'green' ]; + const colors: Record = { + 'black': '#000000', + 'red': '#FC0000', + 'orange': '#F59A07', + 'blue': '#0561F5', + 'purple': '#C002FA', + 'green': '#02c245' + }; + + const handleColorSelection = () => { + if(colors[data.toolbarUpdatedSelection] != null && colors[data.toolbarUpdatedSelection] != undefined){ + return colors[data.toolbarUpdatedSelection]; + } else { + return data.toolbarUpdatedSelection; + } + } + return (
-
+
{(!data.updatedCanvas && ( @@ -55,6 +72,8 @@ export const TacticalMap = (props, context) => { fluid={1} disabled={!canUpdate} color="red" + icon="download" + className="text-center" content="Update Canvas" onClick={() => act('updateCanvas')} /> @@ -63,7 +82,7 @@ export const TacticalMap = (props, context) => { fontSize="10px" fluid={1} color="green" - icon="checkmark" + icon="bullhorn" content="Announce" className="text-center" onClick={() => @@ -104,7 +123,7 @@ export const TacticalMap = (props, context) => { /> - + {timeLeft > 0 && ( Date: Fri, 30 Jun 2023 16:25:22 -0400 Subject: [PATCH 012/161] fix --- code/controllers/subsystem/minimap.dm | 4 ++-- tgui/packages/tgui/interfaces/TacticalMap.tsx | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 9d5f16afb855..ec28972fb052 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -516,13 +516,11 @@ SUBSYSTEM_DEF(minimaps) if ("updateCanvas") if(alert(user, "Are you sure you want to update the canvas changes?", "Confirm?", "Yes", "No") == "No") - toolbar_updated_selection = "clear" return toolbar_updated_selection = "export" COOLDOWN_START(src, canvas_cooldown, canvas_cooldown_time) updated_canvas = TRUE - // callback timer for when the user can update again . = TRUE if ("undoChange") @@ -543,6 +541,8 @@ SUBSYSTEM_DEF(minimaps) toolbar_color_selection = "blue" if("green") toolbar_color_selection = "green" + if("brown") + toolbar_color_selection = "brown" toolbar_updated_selection = toolbar_color_selection . = TRUE diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index e144edf45653..af2d10925d74 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -33,7 +33,8 @@ export const TacticalMap = (props, context) => { 'orange', 'blue', 'purple', - 'green' + 'green', + 'brown' ]; const colors: Record = { @@ -42,7 +43,8 @@ export const TacticalMap = (props, context) => { 'orange': '#F59A07', 'blue': '#0561F5', 'purple': '#C002FA', - 'green': '#02c245' + 'green': '#02c245', + 'brown': '#5C351E' }; const handleColorSelection = () => { @@ -95,8 +97,8 @@ export const TacticalMap = (props, context) => {
-
+
- {(!data.updatedCanvas && ( + {(!data.updatedCanvas && (
); }; - From 3d22bbd34eb6cd2c47f1ac0c213da35c27b00a4d Mon Sep 17 00:00:00 2001 From: DOOM Date: Sat, 1 Jul 2023 20:21:54 -0400 Subject: [PATCH 019/161] fix --- tgui/packages/tgui/interfaces/CanvasLayer.js | 2 +- tgui/packages/tgui/interfaces/TacticalMap.tsx | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index be885f29bf63..a4b90c0a9e3b 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -171,7 +171,7 @@ export class CanvasLayer extends Component { if (selection === 'export') { this.props.onImageExport( - String(this.canvasRef.current.toDataURL('image/jpeg', 0.4)) + String(this.canvasRef.current.toDataURL('image/jpeg', 0.5)) ); return; diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 2e0b4a8abbe2..3b80f8646fd4 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -1,12 +1,5 @@ import { useBackend } from '../backend'; -import { - Button, - Dropdown, - Section, - Stack, - ProgressBar, - Box, -} from '../components'; +import { Button, Dropdown, Section, Stack, ProgressBar, Box } from '../components'; import { Window } from '../layouts'; import { CanvasLayer } from './CanvasLayer'; @@ -144,8 +137,7 @@ export const TacticalMap = (props, context) => { good: [-Infinity, 0.33], average: [0.33, 0.67], bad: [0.67, Infinity], - }} - > + }}> {Math.ceil(timeLeft / 10)} seconds until the canvas changes can be updated From 362df62087089de8f93f0df1a6d6504436c2e8ff Mon Sep 17 00:00:00 2001 From: DOOM Date: Sat, 1 Jul 2023 20:25:27 -0400 Subject: [PATCH 020/161] LINTER --- tgui/packages/tgui/interfaces/TacticalMap.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 3b80f8646fd4..c1e0c2afc132 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -47,8 +47,8 @@ export const TacticalMap = (props, context) => { const handleColorSelection = () => { if ( - colors[data.toolbarUpdatedSelection] != null && - colors[data.toolbarUpdatedSelection] != undefined + colors[data.toolbarUpdatedSelection] !== null && + colors[data.toolbarUpdatedSelection] !== undefined ) { return colors[data.toolbarUpdatedSelection]; } else { From d87da9e9bc5202c8cfa9996ed39bd5b6e43d1280 Mon Sep 17 00:00:00 2001 From: DOOM Date: Sat, 1 Jul 2023 21:05:49 -0400 Subject: [PATCH 021/161] fix --- code/controllers/subsystem/minimap.dm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 43c562847aa2..476e4037dc64 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -513,7 +513,7 @@ SUBSYSTEM_DEF(minimaps) toolbar_color_selection = "black" toolbar_updated_selection = "black" -/datum/tacmap/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state){ +/datum/tacmap/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) . = ..() if(.) return @@ -584,8 +584,6 @@ SUBSYSTEM_DEF(minimaps) qdel(canvas_image) . = TRUE -} - /datum/tacmap/ui_status(mob/user) if(!(isatom(owner))) return UI_INTERACTIVE From cf1cc1c5778ac2927f905753bd05b6272d5ecde8 Mon Sep 17 00:00:00 2001 From: DOOM Date: Sat, 1 Jul 2023 21:07:32 -0400 Subject: [PATCH 022/161] ... --- code/modules/client/client_procs.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index 50a77edfb180..107e0c71fde5 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -155,7 +155,7 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list( if(!istype(image)) return - show_browser(usr, "","Map Image", "Map Image", "size=1000x1000") + show_browser(usr, "","Tactical Map", "Tactical Map", "size=1000x1000") else if(href_list["FaxView"]) From bdfadb91891191bc3358d45b80ed122ad7ec43d5 Mon Sep 17 00:00:00 2001 From: DOOM Date: Sat, 1 Jul 2023 21:14:20 -0400 Subject: [PATCH 023/161] fix --- code/controllers/subsystem/minimap.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 476e4037dc64..8484283f702e 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -570,7 +570,7 @@ SUBSYSTEM_DEF(minimaps) 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]" + signed = "[paygrade] [id.registered_name]" var/href_map = "View Tacitcal Map

" var/outgoing_message = href_map + input From 4cf8abf51d8994ab839c2f2de43c32a7d64455a9 Mon Sep 17 00:00:00 2001 From: DOOM Date: Mon, 3 Jul 2023 00:37:08 -0400 Subject: [PATCH 024/161] typo --- code/controllers/subsystem/minimap.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 8484283f702e..8846b5845472 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -572,10 +572,10 @@ SUBSYSTEM_DEF(minimaps) var/paygrade = get_paygrades(id.paygrade, FALSE, H.gender) signed = "[paygrade] [id.registered_name]" - var/href_map = "View Tacitcal Map

" + var/href_map = "View Tactical Map

" var/outgoing_message = href_map + input - message_admins("[key_name(user)] has made a tacitcal map announcement.") + message_admins("[key_name(user)] has made a tactical map announcement.") log_announcement("[key_name(user)] has announced the following: [outgoing_message]") //hardcoded testing, PROGRESS! From 5d8784f10e85b480feef5cfb22aaf6594eb0db46 Mon Sep 17 00:00:00 2001 From: DOOM Date: Mon, 3 Jul 2023 10:32:14 -0400 Subject: [PATCH 025/161] var refactor --- code/controllers/subsystem/minimap.dm | 4 ++-- tgui/packages/tgui/interfaces/TacticalMap.tsx | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 8846b5845472..18e3db61656d 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -502,8 +502,8 @@ SUBSYSTEM_DEF(minimaps) data["toolbarUpdatedSelection"] = toolbar_updated_selection data["worldtime"] = world.time - data["nextcanvastime"] = canvas_cooldown - data["canvas_cooldown"] = canvas_cooldown_time + data["canvasCooldown"] = canvas_cooldown + data["nextCanvasTime"] = canvas_cooldown_time data["updatedCanvas"] = updated_canvas return data diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index c1e0c2afc132..0bed07e4f818 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -9,16 +9,16 @@ interface TacMapProps { updatedCanvas: boolean; imageSrc: string; worldtime: any; - nextcanvastime: any; - canvas_cooldown: any; + nextCanvasTime: any; + canvasCooldown: any; exportedTacMapImage: any; } export const TacticalMap = (props, context) => { const { data, act } = useBackend(context); - const timeLeft = data.nextcanvastime - data.worldtime; - const timeLeftPct = timeLeft / data.canvas_cooldown; + const timeLeft = data.canvasCooldown - data.worldtime; + const timeLeftPct = timeLeft / data.nextCanvasTime; const canUpdate = timeLeft < 0 && !data.updatedCanvas; const handleTacMapExport = (image: any) => { From 3781a3768429fe4f468e5e8eeaebba19bd537995 Mon Sep 17 00:00:00 2001 From: DOOM Date: Mon, 3 Jul 2023 23:57:41 -0400 Subject: [PATCH 026/161] less shit code --- code/controllers/subsystem/minimap.dm | 28 +++++++++++++-------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 18e3db61656d..49541171683b 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -460,6 +460,16 @@ SUBSYSTEM_DEF(minimaps) var/canvas_cooldown_time = 4 MINUTES + var/allowed_colors = [ + "black", + "red", + "orange", + "purple", + "blue", + "green", + "brown" + ] + // prevent multiple users from updating the canvas image until the cooldown expires. COOLDOWN_DECLARE(canvas_cooldown) @@ -539,21 +549,9 @@ SUBSYSTEM_DEF(minimaps) . = TRUE if ("selectColor") - switch(params["color"]) - if("black") - toolbar_color_selection = "black" - if("red") - toolbar_color_selection = "red" - if("orange") - toolbar_color_selection = "orange" - if("purple") - toolbar_color_selection = "purple" - if("blue") - toolbar_color_selection = "blue" - if("green") - toolbar_color_selection = "green" - if("brown") - toolbar_color_selection = "brown" + + if(params['color'] in allowed_colors) + return params['color'] toolbar_updated_selection = toolbar_color_selection . = TRUE From 22dbf83e41269467090c081c9488b4a57237b4ff Mon Sep 17 00:00:00 2001 From: DOOM Date: Mon, 3 Jul 2023 23:58:42 -0400 Subject: [PATCH 027/161] fix --- code/controllers/subsystem/minimap.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 49541171683b..eac47ad35808 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -531,7 +531,7 @@ SUBSYSTEM_DEF(minimaps) var/user = ui.user switch (action) - if ("clearCanvas") // boiler plate code. + if ("clearCanvas") toolbar_updated_selection = "clear" . = TRUE From 9757437e158a368990d56fdcbb29309f0e60148a Mon Sep 17 00:00:00 2001 From: DOOM Date: Tue, 4 Jul 2023 00:04:10 -0400 Subject: [PATCH 028/161] too much python lol --- code/controllers/subsystem/minimap.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index eac47ad35808..8b0c93a49d49 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -460,7 +460,7 @@ SUBSYSTEM_DEF(minimaps) var/canvas_cooldown_time = 4 MINUTES - var/allowed_colors = [ + var/allowed_colors = ( "black", "red", "orange", @@ -468,7 +468,7 @@ SUBSYSTEM_DEF(minimaps) "blue", "green", "brown" - ] + ) // prevent multiple users from updating the canvas image until the cooldown expires. COOLDOWN_DECLARE(canvas_cooldown) From 396ce2635654fbb705b79b163e10123559547783 Mon Sep 17 00:00:00 2001 From: DOOM Date: Tue, 4 Jul 2023 00:07:21 -0400 Subject: [PATCH 029/161] fox --- code/controllers/subsystem/minimap.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 8b0c93a49d49..4e2cb176135e 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -460,7 +460,7 @@ SUBSYSTEM_DEF(minimaps) var/canvas_cooldown_time = 4 MINUTES - var/allowed_colors = ( + var/allowed_colors = list( "black", "red", "orange", From 13151cb74fdd0c70d44fbb932431c479d676cc29 Mon Sep 17 00:00:00 2001 From: DOOM Date: Tue, 4 Jul 2023 00:10:10 -0400 Subject: [PATCH 030/161] fix --- code/controllers/subsystem/minimap.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 4e2cb176135e..5a264dde09c7 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -550,8 +550,8 @@ SUBSYSTEM_DEF(minimaps) if ("selectColor") - if(params['color'] in allowed_colors) - return params['color'] + if(params["color"] in allowed_colors) + return params["color"] toolbar_updated_selection = toolbar_color_selection . = TRUE From dcd697c6b15896e605b85f62cbdce441285b4296 Mon Sep 17 00:00:00 2001 From: expanse Date: Mon, 17 Jul 2023 03:08:19 -0400 Subject: [PATCH 031/161] fix --- code/controllers/subsystem/minimap.dm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 5a264dde09c7..4a8e1a3504c4 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -550,8 +550,7 @@ SUBSYSTEM_DEF(minimaps) if ("selectColor") - if(params["color"] in allowed_colors) - return params["color"] + toolbar_color_selection = params["color"] toolbar_updated_selection = toolbar_color_selection . = TRUE From be1cef3cdb6aaa21c9dcbdef5a0bfb6fd2e1e638 Mon Sep 17 00:00:00 2001 From: expanse Date: Mon, 17 Jul 2023 03:14:58 -0400 Subject: [PATCH 032/161] hacky svg implementation --- tgui/packages/tgui/interfaces/CanvasLayer.js | 49 ++++++++++++++------ 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index a4b90c0a9e3b..4514fc1b08f5 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -5,20 +5,20 @@ export class CanvasLayer extends Component { constructor(props) { super(props); this.canvasRef = createRef(); - + // color selection // using this.state prevents unpredictable behavior this.state = { selection: this.props.selection, }; - + // needs to be of type png of jpg this.img = null; this.imageSrc = this.props.imageSrc; - + // stores the stacked lines this.lineStack = []; - + // stores the individual line drawn this.currentLine = []; @@ -77,7 +77,7 @@ export class CanvasLayer extends Component { return; } - // defaults to black sometimes, it's a bug I think maybe. + // defaults to black sometimes, it's a bug I think maybe. this.ctx.strokeStyle = this.state.selection; const rect = this.canvasRef.current.getBoundingClientRect(); @@ -136,7 +136,7 @@ export class CanvasLayer extends Component { } const line = this.lineStack[this.lineStack.length - 1]; - // selects last color before line is yeeted, this is buggy sometimes. + // selects last color before line is yeeted, this is buggy sometimes. const prevColor = line[0][4]; this.lineStack.pop(); @@ -169,13 +169,12 @@ export class CanvasLayer extends Component { return; } - if (selection === 'export') { - this.props.onImageExport( - String(this.canvasRef.current.toDataURL('image/jpeg', 0.5)) - ); - - return; - } + if (selection === 'export') { + const svgData = this.convertToSVG(); + const svgString = new XMLSerializer().serializeToString(svgData); + this.props.onImageExport(svgString); + return; + } this.setState({ selection: selection }); }; @@ -188,7 +187,7 @@ export class CanvasLayer extends Component { drawCanvas() { this.img.onload = () => { - // this onload may or may not be causing problems. + // this onload may or may not be causing problems. this.ctx.drawImage( this.img, 0, @@ -199,6 +198,28 @@ export class CanvasLayer extends Component { }; } + convertToSVG() { + const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); + svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg'); + svg.setAttribute('width', this.canvasRef.current.width); + svg.setAttribute('height', this.canvasRef.current.height); + + const lines = this.lineStack.flat(); + lines.forEach(([lastX, lastY, x, y, colorSelection]) => { + const line = document.createElementNS('http://www.w3.org/2000/svg', 'line'); + line.setAttribute('x1', lastX); + line.setAttribute('y1', lastY); + line.setAttribute('x2', x); + line.setAttribute('y2', y); + line.setAttribute('stroke', colorSelection); + line.setAttribute('stroke-width', '4'); + line.setAttribute('stroke-linecap', 'round'); + svg.appendChild(line); + }); + + return svg.outerHTML; + } + render() { return ( Date: Mon, 17 Jul 2023 03:22:17 -0400 Subject: [PATCH 033/161] fix --- code/controllers/subsystem/minimap.dm | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 5a264dde09c7..003588960b50 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -460,16 +460,6 @@ SUBSYSTEM_DEF(minimaps) var/canvas_cooldown_time = 4 MINUTES - var/allowed_colors = list( - "black", - "red", - "orange", - "purple", - "blue", - "green", - "brown" - ) - // prevent multiple users from updating the canvas image until the cooldown expires. COOLDOWN_DECLARE(canvas_cooldown) @@ -550,8 +540,7 @@ SUBSYSTEM_DEF(minimaps) if ("selectColor") - if(params["color"] in allowed_colors) - return params["color"] + toolbar_color_selection = params["color"] toolbar_updated_selection = toolbar_color_selection . = TRUE From 945df1c3e34bd37727c6f690e1ee97e0d0e9b474 Mon Sep 17 00:00:00 2001 From: expanse Date: Mon, 17 Jul 2023 03:31:09 -0400 Subject: [PATCH 034/161] fix --- tgui/packages/tgui/interfaces/CanvasLayer.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index 4514fc1b08f5..d38a95ac2cbc 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -171,8 +171,7 @@ export class CanvasLayer extends Component { if (selection === 'export') { const svgData = this.convertToSVG(); - const svgString = new XMLSerializer().serializeToString(svgData); - this.props.onImageExport(svgString); + this.props.onImageExport(svgData); return; } From 97c761664ef68b976c96ffe21ee3de3b399867b4 Mon Sep 17 00:00:00 2001 From: expanse Date: Mon, 17 Jul 2023 04:03:38 -0400 Subject: [PATCH 035/161] fuck yeah --- code/controllers/subsystem/minimap.dm | 2 ++ tgui/packages/tgui/interfaces/CanvasLayer.js | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 003588960b50..0b3d55aaf858 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -546,6 +546,8 @@ SUBSYSTEM_DEF(minimaps) if ("selectAnnouncement") toolbar_updated_selection = "export" + + to_chat(usr, SPAN_WARNING(params["image"])) var/datum/canvas_map/canvas_image = new(params["image"]) GLOB.canvas_drawings += canvas_image diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index d38a95ac2cbc..c036b749040e 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -202,7 +202,7 @@ export class CanvasLayer extends Component { svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg'); svg.setAttribute('width', this.canvasRef.current.width); svg.setAttribute('height', this.canvasRef.current.height); - + const lines = this.lineStack.flat(); lines.forEach(([lastX, lastY, x, y, colorSelection]) => { const line = document.createElementNS('http://www.w3.org/2000/svg', 'line'); @@ -215,8 +215,13 @@ export class CanvasLayer extends Component { line.setAttribute('stroke-linecap', 'round'); svg.appendChild(line); }); - - return svg.outerHTML; + + const serializer = new XMLSerializer(); + const serializedSvg = serializer.serializeToString(svg); + const base64Svg = btoa(serializedSvg); + const dataUrl = `data:image/svg+xml;base64,${base64Svg}`; + + return dataUrl; } render() { From 4b27583d9c7105d5c76f4bf00eec2fe6f05d12a2 Mon Sep 17 00:00:00 2001 From: expanse Date: Mon, 17 Jul 2023 04:17:57 -0400 Subject: [PATCH 036/161] svg --- tgui/packages/tgui/interfaces/CanvasLayer.js | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index c036b749040e..bac294c977bf 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -198,21 +198,21 @@ export class CanvasLayer extends Component { } convertToSVG() { - const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); - svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg'); - svg.setAttribute('width', this.canvasRef.current.width); - svg.setAttribute('height', this.canvasRef.current.height); + const svgNS = "http://www.w3.org/2000/svg"; + const svg = document.createElementNS(svgNS, 'svg'); + svg.setAttributeNS(null, 'width', this.canvasRef.current.width); + svg.setAttributeNS(null, 'height', this.canvasRef.current.height); const lines = this.lineStack.flat(); lines.forEach(([lastX, lastY, x, y, colorSelection]) => { - const line = document.createElementNS('http://www.w3.org/2000/svg', 'line'); - line.setAttribute('x1', lastX); - line.setAttribute('y1', lastY); - line.setAttribute('x2', x); - line.setAttribute('y2', y); - line.setAttribute('stroke', colorSelection); - line.setAttribute('stroke-width', '4'); - line.setAttribute('stroke-linecap', 'round'); + const line = document.createElementNS(svgNS, 'line'); + line.setAttributeNS(null, 'x1', lastX); + line.setAttributeNS(null, 'y1', lastY); + line.setAttributeNS(null, 'x2', x); + line.setAttributeNS(null, 'y2', y); + line.setAttributeNS(null, 'stroke', colorSelection); + line.setAttributeNS(null, 'stroke-width', '4'); + line.setAttributeNS(null, 'stroke-linecap', 'round'); svg.appendChild(line); }); From 18f10805f6795deda81d25f81393e1b8360c8d30 Mon Sep 17 00:00:00 2001 From: expanse Date: Tue, 18 Jul 2023 19:53:13 -0400 Subject: [PATCH 037/161] prettier --- tgui/packages/tgui/interfaces/CanvasLayer.js | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index bac294c977bf..2ecffcc47fca 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -5,20 +5,20 @@ export class CanvasLayer extends Component { constructor(props) { super(props); this.canvasRef = createRef(); - + // color selection // using this.state prevents unpredictable behavior this.state = { selection: this.props.selection, }; - + // needs to be of type png of jpg this.img = null; this.imageSrc = this.props.imageSrc; - + // stores the stacked lines this.lineStack = []; - + // stores the individual line drawn this.currentLine = []; @@ -77,7 +77,7 @@ export class CanvasLayer extends Component { return; } - // defaults to black sometimes, it's a bug I think maybe. + // defaults to black sometimes, it's a bug I think maybe. this.ctx.strokeStyle = this.state.selection; const rect = this.canvasRef.current.getBoundingClientRect(); @@ -136,7 +136,7 @@ export class CanvasLayer extends Component { } const line = this.lineStack[this.lineStack.length - 1]; - // selects last color before line is yeeted, this is buggy sometimes. + // selects last color before line is yeeted, this is buggy sometimes. const prevColor = line[0][4]; this.lineStack.pop(); @@ -169,11 +169,11 @@ export class CanvasLayer extends Component { return; } - if (selection === 'export') { - const svgData = this.convertToSVG(); - this.props.onImageExport(svgData); - return; - } + if (selection === 'export') { + const svgData = this.convertToSVG(); + this.props.onImageExport(svgData); + return; + } this.setState({ selection: selection }); }; @@ -186,7 +186,7 @@ export class CanvasLayer extends Component { drawCanvas() { this.img.onload = () => { - // this onload may or may not be causing problems. + // this onload may or may not be causing problems. this.ctx.drawImage( this.img, 0, @@ -198,11 +198,11 @@ export class CanvasLayer extends Component { } convertToSVG() { - const svgNS = "http://www.w3.org/2000/svg"; + const svgNS = 'http://www.w3.org/2000/svg'; const svg = document.createElementNS(svgNS, 'svg'); svg.setAttributeNS(null, 'width', this.canvasRef.current.width); svg.setAttributeNS(null, 'height', this.canvasRef.current.height); - + const lines = this.lineStack.flat(); lines.forEach(([lastX, lastY, x, y, colorSelection]) => { const line = document.createElementNS(svgNS, 'line'); @@ -215,12 +215,12 @@ export class CanvasLayer extends Component { line.setAttributeNS(null, 'stroke-linecap', 'round'); svg.appendChild(line); }); - + const serializer = new XMLSerializer(); const serializedSvg = serializer.serializeToString(svg); const base64Svg = btoa(serializedSvg); const dataUrl = `data:image/svg+xml;base64,${base64Svg}`; - + return dataUrl; } From 5507258ad4ab230dbfe7dbb306f36e41106f5a42 Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 22 Sep 2023 12:13:37 -0700 Subject: [PATCH 038/161] tacmap ref --- code/__DEFINES/minimap.dm | 5 + code/_globalvars/global_lists.dm | 4 +- code/controllers/subsystem/minimap.dm | 159 +++++++-- code/modules/client/client_procs.dm | 10 - code/modules/cm_marines/overwatch.dm | 15 - tgui/packages/tgui/interfaces/CanvasLayer.js | 46 +-- tgui/packages/tgui/interfaces/DrawnMap.js | 82 +++++ .../tgui/interfaces/OverwatchConsole.js | 4 - tgui/packages/tgui/interfaces/TacticalMap.tsx | 333 ++++++++++++------ 9 files changed, 457 insertions(+), 201 deletions(-) create mode 100644 tgui/packages/tgui/interfaces/DrawnMap.js diff --git a/code/__DEFINES/minimap.dm b/code/__DEFINES/minimap.dm index c9f21484f622..f4f3821cd038 100644 --- a/code/__DEFINES/minimap.dm +++ b/code/__DEFINES/minimap.dm @@ -16,6 +16,11 @@ 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 feb896dca4bb..3492d0bebe39 100644 --- a/code/_globalvars/global_lists.dm +++ b/code/_globalvars/global_lists.dm @@ -9,7 +9,9 @@ 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 -GLOBAL_LIST_EMPTY(canvas_drawings) //List of canvas drawings +//flat tacmap and svg for viewing minimap drawings +GLOBAL_LIST_EMPTY(uscm_flat_tacmap) +GLOBAL_LIST_EMPTY(xeno_flat_tacmap) GLOBAL_LIST_EMPTY(failed_fultons) //A list of fultoned items which weren't collected and fell back down GLOBAL_LIST_EMPTY(larva_burst_by_hive) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 08163e450a5d..1cbc2da454f7 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -322,7 +322,7 @@ SUBSYSTEM_DEF(minimaps) minimaps_by_z["[z_level]"].images_assoc["[flag]"] -= source /** - * Fetches a /atom/movable/screen/minimap instance or creates on if none exists + * Fetches a /atom/movable/screen/minimap instance or creates one if none exists * Note this does not destroy them when the map is unused, might be a potential thing to do? * Arguments: * * zlevel: zlevel to fetch map for @@ -338,6 +338,28 @@ SUBSYSTEM_DEF(minimaps) hashed_minimaps[hash] = map return map +/datum/tacmap/proc/get_current_map(mob/user) + var/datum/svg_overlay/selected_svg + var/list/map_list + + if(ishuman(user)) + map_list = GLOB.uscm_flat_tacmap + else + if(!isxeno(user)) + return + map_list = GLOB.xeno_flat_tacmap + + if(map_list.len == 0) + return + + selected_svg = map_list[map_list.len] + + if(!selected_svg) + return + + svg = selected_svg.svg_data + drawn_map_png_asset = selected_svg.flat_tacmap + /datum/controller/subsystem/minimaps/proc/fetch_tacmap_datum(zlevel, flags) var/hash = "[zlevel]-[flags]" if(hashed_tacmaps[hash]) @@ -442,7 +464,7 @@ SUBSYSTEM_DEF(minimaps) marker_flags = MINIMAP_FLAG_USCM /datum/action/minimap/observer - minimap_flags = MINIMAP_FLAG_XENO|MINIMAP_FLAG_USCM|MINIMAP_FLAG_UPP|MINIMAP_FLAG_CLF|MINIMAP_FLAG_UPP + minimap_flags = MINIMAP_FLAG_ALL marker_flags = NONE hidden = TRUE @@ -452,26 +474,43 @@ SUBSYSTEM_DEF(minimaps) var/targeted_ztrait = ZTRAIT_GROUND var/atom/owner - // used in cic tactical maps for drawing on the canvas, defaults to blue. + // color selection for the tactical map canvas, defaults to black. var/toolbar_color_selection = "black" - - // hacky ass solution for tgui color display, move functionality to js, fix later. var/toolbar_updated_selection = "black" var/canvas_cooldown_time = 4 MINUTES - - // prevent multiple users from updating the canvas image until the cooldown expires. COOLDOWN_DECLARE(canvas_cooldown) - var/updated_canvas = FALSE + // empty map icon without layered blips. + var/base_map_png_asset + // stored state for the current menu + var/current_menu + // boolean value to keep track if the canvas has been updated or not, the value is used in tgui state. + var/updated_canvas = FALSE + var/theme = DEFAULT_MINIMAP_THEME var/datum/tacmap_holder/map_holder - var/img_ref + + // shouldn't be shared, fix later + var/drawn_map_png_asset + + // datum containing the flattend map and svg + var/datum/svg_overlay/svg /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 @@ -483,12 +522,32 @@ SUBSYSTEM_DEF(minimaps) if(!level[1]) return map_holder = SSminimaps.fetch_tacmap_datum(level[1], allowed_flags) + var/icon/map_icon = map_holder.map + + //not the best way to do this, fix later + if(!base_map_png_asset) + var/list/faction_clients = list() + for(var/client/client in GLOB.clients) + var/mob/client_mob = client.mob + if(client_mob.faction == user.faction) + faction_clients += client + base_map_png_asset = icon2html(map_icon, faction_clients, sourceonly = TRUE) + // TODO: check if user has the cached asset. ui = SStgui.try_update_ui(user, src, ui) if(!ui) - var/icon/map_icon = getFlatIcon(map_holder.map) - img_ref = icon2html(map_icon, user, sourceonly = TRUE) + get_current_map(user) + var/mob/living/carbon/xenomorph/xeno_user + if(isxeno(user)) + xeno_user = user + + if(ishuman(user) && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT) || isqueen(user) && xeno_user.hivenumber == XENO_HIVE_NORMAL) + current_menu = "home" + else if(isxeno(user) && xeno_user.hivenumber != XENO_HIVE_NORMAL) + current_menu = "view" + else + current_menu = "old_canvas" user.client.register_map_obj(map_holder.map) ui = new(user, src, "TacticalMap") @@ -497,11 +556,21 @@ SUBSYSTEM_DEF(minimaps) /datum/tacmap/ui_data(mob/user) var/list/data = list() - data["imageSrc"] = img_ref + + // empty map dmi image used as the background for the canvas + data["imageSrc"] = base_map_png_asset + + //flat image of most recently announced tacmap + data["flatImage"] = drawn_map_png_asset + + data["svgData"] = svg + + data["currentMenu"] = current_menu + data["themeId"] = theme + data["mapRef"] = map_holder.map_ref data["toolbarColorSelection"] = toolbar_color_selection data["toolbarUpdatedSelection"] = toolbar_updated_selection data["worldtime"] = world.time - data["canvasCooldown"] = canvas_cooldown data["nextCanvasTime"] = canvas_cooldown_time data["updatedCanvas"] = updated_canvas @@ -521,16 +590,22 @@ SUBSYSTEM_DEF(minimaps) var/user = ui.user switch (action) + if ("menuSelect") + if(params["selection"] == "old_canvas") + get_current_map(user) + to_chat(user, SPAN_WARNING("old_canvas")) + current_menu = params["selection"] + . = TRUE + if ("clearCanvas") toolbar_updated_selection = "clear" . = TRUE - if ("updateCanvas") if(alert(user, "Are you sure you want to update the canvas changes?", "Confirm?", "Yes", "No") == "No") return - toolbar_updated_selection = "export" COOLDOWN_START(src, canvas_cooldown, canvas_cooldown_time) + updated_canvas = TRUE . = TRUE @@ -545,32 +620,48 @@ SUBSYSTEM_DEF(minimaps) . = TRUE if ("selectAnnouncement") - toolbar_updated_selection = "export" - - to_chat(usr, SPAN_WARNING(params["image"])) - var/datum/canvas_map/canvas_image = new(params["image"]) - GLOB.canvas_drawings += canvas_image + var/icon/flat_map = getFlatIcon(map_holder.map) + var/datum/svg_overlay/overlay = new(params["image"], flat_map) - var/input = stripped_multiline_input(user, "Optional message to announce to the [MAIN_SHIP_NAME]'s crew with the tactical map", "Tactical Map Announcement", "") + toolbar_updated_selection = "clear" + + var/outgoing_message = stripped_multiline_input(user, "Optional message to announce with the tactical map", "Tactical Map Announcement", "") var/signed - if(ishuman(user)) + + var/user_faction + if(isxeno(user)) + user_faction = FACTION_XENOMORPH + else + user_faction = FACTION_MARINE + + var/list/faction_clients = list() + for(var/client/client in GLOB.clients) + var/mob/client_mob = client.mob + if(client_mob.faction == user_faction) + faction_clients += client + overlay.flat_tacmap = icon2html(overlay.flat_tacmap, faction_clients, sourceonly = TRUE) + + // better to do it this way than icon2html on every new interface imo. + base_map_png_asset = icon2html(map_holder.map, faction_clients, sourceonly = TRUE) + + if(user_faction == FACTION_XENOMORPH) + var/mob/living/carbon/xenomorph/xeno = user + xeno_announcement(outgoing_message, xeno.hivenumber) + GLOB.xeno_flat_tacmap += overlay + else + GLOB.uscm_flat_tacmap += overlay 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]" - - var/href_map = "View Tactical Map

" - var/outgoing_message = href_map + input + marine_announcement(outgoing_message, "Tactical Map Announcement", signature = signed) message_admins("[key_name(user)] has made a tactical map announcement.") log_announcement("[key_name(user)] has announced the following: [outgoing_message]") - - //hardcoded testing, PROGRESS! - marine_announcement(outgoing_message, "Tactical Map Announcement", signature = signed) updated_canvas = FALSE - qdel(canvas_image) + qdel(overlay) . = TRUE /datum/tacmap/ui_status(mob/user) @@ -609,9 +700,11 @@ SUBSYSTEM_DEF(minimaps) map = null return ..() -/datum/canvas_map - var/data +/datum/svg_overlay + var/svg_data + var/flat_tacmap -/datum/canvas_map/New(data) +/datum/svg_overlay/New(svg_data, flat_tacmap) . = ..() - src.data = data + src.svg_data = svg_data + src.flat_tacmap = flat_tacmap diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index 34c6ccd216a8..97e751b5c43f 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -148,16 +148,6 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list( if(unansweredAhelps[receiver_client.computer_id]) unansweredAhelps.Remove(receiver_client.computer_id) cmd_admin_pm(receiver_client, null) return - - else if(href_list["MapView"]) - - var/datum/canvas_map/image = locate(href_list["MapView"]) - - if(!istype(image)) - return - - show_browser(usr, "","Tactical Map", "Tactical Map", "size=1000x1000") - else if(href_list["FaxView"]) var/datum/fax/info = locate(href_list["FaxView"]) diff --git a/code/modules/cm_marines/overwatch.dm b/code/modules/cm_marines/overwatch.dm index d2d55a8cadb1..744967bd1be8 100644 --- a/code/modules/cm_marines/overwatch.dm +++ b/code/modules/cm_marines/overwatch.dm @@ -27,9 +27,6 @@ var/marine_filter_enabled = TRUE var/faction = FACTION_MARINE - var/datum/tacmap/tacmap - var/minimap_type = MINIMAP_FLAG_USCM - ///List of saved coordinates, format of ["x", "y", "comment"] var/list/saved_coordinates = list() @@ -39,11 +36,9 @@ /obj/structure/machinery/computer/overwatch/Initialize() . = ..() - tacmap = new(src, minimap_type) /obj/structure/machinery/computer/overwatch/Destroy() - QDEL_NULL(tacmap) return ..() /obj/structure/machinery/computer/overwatch/attackby(obj/I as obj, mob/user as mob) //Can't break or disassemble. @@ -88,20 +83,12 @@ /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() @@ -446,8 +433,6 @@ else z_hidden = HIDE_NONE to_chat(user, "[icon2html(src, usr)] [SPAN_NOTICE("No location is ignored anymore.")]") - if("tacmap_unpin") - tacmap.tgui_interact(user) if("dropbomb") if(!params["x"] || !params["y"]) return diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index 2ecffcc47fca..9d2ec55151c2 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -77,7 +77,6 @@ export class CanvasLayer extends Component { return; } - // defaults to black sometimes, it's a bug I think maybe. this.ctx.strokeStyle = this.state.selection; const rect = this.canvasRef.current.getBoundingClientRect(); @@ -198,43 +197,20 @@ export class CanvasLayer extends Component { } convertToSVG() { - const svgNS = 'http://www.w3.org/2000/svg'; - const svg = document.createElementNS(svgNS, 'svg'); - svg.setAttributeNS(null, 'width', this.canvasRef.current.width); - svg.setAttributeNS(null, 'height', this.canvasRef.current.height); - const lines = this.lineStack.flat(); - lines.forEach(([lastX, lastY, x, y, colorSelection]) => { - const line = document.createElementNS(svgNS, 'line'); - line.setAttributeNS(null, 'x1', lastX); - line.setAttributeNS(null, 'y1', lastY); - line.setAttributeNS(null, 'x2', x); - line.setAttributeNS(null, 'y2', y); - line.setAttributeNS(null, 'stroke', colorSelection); - line.setAttributeNS(null, 'stroke-width', '4'); - line.setAttributeNS(null, 'stroke-linecap', 'round'); - svg.appendChild(line); - }); - - const serializer = new XMLSerializer(); - const serializedSvg = serializer.serializeToString(svg); - const base64Svg = btoa(serializedSvg); - const dataUrl = `data:image/svg+xml;base64,${base64Svg}`; - - return dataUrl; + const combinedArray = lines.flatMap( + ([lastX, lastY, x, y, colorSelection]) => [ + lastX, + lastY, + x, + y, + colorSelection, + ] + ); + return combinedArray; } render() { - return ( - - ); + return ; } } diff --git a/tgui/packages/tgui/interfaces/DrawnMap.js b/tgui/packages/tgui/interfaces/DrawnMap.js new file mode 100644 index 000000000000..1aa013286798 --- /dev/null +++ b/tgui/packages/tgui/interfaces/DrawnMap.js @@ -0,0 +1,82 @@ +import { Component, createRef } from 'inferno'; + +export class DrawnMap extends Component { + constructor(props) { + super(props); + this.containerRef = createRef(); + this.flatImgSrc = this.props.flatImage; + this.backupImageSrc = this.props.imageSrc; + this.svg = this.props.svgData; + } + + parseSvgData(svgDataArray) { + let lines = []; + for (let i = 0; i < svgDataArray.length; i += 5) { + const x1 = svgDataArray[i]; + const y1 = svgDataArray[i + 1]; + const x2 = svgDataArray[i + 2]; + const y2 = svgDataArray[i + 3]; + const stroke = svgDataArray[i + 4]; + lines.push({ x1, y1, x2, y2, stroke }); + } + return lines; + } + + render() { + const parsedSvgData = this.parseSvgData(this.svg); + + if (this.imageSrc == null && this.backupImageSrc == null) { + return; + } + + if (this.flatImgSrc == null) { + this.flatImgSrc = this.backupImageSrc; + } + + return ( +
+ + {parsedSvgData && ( + + {parsedSvgData.map((line, index) => ( + + ))} + + )} +
+ ); + } +} diff --git a/tgui/packages/tgui/interfaces/OverwatchConsole.js b/tgui/packages/tgui/interfaces/OverwatchConsole.js index 7beceef9e72d..ef4b1af941c9 100644 --- a/tgui/packages/tgui/interfaces/OverwatchConsole.js +++ b/tgui/packages/tgui/interfaces/OverwatchConsole.js @@ -60,7 +60,6 @@ const SquadPanel = (props, context) => { const { act, data } = useBackend(context); const [category, setCategory] = useLocalState(context, 'selected', 'monitor'); - let hello = 2; return ( <> @@ -93,9 +92,6 @@ const SquadPanel = (props, context) => { onClick={() => setCategory('ob')}> Orbital Bombardment - act('tacmap_unpin')}> - Tactical Map - {category === 'monitor' && } {category === 'supply' && data.can_launch_crates && } diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 0bed07e4f818..244fa50e9fc6 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -1,22 +1,162 @@ -import { useBackend } from '../backend'; +import { useBackend, useLocalState } from '../backend'; import { Button, Dropdown, Section, Stack, ProgressBar, Box } from '../components'; import { Window } from '../layouts'; import { CanvasLayer } from './CanvasLayer'; +import { DrawnMap } from './DrawnMap'; +import { ByondUi } from '../components'; interface TacMapProps { toolbarColorSelection: string; toolbarUpdatedSelection: string; updatedCanvas: boolean; imageSrc: string; + themeId: number; + svgData: any; + flatImage: string; + mapRef: any; + currentMenu: string; worldtime: any; nextCanvasTime: any; canvasCooldown: any; exportedTacMapImage: any; } +const PAGES = { + 'view': () => ViewMapPanel, + 'old_canvas': () => OldMapPanel, + 'draw': () => DrawMapPanel, + 'home': () => HomePanel, +}; + +const themes = [ + { + 'theme': 'default', + 'button-color': 'black', + }, + { + 'theme': 'crtblue', + 'button-color': 'blue', + }, + { + 'theme': 'xeno', + 'button-color': 'purple', + }, +]; + +const colorOptions = [ + 'black', + 'red', + 'orange', + 'blue', + 'purple', + 'green', + 'brown', +]; + +const colors: Record = { + 'black': '#000000', + 'red': '#FC0000', + 'orange': '#F59A07', + 'blue': '#0561F5', + 'purple': '#C002FA', + 'green': '#02c245', + 'brown': '#5C351E', +}; + export const TacticalMap = (props, context) => { const { data, act } = useBackend(context); + const PageComponent = PAGES[data.currentMenu](); + + return ( + + + + + + ); +}; + +const HomePanel = (props, context) => { + const { data, act } = useBackend(context); + + return ( +
+ + + + + + + + + + + +
+ ); +}; + +const ViewMapPanel = (props, context) => { + const { data, act } = useBackend(context); + return ( + <> + + + ); +}; + +const OldMapPanel = (props, context) => { + const { data, act } = useBackend(context); + + return ( + <> + + + ); +}; + +const DrawMapPanel = (props, context) => { + const { data, act } = useBackend(context); + const timeLeft = data.canvasCooldown - data.worldtime; const timeLeftPct = timeLeft / data.nextCanvasTime; const canUpdate = timeLeft < 0 && !data.updatedCanvas; @@ -25,26 +165,6 @@ export const TacticalMap = (props, context) => { data.exportedTacMapImage = image; }; - const colorOptions = [ - 'black', - 'red', - 'orange', - 'blue', - 'purple', - 'green', - 'brown', - ]; - - const colors: Record = { - 'black': '#000000', - 'red': '#FC0000', - 'orange': '#F59A07', - 'blue': '#0561F5', - 'purple': '#C002FA', - 'green': '#02c245', - 'brown': '#5C351E', - }; - const handleColorSelection = () => { if ( colors[data.toolbarUpdatedSelection] !== null && @@ -57,97 +177,104 @@ export const TacticalMap = (props, context) => { }; return ( - - -
- -
-
- - - {(!data.updatedCanvas && ( - + +
+
+ + + {(!data.updatedCanvas && (
-
-
+ )} + + +
+ ); }; From 1d3ec4095f24ef681f09006ab9b4ab7e2fafa8f6 Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 22 Sep 2023 12:31:23 -0700 Subject: [PATCH 039/161] fix --- tgui/packages/tgui/interfaces/DrawnMap.js | 4 +- tgui/packages/tgui/interfaces/TacticalMap.tsx | 42 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/tgui/packages/tgui/interfaces/DrawnMap.js b/tgui/packages/tgui/interfaces/DrawnMap.js index 1aa013286798..402de990aea8 100644 --- a/tgui/packages/tgui/interfaces/DrawnMap.js +++ b/tgui/packages/tgui/interfaces/DrawnMap.js @@ -25,11 +25,11 @@ export class DrawnMap extends Component { render() { const parsedSvgData = this.parseSvgData(this.svg); - if (this.imageSrc == null && this.backupImageSrc == null) { + if (this.imageSrc === null && this.backupImageSrc === null) { return; } - if (this.flatImgSrc == null) { + if (this.flatImgSrc === null) { this.flatImgSrc = this.backupImageSrc; } diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 244fa50e9fc6..adf01a61a5bd 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -1,4 +1,4 @@ -import { useBackend, useLocalState } from '../backend'; +import { useBackend } from '../backend'; import { Button, Dropdown, Section, Stack, ProgressBar, Box } from '../components'; import { Window } from '../layouts'; import { CanvasLayer } from './CanvasLayer'; @@ -96,7 +96,8 @@ const HomePanel = (props, context) => { act('menuSelect', { selection: 'view', }) - }> + } + /> + } + /> + } + />
@@ -128,15 +131,13 @@ const HomePanel = (props, context) => { const ViewMapPanel = (props, context) => { const { data, act } = useBackend(context); return ( - <> - - + ); }; @@ -144,13 +145,11 @@ const OldMapPanel = (props, context) => { const { data, act } = useBackend(context); return ( - <> - - + ); }; @@ -187,7 +186,8 @@ const DrawMapPanel = (props, context) => { act('menuSelect', { selection: 'home', }) - }> + } + /> Date: Fri, 22 Sep 2023 17:52:46 -0700 Subject: [PATCH 040/161] general improvements --- code/controllers/subsystem/minimap.dm | 7 +++---- .../carbon/xenomorph/abilities/queen/queen_powers.dm | 5 ++++- .../mob/living/carbon/xenomorph/xeno_defines.dm | 2 ++ tgui/packages/tgui/interfaces/DrawnMap.js | 9 --------- tgui/packages/tgui/interfaces/TacticalMap.tsx | 11 +++++------ 5 files changed, 14 insertions(+), 20 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 1cbc2da454f7..6a076ea98b35 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -484,6 +484,9 @@ SUBSYSTEM_DEF(minimaps) // empty map icon without layered blips. var/base_map_png_asset + // flattend map asset + var/drawn_map_png_asset + // stored state for the current menu var/current_menu // boolean value to keep track if the canvas has been updated or not, the value is used in tgui state. @@ -491,9 +494,6 @@ SUBSYSTEM_DEF(minimaps) var/theme = DEFAULT_MINIMAP_THEME var/datum/tacmap_holder/map_holder - // shouldn't be shared, fix later - var/drawn_map_png_asset - // datum containing the flattend map and svg var/datum/svg_overlay/svg @@ -593,7 +593,6 @@ SUBSYSTEM_DEF(minimaps) if ("menuSelect") if(params["selection"] == "old_canvas") get_current_map(user) - to_chat(user, SPAN_WARNING("old_canvas")) current_menu = params["selection"] . = TRUE 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 65ea443c133c..6d9e9b3b6384 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,5 +698,8 @@ 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 a74fa7413804..f944aef9ad99 100644 --- a/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm +++ b/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm @@ -363,6 +363,7 @@ /// 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 @@ -372,6 +373,7 @@ 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/DrawnMap.js b/tgui/packages/tgui/interfaces/DrawnMap.js index 402de990aea8..ed1c520ec0cf 100644 --- a/tgui/packages/tgui/interfaces/DrawnMap.js +++ b/tgui/packages/tgui/interfaces/DrawnMap.js @@ -5,7 +5,6 @@ export class DrawnMap extends Component { super(props); this.containerRef = createRef(); this.flatImgSrc = this.props.flatImage; - this.backupImageSrc = this.props.imageSrc; this.svg = this.props.svgData; } @@ -25,14 +24,6 @@ export class DrawnMap extends Component { render() { const parsedSvgData = this.parseSvgData(this.svg); - if (this.imageSrc === null && this.backupImageSrc === null) { - return; - } - - if (this.flatImgSrc === null) { - this.flatImgSrc = this.backupImageSrc; - } - return (
{ const OldMapPanel = (props, context) => { const { data, act } = useBackend(context); - return ( - + <> + {data.flatImage && ( + + )} + ); }; From 645b766b9c4c89cccc4c12ab3b92f1d389ad22be Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 22 Sep 2023 17:58:31 -0700 Subject: [PATCH 041/161] ... --- tgui/packages/tgui/interfaces/TacticalMap.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 2c8a5475d6ff..4e4946c8af31 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -144,11 +144,9 @@ const ViewMapPanel = (props, context) => { const OldMapPanel = (props, context) => { const { data, act } = useBackend(context); return ( - <> - {data.flatImage && ( - - )} - + data.flatImage && ( + + ) ); }; From 5c75609ae044b2d0ed4b0cf7f45b65ba2d389a5e Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 22 Sep 2023 22:09:22 -0700 Subject: [PATCH 042/161] action button --- code/_globalvars/misc.dm | 3 ++ code/controllers/subsystem/minimap.dm | 16 +---------- .../computer/groundside_operations.dm | 5 ++++ .../objects/items/devices/helmet_visors.dm | 28 +++++++++++++++++-- code/modules/clothing/head/helmet.dm | 5 ++-- 5 files changed, 38 insertions(+), 19 deletions(-) diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index 6c689e995504..c95b7edf5214 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -21,6 +21,9 @@ 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) + /// 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 6a076ea98b35..a30b69b0b1b4 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -510,7 +510,6 @@ SUBSYSTEM_DEF(minimaps) return theme = DEFAULT_MINIMAP_THEME - /datum/tacmap/Destroy() map_holder = null owner = null @@ -522,17 +521,6 @@ SUBSYSTEM_DEF(minimaps) if(!level[1]) return map_holder = SSminimaps.fetch_tacmap_datum(level[1], allowed_flags) - var/icon/map_icon = map_holder.map - - //not the best way to do this, fix later - if(!base_map_png_asset) - var/list/faction_clients = list() - for(var/client/client in GLOB.clients) - var/mob/client_mob = client.mob - if(client_mob.faction == user.faction) - faction_clients += client - base_map_png_asset = icon2html(map_icon, faction_clients, sourceonly = TRUE) - // TODO: check if user has the cached asset. ui = SStgui.try_update_ui(user, src, ui) if(!ui) @@ -543,6 +531,7 @@ SUBSYSTEM_DEF(minimaps) xeno_user = user if(ishuman(user) && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT) || isqueen(user) && xeno_user.hivenumber == XENO_HIVE_NORMAL) + base_map_png_asset = icon2html(map_holder.map, user, sourceonly = TRUE) current_menu = "home" else if(isxeno(user) && xeno_user.hivenumber != XENO_HIVE_NORMAL) current_menu = "view" @@ -641,9 +630,6 @@ SUBSYSTEM_DEF(minimaps) faction_clients += client overlay.flat_tacmap = icon2html(overlay.flat_tacmap, faction_clients, sourceonly = TRUE) - // better to do it this way than icon2html on every new interface imo. - base_map_png_asset = icon2html(map_holder.map, faction_clients, sourceonly = TRUE) - if(user_faction == FACTION_XENOMORPH) var/mob/living/carbon/xenomorph/xeno = user xeno_announcement(outgoing_message, xeno.hivenumber) diff --git a/code/game/machinery/computer/groundside_operations.dm b/code/game/machinery/computer/groundside_operations.dm index 9856ae8f970e..8b5d7338b036 100644 --- a/code/game/machinery/computer/groundside_operations.dm +++ b/code/game/machinery/computer/groundside_operations.dm @@ -26,6 +26,11 @@ else if(SSticker.current_state < GAME_STATE_PLAYING) RegisterSignal(SSdcs, COMSIG_GLOB_MODE_PRESETUP, PROC_REF(disable_pmc)) tacmap = new(src, minimap_type) + + // global tacmap for marines to access through an action button. + // dumb implementation for testing, fix later. + var/datum/tacmap/uscm_tacmap + GLOB.tacmap_datum = new(uscm_tacmap, minimap_type) return ..() /obj/structure/machinery/computer/groundside_operations/Destroy() diff --git a/code/game/objects/items/devices/helmet_visors.dm b/code/game/objects/items/devices/helmet_visors.dm index dd913daf7620..50fc0315881b 100644 --- a/code/game/objects/items/devices/helmet_visors.dm +++ b/code/game/objects/items/devices/helmet_visors.dm @@ -26,14 +26,13 @@ /// Called to see if this visor is a special non-HUD visor /obj/item/device/helmet_visor/proc/visor_function(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user, silent = FALSE) + var/datum/mob_hud/current_mob_hud = huds[hud_type] if(attached_helmet == user.head && attached_helmet.active_visor == src) - var/datum/mob_hud/current_mob_hud = huds[hud_type] current_mob_hud.add_hud_to(user, attached_helmet) if(!silent) to_chat(user, SPAN_NOTICE("You activate [src] on [attached_helmet].")) return TRUE - var/datum/mob_hud/current_mob_hud = huds[hud_type] current_mob_hud.remove_hud_from(user, attached_helmet) if(!silent) to_chat(user, SPAN_NOTICE("You deactivate [src] on [attached_helmet].")) @@ -71,6 +70,9 @@ action_icon_string = "blank_hud_sight_down" helmet_overlay = "weld_visor" +/obj/item/device/helmet_visor/tactical_map_visor + name = "map visor" + /obj/item/device/helmet_visor/welding_visor/visor_function(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user, silent = FALSE) if(attached_helmet == user.head && attached_helmet.active_visor == src) attached_helmet.vision_impair = VISION_IMPAIR_MAX @@ -91,6 +93,28 @@ user.update_tint() return TRUE +/obj/item/device/helmet_visor/medical/advanced/can_toggle(mob/living/carbon/human/user) + if(skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT)) + to_chat(user, SPAN_NOTICE("This [src] is not for you to use.")) + return FALSE + + return TRUE + +/obj/item/device/helmet_visor/tactical_map_visor/visor_function(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user, silent = FALSE) + var/datum/mob_hud/current_mob_hud = huds[hud_type] + if(attached_helmet == user.head && attached_helmet.active_visor == src) + GLOB.tacmap_datum.tgui_interact(user) + current_mob_hud.add_hud_to(user, attached_helmet) + if(!silent) + to_chat(user, SPAN_NOTICE("You activate [src] on [attached_helmet].")) + return TRUE + + GLOB.tacmap_datum.ui_close(user) + current_mob_hud.remove_hud_from(user, attached_helmet) + if(!silent) + to_chat(user, SPAN_NOTICE("You deactivate [src] on [attached_helmet].")) + return TRUE + /obj/item/device/helmet_visor/welding_visor/mercenary helmet_overlay = "" diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index d5698fd4be32..0cebc53e8856 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -765,6 +765,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( icon_state = "sl_helmet" armor_bio = CLOTHING_ARMOR_MEDIUMHIGH specialty = "M11 pattern marine" + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/tactical_map_visor) /obj/item/clothing/head/helmet/marine/rto name = "\improper M12 pattern dust helmet" @@ -885,7 +886,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( armor_bio = CLOTHING_ARMOR_MEDIUMHIGH specialty = "M10 pattern captain" flags_atom = NO_SNOW_TYPE - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/security) + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/security, new /obj/item/device/helmet_visor/tactical_map_visor) /obj/item/clothing/head/helmet/marine/MP name = "\improper M10 pattern MP helmet" @@ -909,7 +910,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( icon_state = "helmet" item_state = "helmet" specialty = "M10 pattern officer" - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced) + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/tactical_map_visor) /obj/item/clothing/head/helmet/marine/mp/provost/marshal name = "\improper Provost Marshal Cap" From 371a6736911c0488926f24fa92f6696b9f39b33e Mon Sep 17 00:00:00 2001 From: doom Date: Sat, 23 Sep 2023 05:55:39 -0700 Subject: [PATCH 043/161] ... --- code/game/objects/items/devices/helmet_visors.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/game/objects/items/devices/helmet_visors.dm b/code/game/objects/items/devices/helmet_visors.dm index 50fc0315881b..a44ff81c4813 100644 --- a/code/game/objects/items/devices/helmet_visors.dm +++ b/code/game/objects/items/devices/helmet_visors.dm @@ -72,6 +72,9 @@ /obj/item/device/helmet_visor/tactical_map_visor name = "map visor" + icon_state = "tac_empty" + action_icon_string = "tac_hud_sight_down" + helmet_overlay = "tac_visor" /obj/item/device/helmet_visor/welding_visor/visor_function(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user, silent = FALSE) if(attached_helmet == user.head && attached_helmet.active_visor == src) From 3b8f2e759f123d77171e4362cdd7cd658f0f7461 Mon Sep 17 00:00:00 2001 From: doom Date: Sat, 23 Sep 2023 06:18:59 -0700 Subject: [PATCH 044/161] ... --- code/game/objects/items/devices/helmet_visors.dm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/code/game/objects/items/devices/helmet_visors.dm b/code/game/objects/items/devices/helmet_visors.dm index a44ff81c4813..9562141e30aa 100644 --- a/code/game/objects/items/devices/helmet_visors.dm +++ b/code/game/objects/items/devices/helmet_visors.dm @@ -72,9 +72,8 @@ /obj/item/device/helmet_visor/tactical_map_visor name = "map visor" - icon_state = "tac_empty" - action_icon_string = "tac_hud_sight_down" - helmet_overlay = "tac_visor" + action_icon_string = "tac_sight_down" + helmet_overlay = "tac_sight_right" /obj/item/device/helmet_visor/welding_visor/visor_function(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user, silent = FALSE) if(attached_helmet == user.head && attached_helmet.active_visor == src) From ace9fda0c3f7799719e8231412cc9b0b27709813 Mon Sep 17 00:00:00 2001 From: doom Date: Sat, 23 Sep 2023 07:32:14 -0700 Subject: [PATCH 045/161] ... --- code/game/objects/items/devices/helmet_visors.dm | 4 ++-- code/modules/clothing/head/helmet.dm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/game/objects/items/devices/helmet_visors.dm b/code/game/objects/items/devices/helmet_visors.dm index 9562141e30aa..6d8a9d8cbdbd 100644 --- a/code/game/objects/items/devices/helmet_visors.dm +++ b/code/game/objects/items/devices/helmet_visors.dm @@ -95,9 +95,9 @@ user.update_tint() return TRUE -/obj/item/device/helmet_visor/medical/advanced/can_toggle(mob/living/carbon/human/user) +/obj/item/device/helmet_visor/tactical_map_visor/can_toggle(mob/living/carbon/human/user) if(skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT)) - to_chat(user, SPAN_NOTICE("This [src] is not for you to use.")) + to_chat(user, SPAN_WARNING("[src] is not for you to use, [src] flickers as it powers off.")) return FALSE return TRUE diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index 0cebc53e8856..86488a930283 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -886,7 +886,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( armor_bio = CLOTHING_ARMOR_MEDIUMHIGH specialty = "M10 pattern captain" flags_atom = NO_SNOW_TYPE - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/security, new /obj/item/device/helmet_visor/tactical_map_visor) + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/security) /obj/item/clothing/head/helmet/marine/MP name = "\improper M10 pattern MP helmet" @@ -910,7 +910,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( icon_state = "helmet" item_state = "helmet" specialty = "M10 pattern officer" - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/tactical_map_visor) + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced) /obj/item/clothing/head/helmet/marine/mp/provost/marshal name = "\improper Provost Marshal Cap" From 1f71369732bae68125b87dcffb6e23d5cc98e34b Mon Sep 17 00:00:00 2001 From: doom Date: Sat, 23 Sep 2023 08:26:26 -0700 Subject: [PATCH 046/161] ... --- code/modules/clothing/head/helmet.dm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index 86488a930283..082d2809a617 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -780,11 +780,13 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( /obj/item/clothing/head/helmet/marine/rto/intel name = "\improper XM12 pattern intelligence helmet" desc = "An experimental brain-bucket. A dust ruffle hangs from back. Moderately better at deflecting blunt objects at the cost of humiliation, can also hold a second visor optic. But who will be laughing at the memorial? Not you, you'll be busy getting medals for your intel work." + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/tactical_map_visor) specialty = "XM12 pattern intel" /obj/item/clothing/head/helmet/marine/specialist name = "\improper B18 helmet" desc = "The B18 Helmet that goes along with the B18 Defensive Armor. It's heavy, reinforced, and protects more of the face." + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/tactical_map_visor) icon_state = "grenadier_helmet" item_state = "grenadier_helmet" armor_melee = CLOTHING_ARMOR_HIGH @@ -801,6 +803,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( /obj/item/clothing/head/helmet/marine/grenadier name = "\improper M3-G4 grenadier helmet" desc = "Pairs with the M3-G4 heavy grenadier plating. A distant cousin of the experimental B18 defensive helmet. Comes with inbuilt ear blast protection." + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/tactical_map_visor) icon_state = "grenadier_helmet" item_state = "grenadier_helmet" armor_melee = CLOTHING_ARMOR_MEDIUMHIGH @@ -818,6 +821,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( /obj/item/clothing/head/helmet/marine/scout name = "\improper M3-S light helmet" icon_state = "scout_helmet" + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/tactical_map_visor) desc = "A custom helmet designed for USCM Scouts." min_cold_protection_temperature = ICE_PLANET_MIN_COLD_PROT specialty = "M3-S light" @@ -825,6 +829,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( /obj/item/clothing/head/helmet/marine/pyro name = "\improper M35 pyrotechnician helmet" + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/tactical_map_visor) icon_state = "pyro_helmet" desc = "A helmet designed for USCM Pyrotechnicians." min_cold_protection_temperature = ICE_PLANET_MIN_COLD_PROT @@ -836,6 +841,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( name = "\improper M3-T bombardier helmet" icon_state = "sadar_helmet" desc = "A custom-built helmet for explosive weaponry users. Comes with inbuilt ear blast protection, firing a rocket launcher without this is not recommended." + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/tactical_map_visor) min_cold_protection_temperature = ICE_PLANET_MIN_COLD_PROT armor_bomb = CLOTHING_ARMOR_HIGH specialty = "M3-T bombardier" @@ -865,6 +871,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( /obj/item/clothing/head/helmet/marine/ghillie name = "\improper M45 ghillie helmet" desc = "A lightweight M45 helmet with ghillie coif used by USCM snipers on recon missions." + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/tactical_map_visor) icon_state = "ghillie_coif" armor_bomb = CLOTHING_ARMOR_MEDIUM armor_bio = CLOTHING_ARMOR_LOW From 86eef8a3384cf02e8150a7106d08924ea21ee382 Mon Sep 17 00:00:00 2001 From: doom Date: Sat, 23 Sep 2023 08:46:24 -0700 Subject: [PATCH 047/161] ... --- code/modules/clothing/head/helmet.dm | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index 082d2809a617..44fb92959d92 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -378,7 +378,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( var/helmet_overlay_icon = 'icons/mob/humans/onmob/head_1.dmi' ///Any visors built into the helmet - var/list/built_in_visors = list(new /obj/item/device/helmet_visor) + var/list/built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/tactical_map_visor) ///Any visors that have been added into the helmet var/list/inserted_visors = list() @@ -716,7 +716,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( desc = "A modified M10 marine helmet for ComTechs. Features a toggleable welding screen for eye protection." icon_state = "tech_helmet" specialty = "M10 technician" - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/welding_visor) + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/welding_visor, new /obj/item/device/helmet_visor/tactical_map_visor) /obj/item/clothing/head/helmet/marine/grey desc = "A standard M10 Pattern Helmet. This one has not had a camouflage pattern applied to it yet. There is a built-in camera on the right side." @@ -735,14 +735,14 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( flags_inventory = BLOCKSHARPOBJ flags_inv_hide = HIDEEARS|HIDETOPHAIR specialty = "M50 tanker" - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/welding_visor/tanker) + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/welding_visor/tanker, new /obj/item/device/helmet_visor/tactical_map_visor) /obj/item/clothing/head/helmet/marine/medic name = "\improper M10 corpsman helmet" desc = "An M10 marine helmet version worn by marine hospital corpsmen. Has red cross painted on its front." icon_state = "med_helmet" specialty = "M10 pattern medic" - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced) + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/tactical_map_visor) start_down_visor_type = /obj/item/device/helmet_visor/medical/advanced /obj/item/clothing/head/helmet/marine/covert @@ -765,7 +765,6 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( icon_state = "sl_helmet" armor_bio = CLOTHING_ARMOR_MEDIUMHIGH specialty = "M11 pattern marine" - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/tactical_map_visor) /obj/item/clothing/head/helmet/marine/rto name = "\improper M12 pattern dust helmet" @@ -780,13 +779,11 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( /obj/item/clothing/head/helmet/marine/rto/intel name = "\improper XM12 pattern intelligence helmet" desc = "An experimental brain-bucket. A dust ruffle hangs from back. Moderately better at deflecting blunt objects at the cost of humiliation, can also hold a second visor optic. But who will be laughing at the memorial? Not you, you'll be busy getting medals for your intel work." - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/tactical_map_visor) specialty = "XM12 pattern intel" /obj/item/clothing/head/helmet/marine/specialist name = "\improper B18 helmet" desc = "The B18 Helmet that goes along with the B18 Defensive Armor. It's heavy, reinforced, and protects more of the face." - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/tactical_map_visor) icon_state = "grenadier_helmet" item_state = "grenadier_helmet" armor_melee = CLOTHING_ARMOR_HIGH @@ -803,7 +800,6 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( /obj/item/clothing/head/helmet/marine/grenadier name = "\improper M3-G4 grenadier helmet" desc = "Pairs with the M3-G4 heavy grenadier plating. A distant cousin of the experimental B18 defensive helmet. Comes with inbuilt ear blast protection." - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/tactical_map_visor) icon_state = "grenadier_helmet" item_state = "grenadier_helmet" armor_melee = CLOTHING_ARMOR_MEDIUMHIGH @@ -821,7 +817,6 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( /obj/item/clothing/head/helmet/marine/scout name = "\improper M3-S light helmet" icon_state = "scout_helmet" - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/tactical_map_visor) desc = "A custom helmet designed for USCM Scouts." min_cold_protection_temperature = ICE_PLANET_MIN_COLD_PROT specialty = "M3-S light" @@ -829,7 +824,6 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( /obj/item/clothing/head/helmet/marine/pyro name = "\improper M35 pyrotechnician helmet" - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/tactical_map_visor) icon_state = "pyro_helmet" desc = "A helmet designed for USCM Pyrotechnicians." min_cold_protection_temperature = ICE_PLANET_MIN_COLD_PROT @@ -841,7 +835,6 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( name = "\improper M3-T bombardier helmet" icon_state = "sadar_helmet" desc = "A custom-built helmet for explosive weaponry users. Comes with inbuilt ear blast protection, firing a rocket launcher without this is not recommended." - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/tactical_map_visor) min_cold_protection_temperature = ICE_PLANET_MIN_COLD_PROT armor_bomb = CLOTHING_ARMOR_HIGH specialty = "M3-T bombardier" @@ -871,7 +864,6 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( /obj/item/clothing/head/helmet/marine/ghillie name = "\improper M45 ghillie helmet" desc = "A lightweight M45 helmet with ghillie coif used by USCM snipers on recon missions." - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/tactical_map_visor) icon_state = "ghillie_coif" armor_bomb = CLOTHING_ARMOR_MEDIUM armor_bio = CLOTHING_ARMOR_LOW From 2c6b294fa74e424b037a4270b06736d0505d3c70 Mon Sep 17 00:00:00 2001 From: doom Date: Sat, 23 Sep 2023 11:14:24 -0700 Subject: [PATCH 048/161] ... --- code/game/objects/items/devices/helmet_visors.dm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/game/objects/items/devices/helmet_visors.dm b/code/game/objects/items/devices/helmet_visors.dm index 6d8a9d8cbdbd..a96df205013a 100644 --- a/code/game/objects/items/devices/helmet_visors.dm +++ b/code/game/objects/items/devices/helmet_visors.dm @@ -72,8 +72,9 @@ /obj/item/device/helmet_visor/tactical_map_visor name = "map visor" - action_icon_string = "tac_sight_down" - helmet_overlay = "tac_sight_right" + icon_state = "meson_sight" + action_icon_string = "meson_sight_down" + helmet_overlay = "tacmap_visor" /obj/item/device/helmet_visor/welding_visor/visor_function(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user, silent = FALSE) if(attached_helmet == user.head && attached_helmet.active_visor == src) From d23a6adea4fe096140908e6042ec05aa216fffc2 Mon Sep 17 00:00:00 2001 From: doom Date: Sat, 23 Sep 2023 14:26:44 -0700 Subject: [PATCH 049/161] copy pasta --- code/game/objects/items/devices/helmet_visors.dm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/code/game/objects/items/devices/helmet_visors.dm b/code/game/objects/items/devices/helmet_visors.dm index a96df205013a..1268f68d5fec 100644 --- a/code/game/objects/items/devices/helmet_visors.dm +++ b/code/game/objects/items/devices/helmet_visors.dm @@ -73,6 +73,7 @@ /obj/item/device/helmet_visor/tactical_map_visor name = "map visor" icon_state = "meson_sight" + hud_type = null action_icon_string = "meson_sight_down" helmet_overlay = "tacmap_visor" @@ -104,16 +105,13 @@ return TRUE /obj/item/device/helmet_visor/tactical_map_visor/visor_function(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user, silent = FALSE) - var/datum/mob_hud/current_mob_hud = huds[hud_type] if(attached_helmet == user.head && attached_helmet.active_visor == src) GLOB.tacmap_datum.tgui_interact(user) - current_mob_hud.add_hud_to(user, attached_helmet) if(!silent) to_chat(user, SPAN_NOTICE("You activate [src] on [attached_helmet].")) return TRUE GLOB.tacmap_datum.ui_close(user) - current_mob_hud.remove_hud_from(user, attached_helmet) if(!silent) to_chat(user, SPAN_NOTICE("You deactivate [src] on [attached_helmet].")) return TRUE From 5dbff93fc474adf8a8a09e005575a9fa1dad4903 Mon Sep 17 00:00:00 2001 From: doom Date: Sat, 23 Sep 2023 16:04:18 -0700 Subject: [PATCH 050/161] ... --- code/controllers/subsystem/minimap.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index a30b69b0b1b4..14c6162d2cd4 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -612,7 +612,7 @@ SUBSYSTEM_DEF(minimaps) var/icon/flat_map = getFlatIcon(map_holder.map) var/datum/svg_overlay/overlay = new(params["image"], flat_map) - toolbar_updated_selection = "clear" + toolbar_updated_selection = "export" var/outgoing_message = stripped_multiline_input(user, "Optional message to announce with the tactical map", "Tactical Map Announcement", "") var/signed From 7bd02a98d4e4d5381d8ef7099998ba2391e97b7f Mon Sep 17 00:00:00 2001 From: doom Date: Sun, 24 Sep 2023 13:29:37 -0700 Subject: [PATCH 051/161] general improvements --- code/__HELPERS/icons.dm | 10 ++-- code/_globalvars/misc.dm | 2 +- code/controllers/subsystem/minimap.dm | 57 +++++++++++++++++-- .../computer/groundside_operations.dm | 2 +- .../objects/items/devices/helmet_visors.dm | 7 --- .../living/carbon/xenomorph/xeno_defines.dm | 2 +- tgui/packages/tgui/interfaces/TacticalMap.tsx | 50 +++++++++------- 7 files changed, 87 insertions(+), 43 deletions(-) diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index 99f621919771..0cb07db47ffc 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -451,9 +451,9 @@ world if ( addX1 != flatX1 \ - && addX2 != flatX2 \ - && addY1 != flatY1 \ - && addY2 != flatY2 \ + || addX2 != flatX2 \ + || addY1 != flatY1 \ + || addY2 != flatY2 \ ) // Resize the flattened icon so the new icon fits flat.Crop( @@ -464,8 +464,8 @@ world ) flatX1 = addX1 - flatX2 = addY1 - flatY1 = addX2 + flatX2 = addX2 + flatY1 = addY1 flatY2 = addY2 // Blend the overlay into the flattened icon diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index c95b7edf5214..4c00812cf28b 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -22,7 +22,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/marine_view_only) /// 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 14c6162d2cd4..d813c3cfaf2b 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -492,6 +492,8 @@ SUBSYSTEM_DEF(minimaps) // boolean value to keep track if the canvas has been updated or not, the value is used in tgui state. var/updated_canvas = FALSE var/theme = DEFAULT_MINIMAP_THEME + var/can_draw = FALSE + var/can_view_home = FALSE var/datum/tacmap_holder/map_holder // datum containing the flattend map and svg @@ -533,8 +535,8 @@ SUBSYSTEM_DEF(minimaps) if(ishuman(user) && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT) || isqueen(user) && xeno_user.hivenumber == XENO_HIVE_NORMAL) base_map_png_asset = icon2html(map_holder.map, user, sourceonly = TRUE) current_menu = "home" - else if(isxeno(user) && xeno_user.hivenumber != XENO_HIVE_NORMAL) - current_menu = "view" + can_draw = TRUE + can_view_home = TRUE else current_menu = "old_canvas" @@ -542,6 +544,40 @@ SUBSYSTEM_DEF(minimaps) ui = new(user, src, "TacticalMap") ui.open() +/datum/tacmap/xeno/xeno_view/tgui_interact(mob/user, datum/tgui/ui) + if(!map_holder) + var/level = SSmapping.levels_by_trait(targeted_ztrait) + if(!level[1]) + return + map_holder = SSminimaps.fetch_tacmap_datum(level[1], allowed_flags) + + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + + get_current_map(user) + current_menu = "home" + can_view_home = TRUE + + user.client.register_map_obj(map_holder.map) + ui = new(user, src, "TacticalMap") + ui.open() + +/datum/tacmap/marine_view_only/tgui_interact(mob/user, datum/tgui/ui) + if(!map_holder) + var/level = SSmapping.levels_by_trait(targeted_ztrait) + if(!level[1]) + return + map_holder = SSminimaps.fetch_tacmap_datum(level[1], allowed_flags) + + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + get_current_map(user) + current_menu = "old_canvas" + + user.client.register_map_obj(map_holder.map) + ui = new(user, src, "TacticalMap") + ui.open() + /datum/tacmap/ui_data(mob/user) var/list/data = list() @@ -549,6 +585,9 @@ SUBSYSTEM_DEF(minimaps) // empty map dmi image used as the background for the canvas data["imageSrc"] = base_map_png_asset + data["canDraw"] = can_draw + data["canViewHome"] = can_view_home + //flat image of most recently announced tacmap data["flatImage"] = drawn_map_png_asset @@ -618,20 +657,26 @@ SUBSYSTEM_DEF(minimaps) var/signed var/user_faction + var/mob/living/carbon/xenomorph/xeno if(isxeno(user)) - user_faction = FACTION_XENOMORPH + xeno = user + user_faction = xeno.hivenumber else user_faction = FACTION_MARINE var/list/faction_clients = list() for(var/client/client in GLOB.clients) var/mob/client_mob = client.mob - if(client_mob.faction == user_faction) + if(isxeno(client_mob)) + xeno = client_mob + if(xeno.hivenumber == user_faction) + faction_clients += client + else if(client_mob.faction == user_faction) faction_clients += client overlay.flat_tacmap = icon2html(overlay.flat_tacmap, faction_clients, sourceonly = TRUE) - if(user_faction == FACTION_XENOMORPH) - var/mob/living/carbon/xenomorph/xeno = user + if(isxeno(user)) + xeno = user xeno_announcement(outgoing_message, xeno.hivenumber) GLOB.xeno_flat_tacmap += overlay else diff --git a/code/game/machinery/computer/groundside_operations.dm b/code/game/machinery/computer/groundside_operations.dm index 8b5d7338b036..d319f1de8a19 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/marine_view_only/uscm_tacmap GLOB.tacmap_datum = new(uscm_tacmap, minimap_type) return ..() diff --git a/code/game/objects/items/devices/helmet_visors.dm b/code/game/objects/items/devices/helmet_visors.dm index 1268f68d5fec..604acaa817a9 100644 --- a/code/game/objects/items/devices/helmet_visors.dm +++ b/code/game/objects/items/devices/helmet_visors.dm @@ -97,13 +97,6 @@ user.update_tint() return TRUE -/obj/item/device/helmet_visor/tactical_map_visor/can_toggle(mob/living/carbon/human/user) - if(skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT)) - to_chat(user, SPAN_WARNING("[src] is not for you to use, [src] flickers as it powers off.")) - return FALSE - - return TRUE - /obj/item/device/helmet_visor/tactical_map_visor/visor_function(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user, silent = FALSE) if(attached_helmet == user.head && attached_helmet.active_visor == src) GLOB.tacmap_datum.tgui_interact(user) diff --git a/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm b/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm index f944aef9ad99..288d135272d3 100644 --- a/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm +++ b/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm @@ -364,7 +364,7 @@ var/playable_lesser_drones_max_divisor = 3 var/datum/tacmap/xeno/queen_tacmap - var/datum/tacmap/xeno/tacmap + var/datum/tacmap/xeno/xeno_view/tacmap var/minimap_type = MINIMAP_FLAG_XENO /datum/hive_status/New() diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 4e4946c8af31..acb9b6dd7f40 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -12,6 +12,8 @@ interface TacMapProps { imageSrc: string; themeId: number; svgData: any; + canViewHome: boolean; + canDraw: boolean; flatImage: string; mapRef: any; currentMenu: string; @@ -75,6 +77,18 @@ export const TacticalMap = (props, context) => { theme={themes[data.themeId]['theme']} title={'Tactical Map'}> + {data.canViewHome == true && ( +
); @@ -175,16 +191,6 @@ const DrawMapPanel = (props, context) => { return ( <>
-
- ); -}; - const ViewMapPanel = (props, context) => { - const { data, act } = useBackend(context); + const { data } = useBackend(context); return ( - +
+ +
); }; const OldMapPanel = (props, context) => { - const { data, act } = useBackend(context); + const { data } = useBackend(context); return ( - data.flatImage && ( - - ) +
+ {data.flatImage ? ( + + ) : ( + 'No Tactical Map Announcement Found' + )} +
); }; @@ -274,7 +268,7 @@ const DrawMapPanel = (props, context) => {
From 46957f8812da2a8ad4e1cbb88437d545ed8c0e63 Mon Sep 17 00:00:00 2001 From: doom Date: Mon, 25 Sep 2023 21:36:11 -0700 Subject: [PATCH 060/161] ... --- tgui/packages/tgui/interfaces/TacticalMap.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 84a0baed0f41..7e1be28a8bc7 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -1,5 +1,5 @@ import { useBackend, useLocalState } from '../backend'; -import { Button, Dropdown, Section, Stack, ProgressBar, Box, Tabs, LabeledList } from '../components'; +import { Button, Dropdown, Section, Stack, ProgressBar, Box, Tabs } from '../components'; import { Window } from '../layouts'; import { CanvasLayer } from './CanvasLayer'; import { DrawnMap } from './DrawnMap'; From fb1511aaf76285a20d4ada4652570ae260d58447 Mon Sep 17 00:00:00 2001 From: doom Date: Tue, 26 Sep 2023 12:24:37 -0700 Subject: [PATCH 061/161] progress --- code/__DEFINES/minimap.dm | 5 - code/_globalvars/global_lists.dm | 6 +- code/controllers/subsystem/minimap.dm | 112 +++++++++--------- .../xenomorph/abilities/queen/queen_powers.dm | 5 +- .../living/carbon/xenomorph/xeno_defines.dm | 2 - tgui/packages/tgui/interfaces/TacticalMap.tsx | 19 +-- 6 files changed, 71 insertions(+), 78 deletions(-) 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' )}
); From a8487fa0f38ad31d609476511a3d0baeed9ed429 Mon Sep 17 00:00:00 2001 From: doom Date: Tue, 26 Sep 2023 13:22:00 -0700 Subject: [PATCH 062/161] ... --- code/controllers/subsystem/minimap.dm | 5 ++++- tgui/packages/tgui/interfaces/TacticalMap.tsx | 22 +++++++++---------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index c385cb9f26db..491bd89810ee 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -541,6 +541,9 @@ SUBSYSTEM_DEF(minimaps) ui = SStgui.try_update_ui(user, src, ui) if(!ui) + current_map = get_current_map(user) + if(!current_map) + distribute_current_map_png(user) user.client.register_map_obj(map_holder.map) ui = new(user, src, "TacticalMap") @@ -603,7 +606,7 @@ SUBSYSTEM_DEF(minimaps) if ("menuSelect") if(params["selection"] == "new canvas") distribute_current_map_png(user) - current_map = get_current_map(user) + . = TRUE if ("updateCanvas") diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 93b73be75087..4ca48bc0a034 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -98,7 +98,7 @@ export const TacticalMap = (props, context) => { }; return ( - +
{ return ( handleTacmapOnClick(i, page.title)}> @@ -137,15 +137,15 @@ const ViewMapPanel = (props, context) => { const { data } = useBackend(context); return (
- {data.canViewHome === 1 && - - } + {data.canViewHome === 1 && ( + + )}
); }; From c75b1e53d9cdb51354e9f9cc63516706f220e059 Mon Sep 17 00:00:00 2001 From: doom Date: Tue, 26 Sep 2023 14:23:54 -0700 Subject: [PATCH 063/161] tacmap --- code/controllers/subsystem/minimap.dm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 491bd89810ee..bb44033f6747 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -552,14 +552,9 @@ SUBSYSTEM_DEF(minimaps) /datum/tacmap/ui_data(mob/user) var/list/data = list() - data["flatImage"] = null + data["flatImage"] = get_current_map(user, TRUE) data["svgData"] = null - current_map = get_current_map(user) - if(current_map) - data["flatImage"] = current_map.flat_tacmap - data["svgData"] = current_map.svg_data - data["mapRef"] = map_holder.map_ref data["toolbarColorSelection"] = toolbar_color_selection data["toolbarUpdatedSelection"] = toolbar_updated_selection @@ -568,6 +563,11 @@ SUBSYSTEM_DEF(minimaps) data["nextCanvasTime"] = canvas_cooldown_time data["updatedCanvas"] = updated_canvas + current_map = get_current_map(user) + if(current_map) + data["flatImage"] = current_map.flat_tacmap + data["svgData"] = current_map.svg_data + return data /datum/tacmap/ui_static_data(mob/user) @@ -586,6 +586,7 @@ 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 + distribute_current_map_png(user) return data From 60c6bac8132b5b35ae1f056bbf2b6d7096628f67 Mon Sep 17 00:00:00 2001 From: doom Date: Tue, 26 Sep 2023 15:00:27 -0700 Subject: [PATCH 064/161] ... --- code/controllers/subsystem/minimap.dm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index bb44033f6747..9df9d2c76f83 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -551,8 +551,9 @@ SUBSYSTEM_DEF(minimaps) /datum/tacmap/ui_data(mob/user) var/list/data = list() + //todo: upon joining user should have the base map without layered icons as default. Otherwise loads failed png for a new user. + data["flatImage"] = null - data["flatImage"] = get_current_map(user, TRUE) data["svgData"] = null data["mapRef"] = map_holder.map_ref @@ -587,6 +588,7 @@ SUBSYSTEM_DEF(minimaps) data["canDraw"] = TRUE data["canViewHome"] = TRUE distribute_current_map_png(user) + data["flatImage"] = get_current_map(user, TRUE) return data @@ -612,8 +614,6 @@ SUBSYSTEM_DEF(minimaps) if ("updateCanvas") toolbar_updated_selection = "export" - COOLDOWN_START(src, canvas_cooldown, canvas_cooldown_time) - updated_canvas = TRUE . = TRUE @@ -638,6 +638,7 @@ SUBSYSTEM_DEF(minimaps) . = TRUE if ("selectAnnouncement") + COOLDOWN_START(src, canvas_cooldown, canvas_cooldown_time) var/current_map_asset = get_current_map(user, TRUE) var/datum/svg_overlay/svg_overlay = new(params["image"], current_map_asset) From d9ebaa71585adddc2a7c16b98842cba841f9739e Mon Sep 17 00:00:00 2001 From: doom Date: Tue, 26 Sep 2023 15:00:47 -0700 Subject: [PATCH 065/161] ... --- code/controllers/subsystem/minimap.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 24cb49c5ded2..92f16ec703bf 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -551,7 +551,7 @@ SUBSYSTEM_DEF(minimaps) /datum/tacmap/ui_data(mob/user) var/list/data = list() - //todo: upon joining user should have the base map without layered icons as default. Otherwise loads failed png for a new user. + //todo: upon joining user should have the base map without layered icons as default. Otherwise loads failed png for a new user. data["flatImage"] = null data["svgData"] = null From 91271b9b389d6fd614495d0471fc60256dd1aa8f Mon Sep 17 00:00:00 2001 From: doom Date: Tue, 26 Sep 2023 15:21:52 -0700 Subject: [PATCH 066/161] ... --- code/controllers/subsystem/minimap.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 92f16ec703bf..7d44bd12201d 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -552,7 +552,7 @@ SUBSYSTEM_DEF(minimaps) /datum/tacmap/ui_data(mob/user) var/list/data = list() //todo: upon joining user should have the base map without layered icons as default. Otherwise loads failed png for a new user. - data["flatImage"] = null + data["flatImage"] = get_current_map(user, TRUE) data["svgData"] = null From 1013ad839e36561d227060e0d11bee745c89683c Mon Sep 17 00:00:00 2001 From: doom Date: Tue, 26 Sep 2023 16:00:50 -0700 Subject: [PATCH 067/161] ... --- code/controllers/subsystem/minimap.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 7d44bd12201d..ac53f4295fb3 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -350,7 +350,7 @@ SUBSYSTEM_DEF(minimaps) if(!isxeno(user)) return if(png_asset_only) - map_list = GLOB.uscm_flat_tacmap_png_asset + map_list = GLOB.xeno_flat_tacmap_png_asset else map_list = GLOB.xeno_flat_tacmap @@ -385,7 +385,7 @@ SUBSYSTEM_DEF(minimaps) faction_clients += client 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) + if(!isxeno(user)) GLOB.uscm_flat_tacmap_png_asset += flat_tacmap_png else GLOB.xeno_flat_tacmap_png_asset += flat_tacmap_png From 9553df48bf3da3487a942d42f139e26b3088ae38 Mon Sep 17 00:00:00 2001 From: doom Date: Tue, 26 Sep 2023 16:11:12 -0700 Subject: [PATCH 068/161] ... --- code/controllers/subsystem/minimap.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index ac53f4295fb3..c08e248f7afb 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -588,7 +588,6 @@ SUBSYSTEM_DEF(minimaps) data["canDraw"] = TRUE data["canViewHome"] = TRUE distribute_current_map_png(user) - data["flatImage"] = get_current_map(user, TRUE) return data From 23294064d478a1d9720af9441f1eb3aca621c867 Mon Sep 17 00:00:00 2001 From: doom Date: Tue, 26 Sep 2023 20:54:06 -0700 Subject: [PATCH 069/161] fixed visor --- code/controllers/subsystem/minimap.dm | 3 ++- code/game/objects/items/devices/helmet_visors.dm | 6 +++--- code/modules/clothing/head/helmet.dm | 10 ++++++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index c08e248f7afb..34a4f8311f93 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -381,7 +381,8 @@ SUBSYSTEM_DEF(minimaps) xeno = client_mob if(xeno.hivenumber == user_faction) faction_clients += client - else if(client_mob.faction == user_faction) + else if(client_mob.faction == user_faction) // TODO: not distributing properly, fix. + to_chat(user, SPAN_WARNING(client)) faction_clients += client COOLDOWN_START(src, flatten_map_cooldown, flatten_map_cooldown_time) var/flat_tacmap_png = icon2html(flat_map, faction_clients, sourceonly = TRUE) diff --git a/code/game/objects/items/devices/helmet_visors.dm b/code/game/objects/items/devices/helmet_visors.dm index 604acaa817a9..40242e679f43 100644 --- a/code/game/objects/items/devices/helmet_visors.dm +++ b/code/game/objects/items/devices/helmet_visors.dm @@ -97,14 +97,14 @@ user.update_tint() return TRUE -/obj/item/device/helmet_visor/tactical_map_visor/visor_function(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user, silent = FALSE) - if(attached_helmet == user.head && attached_helmet.active_visor == src) +/obj/item/device/helmet_visor/tactical_map_visor/visor_function(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user, silent = FALSE, toggle_type) + if(attached_helmet == user.head && attached_helmet.active_visor == src && toggle_type) GLOB.tacmap_datum.tgui_interact(user) if(!silent) to_chat(user, SPAN_NOTICE("You activate [src] on [attached_helmet].")) return TRUE - GLOB.tacmap_datum.ui_close(user) + SStgui.close_user_uis(user, GLOB.tacmap_datum) if(!silent) to_chat(user, SPAN_NOTICE("You deactivate [src] on [attached_helmet].")) return TRUE diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index 4dcefc21b3b6..f9c6f6f76e81 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -623,7 +623,10 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( return if(active_visor.can_toggle(user)) - active_visor.visor_function(src, user) + if(istype(active_visor, /obj/item/device/helmet_visor/tactical_map_visor)) + active_visor.visor_function(src, user, FALSE, TRUE) + else + active_visor.visor_function(src, user) playsound_client(user.client, active_visor.toggle_on_sound, null, 75) update_icon() @@ -634,7 +637,10 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( return if(current_visor.can_toggle(user)) - current_visor.visor_function(src, user) + if(istype(current_visor, /obj/item/device/helmet_visor/tactical_map_visor)) + current_visor.visor_function(src, user, sound, FALSE) + else + current_visor.visor_function(src, user) if(sound) playsound_client(user.client, current_visor.toggle_off_sound, null, 75) From 79d20d23c792f8c2f7ef9c8c8a376e68f23c133b Mon Sep 17 00:00:00 2001 From: doom Date: Wed, 27 Sep 2023 11:44:37 -0700 Subject: [PATCH 070/161] such immense suffering. --- code/modules/clothing/head/helmet.dm | 4 ++-- tgui/packages/tgui/interfaces/CanvasLayer.js | 9 ++++---- tgui/packages/tgui/interfaces/TacticalMap.tsx | 22 +++++++++++-------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index f9c6f6f76e81..b9ad4a96b315 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -891,7 +891,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( armor_bio = CLOTHING_ARMOR_MEDIUMHIGH specialty = "M10 pattern captain" flags_atom = NO_SNOW_TYPE - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/security) + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/security, new /obj/item/device/helmet_visor/tactical_map_visor) /obj/item/clothing/head/helmet/marine/MP name = "\improper M10 pattern MP helmet" @@ -915,7 +915,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( icon_state = "helmet" item_state = "helmet" specialty = "M10 pattern officer" - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced) + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/tactical_map_visor) /obj/item/clothing/head/helmet/marine/mp/provost/marshal name = "\improper Provost Marshal Cap" diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index 2562bd1e23bf..cbfd0b81e30c 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -92,7 +92,7 @@ export class CanvasLayer extends Component { this.lastY, x, y, - this.state.selection, + this.ctx.strokeStyle, ]); } @@ -133,11 +133,12 @@ export class CanvasLayer extends Component { if (this.lineStack.length === 0) { return; } - const line = this.lineStack[this.lineStack.length - 1]; - // selects last color before line is yeeted, this is buggy sometimes. + const line = this.lineStack.pop(); + if (line.length === 0) { + return; + } const prevColor = line[0][4]; - this.lineStack.pop(); this.ctx.clearRect( 0, diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 4ca48bc0a034..d5adc25c7a3b 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -135,17 +135,21 @@ export const TacticalMap = (props, context) => { const ViewMapPanel = (props, context) => { const { data } = useBackend(context); + + //byond ui can't resist trying to render + if (data.canViewHome !== 1) { + return ; + } + return (
- {data.canViewHome === 1 && ( - - )} +
); }; From 7319fa623567c6015da2f57c02d664dc75b5ae17 Mon Sep 17 00:00:00 2001 From: doom Date: Wed, 27 Sep 2023 12:08:10 -0700 Subject: [PATCH 071/161] ... --- tgui/packages/tgui/interfaces/TacticalMap.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index d5adc25c7a3b..c92cd6f6dc2d 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -136,7 +136,7 @@ export const TacticalMap = (props, context) => { const ViewMapPanel = (props, context) => { const { data } = useBackend(context); - //byond ui can't resist trying to render + // byond ui can't resist trying to render if (data.canViewHome !== 1) { return ; } From 47241c9b7593b2e4876afdab90178b31cb5cf538 Mon Sep 17 00:00:00 2001 From: doom Date: Wed, 27 Sep 2023 13:42:09 -0700 Subject: [PATCH 072/161] ... --- code/_globalvars/misc.dm | 4 ++++ code/controllers/subsystem/minimap.dm | 9 ++++++--- tgui/packages/tgui/interfaces/TacticalMap.tsx | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index c95b7edf5214..a8887812c7c6 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -14,6 +14,10 @@ GLOBAL_LIST_INIT(pill_icon_mappings, map_pill_icons()) /// In-round override to default OOC color GLOBAL_VAR(ooc_color_override) +// tacmap cooldown for xenos and marines +GLOBAL_VAR_INIT(uscm_canvas_cooldown, 0) +GLOBAL_VAR_INIT(xeno_canvas_cooldown, 0) + /// List of roles that can be setup for each gamemode GLOBAL_LIST_INIT(gamemode_roles, list()) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 34a4f8311f93..074a49a82b47 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -512,7 +512,6 @@ SUBSYSTEM_DEF(minimaps) var/canvas_cooldown_time = 4 MINUTES var/flatten_map_cooldown_time = 3 MINUTES - COOLDOWN_DECLARE(canvas_cooldown) COOLDOWN_DECLARE(flatten_map_cooldown) //tacmap holder for holding the minimap @@ -561,7 +560,10 @@ SUBSYSTEM_DEF(minimaps) data["toolbarColorSelection"] = toolbar_color_selection data["toolbarUpdatedSelection"] = toolbar_updated_selection data["worldtime"] = world.time - data["canvasCooldown"] = canvas_cooldown + if(isxeno(user)) + data["canvasCooldown"] = GLOB.xeno_canvas_cooldown + else + data["canvasCooldown"] = GLOB.uscm_canvas_cooldown data["nextCanvasTime"] = canvas_cooldown_time data["updatedCanvas"] = updated_canvas @@ -638,7 +640,6 @@ SUBSYSTEM_DEF(minimaps) . = TRUE if ("selectAnnouncement") - COOLDOWN_START(src, canvas_cooldown, canvas_cooldown_time) var/current_map_asset = get_current_map(user, TRUE) var/datum/svg_overlay/svg_overlay = new(params["image"], current_map_asset) @@ -654,6 +655,7 @@ SUBSYSTEM_DEF(minimaps) xeno = user xeno_announcement(outgoing_message, xeno.hivenumber) GLOB.xeno_flat_tacmap += svg_overlay + COOLDOWN_START(GLOB, xeno_canvas_cooldown, canvas_cooldown_time) else GLOB.uscm_flat_tacmap += svg_overlay var/mob/living/carbon/human/H = user @@ -662,6 +664,7 @@ SUBSYSTEM_DEF(minimaps) var/paygrade = get_paygrades(id.paygrade, FALSE, H.gender) signed = "[paygrade] [id.registered_name]" marine_announcement(outgoing_message, "Tactical Map Announcement", signature = signed) + 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]") diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index c92cd6f6dc2d..877a86f64dda 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -98,7 +98,7 @@ export const TacticalMap = (props, context) => { }; return ( - +
Date: Wed, 27 Sep 2023 16:14:01 -0700 Subject: [PATCH 073/161] ... --- code/controllers/subsystem/minimap.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 074a49a82b47..aa581f1d9752 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -590,7 +590,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 - distribute_current_map_png(user) return data From 63e4a82e2d186ac154d9bdb23da3f3227a48bd0b Mon Sep 17 00:00:00 2001 From: doom Date: Wed, 27 Sep 2023 19:31:07 -0700 Subject: [PATCH 074/161] refactor --- code/_globalvars/global_lists.dm | 8 ++-- code/controllers/subsystem/minimap.dm | 56 +++++++++++++++------------ 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/code/_globalvars/global_lists.dm b/code/_globalvars/global_lists.dm index 5c1a28aa6bdf..4e1250c61df1 100644 --- a/code/_globalvars/global_lists.dm +++ b/code/_globalvars/global_lists.dm @@ -9,13 +9,13 @@ 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 -//datum containing only the flat tacmap png asset +//datum containing only a reference to the flattend map png, the actual png is stored in the user's cache. 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) +//datum containing the svg overlay coords in array format. +GLOBAL_LIST_EMPTY(uscm_svg_overlay) +GLOBAL_LIST_EMPTY(xeno_svg_overlay) GLOBAL_LIST_EMPTY(failed_fultons) //A list of fultoned items which weren't collected and fell back down GLOBAL_LIST_EMPTY(larva_burst_by_hive) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index aa581f1d9752..c9db6d8440c0 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -338,21 +338,26 @@ SUBSYSTEM_DEF(minimaps) hashed_minimaps[hash] = map return map - -/datum/tacmap/proc/get_current_map(mob/user, png_asset_only = FALSE) +/** + * Fetches either flattend map png asset or the svg coords datum + * Arguments: + * * user: to determine whivh faction get the map from. + * * asset_type: true for png, false for svg + */ +/datum/tacmap/proc/get_current_map(mob/user, asset_type) var/list/map_list if(ishuman(user)) - if(png_asset_only) + if(asset_type) map_list = GLOB.uscm_flat_tacmap_png_asset else - map_list = GLOB.uscm_flat_tacmap + map_list = GLOB.uscm_svg_overlay else if(!isxeno(user)) return - if(png_asset_only) + if(asset_type) map_list = GLOB.xeno_flat_tacmap_png_asset else - map_list = GLOB.xeno_flat_tacmap + map_list = GLOB.uscm_svg_overlay if(map_list.len == 0) return @@ -386,10 +391,12 @@ SUBSYSTEM_DEF(minimaps) faction_clients += client COOLDOWN_START(src, flatten_map_cooldown, flatten_map_cooldown_time) var/flat_tacmap_png = icon2html(flat_map, faction_clients, sourceonly = TRUE) + var/datum/flattend_tacmap_png = new(flat_tacmap_png) if(!isxeno(user)) - GLOB.uscm_flat_tacmap_png_asset += flat_tacmap_png + GLOB.uscm_flat_tacmap_png_asset += flattend_tacmap_png else - GLOB.xeno_flat_tacmap_png_asset += flat_tacmap_png + GLOB.xeno_flat_tacmap_png_asset += flattend_tacmap_png + qdel(flattend_tacmap_png) /datum/controller/subsystem/minimaps/proc/fetch_tacmap_datum(zlevel, flags) @@ -541,7 +548,7 @@ SUBSYSTEM_DEF(minimaps) ui = SStgui.try_update_ui(user, src, ui) if(!ui) - current_map = get_current_map(user) + current_map = get_current_map(user, TRUE) if(!current_map) distribute_current_map_png(user) @@ -552,9 +559,10 @@ SUBSYSTEM_DEF(minimaps) /datum/tacmap/ui_data(mob/user) var/list/data = list() //todo: upon joining user should have the base map without layered icons as default. Otherwise loads failed png for a new user. - data["flatImage"] = get_current_map(user, TRUE) - data["svgData"] = null + // it's getting a datum of type + data["flatImage"] = get_current_map(user, TRUE).flat_tacmap + data["svgData"] = get_current_map(user, FALSE).svg_data data["mapRef"] = map_holder.map_ref data["toolbarColorSelection"] = toolbar_color_selection @@ -567,11 +575,6 @@ SUBSYSTEM_DEF(minimaps) data["nextCanvasTime"] = canvas_cooldown_time data["updatedCanvas"] = updated_canvas - current_map = get_current_map(user) - if(current_map) - data["flatImage"] = current_map.flat_tacmap - data["svgData"] = current_map.svg_data - return data /datum/tacmap/ui_static_data(mob/user) @@ -609,7 +612,7 @@ SUBSYSTEM_DEF(minimaps) switch (action) if ("menuSelect") if(params["selection"] == "new canvas") - distribute_current_map_png(user) + distribute_current_map_png(user) // not updating? . = TRUE @@ -639,9 +642,7 @@ SUBSYSTEM_DEF(minimaps) . = TRUE if ("selectAnnouncement") - - var/current_map_asset = get_current_map(user, TRUE) - var/datum/svg_overlay/svg_overlay = new(params["image"], current_map_asset) + var/datum/svg_overlay/svg_overlay = new(params["image"]) var/outgoing_message = stripped_multiline_input(user, "Optional message to announce with the tactical map", "Tactical Map Announcement", "") if(!outgoing_message) @@ -653,10 +654,10 @@ SUBSYSTEM_DEF(minimaps) if(isxeno(user)) xeno = user xeno_announcement(outgoing_message, xeno.hivenumber) - GLOB.xeno_flat_tacmap += svg_overlay + GLOB.xeno_svg_overlay += svg_overlay COOLDOWN_START(GLOB, xeno_canvas_cooldown, canvas_cooldown_time) else - GLOB.uscm_flat_tacmap += svg_overlay + GLOB.uscm_svg_overlay += svg_overlay var/mob/living/carbon/human/H = user var/obj/item/card/id/id = H.wear_id if(istype(id)) @@ -707,10 +708,15 @@ SUBSYSTEM_DEF(minimaps) map = null return ..() +// datums for holding both the flattened png asset and overlay. It's best to keep them separate with the current implementation imo. +/datum/flat_tacmap_png + var/flat_tacmap + +/datum/flat_tacmap_png/New(flat_tacmap) + src.flat_tacmap = flat_tacmap + /datum/svg_overlay var/svg_data - var/flat_tacmap -/datum/svg_overlay/New(svg_data, flat_tacmap) +/datum/svg_overlay/New(svg_data) src.svg_data = svg_data - src.flat_tacmap = flat_tacmap From 29420bf3b3f68b19cda6096e671e8729b3fcdce3 Mon Sep 17 00:00:00 2001 From: doom Date: Wed, 27 Sep 2023 20:04:30 -0700 Subject: [PATCH 075/161] ... --- code/controllers/subsystem/minimap.dm | 58 +++++++++++++++++++-------- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index c9db6d8440c0..a879c4806d90 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -339,12 +339,12 @@ SUBSYSTEM_DEF(minimaps) return map /** - * Fetches either flattend map png asset or the svg coords datum + * Fetches either a datum containing either a flattend map png reference or a set of given svg coords * Arguments: - * * user: to determine whivh faction get the map from. + * * user: to determine which faction get the map from. * * asset_type: true for png, false for svg */ -/datum/tacmap/proc/get_current_map(mob/user, asset_type) +/datum/proc/get_current_tacmap_data(mob/user, asset_type) var/list/map_list if(ishuman(user)) if(asset_type) @@ -364,6 +364,11 @@ SUBSYSTEM_DEF(minimaps) return map_list[map_list.len] +/** + * flattens the current map and then distributes it based off user faction. + * Arguments: + * * user: to determine which faction to distribute to + */ /datum/tacmap/proc/distribute_current_map_png(mob/user) if(!COOLDOWN_FINISHED(src, flatten_map_cooldown)) return @@ -398,6 +403,27 @@ SUBSYSTEM_DEF(minimaps) GLOB.xeno_flat_tacmap_png_asset += flattend_tacmap_png qdel(flattend_tacmap_png) +/** + * globally stores svg coords for a given faction. + * Arguments: + * * user: to determine which faction to distribute to + * * svg_coords: an array of coordinates corresponding to an svg. + */ +/datum/tacmap/proc/store_current_svg_coords(mob/user, svg_coords) + if(!svg_coords) + to_chat(user, SPAN_WARNING("The tacmap filckers and then shuts off, a critical error has occured")) // tf2heavy: "Oh, this is bad!" + return FALSE + + var/datum/svg_overlay/svg_overlay = new(svg_coords) + + if(isxeno(user)) + GLOB.xeno_svg_overlay += svg_overlay + else + GLOB.uscm_svg_overlay += svg_overlay + + return TRUE + qdel(svg_overlay) + /datum/controller/subsystem/minimaps/proc/fetch_tacmap_datum(zlevel, flags) var/hash = "[zlevel]-[flags]" @@ -527,7 +553,7 @@ SUBSYSTEM_DEF(minimaps) // boolean value to keep track if the canvas has been updated or not, the value is used in tgui state. var/updated_canvas = FALSE - var/datum/svg_overlay/current_map + var/datum/flattend_tacmap_png/current_map /datum/tacmap/New(atom/source, minimap_type) @@ -548,7 +574,7 @@ SUBSYSTEM_DEF(minimaps) ui = SStgui.try_update_ui(user, src, ui) if(!ui) - current_map = get_current_map(user, TRUE) + current_map = get_current_tacmap_data(user, TRUE) if(!current_map) distribute_current_map_png(user) @@ -559,10 +585,13 @@ SUBSYSTEM_DEF(minimaps) /datum/tacmap/ui_data(mob/user) var/list/data = list() //todo: upon joining user should have the base map without layered icons as default. Otherwise loads failed png for a new user. + data["flatImage"] = null + data["svgData"] = null - // it's getting a datum of type - data["flatImage"] = get_current_map(user, TRUE).flat_tacmap - data["svgData"] = get_current_map(user, FALSE).svg_data + // current_map = get_current_tacmap_data(user, TRUE) + // if(current_map) + // data["flatImage"] = current_map.flat_tacmap + // data["svgData"] = get_current_tacmap_data(user, FALSE).svg_data data["mapRef"] = map_holder.map_ref data["toolbarColorSelection"] = toolbar_color_selection @@ -642,22 +671,20 @@ SUBSYSTEM_DEF(minimaps) . = TRUE if ("selectAnnouncement") - var/datum/svg_overlay/svg_overlay = new(params["image"]) - var/outgoing_message = stripped_multiline_input(user, "Optional message to announce with the tactical map", "Tactical Map Announcement", "") if(!outgoing_message) return + if(!store_current_svg_coords(params["image"])) + 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_svg_overlay += svg_overlay COOLDOWN_START(GLOB, xeno_canvas_cooldown, canvas_cooldown_time) else - GLOB.uscm_svg_overlay += svg_overlay var/mob/living/carbon/human/H = user var/obj/item/card/id/id = H.wear_id if(istype(id)) @@ -669,7 +696,6 @@ 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(svg_overlay) . = TRUE /datum/tacmap/ui_status(mob/user) @@ -709,10 +735,10 @@ SUBSYSTEM_DEF(minimaps) return ..() // datums for holding both the flattened png asset and overlay. It's best to keep them separate with the current implementation imo. -/datum/flat_tacmap_png +/datum/flattend_tacmap_png var/flat_tacmap -/datum/flat_tacmap_png/New(flat_tacmap) +/datum/flattend_tacmap_png/New(flat_tacmap) src.flat_tacmap = flat_tacmap /datum/svg_overlay From d79fc0abd15f3a2726ebc0cc08c2ce8d86532ea4 Mon Sep 17 00:00:00 2001 From: doom Date: Wed, 27 Sep 2023 20:12:21 -0700 Subject: [PATCH 076/161] ... --- code/controllers/subsystem/minimap.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index a879c4806d90..e188af3cf724 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -421,8 +421,8 @@ SUBSYSTEM_DEF(minimaps) else GLOB.uscm_svg_overlay += svg_overlay - return TRUE qdel(svg_overlay) + return TRUE /datum/controller/subsystem/minimaps/proc/fetch_tacmap_datum(zlevel, flags) From 7fbad6220bfff8ab868f83327f19f150d8aa15c0 Mon Sep 17 00:00:00 2001 From: doom Date: Wed, 27 Sep 2023 21:14:00 -0700 Subject: [PATCH 077/161] changes --- code/controllers/subsystem/minimap.dm | 30 ++++++++++++--------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index e188af3cf724..590eece61f7e 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -341,7 +341,7 @@ SUBSYSTEM_DEF(minimaps) /** * Fetches either a datum containing either a flattend map png reference or a set of given svg coords * Arguments: - * * user: to determine which faction get the map from. + * * user: mob, to determine which faction get the map from. * * asset_type: true for png, false for svg */ /datum/proc/get_current_tacmap_data(mob/user, asset_type) @@ -352,8 +352,6 @@ SUBSYSTEM_DEF(minimaps) else map_list = GLOB.uscm_svg_overlay else - if(!isxeno(user)) - return if(asset_type) map_list = GLOB.xeno_flat_tacmap_png_asset else @@ -392,21 +390,20 @@ SUBSYSTEM_DEF(minimaps) if(xeno.hivenumber == user_faction) faction_clients += client else if(client_mob.faction == user_faction) // TODO: not distributing properly, fix. - to_chat(user, SPAN_WARNING(client)) faction_clients += client COOLDOWN_START(src, flatten_map_cooldown, flatten_map_cooldown_time) var/flat_tacmap_png = icon2html(flat_map, faction_clients, sourceonly = TRUE) - var/datum/flattend_tacmap_png = new(flat_tacmap_png) + var/datum/flattend_tacmap_png/new_flat = new(flat_tacmap_png) if(!isxeno(user)) - GLOB.uscm_flat_tacmap_png_asset += flattend_tacmap_png + GLOB.uscm_flat_tacmap_png_asset += new_flat else - GLOB.xeno_flat_tacmap_png_asset += flattend_tacmap_png - qdel(flattend_tacmap_png) + GLOB.xeno_flat_tacmap_png_asset += new_flat + qdel(new_flat) /** * globally stores svg coords for a given faction. * Arguments: - * * user: to determine which faction to distribute to + * * user: mob, to determine which faction to distribute to * * svg_coords: an array of coordinates corresponding to an svg. */ /datum/tacmap/proc/store_current_svg_coords(mob/user, svg_coords) @@ -553,7 +550,7 @@ SUBSYSTEM_DEF(minimaps) // boolean value to keep track if the canvas has been updated or not, the value is used in tgui state. var/updated_canvas = FALSE - var/datum/flattend_tacmap_png/current_map + var/datum/flattend_tacmap_png/current_map = new /datum/tacmap/New(atom/source, minimap_type) @@ -577,6 +574,7 @@ SUBSYSTEM_DEF(minimaps) current_map = get_current_tacmap_data(user, TRUE) if(!current_map) distribute_current_map_png(user) + current_map.flat_tacmap = get_current_tacmap_data(user, TRUE).flat_tacmap user.client.register_map_obj(map_holder.map) ui = new(user, src, "TacticalMap") @@ -584,14 +582,11 @@ SUBSYSTEM_DEF(minimaps) /datum/tacmap/ui_data(mob/user) var/list/data = list() - //todo: upon joining user should have the base map without layered icons as default. Otherwise loads failed png for a new user. - data["flatImage"] = null data["svgData"] = null - // current_map = get_current_tacmap_data(user, TRUE) - // if(current_map) - // data["flatImage"] = current_map.flat_tacmap - // data["svgData"] = get_current_tacmap_data(user, FALSE).svg_data + data["flatImage"] = current_map.flat_tacmap + if(current_map) + data["svgData"] = get_current_tacmap_data(user, FALSE).svg_data data["mapRef"] = map_holder.map_ref data["toolbarColorSelection"] = toolbar_color_selection @@ -642,6 +637,7 @@ SUBSYSTEM_DEF(minimaps) if ("menuSelect") if(params["selection"] == "new canvas") distribute_current_map_png(user) // not updating? + current_map = get_current_tacmap_data(user, TRUE) . = TRUE @@ -734,7 +730,7 @@ SUBSYSTEM_DEF(minimaps) map = null return ..() -// datums for holding both the flattened png asset and overlay. It's best to keep them separate with the current implementation imo. +// datums for holding both the flattend png asset reference and an svg overlay. It's best to keep them separate with the current implementation imo. /datum/flattend_tacmap_png var/flat_tacmap From 15abb6ddb4941130d4aba10dd9ccecff5d1fefce Mon Sep 17 00:00:00 2001 From: doom Date: Wed, 27 Sep 2023 22:49:22 -0700 Subject: [PATCH 078/161] ... --- code/controllers/subsystem/minimap.dm | 36 ++++++++++--------- .../objects/items/devices/helmet_visors.dm | 19 ---------- code/modules/clothing/head/helmet.dm | 22 +++++------- 3 files changed, 28 insertions(+), 49 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 590eece61f7e..e659c70137c6 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -357,6 +357,7 @@ SUBSYSTEM_DEF(minimaps) else map_list = GLOB.uscm_svg_overlay + if(map_list.len == 0) return @@ -390,6 +391,7 @@ SUBSYSTEM_DEF(minimaps) if(xeno.hivenumber == user_faction) faction_clients += client else if(client_mob.faction == user_faction) // TODO: not distributing properly, fix. + to_chat(user, SPAN_WARNING(client)) faction_clients += client COOLDOWN_START(src, flatten_map_cooldown, flatten_map_cooldown_time) var/flat_tacmap_png = icon2html(flat_map, faction_clients, sourceonly = TRUE) @@ -407,19 +409,14 @@ SUBSYSTEM_DEF(minimaps) * * svg_coords: an array of coordinates corresponding to an svg. */ /datum/tacmap/proc/store_current_svg_coords(mob/user, svg_coords) - if(!svg_coords) - to_chat(user, SPAN_WARNING("The tacmap filckers and then shuts off, a critical error has occured")) // tf2heavy: "Oh, this is bad!" - return FALSE - - var/datum/svg_overlay/svg_overlay = new(svg_coords) + var/datum/svg_overlay/svg_store_overlay = new(svg_coords) if(isxeno(user)) - GLOB.xeno_svg_overlay += svg_overlay + GLOB.xeno_svg_overlay += svg_store_overlay else - GLOB.uscm_svg_overlay += svg_overlay + GLOB.uscm_svg_overlay += svg_store_overlay - qdel(svg_overlay) - return TRUE + qdel(svg_store_overlay) /datum/controller/subsystem/minimaps/proc/fetch_tacmap_datum(zlevel, flags) @@ -551,7 +548,7 @@ SUBSYSTEM_DEF(minimaps) var/updated_canvas = FALSE var/datum/flattend_tacmap_png/current_map = new - + var/datum/svg_overlay/current_svg = new /datum/tacmap/New(atom/source, minimap_type) allowed_flags = minimap_type @@ -574,7 +571,8 @@ SUBSYSTEM_DEF(minimaps) current_map = get_current_tacmap_data(user, TRUE) if(!current_map) distribute_current_map_png(user) - current_map.flat_tacmap = get_current_tacmap_data(user, TRUE).flat_tacmap + current_map = get_current_tacmap_data(user, TRUE) + user.client.register_map_obj(map_holder.map) ui = new(user, src, "TacticalMap") @@ -582,11 +580,13 @@ SUBSYSTEM_DEF(minimaps) /datum/tacmap/ui_data(mob/user) var/list/data = list() - data["svgData"] = null data["flatImage"] = current_map.flat_tacmap - if(current_map) - data["svgData"] = get_current_tacmap_data(user, FALSE).svg_data + + data["svgData"] = null + + if(current_svg) + data["svgData"] = current_svg.svg_data data["mapRef"] = map_holder.map_ref data["toolbarColorSelection"] = toolbar_color_selection @@ -667,11 +667,15 @@ SUBSYSTEM_DEF(minimaps) . = TRUE 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) return - if(!store_current_svg_coords(params["image"])) - return + store_current_svg_coords(user, params["image"]) + + current_svg = get_current_tacmap_data(user, FALSE) var/signed var/mob/living/carbon/xenomorph/xeno diff --git a/code/game/objects/items/devices/helmet_visors.dm b/code/game/objects/items/devices/helmet_visors.dm index 40242e679f43..fbeba4d2d66a 100644 --- a/code/game/objects/items/devices/helmet_visors.dm +++ b/code/game/objects/items/devices/helmet_visors.dm @@ -70,13 +70,6 @@ action_icon_string = "blank_hud_sight_down" helmet_overlay = "weld_visor" -/obj/item/device/helmet_visor/tactical_map_visor - name = "map visor" - icon_state = "meson_sight" - hud_type = null - action_icon_string = "meson_sight_down" - helmet_overlay = "tacmap_visor" - /obj/item/device/helmet_visor/welding_visor/visor_function(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user, silent = FALSE) if(attached_helmet == user.head && attached_helmet.active_visor == src) attached_helmet.vision_impair = VISION_IMPAIR_MAX @@ -97,18 +90,6 @@ user.update_tint() return TRUE -/obj/item/device/helmet_visor/tactical_map_visor/visor_function(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user, silent = FALSE, toggle_type) - if(attached_helmet == user.head && attached_helmet.active_visor == src && toggle_type) - GLOB.tacmap_datum.tgui_interact(user) - if(!silent) - to_chat(user, SPAN_NOTICE("You activate [src] on [attached_helmet].")) - return TRUE - - SStgui.close_user_uis(user, GLOB.tacmap_datum) - if(!silent) - to_chat(user, SPAN_NOTICE("You deactivate [src] on [attached_helmet].")) - return TRUE - /obj/item/device/helmet_visor/welding_visor/mercenary helmet_overlay = "" diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index b9ad4a96b315..dda517cf1f9f 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -378,7 +378,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( var/helmet_overlay_icon = 'icons/mob/humans/onmob/head_1.dmi' ///Any visors built into the helmet - var/list/built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/tactical_map_visor) + var/list/built_in_visors = list(new /obj/item/device/helmet_visor) ///Any visors that have been added into the helmet var/list/inserted_visors = list() @@ -623,10 +623,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( return if(active_visor.can_toggle(user)) - if(istype(active_visor, /obj/item/device/helmet_visor/tactical_map_visor)) - active_visor.visor_function(src, user, FALSE, TRUE) - else - active_visor.visor_function(src, user) + active_visor.visor_function(src, user) playsound_client(user.client, active_visor.toggle_on_sound, null, 75) update_icon() @@ -637,10 +634,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( return if(current_visor.can_toggle(user)) - if(istype(current_visor, /obj/item/device/helmet_visor/tactical_map_visor)) - current_visor.visor_function(src, user, sound, FALSE) - else - current_visor.visor_function(src, user) + current_visor.visor_function(src, user) if(sound) playsound_client(user.client, current_visor.toggle_off_sound, null, 75) @@ -722,7 +716,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( desc = "A modified M10 marine helmet for ComTechs. Features a toggleable welding screen for eye protection." icon_state = "tech_helmet" specialty = "M10 technician" - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/welding_visor, new /obj/item/device/helmet_visor/tactical_map_visor) + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/welding_visor) /obj/item/clothing/head/helmet/marine/grey desc = "A standard M10 Pattern Helmet. This one has not had a camouflage pattern applied to it yet. There is a built-in camera on the right side." @@ -741,14 +735,14 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( flags_inventory = BLOCKSHARPOBJ flags_inv_hide = HIDEEARS|HIDETOPHAIR specialty = "M50 tanker" - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/welding_visor/tanker, new /obj/item/device/helmet_visor/tactical_map_visor) + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/welding_visor/tanker) /obj/item/clothing/head/helmet/marine/medic name = "\improper M10 corpsman helmet" desc = "An M10 marine helmet version worn by marine hospital corpsmen. Has red cross painted on its front." icon_state = "med_helmet" specialty = "M10 pattern medic" - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/tactical_map_visor) + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced) start_down_visor_type = /obj/item/device/helmet_visor/medical/advanced /obj/item/clothing/head/helmet/marine/covert @@ -891,7 +885,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( armor_bio = CLOTHING_ARMOR_MEDIUMHIGH specialty = "M10 pattern captain" flags_atom = NO_SNOW_TYPE - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/security, new /obj/item/device/helmet_visor/tactical_map_visor) + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/security) /obj/item/clothing/head/helmet/marine/MP name = "\improper M10 pattern MP helmet" @@ -915,7 +909,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list( icon_state = "helmet" item_state = "helmet" specialty = "M10 pattern officer" - built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/tactical_map_visor) + built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced) /obj/item/clothing/head/helmet/marine/mp/provost/marshal name = "\improper Provost Marshal Cap" From 072377dfd5cbb233d774841a353b0d2b959e4376 Mon Sep 17 00:00:00 2001 From: doom Date: Thu, 28 Sep 2023 20:58:41 -0700 Subject: [PATCH 079/161] 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' )} From 2c63accf4a71cc5e85b30fa84f97f0682ca39a17 Mon Sep 17 00:00:00 2001 From: doom Date: Thu, 28 Sep 2023 21:03:50 -0700 Subject: [PATCH 080/161] ... --- tgui/packages/tgui/interfaces/DrawnMap.js | 2 +- tgui/packages/tgui/interfaces/TacticalMap.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tgui/packages/tgui/interfaces/DrawnMap.js b/tgui/packages/tgui/interfaces/DrawnMap.js index e14e0d62dcfe..97fc9ceaf938 100644 --- a/tgui/packages/tgui/interfaces/DrawnMap.js +++ b/tgui/packages/tgui/interfaces/DrawnMap.js @@ -10,7 +10,7 @@ export class DrawnMap extends Component { this.backupImg = null; } - onComponentDidMout() { + componentDidMount() { this.backupImg = new Image(); this.backupImg.src = backupImgSrc; } diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 7476f2d36bea..fb20958967fa 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -57,7 +57,7 @@ const mapPngs = { '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', + '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', From 2d178ca861a89185e73d439d0c03a754288fa79f Mon Sep 17 00:00:00 2001 From: doom Date: Thu, 28 Sep 2023 21:14:43 -0700 Subject: [PATCH 081/161] ... --- tgui/packages/tgui/interfaces/DrawnMap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tgui/packages/tgui/interfaces/DrawnMap.js b/tgui/packages/tgui/interfaces/DrawnMap.js index 97fc9ceaf938..d9498cde6bae 100644 --- a/tgui/packages/tgui/interfaces/DrawnMap.js +++ b/tgui/packages/tgui/interfaces/DrawnMap.js @@ -12,7 +12,7 @@ export class DrawnMap extends Component { componentDidMount() { this.backupImg = new Image(); - this.backupImg.src = backupImgSrc; + this.backupImg.src = this.backupImgSrc; } parseSvgData(svgDataArray) { From 546934884eefd5ee5a2b86b50632257733a4660f Mon Sep 17 00:00:00 2001 From: doom Date: Thu, 28 Sep 2023 21:18:07 -0700 Subject: [PATCH 082/161] ... --- tgui/packages/tgui/interfaces/DrawnMap.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tgui/packages/tgui/interfaces/DrawnMap.js b/tgui/packages/tgui/interfaces/DrawnMap.js index d9498cde6bae..c74667083386 100644 --- a/tgui/packages/tgui/interfaces/DrawnMap.js +++ b/tgui/packages/tgui/interfaces/DrawnMap.js @@ -7,12 +7,6 @@ export class DrawnMap extends Component { this.flatImgSrc = this.props.flatImage; this.backupImgSrc = this.props.backupImage; this.svg = this.props.svgData; - this.backupImg = null; - } - - componentDidMount() { - this.backupImg = new Image(); - this.backupImg.src = this.backupImgSrc; } parseSvgData(svgDataArray) { @@ -42,7 +36,7 @@ export class DrawnMap extends Component { }}> {this.backupImg} Date: Thu, 28 Sep 2023 21:26:35 -0700 Subject: [PATCH 083/161] ... --- tgui/packages/tgui/interfaces/DrawnMap.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tgui/packages/tgui/interfaces/DrawnMap.js b/tgui/packages/tgui/interfaces/DrawnMap.js index c74667083386..be10f423dd57 100644 --- a/tgui/packages/tgui/interfaces/DrawnMap.js +++ b/tgui/packages/tgui/interfaces/DrawnMap.js @@ -33,10 +33,11 @@ export class DrawnMap extends Component { position: 'relative', width: '100%', height: '100%', - }}> + }} + > {this.backupImgSrc + }} + > {parsedSvgData.map((line, index) => ( Date: Thu, 28 Sep 2023 21:30:49 -0700 Subject: [PATCH 084/161] ... --- tgui/packages/tgui/interfaces/DrawnMap.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tgui/packages/tgui/interfaces/DrawnMap.js b/tgui/packages/tgui/interfaces/DrawnMap.js index be10f423dd57..72c6b9791bd6 100644 --- a/tgui/packages/tgui/interfaces/DrawnMap.js +++ b/tgui/packages/tgui/interfaces/DrawnMap.js @@ -33,8 +33,7 @@ export class DrawnMap extends Component { position: 'relative', width: '100%', height: '100%', - }} - > + }}> {this.backupImgSrc + }}> {parsedSvgData.map((line, index) => ( Date: Thu, 28 Sep 2023 22:29:51 -0700 Subject: [PATCH 085/161] ... --- code/controllers/subsystem/minimap.dm | 15 +++++---------- tgui/packages/tgui/interfaces/TacticalMap.tsx | 7 ++----- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 444afee25695..1429bb83b336 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -570,9 +570,6 @@ 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) @@ -619,6 +616,9 @@ 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,15 +646,10 @@ 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") 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 fb20958967fa..b905e127d1e7 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -89,11 +89,8 @@ export const TacticalMap = (props, context) => { const [pageIndex, setPageIndex] = useLocalState(context, 'pageIndex', 0); const PageComponent = PAGES[pageIndex].component(); - const handleTacmapOnClick = (i, pageTitle) => { + const handleTacmapOnClick = (i) => { setPageIndex(i); - act('menuSelect', { - selection: pageTitle, - }); }; return ( @@ -117,7 +114,7 @@ export const TacticalMap = (props, context) => { color={data.isXeno ? 'purple' : 'blue'} selected={i === pageIndex} icon={page.icon} - onClick={() => handleTacmapOnClick(i, page.title)}> + onClick={() => handleTacmapOnClick(i)}> {page.title} ); From dc1091a1a82c5ee5868cb40f15ba9891cea09de0 Mon Sep 17 00:00:00 2001 From: doom Date: Thu, 28 Sep 2023 22:54:52 -0700 Subject: [PATCH 086/161] ... --- 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} ); From 6e0f7b2077b83695e5332437f10a8c877a92cf53 Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 29 Sep 2023 08:00:22 -0700 Subject: [PATCH 087/161] ... --- code/controllers/subsystem/minimap.dm | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 6a46d83e9ce5..2248730a7ca6 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -367,14 +367,16 @@ SUBSYSTEM_DEF(minimaps) * flattens the current map and then distributes it based off user faction. * Arguments: * * user: to determine which faction to distribute to + * Return: + * * returns a boolean value, true if the operation was successful, false if it was not. */ /datum/tacmap/proc/distribute_current_map_png(mob/user) if(!COOLDOWN_FINISHED(src, flatten_map_cooldown)) - return + return FALSE 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")) // tf2heavy: "Oh, this is bad!" - return + return FALSE var/user_faction var/mob/living/carbon/xenomorph/xeno if(isxeno(user)) @@ -390,8 +392,7 @@ SUBSYSTEM_DEF(minimaps) xeno = client_mob if(xeno.hivenumber == user_faction) faction_clients += client - else if(client_mob.faction == user_faction) // TODO: not distributing properly, fix. - to_chat(user, SPAN_WARNING(client)) + else if(client_mob.faction == user_faction) faction_clients += client COOLDOWN_START(src, flatten_map_cooldown, flatten_map_cooldown_time) var/flat_tacmap_png = icon2html(flat_map, faction_clients, sourceonly = TRUE) @@ -401,6 +402,7 @@ SUBSYSTEM_DEF(minimaps) else GLOB.xeno_flat_tacmap_png_asset += new_flat qdel(new_flat) + return TRUE /** * globally stores svg coords for a given faction. @@ -571,7 +573,9 @@ SUBSYSTEM_DEF(minimaps) current_map = get_current_tacmap_data(user, TRUE) current_svg = get_current_tacmap_data(user, FALSE) if(!current_map) - distribute_current_map_png(user) + var/distribute_status = distribute_current_map_png(user) + if(!distribute_status) + return current_map = get_current_tacmap_data(user, TRUE) @@ -648,7 +652,9 @@ SUBSYSTEM_DEF(minimaps) switch (action) if ("menuSelect") if(params["selection"] == "new canvas") - distribute_current_map_png(user) // not updating? + var/distribute_status = distribute_current_map_png(user) // not updating? + if(!distribute_status) + return current_map = get_current_tacmap_data(user, TRUE) . = TRUE @@ -681,14 +687,13 @@ SUBSYSTEM_DEF(minimaps) if ("selectAnnouncement") - if(!istype(params["image"], /list)) + if(!istype(params["image"], /list)) // potentially very serious? return store_current_svg_coords(user, params["image"]) current_svg = get_current_tacmap_data(user, FALSE) - toolbar_updated_selection = "export" if(isxeno(user)) var/mob/living/carbon/xenomorph/xeno = user xeno_maptext("The Queen has updated your hive mind map", "You sense something unusual...", xeno.hivenumber) @@ -696,9 +701,9 @@ SUBSYSTEM_DEF(minimaps) else 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:") + current_squad.send_maptext("Tactical map update in progress...", "Tactical Map:") - human_leader.visible_message(SPAN_BOLDNOTICE("Tactical map update in progres...")) + human_leader.visible_message(SPAN_BOLDNOTICE("Tactical map update in progress...")) COOLDOWN_START(GLOB, uscm_canvas_cooldown, canvas_cooldown_time) message_admins("[key_name(user)] has updated the tactical map") From 5ada289c6c5fee9dc441b11f1821dfa47d5172ee Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 29 Sep 2023 08:19:04 -0700 Subject: [PATCH 088/161] ... --- code/_globalvars/misc.dm | 2 +- code/controllers/subsystem/minimap.dm | 9 ++++++++- code/game/machinery/computer/groundside_operations.dm | 4 ---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index ce1c64d4ada6..956f5fddf0b4 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/status_tab_view) +GLOBAL_DATUM_INIT(tacmap_datum, /datum/tacmap/status_tab_view, new) /// 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 2248730a7ca6..fc50a24f84e6 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -556,6 +556,12 @@ SUBSYSTEM_DEF(minimaps) allowed_flags = minimap_type owner = source + +/datum/tacmap/status_tab_view/New() + var/datum/tacmap/status_tab_view/uscm_tacmap + allowed_flags = MINIMAP_FLAG_USCM + owner = uscm_tacmap + /datum/tacmap/Destroy() map_holder = null owner = null @@ -660,7 +666,7 @@ SUBSYSTEM_DEF(minimaps) . = TRUE if ("updateCanvas") - // forces state change + // forces state change, this will export the svg. toolbar_updated_selection = "export" updated_canvas = TRUE . = TRUE @@ -704,6 +710,7 @@ SUBSYSTEM_DEF(minimaps) current_squad.send_maptext("Tactical map update in progress...", "Tactical Map:") human_leader.visible_message(SPAN_BOLDNOTICE("Tactical map update in progress...")) + human_leader << 'sound/effects/sos-morse-code.ogg' COOLDOWN_START(GLOB, uscm_canvas_cooldown, canvas_cooldown_time) message_admins("[key_name(user)] has updated the tactical map") diff --git a/code/game/machinery/computer/groundside_operations.dm b/code/game/machinery/computer/groundside_operations.dm index 4578f5a1a18a..5f1abeb84899 100644 --- a/code/game/machinery/computer/groundside_operations.dm +++ b/code/game/machinery/computer/groundside_operations.dm @@ -27,10 +27,6 @@ RegisterSignal(SSdcs, COMSIG_GLOB_MODE_PRESETUP, PROC_REF(disable_pmc)) tacmap = new(src, minimap_type) - // global tacmap for marines to access through an action button. - // dumb implementation for testing, fix later. - var/datum/tacmap/status_tab_view/uscm_tacmap - GLOB.tacmap_datum = new(uscm_tacmap, minimap_type) return ..() /obj/structure/machinery/computer/groundside_operations/Destroy() From d3c811dfdf51b48bdca7b1e5404043314811d94a Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 29 Sep 2023 08:59:54 -0700 Subject: [PATCH 089/161] ... --- html/statbrowser.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/html/statbrowser.js b/html/statbrowser.js index c403f10db5b2..fbf98feb4f8b 100644 --- a/html/statbrowser.js +++ b/html/statbrowser.js @@ -348,6 +348,8 @@ function draw_debug() { document.getElementById("statcontent").appendChild(table3); } function draw_status() { + const satus_tab_map_href_exception = + "Click To View Tactical Map"; if (!document.getElementById("Status")) { createStatusTab("Status"); current_tab = "Status"; @@ -360,8 +362,7 @@ function draw_status() { .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" + status_tab_parts[i] == satus_tab_map_href_exception ) { var maplink = document.createElement("a"); maplink.innerHTML = status_tab_parts[i]; From ab197b5b557099aabc771aeacfb153c828d25b65 Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 29 Sep 2023 11:01:51 -0700 Subject: [PATCH 090/161] ... --- code/controllers/subsystem/minimap.dm | 1 - tgui/packages/tgui/interfaces/DrawnMap.js | 22 +++++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index fc50a24f84e6..0b465c52a829 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -699,7 +699,6 @@ SUBSYSTEM_DEF(minimaps) store_current_svg_coords(user, params["image"]) current_svg = get_current_tacmap_data(user, FALSE) - if(isxeno(user)) var/mob/living/carbon/xenomorph/xeno = user xeno_maptext("The Queen has updated your hive mind map", "You sense something unusual...", xeno.hivenumber) diff --git a/tgui/packages/tgui/interfaces/DrawnMap.js b/tgui/packages/tgui/interfaces/DrawnMap.js index 72c6b9791bd6..5143b847c3bb 100644 --- a/tgui/packages/tgui/interfaces/DrawnMap.js +++ b/tgui/packages/tgui/interfaces/DrawnMap.js @@ -6,9 +6,26 @@ export class DrawnMap extends Component { this.containerRef = createRef(); this.flatImgSrc = this.props.flatImage; this.backupImgSrc = this.props.backupImage; + this.state = { + mapLoad: true, + }; + this.img = null; this.svg = this.props.svgData; } + componentWillMount() { + this.img = new Image(); + this.img.src = this.flatImgSrc; + this.img.onload = () => { + this.setState({ mapLoad: true }); + }; + + this.img.onerror = () => { + this.img.src = this.backupImgSrc; + this.setState({ mapLoad: false }); + }; + } + parseSvgData(svgDataArray) { if (!svgDataArray) return null; let lines = []; @@ -35,8 +52,7 @@ export class DrawnMap extends Component { height: '100%', }}> {this.backupImgSrc - {parsedSvgData && ( + {parsedSvgData && this.state.mapLoad && ( Date: Fri, 29 Sep 2023 11:14:43 -0700 Subject: [PATCH 091/161] ... --- code/controllers/subsystem/minimap.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 0b465c52a829..5ba9790384f5 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -658,7 +658,7 @@ SUBSYSTEM_DEF(minimaps) switch (action) if ("menuSelect") if(params["selection"] == "new canvas") - var/distribute_status = distribute_current_map_png(user) // not updating? + var/distribute_status = distribute_current_map_png(user) if(!distribute_status) return current_map = get_current_tacmap_data(user, TRUE) From a747b62474015690571015e7f6f4ceb7fcc41ef9 Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 29 Sep 2023 11:33:37 -0700 Subject: [PATCH 092/161] ... --- tgui/packages/tgui/interfaces/DrawnMap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tgui/packages/tgui/interfaces/DrawnMap.js b/tgui/packages/tgui/interfaces/DrawnMap.js index 5143b847c3bb..c22f1f24c609 100644 --- a/tgui/packages/tgui/interfaces/DrawnMap.js +++ b/tgui/packages/tgui/interfaces/DrawnMap.js @@ -13,7 +13,7 @@ export class DrawnMap extends Component { this.svg = this.props.svgData; } - componentWillMount() { + componentDidMount(){ this.img = new Image(); this.img.src = this.flatImgSrc; this.img.onload = () => { From 55fbb82ca3954936255b439439c2305090f582c1 Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 29 Sep 2023 11:41:28 -0700 Subject: [PATCH 093/161] ... --- tgui/packages/tgui/interfaces/DrawnMap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tgui/packages/tgui/interfaces/DrawnMap.js b/tgui/packages/tgui/interfaces/DrawnMap.js index c22f1f24c609..501e797280b2 100644 --- a/tgui/packages/tgui/interfaces/DrawnMap.js +++ b/tgui/packages/tgui/interfaces/DrawnMap.js @@ -13,7 +13,7 @@ export class DrawnMap extends Component { this.svg = this.props.svgData; } - componentDidMount(){ + componentDidMount() { this.img = new Image(); this.img.src = this.flatImgSrc; this.img.onload = () => { From bb7726e6770b131ed23b070211f0e25d159dee22 Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 29 Sep 2023 11:56:21 -0700 Subject: [PATCH 094/161] ... --- tgui/packages/tgui/interfaces/DrawnMap.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tgui/packages/tgui/interfaces/DrawnMap.js b/tgui/packages/tgui/interfaces/DrawnMap.js index 501e797280b2..525f68486831 100644 --- a/tgui/packages/tgui/interfaces/DrawnMap.js +++ b/tgui/packages/tgui/interfaces/DrawnMap.js @@ -51,15 +51,17 @@ export class DrawnMap extends Component { width: '100%', height: '100%', }}> - + {this.img && ( + + )} {parsedSvgData && this.state.mapLoad && ( Date: Fri, 29 Sep 2023 13:57:15 -0700 Subject: [PATCH 095/161] ... --- code/controllers/subsystem/minimap.dm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 5ba9790384f5..0928338667b2 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -579,8 +579,7 @@ SUBSYSTEM_DEF(minimaps) current_map = get_current_tacmap_data(user, TRUE) current_svg = get_current_tacmap_data(user, FALSE) if(!current_map) - var/distribute_status = distribute_current_map_png(user) - if(!distribute_status) + if(!distribute_current_map_png(user)) return current_map = get_current_tacmap_data(user, TRUE) @@ -658,8 +657,7 @@ SUBSYSTEM_DEF(minimaps) switch (action) if ("menuSelect") if(params["selection"] == "new canvas") - var/distribute_status = distribute_current_map_png(user) - if(!distribute_status) + if(!distribute_current_map_png(user)) return current_map = get_current_tacmap_data(user, TRUE) From 1321b627f655634e4b4b1ca104952e1ff85b2f3a Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 29 Sep 2023 16:08:29 -0700 Subject: [PATCH 096/161] ... --- code/controllers/subsystem/minimap.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 0928338667b2..3af2b46836d2 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -707,7 +707,7 @@ SUBSYSTEM_DEF(minimaps) current_squad.send_maptext("Tactical map update in progress...", "Tactical Map:") human_leader.visible_message(SPAN_BOLDNOTICE("Tactical map update in progress...")) - human_leader << 'sound/effects/sos-morse-code.ogg' + playsound(src, "sound/effects/sos-morse-code.ogg", 15) COOLDOWN_START(GLOB, uscm_canvas_cooldown, canvas_cooldown_time) message_admins("[key_name(user)] has updated the tactical map") From 80fbcaf9948c715b2ef2c4a0aad78cb850954320 Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 29 Sep 2023 16:20:27 -0700 Subject: [PATCH 097/161] ... --- code/controllers/subsystem/minimap.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 3af2b46836d2..a7ac6c4583ec 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -707,7 +707,7 @@ SUBSYSTEM_DEF(minimaps) current_squad.send_maptext("Tactical map update in progress...", "Tactical Map:") human_leader.visible_message(SPAN_BOLDNOTICE("Tactical map update in progress...")) - playsound(src, "sound/effects/sos-morse-code.ogg", 15) + playsound_client(human_leader.client, "sound/effects/sos-morse-code.ogg") COOLDOWN_START(GLOB, uscm_canvas_cooldown, canvas_cooldown_time) message_admins("[key_name(user)] has updated the tactical map") From 4d722938b847502d2e5f669584677d65c8b2f07b Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 29 Sep 2023 17:22:02 -0700 Subject: [PATCH 098/161] ... --- code/controllers/subsystem/minimap.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index a7ac6c4583ec..e9a4299d3730 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -549,6 +549,7 @@ SUBSYSTEM_DEF(minimaps) // boolean value to keep track if the canvas has been updated or not, the value is used in tgui state. var/updated_canvas = FALSE + // datums for holding both the flattend png asset reference and an svg overlay. It's best to keep them separate with the current implementation imo. var/datum/flattend_tacmap_png/current_map = new var/datum/svg_overlay/current_svg = new @@ -750,7 +751,6 @@ SUBSYSTEM_DEF(minimaps) map = null return ..() -// datums for holding both the flattend png asset reference and an svg overlay. It's best to keep them separate with the current implementation imo. /datum/flattend_tacmap_png var/flat_tacmap From 5618b2d78a530cf187a56feb46c2843dd4542d0c Mon Sep 17 00:00:00 2001 From: doom Date: Sun, 1 Oct 2023 22:26:44 -0700 Subject: [PATCH 099/161] ... --- code/controllers/subsystem/minimap.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index e9a4299d3730..00786f4361c3 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -658,6 +658,7 @@ SUBSYSTEM_DEF(minimaps) switch (action) if ("menuSelect") if(params["selection"] == "new canvas") + updated_canvas = FALSE if(!distribute_current_map_png(user)) return current_map = get_current_tacmap_data(user, TRUE) @@ -696,8 +697,8 @@ SUBSYSTEM_DEF(minimaps) return store_current_svg_coords(user, params["image"]) - current_svg = get_current_tacmap_data(user, FALSE) + if(isxeno(user)) var/mob/living/carbon/xenomorph/xeno = user xeno_maptext("The Queen has updated your hive mind map", "You sense something unusual...", xeno.hivenumber) From 937e7c80364cba4171b150936f7fce026a8c173b Mon Sep 17 00:00:00 2001 From: doom Date: Sun, 1 Oct 2023 22:31:40 -0700 Subject: [PATCH 100/161] ... --- code/modules/mob/living/carbon/human/human.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index bdce3c35f29c..3351226d1aff 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -116,6 +116,7 @@ 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) From 689d2a45b74a2c1373d37fb76b6149756160d898 Mon Sep 17 00:00:00 2001 From: doom Date: Sun, 1 Oct 2023 22:43:33 -0700 Subject: [PATCH 101/161] bug fix --- code/controllers/subsystem/minimap.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 00786f4361c3..f6ebb0f4a0a3 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -659,6 +659,7 @@ SUBSYSTEM_DEF(minimaps) if ("menuSelect") if(params["selection"] == "new canvas") updated_canvas = FALSE + toolbar_updated_selection = toolbar_color_selection if(!distribute_current_map_png(user)) return current_map = get_current_tacmap_data(user, TRUE) From 3c5d5b4bc31186457b0a7d10dd72d01b73e689b0 Mon Sep 17 00:00:00 2001 From: doom Date: Sun, 1 Oct 2023 22:52:25 -0700 Subject: [PATCH 102/161] bug fix --- code/controllers/subsystem/minimap.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index f6ebb0f4a0a3..4832c07983d3 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -657,9 +657,10 @@ SUBSYSTEM_DEF(minimaps) switch (action) if ("menuSelect") - if(params["selection"] == "new canvas") + if(params["selection"] != "new canvas") // doing this if it == canvas can cause a latency issue with the stroke. updated_canvas = FALSE toolbar_updated_selection = toolbar_color_selection + else if(!distribute_current_map_png(user)) return current_map = get_current_tacmap_data(user, TRUE) From 293c147fb767fccbf1b383d5093ab19d47677b0d Mon Sep 17 00:00:00 2001 From: doom Date: Sun, 1 Oct 2023 23:56:16 -0700 Subject: [PATCH 103/161] ... --- code/controllers/subsystem/minimap.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 4832c07983d3..200dab4c91d2 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -658,6 +658,8 @@ SUBSYSTEM_DEF(minimaps) switch (action) if ("menuSelect") if(params["selection"] != "new canvas") // doing this if it == canvas can cause a latency issue with the stroke. + if(!updated_canvas) + return updated_canvas = FALSE toolbar_updated_selection = toolbar_color_selection else From 03765e39999df74b07a4bc3af51e9117590cdd4e Mon Sep 17 00:00:00 2001 From: doom Date: Mon, 2 Oct 2023 00:10:03 -0700 Subject: [PATCH 104/161] bug fix --- code/controllers/subsystem/minimap.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 200dab4c91d2..609f892a0142 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -716,6 +716,7 @@ SUBSYSTEM_DEF(minimaps) playsound_client(human_leader.client, "sound/effects/sos-morse-code.ogg") COOLDOWN_START(GLOB, uscm_canvas_cooldown, canvas_cooldown_time) + toolbar_updated_selection = toolbar_color_selection message_admins("[key_name(user)] has updated the tactical map") updated_canvas = FALSE . = TRUE From 89382787aa5d2889ba09aa6d1869fa82a72faeb5 Mon Sep 17 00:00:00 2001 From: doom Date: Mon, 2 Oct 2023 00:13:28 -0700 Subject: [PATCH 105/161] ... --- code/controllers/subsystem/minimap.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 609f892a0142..53c99bdf74af 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -657,11 +657,11 @@ SUBSYSTEM_DEF(minimaps) switch (action) if ("menuSelect") - if(params["selection"] != "new canvas") // doing this if it == canvas can cause a latency issue with the stroke. + if(params["selection"] != "new canvas") if(!updated_canvas) return updated_canvas = FALSE - toolbar_updated_selection = toolbar_color_selection + toolbar_updated_selection = toolbar_color_selection // doing this if it == canvas can cause a latency issue with the stroke. else if(!distribute_current_map_png(user)) return From abbff0db9e57611411b56a51f6cad46c2f66c329 Mon Sep 17 00:00:00 2001 From: doom Date: Mon, 2 Oct 2023 17:31:10 -0700 Subject: [PATCH 106/161] ... --- code/controllers/subsystem/minimap.dm | 26 ++++++++++++------- tgui/packages/tgui/interfaces/TacticalMap.tsx | 11 ++++---- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 53c99bdf74af..464833c93bb7 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -577,12 +577,16 @@ 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) - if(!distribute_current_map_png(user)) - return + + + var/mob/living/carbon/xenomorph/xeno = user + if(ishuman(user) || isxeno(user) && xeno.hivenumber == XENO_HIVE_NORMAL) current_map = get_current_tacmap_data(user, TRUE) + current_svg = get_current_tacmap_data(user, FALSE) + if(!current_map) + if(!distribute_current_map_png(user)) + return + current_map = get_current_tacmap_data(user, TRUE) user.client.register_map_obj(map_holder.map) @@ -616,7 +620,8 @@ SUBSYSTEM_DEF(minimaps) var/list/data = list() data["canDraw"] = FALSE - data["canViewHome"] = FALSE + data["canViewTacmap"] = FALSE + data["canViewCanvas"] = TRUE data["isXeno"] = FALSE data["currentMapName"] = SSmapping.configs?[GROUND_MAP].map_name @@ -624,11 +629,13 @@ SUBSYSTEM_DEF(minimaps) if(isxeno(user)) xeno_user = user data["isXeno"] = TRUE - data["canViewHome"] = TRUE + if(xeno_user.hivenumber != XENO_HIVE_NORMAL) + data["canViewCanvas"] = FALSE + data["canViewTacmap"] = 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 + data["canViewTacmap"] = TRUE return data @@ -637,7 +644,8 @@ SUBSYSTEM_DEF(minimaps) data["currentMapName"] = SSmapping.configs?[GROUND_MAP].map_name data["canDraw"] = FALSE - data["canViewHome"] = FALSE + data["canViewTacmap"] = FALSE + data["canViewCanvas"] = TRUE data["isXeno"] = FALSE return data diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index fb20958967fa..339b4d908cf4 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -11,9 +11,10 @@ interface TacMapProps { updatedCanvas: boolean; themeId: number; svgData: any; - canViewHome: number; + canViewTacmap: number; canDraw: number; isXeno: boolean; + canViewCanvas: number; flatImage: string; currentMapName: string; mapRef: any; @@ -30,15 +31,15 @@ const PAGES = [ component: () => ViewMapPanel, icon: 'map', canAccess: (data) => { - return data.canViewHome; + return data.canViewTacmap; }, }, { title: 'old canvas', component: () => OldMapPanel, icon: 'eye', - canAccess: () => { - return 1; + canAccess: (data) => { + return data.canViewCanvas; }, }, { @@ -136,7 +137,7 @@ const ViewMapPanel = (props, context) => { const { data } = useBackend(context); // byond ui can't resist trying to render - if (data.canViewHome !== 1) { + if (data.canViewTacmap === 0) { return ; } From fbe471be77122dd06aad41923bec83610fee8729 Mon Sep 17 00:00:00 2001 From: doom Date: Mon, 2 Oct 2023 18:07:17 -0700 Subject: [PATCH 107/161] ... --- code/controllers/subsystem/minimap.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 464833c93bb7..6edf73752e4a 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -636,6 +636,9 @@ 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["canViewTacmap"] = TRUE + if(!distribute_current_map_png(user)) + return data + current_map = get_current_tacmap_data(user, TRUE) return data From 3c9bad60353040b8acdab219e6df4acf9d460cdb Mon Sep 17 00:00:00 2001 From: doom Date: Mon, 2 Oct 2023 19:42:20 -0700 Subject: [PATCH 108/161] ... --- code/modules/mob/living/carbon/human/human.dm | 3 +-- html/statbrowser.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 3351226d1aff..3caca1c5f4f5 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -117,8 +117,7 @@ . += "Secondary Objective: [html_decode(assigned_squad.secondary_objective)]" if(faction == FACTION_MARINE) . += "" - . += "Tactical Map:" - . += html_decode("Click To View Tactical Map") + . += "View Tactical Map" if(mobility_aura) . += "Active Order: MOVE" if(protection_aura) diff --git a/html/statbrowser.js b/html/statbrowser.js index fbf98feb4f8b..f6e3ecb02634 100644 --- a/html/statbrowser.js +++ b/html/statbrowser.js @@ -349,7 +349,7 @@ function draw_debug() { } function draw_status() { const satus_tab_map_href_exception = - "Click To View Tactical Map"; + "View Tactical Map"; if (!document.getElementById("Status")) { createStatusTab("Status"); current_tab = "Status"; From 0e4cf9b0933e098b2048bcbe3b54d0d690c9ebbf Mon Sep 17 00:00:00 2001 From: doom Date: Tue, 3 Oct 2023 19:51:56 -0700 Subject: [PATCH 109/161] ... --- code/game/objects/items/devices/helmet_visors.dm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/game/objects/items/devices/helmet_visors.dm b/code/game/objects/items/devices/helmet_visors.dm index 8c042be1cdeb..596409c88c8b 100644 --- a/code/game/objects/items/devices/helmet_visors.dm +++ b/code/game/objects/items/devices/helmet_visors.dm @@ -37,7 +37,6 @@ return TRUE /// Called to see if this visor is a special non-HUD visor - /obj/item/device/helmet_visor/proc/toggle_visor(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user, silent = FALSE) if(attached_helmet == user.head && attached_helmet.active_visor == src) @@ -45,7 +44,7 @@ return FALSE activate_visor(attached_helmet, user) - + if(!silent) to_chat(user, SPAN_NOTICE("You activate [src] on [attached_helmet].")) playsound_client(user.client, toggle_on_sound, null, 75) From ba3da5449a3692e4dc33ab1fe5699b99277eedb1 Mon Sep 17 00:00:00 2001 From: doom Date: Wed, 4 Oct 2023 07:01:50 -0700 Subject: [PATCH 110/161] ... --- code/__HELPERS/icons.dm | 42 ++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index 535dfed3ac1a..60d2681a1d1a 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -329,7 +329,8 @@ world /// appearance system (overlays/underlays, etc.) is not available. /// /// Only the first argument is required. -/proc/getFlatIcon(image/appearance, defdir, deficon, defstate, defblend, start = TRUE, no_anim = FALSE) +/// appearance_flags indicates whether appearance_flags should be respected (at the cost of about 10-20% perf) +/proc/getFlatIcon(image/appearance, defdir, deficon, defstate, defblend, start = TRUE, no_anim = FALSE, appearance_flags = FALSE) // Loop through the underlays, then overlays, sorting them into the layers list #define PROCESS_OVERLAYS_OR_UNDERLAYS(flat, process, base_layer) \ for (var/i in 1 to process.len) { \ @@ -435,6 +436,7 @@ world if(layer_image.alpha == 0) continue + // variables only relevant when accounting for appearance_flags: var/apply_color = TRUE var/apply_alpha = TRUE @@ -443,11 +445,12 @@ world add = icon(layer_image.icon, layer_image.icon_state, base_icon_dir) else // 'I' is an appearance object. var/image/layer_as_image = image(layer_image) - if(layer_as_image.appearance_flags & RESET_COLOR) - apply_color = FALSE - if(layer_as_image.appearance_flags & RESET_ALPHA) - apply_alpha = FALSE - add = getFlatIcon(layer_as_image, curdir, curicon, curstate, curblend, FALSE, no_anim) + if(appearance_flags) + if(layer_as_image.appearance_flags & RESET_COLOR) + apply_color = FALSE + if(layer_as_image.appearance_flags & RESET_ALPHA) + apply_alpha = FALSE + add = getFlatIcon(layer_as_image, curdir, curicon, curstate, curblend, FALSE, no_anim, appearance_flags) if(!add) continue @@ -476,18 +479,31 @@ world flatY1 = addY1 flatY2 = addY2 - if(apply_color && appearance.color) - if(islist(appearance.color)) - add.MapColors(arglist(appearance.color)) - else - add.Blend(appearance.color, ICON_MULTIPLY) + if(appearance_flags) + // apply parent's color/alpha to the added layers if the layer didn't opt + if(apply_color && appearance.color) + if(islist(appearance.color)) + add.MapColors(arglist(appearance.color)) + else + add.Blend(appearance.color, ICON_MULTIPLY) - if(apply_alpha && appearance.alpha < 255) - add.Blend(rgb(255, 255, 255, appearance.alpha), ICON_MULTIPLY) + if(apply_alpha && appearance.alpha < 255) + add.Blend(rgb(255, 255, 255, appearance.alpha), ICON_MULTIPLY) // Blend the overlay into the flattened icon flat.Blend(add, blendMode2iconMode(curblend), layer_image.pixel_x + 2 - flatX1, layer_image.pixel_y + 2 - flatY1) + if(!appearance_flags) + // If we didn't apply parent colors individually per layer respecting appearance_flags, then do it just the one time now + if(appearance.color) + if(islist(appearance.color)) + flat.MapColors(arglist(appearance.color)) + else + flat.Blend(appearance.color, ICON_MULTIPLY) + + if(appearance.alpha < 255) + flat.Blend(rgb(255, 255, 255, appearance.alpha), ICON_MULTIPLY) + if(no_anim) //Clean up repeated frames var/icon/cleaned = new /icon() From 2035db767c4f347cd3a090e2cd6811872c064250 Mon Sep 17 00:00:00 2001 From: Cthulhu80 <122310258+Cthulhu80@users.noreply.github.com> Date: Thu, 5 Oct 2023 19:29:37 -0400 Subject: [PATCH 111/161] Update tgui/packages/tgui/interfaces/CanvasLayer.js Co-authored-by: Drathek <76988376+Drulikar@users.noreply.github.com> --- tgui/packages/tgui/interfaces/CanvasLayer.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index cbfd0b81e30c..81fa0ba458d1 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -35,9 +35,6 @@ export class CanvasLayer extends Component { this.img = new Image(); - // hardcoded value for testing pngs - // this.img.src = "https://cm-ss13.com/wiki/images/6/6f/LV624.png" - this.img.src = this.imageSrc; this.drawCanvas(); From 0d02230b047916ecbdc28db8604ba571447ced22 Mon Sep 17 00:00:00 2001 From: Cthulhu80 <122310258+Cthulhu80@users.noreply.github.com> Date: Thu, 5 Oct 2023 19:31:10 -0400 Subject: [PATCH 112/161] Update code/controllers/subsystem/minimap.dm Co-authored-by: Drathek <76988376+Drulikar@users.noreply.github.com> --- code/controllers/subsystem/minimap.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 6edf73752e4a..2f49d5628317 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -375,7 +375,7 @@ SUBSYSTEM_DEF(minimaps) return FALSE 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")) // tf2heavy: "Oh, this is bad!" + to_chat(user, SPAN_WARNING("The tacmap filckers and then shuts off, a critical error has occurred! Contact a coder.")) // tf2heavy: "Oh, this is bad!" return FALSE var/user_faction var/mob/living/carbon/xenomorph/xeno From e20cebcffdaa98ff95e29fac7eca78a734c60124 Mon Sep 17 00:00:00 2001 From: Cthulhu80 <122310258+Cthulhu80@users.noreply.github.com> Date: Thu, 5 Oct 2023 19:31:33 -0400 Subject: [PATCH 113/161] Update code/controllers/subsystem/minimap.dm Co-authored-by: Drathek <76988376+Drulikar@users.noreply.github.com> --- code/controllers/subsystem/minimap.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 2f49d5628317..44991b791c00 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -373,7 +373,7 @@ SUBSYSTEM_DEF(minimaps) /datum/tacmap/proc/distribute_current_map_png(mob/user) if(!COOLDOWN_FINISHED(src, flatten_map_cooldown)) return FALSE - var/icon/flat_map = getFlatIcon(map_holder.map) + var/icon/flat_map = getFlatIcon(map_holder.map, appearance_flags = TRUE) if(!flat_map) to_chat(user, SPAN_WARNING("The tacmap filckers and then shuts off, a critical error has occurred! Contact a coder.")) // tf2heavy: "Oh, this is bad!" return FALSE From 491fc7dd032a5d5af3852be22e460782b528bf79 Mon Sep 17 00:00:00 2001 From: doom Date: Thu, 5 Oct 2023 19:26:02 -0700 Subject: [PATCH 114/161] .... --- code/controllers/subsystem/minimap.dm | 12 +++++++++--- tgui/packages/tgui/interfaces/TacticalMap.tsx | 15 +-------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 6edf73752e4a..12e8c03c6a27 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -535,6 +535,8 @@ SUBSYSTEM_DEF(minimaps) var/targeted_ztrait = ZTRAIT_GROUND var/atom/owner + var/static/map_reference + // color selection for the tactical map canvas, defaults to black. var/toolbar_color_selection = "black" var/toolbar_updated_selection = "black" @@ -557,7 +559,6 @@ SUBSYSTEM_DEF(minimaps) allowed_flags = minimap_type owner = source - /datum/tacmap/status_tab_view/New() var/datum/tacmap/status_tab_view/uscm_tacmap allowed_flags = MINIMAP_FLAG_USCM @@ -578,6 +579,11 @@ SUBSYSTEM_DEF(minimaps) ui = SStgui.try_update_ui(user, src, ui) if(!ui) + if(!map_reference) + var/wiki_url = CONFIG_GET(string/wikiurl) + var/obj/item/map/current_map/new_map = new + map_reference ="[wiki_url]/[new_map.html_link]" + qdel(new_map) var/mob/living/carbon/xenomorph/xeno = user if(ishuman(user) || isxeno(user) && xeno.hivenumber == XENO_HIVE_NORMAL) @@ -623,7 +629,7 @@ SUBSYSTEM_DEF(minimaps) data["canViewTacmap"] = FALSE data["canViewCanvas"] = TRUE data["isXeno"] = FALSE - data["currentMapName"] = SSmapping.configs?[GROUND_MAP].map_name + data["currentMapName"] = map_reference var/mob/living/carbon/xenomorph/xeno_user if(isxeno(user)) @@ -645,7 +651,7 @@ SUBSYSTEM_DEF(minimaps) /datum/tacmap/status_tab_view/ui_static_data(mob/user) var/list/data = list() - data["currentMapName"] = SSmapping.configs?[GROUND_MAP].map_name + data["currentMapName"] = map_reference data["canDraw"] = FALSE data["canViewTacmap"] = FALSE data["canViewCanvas"] = TRUE diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 339b4d908cf4..71f2da7015d0 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -52,19 +52,6 @@ const PAGES = [ }, ]; -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', 'red', @@ -162,7 +149,7 @@ const OldMapPanel = (props, context) => { ) : ( 'Please wait for a new tacmap announcement' From b8f48d9345530a39c2068df3f8ac49532a16f774 Mon Sep 17 00:00:00 2001 From: doom Date: Mon, 9 Oct 2023 00:48:56 -0700 Subject: [PATCH 115/161] ... --- code/_globalvars/misc.dm | 3 + code/controllers/subsystem/minimap.dm | 74 +++++++++++++++---- tgui/packages/tgui/interfaces/TacticalMap.tsx | 11 +-- 3 files changed, 65 insertions(+), 23 deletions(-) diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index 2a862ea4f10b..40d66b1eb9ac 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -25,6 +25,9 @@ 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_VAR_INIT(current_marine_tacmap_announcement_status, TRUE) +GLOBAL_VAR_INIT(current_xeno_tacmap_announcement_status, TRUE) + //global tacmap for action button access GLOBAL_DATUM_INIT(tacmap_datum, /datum/tacmap/status_tab_view, new) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 44562d35a649..228285002916 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -339,29 +339,47 @@ SUBSYSTEM_DEF(minimaps) return map /** - * Fetches either a datum containing either a flattend map png reference or a set of given svg coords + * Fetches either a datum containing either a flattend map png reference or a set of given svg coords, proc is getting rather bloated. I'll probably split this up later. + * PLEASE READ:something to note for tha return_current_map if it's false. The perference is to return the current map if it's been announced, but if it hasn't been then it will return the old one. + * it's a bit confusing, so it will be refactored later. * Arguments: * * user: mob, to determine which faction get the map from. * * asset_type: true for png, false for svg + * * return_current_map: if we want to access the previous map or the current flattened one, true for current, false for previous, although if the current is available it will default to that. */ -/datum/proc/get_current_tacmap_data(mob/user, asset_type) +/datum/proc/get_current_tacmap_data(mob/user, asset_type, return_last_map=FALSE) var/list/map_list + var/faction_announcement_status if(ishuman(user)) if(asset_type) map_list = GLOB.uscm_flat_tacmap_png_asset + faction_announcement_status = GLOB.current_marine_tacmap_announcement_status else map_list = GLOB.uscm_svg_overlay else if(asset_type) map_list = GLOB.xeno_flat_tacmap_png_asset + faction_announcement_status = GLOB.current_xeno_tacmap_announcement_status else map_list = GLOB.xeno_svg_overlay - if(map_list.len == 0) return - return map_list[map_list.len] + // returning the svg + if(!asset_type) + return map_list[map_list.len] + + // edge case so we don't attempt to return a non-existant old map + if(map_list.len == 1) + return map_list[map_list.len] + + // if the current tacmap has been announced or the expected return type is the most up to date map then we return the CURRENT map + if(faction_announcement_status || return_last_map) + return map_list[map_list.len] + else + // otherwise we return the previous map + return map_list[map_list.len - 1] /** * flattens the current map and then distributes it based off user faction. @@ -552,7 +570,14 @@ SUBSYSTEM_DEF(minimaps) var/updated_canvas = FALSE // datums for holding both the flattend png asset reference and an svg overlay. It's best to keep them separate with the current implementation imo. - var/datum/flattend_tacmap_png/current_map = new + + // current flattend map + var/datum/flattend_tacmap_png/new_current_map = new + + // previous flattened map + var/datum/flattend_tacmap_png/old_map = new + + // current svg var/datum/svg_overlay/current_svg = new /datum/tacmap/New(atom/source, minimap_type) @@ -587,12 +612,19 @@ SUBSYSTEM_DEF(minimaps) var/mob/living/carbon/xenomorph/xeno = user if(ishuman(user) || isxeno(user) && xeno.hivenumber == XENO_HIVE_NORMAL) - current_map = get_current_tacmap_data(user, TRUE) - current_svg = get_current_tacmap_data(user, FALSE) - if(!current_map) + old_map = get_current_tacmap_data(user, asset_type=TRUE) + current_svg = get_current_tacmap_data(user, asset_type=FALSE) + new_current_map = get_current_tacmap_data(user, asset_type=TRUE, return_last_map=TRUE) + if(!new_current_map) if(!distribute_current_map_png(user)) return - current_map = get_current_tacmap_data(user, TRUE) + new_current_map = get_current_tacmap_data(user, asset_type=TRUE, return_last_map=TRUE) + old_map = get_current_tacmap_data(user, asset_type=TRUE) + if(ishuman(user) && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT) || isqueen(user)) + if(ishuman(user)) + GLOB.current_marine_tacmap_announcement_status = FALSE + else + GLOB.current_xeno_tacmap_announcement_status = FALSE user.client.register_map_obj(map_holder.map) @@ -602,7 +634,8 @@ SUBSYSTEM_DEF(minimaps) /datum/tacmap/ui_data(mob/user) var/list/data = list() - data["flatImage"] = current_map.flat_tacmap + data["newCanvasFlatImage"] = new_current_map.flat_tacmap + data["oldCanvasFlatImage"] = old_map.flat_tacmap data["svgData"] = null @@ -624,7 +657,6 @@ SUBSYSTEM_DEF(minimaps) /datum/tacmap/ui_static_data(mob/user) var/list/data = list() - data["canDraw"] = FALSE data["canViewTacmap"] = FALSE data["canViewCanvas"] = TRUE @@ -644,13 +676,16 @@ SUBSYSTEM_DEF(minimaps) data["canViewTacmap"] = TRUE if(!distribute_current_map_png(user)) return data - current_map = get_current_tacmap_data(user, TRUE) + new_current_map = get_current_tacmap_data(user, asset_type=TRUE, return_last_map=TRUE) + if(ishuman(user)) + GLOB.current_marine_tacmap_announcement_status = FALSE + else + GLOB.current_xeno_tacmap_announcement_status = FALSE return data /datum/tacmap/status_tab_view/ui_static_data(mob/user) var/list/data = list() - data["currentMapName"] = map_reference data["canDraw"] = FALSE data["canViewTacmap"] = FALSE @@ -681,8 +716,12 @@ SUBSYSTEM_DEF(minimaps) toolbar_updated_selection = toolbar_color_selection // doing this if it == canvas can cause a latency issue with the stroke. else if(!distribute_current_map_png(user)) - return - current_map = get_current_tacmap_data(user, TRUE) + return TRUE + if(ishuman(user)) + GLOB.current_marine_tacmap_announcement_status = FALSE + else + GLOB.current_xeno_tacmap_announcement_status = FALSE + new_current_map = get_current_tacmap_data(user, asset_type=TRUE, return_current_map=TRUE) . = TRUE @@ -724,14 +763,17 @@ SUBSYSTEM_DEF(minimaps) 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) + GLOB.current_xeno_tacmap_announcement_status = TRUE else 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 progress...", "Tactical Map:") - human_leader.visible_message(SPAN_BOLDNOTICE("Tactical map update in progress...")) playsound_client(human_leader.client, "sound/effects/sos-morse-code.ogg") COOLDOWN_START(GLOB, uscm_canvas_cooldown, canvas_cooldown_time) + GLOB.current_marine_tacmap_announcement_status = TRUE + + old_map = get_current_tacmap_data(user, asset_type=TRUE) toolbar_updated_selection = toolbar_color_selection message_admins("[key_name(user)] has updated the tactical map") diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 71f2da7015d0..575bb413a791 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -15,7 +15,8 @@ interface TacMapProps { canDraw: number; isXeno: boolean; canViewCanvas: number; - flatImage: string; + newCanvasFlatImage: string; + oldCanvasFlatImage: string; currentMapName: string; mapRef: any; currentMenu: string; @@ -145,15 +146,11 @@ const OldMapPanel = (props, context) => { const { data } = useBackend(context); return (
- {data.flatImage ? ( - ) : ( - 'Please wait for a new tacmap announcement' - )}
); }; @@ -266,7 +263,7 @@ const DrawMapPanel = (props, context) => {
From 5dd394066ee79bfea7560ec11338a408208c157a Mon Sep 17 00:00:00 2001 From: doom Date: Mon, 9 Oct 2023 00:49:51 -0700 Subject: [PATCH 116/161] ... --- tgui/packages/tgui/interfaces/TacticalMap.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 575bb413a791..edbbaf96f7bf 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -146,11 +146,11 @@ const OldMapPanel = (props, context) => { const { data } = useBackend(context); return (
- +
); }; From af4498288d682e5e52b058ddcf0a9bf787fc2454 Mon Sep 17 00:00:00 2001 From: doom Date: Mon, 9 Oct 2023 11:41:29 -0700 Subject: [PATCH 117/161] ... --- code/controllers/subsystem/minimap.dm | 15 ++++++++------- tgui/packages/tgui/interfaces/CanvasLayer.js | 7 ++++--- tgui/packages/tgui/interfaces/TacticalMap.tsx | 17 +++++++++-------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 228285002916..b1106dbcd152 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -580,6 +580,8 @@ SUBSYSTEM_DEF(minimaps) // current svg var/datum/svg_overlay/current_svg = new + var/action_queue_change = 0 + /datum/tacmap/New(atom/source, minimap_type) allowed_flags = minimap_type owner = source @@ -642,6 +644,7 @@ SUBSYSTEM_DEF(minimaps) if(current_svg) data["svgData"] = current_svg.svg_data + data["actionQueueChange"] = action_queue_change data["mapRef"] = map_holder.map_ref data["toolbarColorSelection"] = toolbar_color_selection data["toolbarUpdatedSelection"] = toolbar_updated_selection @@ -696,6 +699,7 @@ SUBSYSTEM_DEF(minimaps) /datum/tacmap/ui_close(mob/user) . = ..() + action_queue_change = 0 updated_canvas = FALSE toolbar_color_selection = "black" toolbar_updated_selection = "black" @@ -729,26 +733,23 @@ SUBSYSTEM_DEF(minimaps) // forces state change, this will export the svg. toolbar_updated_selection = "export" updated_canvas = TRUE + action_queue_change += 1 . = TRUE if ("clearCanvas") - if(toolbar_updated_selection == "clear") - toolbar_updated_selection = toolbar_color_selection - return toolbar_updated_selection = "clear" + action_queue_change += 1 . = TRUE if ("undoChange") - if(toolbar_updated_selection == "undo") - toolbar_updated_selection = toolbar_color_selection - return toolbar_updated_selection = "undo" + action_queue_change += 1 . = TRUE if ("selectColor") - toolbar_color_selection = params["color"] toolbar_updated_selection = toolbar_color_selection + action_queue_change += 1 . = TRUE if ("selectAnnouncement") diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index 81fa0ba458d1..43774b1ba864 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -10,6 +10,7 @@ export class CanvasLayer extends Component { // using this.state prevents unpredictable behavior this.state = { selection: this.props.selection, + action: this.props.actionQueueChange, }; // needs to be of type png of jpg @@ -135,7 +136,6 @@ export class CanvasLayer extends Component { if (line.length === 0) { return; } - const prevColor = line[0][4]; this.ctx.clearRect( 0, @@ -161,7 +161,8 @@ export class CanvasLayer extends Component { this.ctx.stroke(); }); }); - this.setState({ selection: prevColor }); + + this.setState({ selection: this.props.prevColor }); return; } @@ -175,7 +176,7 @@ export class CanvasLayer extends Component { }; componentDidUpdate(prevProps) { - if (prevProps.selection !== this.props.selection) { + if (prevProps.actionQueueChange !== this.props.actionQueueChange) { this.handleSelectionChange(); } } diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index edbbaf96f7bf..f9212a2e49c1 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -17,6 +17,8 @@ interface TacMapProps { canViewCanvas: number; newCanvasFlatImage: string; oldCanvasFlatImage: string; + actionQueueChange: number; + exportedColor: string; currentMapName: string; mapRef: any; currentMenu: string; @@ -166,14 +168,11 @@ const DrawMapPanel = (props, context) => { data.exportedTacMapImage = image; }; - const handleColorSelection = () => { - if ( - colors[data.toolbarUpdatedSelection] !== null && - colors[data.toolbarUpdatedSelection] !== undefined - ) { - return colors[data.toolbarUpdatedSelection]; + const handleColorSelection = (dataSelection) => { + if (colors[dataSelection] !== null && colors[dataSelection] !== undefined) { + return colors[dataSelection]; } else { - return data.toolbarUpdatedSelection; + return dataSelection; } }; @@ -262,8 +261,10 @@ const DrawMapPanel = (props, context) => {
From 90b6351a864d84970aad093793c6736b2a3b514f Mon Sep 17 00:00:00 2001 From: doom Date: Mon, 9 Oct 2023 14:10:22 -0700 Subject: [PATCH 118/161] ... --- code/_globalvars/misc.dm | 3 +++ code/controllers/subsystem/minimap.dm | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index 40d66b1eb9ac..153f50066b2e 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -18,6 +18,9 @@ GLOBAL_VAR(ooc_color_override) GLOBAL_VAR_INIT(uscm_canvas_cooldown, 0) GLOBAL_VAR_INIT(xeno_canvas_cooldown, 0) +// getFlatIcon cooldown for cic only +GLOBAL_VAR_INIT(cic_flatten_map_icon_cooldown, 0) + /// List of roles that can be setup for each gamemode GLOBAL_LIST_INIT(gamemode_roles, list()) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index b1106dbcd152..5d9f12d09fb8 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -340,12 +340,12 @@ SUBSYSTEM_DEF(minimaps) /** * Fetches either a datum containing either a flattend map png reference or a set of given svg coords, proc is getting rather bloated. I'll probably split this up later. - * PLEASE READ:something to note for tha return_current_map if it's false. The perference is to return the current map if it's been announced, but if it hasn't been then it will return the old one. + * PLEASE READ:something to note for tha return_last_map if it's false. The perference is to return the current map if it's been announced, but if it hasn't been then it will return the old one. * it's a bit confusing, so it will be refactored later. * Arguments: * * user: mob, to determine which faction get the map from. * * asset_type: true for png, false for svg - * * return_current_map: if we want to access the previous map or the current flattened one, true for current, false for previous, although if the current is available it will default to that. + * * return_last_map: if we want to access the previous map or the current flattened one, true for current, false for previous, although if the current is available it will default to that. */ /datum/proc/get_current_tacmap_data(mob/user, asset_type, return_last_map=FALSE) var/list/map_list @@ -389,8 +389,14 @@ SUBSYSTEM_DEF(minimaps) * * returns a boolean value, true if the operation was successful, false if it was not. */ /datum/tacmap/proc/distribute_current_map_png(mob/user) - if(!COOLDOWN_FINISHED(src, flatten_map_cooldown)) - return FALSE + if(!isqueen(user) && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT)) + if(!COOLDOWN_FINISHED(GLOB, cic_flatten_map_icon_cooldown)) + return FALSE + COOLDOWN_START(GLOB, cic_flatten_map_icon_cooldown, flatten_map_cooldown_time) + else + if(!COOLDOWN_FINISHED(src, flatten_map_cooldown)) + return FALSE + COOLDOWN_START(src, flatten_map_cooldown, flatten_map_cooldown_time) var/icon/flat_map = getFlatIcon(map_holder.map, appearance_flags = TRUE) if(!flat_map) to_chat(user, SPAN_WARNING("The tacmap filckers and then shuts off, a critical error has occurred! Contact a coder.")) // tf2heavy: "Oh, this is bad!" @@ -412,7 +418,6 @@ SUBSYSTEM_DEF(minimaps) faction_clients += client else if(client_mob.faction == user_faction) faction_clients += client - COOLDOWN_START(src, flatten_map_cooldown, flatten_map_cooldown_time) var/flat_tacmap_png = icon2html(flat_map, faction_clients, sourceonly = TRUE) var/datum/flattend_tacmap_png/new_flat = new(flat_tacmap_png) if(!isxeno(user)) @@ -561,6 +566,8 @@ SUBSYSTEM_DEF(minimaps) var/canvas_cooldown_time = 4 MINUTES var/flatten_map_cooldown_time = 3 MINUTES + + //flatten cooldown for xenos,queen,marines. Cic has their own that is globally defined. COOLDOWN_DECLARE(flatten_map_cooldown) //tacmap holder for holding the minimap @@ -725,7 +732,7 @@ SUBSYSTEM_DEF(minimaps) GLOB.current_marine_tacmap_announcement_status = FALSE else GLOB.current_xeno_tacmap_announcement_status = FALSE - new_current_map = get_current_tacmap_data(user, asset_type=TRUE, return_current_map=TRUE) + new_current_map = get_current_tacmap_data(user, asset_type=TRUE, return_last_map=TRUE) . = TRUE From b95cb40d170e835778363afe16ce5d0ae54e5f80 Mon Sep 17 00:00:00 2001 From: doom Date: Mon, 9 Oct 2023 14:28:24 -0700 Subject: [PATCH 119/161] guh --- tgui/packages/tgui/interfaces/CanvasLayer.js | 1 - 1 file changed, 1 deletion(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index 43774b1ba864..939f93c9de14 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -10,7 +10,6 @@ export class CanvasLayer extends Component { // using this.state prevents unpredictable behavior this.state = { selection: this.props.selection, - action: this.props.actionQueueChange, }; // needs to be of type png of jpg From 7af8d725cb18a2067eb7d15bc6934807d367eacf Mon Sep 17 00:00:00 2001 From: doom Date: Mon, 9 Oct 2023 16:56:07 -0700 Subject: [PATCH 120/161] bug fix --- code/controllers/subsystem/minimap.dm | 7 +++-- tgui/packages/tgui/interfaces/CanvasLayer.js | 29 +++++++++++++++++-- tgui/packages/tgui/interfaces/TacticalMap.tsx | 20 +++++++++---- 3 files changed, 46 insertions(+), 10 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 5d9f12d09fb8..045e121af74d 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -754,8 +754,11 @@ SUBSYSTEM_DEF(minimaps) . = TRUE if ("selectColor") - toolbar_color_selection = params["color"] - toolbar_updated_selection = toolbar_color_selection + + var/newColor = params["color"] + if(newColor) + toolbar_color_selection = newColor + toolbar_updated_selection = newColor action_queue_change += 1 . = TRUE diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index 939f93c9de14..2e9d1bffae88 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -10,6 +10,7 @@ export class CanvasLayer extends Component { // using this.state prevents unpredictable behavior this.state = { selection: this.props.selection, + mapLoad: true, }; // needs to be of type png of jpg @@ -37,6 +38,14 @@ export class CanvasLayer extends Component { this.img.src = this.imageSrc; + this.img.onload = () => { + this.setState({ mapLoad: true }); + }; + + this.img.onerror = () => { + this.setState({ mapLoad: false }); + }; + this.drawCanvas(); this.canvasRef.current.addEventListener('mousedown', this.handleMouseDown); @@ -45,6 +54,8 @@ export class CanvasLayer extends Component { } componentWillUnmount() { + // otherwise we get a runtime + if (!this.state.mapLoad) return; this.canvasRef.current.removeEventListener( 'mousedown', this.handleMouseDown @@ -136,6 +147,8 @@ export class CanvasLayer extends Component { return; } + const prevColor = line[0][4]; + this.ctx.clearRect( 0, 0, @@ -161,7 +174,8 @@ export class CanvasLayer extends Component { }); }); - this.setState({ selection: this.props.prevColor }); + this.setState({ selection: prevColor }); + this.props.onUndo(prevColor); return; } @@ -208,6 +222,17 @@ export class CanvasLayer extends Component { } render() { - return ; + // edge case where a new user joins and tries to draw on the canvas before they cached the png + return ( +
+ {this.state.mapLoad ? ( + + ) : ( +

+ Please wait a few minutes before attempting to access the canvas +

+ )} +
+ ); } } diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index f9212a2e49c1..2f9c5490a484 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -67,12 +67,12 @@ const colorOptions = [ const colors: Record = { 'black': '#000000', - 'red': '#FC0000', - 'orange': '#F59A07', - 'blue': '#0561F5', - 'purple': '#C002FA', + 'red': '#fc0000', + 'orange': '#f59a07', + 'blue': '#0561f5', + 'purple': '#c002fa', 'green': '#02c245', - 'brown': '#5C351E', + 'brown': '#5c351e', }; export const TacticalMap = (props, context) => { @@ -175,6 +175,11 @@ const DrawMapPanel = (props, context) => { return dataSelection; } }; + const findColorValue = (oldValue: string) => { + return (Object.keys(colors) as Array).find( + (key) => colors[key] === (oldValue as string) + ); + }; return ( <> @@ -237,6 +242,7 @@ const DrawMapPanel = (props, context) => { selected={data.toolbarColorSelection} color={data.toolbarColorSelection} onSelected={(value) => act('selectColor', { color: value })} + displayText={data.toolbarColorSelection} /> @@ -264,8 +270,10 @@ const DrawMapPanel = (props, context) => { selection={handleColorSelection(data.toolbarUpdatedSelection)} actionQueueChange={data.actionQueueChange} imageSrc={data.newCanvasFlatImage} - prevColor={handleColorSelection(data.toolbarColorSelection)} onImageExport={handleTacMapExport} + onUndo={(value) => + act('selectColor', { color: findColorValue(value) }) + } />
From 22dd87eac6eed10cbe7e8fc91ea30ea5719dc970 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Fri, 13 Oct 2023 06:48:36 -0700 Subject: [PATCH 121/161] Refactoring, polish, and ghost verbs --- code/_globalvars/misc.dm | 19 +- code/controllers/subsystem/minimap.dm | 316 ++++++++++-------- code/modules/client/client_procs.dm | 2 +- code/modules/mob/dead/observer/observer.dm | 17 + tgui/packages/tgui/interfaces/CanvasLayer.js | 9 +- tgui/packages/tgui/interfaces/DrawnMap.js | 18 +- tgui/packages/tgui/interfaces/TacticalMap.tsx | 82 +++-- 7 files changed, 273 insertions(+), 190 deletions(-) diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index 153f50066b2e..8bfa57cd54d1 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -18,8 +18,17 @@ GLOBAL_VAR(ooc_color_override) GLOBAL_VAR_INIT(uscm_canvas_cooldown, 0) GLOBAL_VAR_INIT(xeno_canvas_cooldown, 0) -// getFlatIcon cooldown for cic only -GLOBAL_VAR_INIT(cic_flatten_map_icon_cooldown, 0) +// getFlatIcon cooldown for xenos and marines +GLOBAL_VAR_INIT(uscm_flatten_map_icon_cooldown, 0) +GLOBAL_VAR_INIT(xeno_flatten_map_icon_cooldown, 0) + +// latest unannounced flat tacmap for xenos and marines +GLOBAL_VAR_INIT(uscm_unannounced_map, null) +GLOBAL_VAR_INIT(xeno_unannounced_map, null) + +//global tacmaps for action button access +GLOBAL_DATUM_INIT(uscm_tacmap_status, /datum/tacmap/status_tab_view, new) +GLOBAL_DATUM_INIT(xeno_tacmap_status, /datum/tacmap/status_tab_view/xeno, new) /// List of roles that can be setup for each gamemode GLOBAL_LIST_INIT(gamemode_roles, list()) @@ -28,12 +37,6 @@ 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_VAR_INIT(current_marine_tacmap_announcement_status, TRUE) -GLOBAL_VAR_INIT(current_xeno_tacmap_announcement_status, TRUE) - -//global tacmap for action button access -GLOBAL_DATUM_INIT(tacmap_datum, /datum/tacmap/status_tab_view, new) - /// 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 045e121af74d..b60a3c3021f4 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -339,110 +339,124 @@ SUBSYSTEM_DEF(minimaps) return map /** - * Fetches either a datum containing either a flattend map png reference or a set of given svg coords, proc is getting rather bloated. I'll probably split this up later. - * PLEASE READ:something to note for tha return_last_map if it's false. The perference is to return the current map if it's been announced, but if it hasn't been then it will return the old one. - * it's a bit confusing, so it will be refactored later. + * Fetches the datum containing an announced flattend map png reference. + * * Arguments: - * * user: mob, to determine which faction get the map from. - * * asset_type: true for png, false for svg - * * return_last_map: if we want to access the previous map or the current flattened one, true for current, false for previous, although if the current is available it will default to that. + * * faction: FACTION_MARINE or XENO_HIVE_NORMAL */ -/datum/proc/get_current_tacmap_data(mob/user, asset_type, return_last_map=FALSE) +/datum/proc/get_tacmap_data_png(faction) var/list/map_list - var/faction_announcement_status - if(ishuman(user)) - if(asset_type) - map_list = GLOB.uscm_flat_tacmap_png_asset - faction_announcement_status = GLOB.current_marine_tacmap_announcement_status - else - map_list = GLOB.uscm_svg_overlay + + if(faction == FACTION_MARINE) + map_list = GLOB.uscm_flat_tacmap_png_asset + else if(faction == XENO_HIVE_NORMAL) + map_list = GLOB.xeno_flat_tacmap_png_asset else - if(asset_type) - map_list = GLOB.xeno_flat_tacmap_png_asset - faction_announcement_status = GLOB.current_xeno_tacmap_announcement_status - else - map_list = GLOB.xeno_svg_overlay + return null - if(map_list.len == 0) - return + var/map_length = length(map_list) + + if(map_length == 0) + return null + + return map_list[map_length] + +/** + * Fetches the datum containing the latest unannounced flattend map png reference. + * + * Arguments: + * * faction: FACTION_MARINE or XENO_HIVE_NORMAL + */ +/datum/proc/get_unannounced_tacmap_data_png(faction) + if(faction == FACTION_MARINE) + return GLOB.uscm_unannounced_map + else if(faction == XENO_HIVE_NORMAL) + return GLOB.xeno_unannounced_map - // returning the svg - if(!asset_type) - return map_list[map_list.len] + return null - // edge case so we don't attempt to return a non-existant old map - if(map_list.len == 1) - return map_list[map_list.len] +/** + * Fetches the last set of svg coordinates for the tacmap drawing. + * + * Arguments: + * * faction: which faction get the map for: FACTION_MARINE or XENO_HIVE_NORMAL + */ +/datum/proc/get_tacmap_data_svg(faction) + var/list/map_list - // if the current tacmap has been announced or the expected return type is the most up to date map then we return the CURRENT map - if(faction_announcement_status || return_last_map) - return map_list[map_list.len] + if(faction == FACTION_MARINE) + map_list = GLOB.uscm_svg_overlay + else if(faction == XENO_HIVE_NORMAL) + map_list = GLOB.xeno_svg_overlay else - // otherwise we return the previous map - return map_list[map_list.len - 1] + return null + + var/map_length = length(map_list) + + if(map_length == 0) + return null + + return map_list[map_length] /** - * flattens the current map and then distributes it based off user faction. + * Flattens the current map and then distributes it for the specified faction as an unannounced map. + * * Arguments: - * * user: to determine which faction to distribute to + * * faction: which faction to distribute the map to: FACTION_MARINE or XENO_HIVE_NORMAL * Return: * * returns a boolean value, true if the operation was successful, false if it was not. */ -/datum/tacmap/proc/distribute_current_map_png(mob/user) - if(!isqueen(user) && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT)) - if(!COOLDOWN_FINISHED(GLOB, cic_flatten_map_icon_cooldown)) +/datum/tacmap/proc/distribute_current_map_png(faction) + if(faction == FACTION_MARINE) + if(!COOLDOWN_FINISHED(GLOB, uscm_flatten_map_icon_cooldown)) return FALSE - COOLDOWN_START(GLOB, cic_flatten_map_icon_cooldown, flatten_map_cooldown_time) - else - if(!COOLDOWN_FINISHED(src, flatten_map_cooldown)) + COOLDOWN_START(GLOB, uscm_flatten_map_icon_cooldown, flatten_map_cooldown_time) + else if(faction == XENO_HIVE_NORMAL) + if(!COOLDOWN_FINISHED(GLOB, xeno_flatten_map_icon_cooldown)) return FALSE - COOLDOWN_START(src, flatten_map_cooldown, flatten_map_cooldown_time) + COOLDOWN_START(GLOB, xeno_flatten_map_icon_cooldown, flatten_map_cooldown_time) + else + return FALSE + var/icon/flat_map = getFlatIcon(map_holder.map, appearance_flags = TRUE) if(!flat_map) - to_chat(user, SPAN_WARNING("The tacmap filckers and then shuts off, a critical error has occurred! Contact a coder.")) // tf2heavy: "Oh, this is bad!" + to_chat(usr, SPAN_WARNING("The tacmap filckers and then shuts off, a critical error has occurred! Contact a coder.")) // tf2heavy: "Oh, this is bad!" return FALSE - var/user_faction - var/mob/living/carbon/xenomorph/xeno - if(isxeno(user)) - xeno = user - user_faction = xeno.hivenumber - else - user_faction = FACTION_MARINE var/list/faction_clients = list() for(var/client/client in GLOB.clients) var/mob/client_mob = client.mob if(isxeno(client_mob)) - xeno = client_mob - if(xeno.hivenumber == user_faction) + var/mob/living/carbon/xenomorph/xeno = client_mob + if(xeno.hivenumber == faction) faction_clients += client - else if(client_mob.faction == user_faction) + else if(client_mob.faction == faction) faction_clients += client + var/flat_tacmap_png = icon2html(flat_map, faction_clients, sourceonly = TRUE) var/datum/flattend_tacmap_png/new_flat = new(flat_tacmap_png) - if(!isxeno(user)) - GLOB.uscm_flat_tacmap_png_asset += new_flat - else - GLOB.xeno_flat_tacmap_png_asset += new_flat - qdel(new_flat) + + if(faction == FACTION_MARINE) + GLOB.uscm_unannounced_map = new_flat + else //if(faction == XENO_HIVE_NORMAL) + GLOB.xeno_unannounced_map = new_flat + return TRUE /** - * globally stores svg coords for a given faction. + * Globally stores svg coords for a given faction. + * * Arguments: - * * user: mob, to determine which faction to distribute to + * * faction: which faction to save the data for: FACTION_MARINE or XENO_HIVE_NORMAL * * svg_coords: an array of coordinates corresponding to an svg. */ -/datum/tacmap/proc/store_current_svg_coords(mob/user, svg_coords) +/datum/tacmap/proc/store_current_svg_coords(faction, svg_coords) var/datum/svg_overlay/svg_store_overlay = new(svg_coords) - if(isxeno(user)) - GLOB.xeno_svg_overlay += svg_store_overlay - else + if(faction == FACTION_MARINE) GLOB.uscm_svg_overlay += svg_store_overlay - - qdel(svg_store_overlay) - + else if(faction == XENO_HIVE_NORMAL) + GLOB.xeno_svg_overlay += svg_store_overlay /datum/controller/subsystem/minimaps/proc/fetch_tacmap_datum(zlevel, flags) var/hash = "[zlevel]-[flags]" @@ -558,7 +572,7 @@ SUBSYSTEM_DEF(minimaps) var/targeted_ztrait = ZTRAIT_GROUND var/atom/owner - var/static/map_reference + var/static/wiki_map_fallback // color selection for the tactical map canvas, defaults to black. var/toolbar_color_selection = "black" @@ -589,6 +603,11 @@ SUBSYSTEM_DEF(minimaps) var/action_queue_change = 0 + // a time set as key to trick react into updating the canvas + var/last_update_time = 0 + // a temporary lock out before we can open the new canvas tab to allow the tacmap time to fire + var/tacmap_ready_time = 0 + /datum/tacmap/New(atom/source, minimap_type) allowed_flags = minimap_type owner = source @@ -598,13 +617,29 @@ SUBSYSTEM_DEF(minimaps) allowed_flags = MINIMAP_FLAG_USCM owner = uscm_tacmap +/datum/tacmap/status_tab_view/xeno/New() + var/datum/tacmap/status_tab_view/xeno/xeno_tacmap + allowed_flags = MINIMAP_FLAG_XENO + owner = xeno_tacmap + /datum/tacmap/Destroy() map_holder = null owner = null return ..() /datum/tacmap/tgui_interact(mob/user, datum/tgui/ui) - if(!map_holder) + var/mob/living/carbon/xenomorph/xeno = user + var/faction = istype(xeno) ? xeno.hivenumber : user.faction + if(user.faction == FACTION_NEUTRAL && isobserver(user)) + faction = allowed_flags == MINIMAP_FLAG_XENO ? XENO_HIVE_NORMAL : FACTION_MARINE + if(faction == FACTION_MARINE || faction == XENO_HIVE_NORMAL) + new_current_map = get_unannounced_tacmap_data_png(faction) + old_map = get_tacmap_data_png(faction) + current_svg = get_tacmap_data_svg(faction) + + var/use_live_map = faction == FACTION_MARINE && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT) || faction == XENO_HIVE_NORMAL + + if(use_live_map && !map_holder) var/level = SSmapping.levels_by_trait(targeted_ztrait) if(!level[1]) return @@ -612,91 +647,71 @@ SUBSYSTEM_DEF(minimaps) ui = SStgui.try_update_ui(user, src, ui) if(!ui) - - if(!map_reference) + if(!wiki_map_fallback) var/wiki_url = CONFIG_GET(string/wikiurl) var/obj/item/map/current_map/new_map = new - map_reference ="[wiki_url]/[new_map.html_link]" + if(wiki_url && new_map.html_link) + wiki_map_fallback ="[wiki_url]/[new_map.html_link]" + else + debug_log("Failed to determine fallback wiki map! Attempted '[wiki_url]/[new_map.html_link]'") qdel(new_map) - var/mob/living/carbon/xenomorph/xeno = user - if(ishuman(user) || isxeno(user) && xeno.hivenumber == XENO_HIVE_NORMAL) - old_map = get_current_tacmap_data(user, asset_type=TRUE) - current_svg = get_current_tacmap_data(user, asset_type=FALSE) - new_current_map = get_current_tacmap_data(user, asset_type=TRUE, return_last_map=TRUE) - if(!new_current_map) - if(!distribute_current_map_png(user)) - return - new_current_map = get_current_tacmap_data(user, asset_type=TRUE, return_last_map=TRUE) - old_map = get_current_tacmap_data(user, asset_type=TRUE) - if(ishuman(user) && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT) || isqueen(user)) - if(ishuman(user)) - GLOB.current_marine_tacmap_announcement_status = FALSE - else - GLOB.current_xeno_tacmap_announcement_status = FALSE - - - user.client.register_map_obj(map_holder.map) + if(use_live_map) + tacmap_ready_time = SSminimaps.next_fire + user.client.register_map_obj(map_holder.map) + ui = new(user, src, "TacticalMap") ui.open() /datum/tacmap/ui_data(mob/user) var/list/data = list() - data["newCanvasFlatImage"] = new_current_map.flat_tacmap - data["oldCanvasFlatImage"] = old_map.flat_tacmap - - data["svgData"] = null - - if(current_svg) - data["svgData"] = current_svg.svg_data + data["newCanvasFlatImage"] = new_current_map?.flat_tacmap + data["oldCanvasFlatImage"] = old_map?.flat_tacmap + data["svgData"] = current_svg?.svg_data data["actionQueueChange"] = action_queue_change - data["mapRef"] = map_holder.map_ref + data["toolbarColorSelection"] = toolbar_color_selection data["toolbarUpdatedSelection"] = toolbar_updated_selection - data["worldtime"] = world.time + if(isxeno(user)) - data["canvasCooldown"] = GLOB.xeno_canvas_cooldown + data["canvasCooldown"] = GLOB.xeno_canvas_cooldown - world.time else - data["canvasCooldown"] = GLOB.uscm_canvas_cooldown + data["canvasCooldown"] = GLOB.uscm_canvas_cooldown - world.time + data["nextCanvasTime"] = canvas_cooldown_time data["updatedCanvas"] = updated_canvas + data["lastUpdateTime"] = last_update_time + data["tacmapReady"] = world.time > tacmap_ready_time + return data /datum/tacmap/ui_static_data(mob/user) var/list/data = list() + + data["mapRef"] = map_holder.map_ref data["canDraw"] = FALSE - data["canViewTacmap"] = FALSE - data["canViewCanvas"] = TRUE - data["isXeno"] = FALSE - data["currentMapName"] = map_reference + data["mapFallback"] = wiki_map_fallback - var/mob/living/carbon/xenomorph/xeno_user - if(isxeno(user)) - xeno_user = user - data["isXeno"] = TRUE - if(xeno_user.hivenumber != XENO_HIVE_NORMAL) - data["canViewCanvas"] = FALSE - data["canViewTacmap"] = TRUE + var/mob/living/carbon/xenomorph/xeno = user + var/is_xeno = istype(xeno) + var/faction = is_xeno ? xeno.hivenumber : user.faction + + data["isXeno"] = is_xeno + data["canViewTacmap"] = is_xeno + data["canViewCanvas"] = faction == FACTION_MARINE || faction == XENO_HIVE_NORMAL - if(ishuman(user) && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT) || isqueen(user) && xeno_user.hivenumber == XENO_HIVE_NORMAL) + if(faction == FACTION_MARINE && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT) || faction == XENO_HIVE_NORMAL && isqueen(user)) data["canDraw"] = TRUE data["canViewTacmap"] = TRUE - if(!distribute_current_map_png(user)) - return data - new_current_map = get_current_tacmap_data(user, asset_type=TRUE, return_last_map=TRUE) - if(ishuman(user)) - GLOB.current_marine_tacmap_announcement_status = FALSE - else - GLOB.current_xeno_tacmap_announcement_status = FALSE return data /datum/tacmap/status_tab_view/ui_static_data(mob/user) var/list/data = list() - data["currentMapName"] = map_reference + data["mapFallback"] = wiki_map_fallback data["canDraw"] = FALSE data["canViewTacmap"] = FALSE data["canViewCanvas"] = TRUE @@ -704,6 +719,16 @@ SUBSYSTEM_DEF(minimaps) return data +/datum/tacmap/status_tab_view/xeno/ui_static_data(mob/user) + var/list/data = list() + data["mapFallback"] = wiki_map_fallback + data["canDraw"] = FALSE + data["canViewTacmap"] = FALSE + data["canViewCanvas"] = TRUE + data["isXeno"] = TRUE + + return data + /datum/tacmap/ui_close(mob/user) . = ..() action_queue_change = 0 @@ -716,23 +741,25 @@ SUBSYSTEM_DEF(minimaps) if(.) return - var/user = ui.user + var/mob/user = ui.user + var/mob/living/carbon/xenomorph/xeno = user + var/faction = istype(xeno) ? xeno.hivenumber : user.faction + if(user.faction == FACTION_NEUTRAL && isobserver(user)) + faction = allowed_flags == MINIMAP_FLAG_XENO ? XENO_HIVE_NORMAL : FACTION_MARINE switch (action) if ("menuSelect") if(params["selection"] != "new canvas") - if(!updated_canvas) - return - updated_canvas = FALSE - toolbar_updated_selection = toolbar_color_selection // doing this if it == canvas can cause a latency issue with the stroke. + if(updated_canvas) + updated_canvas = FALSE + toolbar_updated_selection = toolbar_color_selection // doing this if it == canvas can cause a latency issue with the stroke. else - if(!distribute_current_map_png(user)) - return TRUE - if(ishuman(user)) - GLOB.current_marine_tacmap_announcement_status = FALSE - else - GLOB.current_xeno_tacmap_announcement_status = FALSE - new_current_map = get_current_tacmap_data(user, asset_type=TRUE, return_last_map=TRUE) + distribute_current_map_png(faction) + last_update_time = world.time + + new_current_map = get_unannounced_tacmap_data_png(faction) + old_map = get_tacmap_data_png(faction) + current_svg = get_tacmap_data_svg(faction) . = TRUE @@ -754,7 +781,6 @@ SUBSYSTEM_DEF(minimaps) . = TRUE if ("selectColor") - var/newColor = params["color"] if(newColor) toolbar_color_selection = newColor @@ -763,28 +789,28 @@ SUBSYSTEM_DEF(minimaps) . = TRUE if ("selectAnnouncement") - if(!istype(params["image"], /list)) // potentially very serious? return - store_current_svg_coords(user, params["image"]) - current_svg = get_current_tacmap_data(user, FALSE) + if(faction == FACTION_MARINE) + GLOB.uscm_flat_tacmap_png_asset += new_current_map + else //if(faction == XENO_HIVE_NORMAL) + GLOB.xeno_flat_tacmap_png_asset += new_current_map - if(isxeno(user)) - 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) - GLOB.current_xeno_tacmap_announcement_status = TRUE - else + store_current_svg_coords(faction, params["image"]) + current_svg = get_tacmap_data_svg(faction) + old_map = get_tacmap_data_png(faction) + + if(faction == FACTION_MARINE) 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 progress...", "Tactical Map:") human_leader.visible_message(SPAN_BOLDNOTICE("Tactical map update in progress...")) playsound_client(human_leader.client, "sound/effects/sos-morse-code.ogg") COOLDOWN_START(GLOB, uscm_canvas_cooldown, canvas_cooldown_time) - GLOB.current_marine_tacmap_announcement_status = TRUE - - old_map = get_current_tacmap_data(user, asset_type=TRUE) + else if(faction == XENO_HIVE_NORMAL) + xeno_maptext("The Queen has updated your hive mind map", "You sense something unusual...", faction) + COOLDOWN_START(GLOB, xeno_canvas_cooldown, canvas_cooldown_time) toolbar_updated_selection = toolbar_color_selection message_admins("[key_name(user)] has updated the tactical map") diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index dc99ae4a9de2..6c5c8d74d634 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -167,7 +167,7 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list( else if(href_list["MapView"]) if(isxeno(mob)) return - GLOB.tacmap_datum.tgui_interact(mob) + GLOB.uscm_tacmap_status.tgui_interact(mob) //NOTES OVERHAUL if(href_list["add_merit_info"]) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 130a8a923edc..8a39ac2e3d35 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -898,6 +898,23 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp GLOB.hive_datum[hives[faction]].hive_ui.open_hive_status(src) +/mob/dead/observer/verb/view_uscm_tacmap() + set name = "View USCM Tacmap" + set category = "Ghost.View" + + GLOB.uscm_tacmap_status.tgui_interact(src) + +/mob/dead/observer/verb/view_xeno_tacmap() + set name = "View Xeno Tacmap" + set category = "Ghost.View" + + var/datum/hive_status/hive = GLOB.hive_datum[XENO_HIVE_NORMAL] + if(!hive || !length(hive.totalXenos)) + to_chat(src, SPAN_ALERT("There seem to be no living hives at the moment")) + return + + GLOB.xeno_tacmap_status.tgui_interact(src) + /mob/dead/verb/join_as_alien() set category = "Ghost.Join" set name = "Join as Xeno" diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index 2e9d1bffae88..ac47fb8f0dc5 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -201,8 +201,8 @@ export class CanvasLayer extends Component { this.img, 0, 0, - this.canvasRef.current.width, - this.canvasRef.current.height + this.canvasRef.current?.width, + this.canvasRef.current?.height ); }; } @@ -226,10 +226,11 @@ export class CanvasLayer extends Component { return (
{this.state.mapLoad ? ( - + ) : (

- Please wait a few minutes before attempting to access the canvas + Please wait a few minutes before attempting to access the canvas.{' '} + {this.state.mapLoad}

)}
diff --git a/tgui/packages/tgui/interfaces/DrawnMap.js b/tgui/packages/tgui/interfaces/DrawnMap.js index 525f68486831..625095994ac8 100644 --- a/tgui/packages/tgui/interfaces/DrawnMap.js +++ b/tgui/packages/tgui/interfaces/DrawnMap.js @@ -44,34 +44,28 @@ export class DrawnMap extends Component { const parsedSvgData = this.parseSvgData(this.svg); return ( -
+
{this.img && ( )} {parsedSvgData && this.state.mapLoad && ( {parsedSvgData.map((line, index) => ( diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 2f9c5490a484..778dc9f1bca7 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -19,18 +19,22 @@ interface TacMapProps { oldCanvasFlatImage: string; actionQueueChange: number; exportedColor: string; - currentMapName: string; - mapRef: any; + mapFallback: string; + mapRef: string; currentMenu: string; - worldtime: any; + lastUpdateTime: any; nextCanvasTime: any; canvasCooldown: any; exportedTacMapImage: any; + tacmapReady: number; } const PAGES = [ { title: 'tacmap', + canOpen: (data) => { + return 1; + }, component: () => ViewMapPanel, icon: 'map', canAccess: (data) => { @@ -39,6 +43,9 @@ const PAGES = [ }, { title: 'old canvas', + canOpen: (data) => { + return 1; + }, component: () => OldMapPanel, icon: 'eye', canAccess: (data) => { @@ -47,6 +54,9 @@ const PAGES = [ }, { title: 'new canvas', + canOpen: (data) => { + return data.tacmapReady; + }, component: () => DrawMapPanel, icon: 'paintbrush', canAccess: (data) => { @@ -77,7 +87,11 @@ const colors: Record = { export const TacticalMap = (props, context) => { const { data, act } = useBackend(context); - const [pageIndex, setPageIndex] = useLocalState(context, 'pageIndex', 0); + const [pageIndex, setPageIndex] = useLocalState( + context, + 'pageIndex', + data.canViewTacmap ? 0 : 1 + ); const PageComponent = PAGES[pageIndex].component(); const handleTacmapOnClick = (i, pageTitle) => { @@ -88,9 +102,14 @@ export const TacticalMap = (props, context) => { }; return ( - +
{ key={i} color={data.isXeno ? 'purple' : 'blue'} selected={i === pageIndex} + disabled={page.canOpen(data) === 0} icon={page.icon} onClick={() => handleTacmapOnClick(i, page.title)}> - {page.title} + {page.canOpen(data) === 0 ? 'loading' : page.title} ); })} @@ -117,7 +137,7 @@ export const TacticalMap = (props, context) => {
- +
); @@ -132,11 +152,12 @@ const ViewMapPanel = (props, context) => { } return ( -
+
@@ -147,11 +168,17 @@ const ViewMapPanel = (props, context) => { const OldMapPanel = (props, context) => { const { data } = useBackend(context); return ( -
+
); @@ -160,9 +187,8 @@ const OldMapPanel = (props, context) => { const DrawMapPanel = (props, context) => { const { data, act } = useBackend(context); - const timeLeft = data.canvasCooldown - data.worldtime; - const timeLeftPct = timeLeft / data.nextCanvasTime; - const canUpdate = timeLeft < 0 && !data.updatedCanvas; + const timeLeftPct = data.canvasCooldown / data.nextCanvasTime; + const canUpdate = data.canvasCooldown < 0 && !data.updatedCanvas; const handleTacMapExport = (image: any) => { data.exportedTacMapImage = image; @@ -183,11 +209,15 @@ const DrawMapPanel = (props, context) => { return ( <> -
- +
+ {(!data.updatedCanvas && ( { /> - + - {timeLeft > 0 && ( + {data.canvasCooldown > 0 && ( { bad: [0.67, Infinity], }}> - {Math.ceil(timeLeft / 10)} seconds until the canvas changes - can be updated + {Math.ceil(data.canvasCooldown / 10)} seconds until the canvas + changes can be updated )}
-
+
act('selectColor', { color: findColorValue(value) }) From 911ded77cb5149b5b3c8ac3d0c8e327b7663465f Mon Sep 17 00:00:00 2001 From: Drulikar Date: Fri, 13 Oct 2023 07:30:14 -0700 Subject: [PATCH 122/161] Remove a testing var --- tgui/packages/tgui/interfaces/CanvasLayer.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index ac47fb8f0dc5..093b44b8f44b 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -229,8 +229,7 @@ export class CanvasLayer extends Component { ) : (

- Please wait a few minutes before attempting to access the canvas.{' '} - {this.state.mapLoad} + Please wait a few minutes before attempting to access the canvas.

)}
From 5fe3f35d6f029bbc2e864c63efc704de1ea947d6 Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 13 Oct 2023 10:24:42 -0700 Subject: [PATCH 123/161] bug fix --- tgui/packages/tgui/interfaces/DrawnMap.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tgui/packages/tgui/interfaces/DrawnMap.js b/tgui/packages/tgui/interfaces/DrawnMap.js index 625095994ac8..58652f64f32d 100644 --- a/tgui/packages/tgui/interfaces/DrawnMap.js +++ b/tgui/packages/tgui/interfaces/DrawnMap.js @@ -8,6 +8,7 @@ export class DrawnMap extends Component { this.backupImgSrc = this.props.backupImage; this.state = { mapLoad: true, + loadingBackup: true, }; this.img = null; this.svg = this.props.svgData; @@ -24,6 +25,12 @@ export class DrawnMap extends Component { this.img.src = this.backupImgSrc; this.setState({ mapLoad: false }); }; + + const backupImg = new Image(); + backupImg.src = this.backupImgSrc; + backupImg.onload = () => { + this.setState({ loadingBackup: false }); + }; } parseSvgData(svgDataArray) { @@ -45,7 +52,10 @@ export class DrawnMap extends Component { return (
- {this.img && ( + {this.state.loadingBackup && !this.state.mapLoad && ( +

Loading map...

+ )} + {this.img && this.state.mapLoad && ( Date: Fri, 13 Oct 2023 14:00:37 -0700 Subject: [PATCH 124/161] ui bug fix --- tgui/packages/tgui/interfaces/CanvasLayer.js | 8 +++++--- tgui/packages/tgui/interfaces/TacticalMap.tsx | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index 093b44b8f44b..198a128c0a1a 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -228,9 +228,11 @@ export class CanvasLayer extends Component { {this.state.mapLoad ? ( ) : ( -

- Please wait a few minutes before attempting to access the canvas. -

+
+

+ Please wait a few minutes before attempting to access the canvas. +

+
)}
); diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 778dc9f1bca7..a1ff120f0cf7 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -286,7 +286,7 @@ const DrawMapPanel = (props, context) => { position="absolute" width="98%" style={{ 'z-index': '1' }} - bottom="-40px"> + bottom="-55px"> {data.canvasCooldown > 0 && ( {
-
+
Date: Fri, 13 Oct 2023 15:05:17 -0700 Subject: [PATCH 125/161] ce --- tgui/packages/tgui/interfaces/CanvasLayer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index 198a128c0a1a..5757bf26b45f 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -228,7 +228,7 @@ export class CanvasLayer extends Component { {this.state.mapLoad ? ( ) : ( -
+

Please wait a few minutes before attempting to access the canvas.

From 6ab67cd0bc8403a1d3e1bb0245e96beaec96854c Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 13 Oct 2023 15:41:57 -0700 Subject: [PATCH 126/161] bug fix --- code/controllers/subsystem/minimap.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index b60a3c3021f4..823168d2e88f 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -637,7 +637,7 @@ SUBSYSTEM_DEF(minimaps) old_map = get_tacmap_data_png(faction) current_svg = get_tacmap_data_svg(faction) - var/use_live_map = faction == FACTION_MARINE && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT) || faction == XENO_HIVE_NORMAL + var/use_live_map = !new_current_map || faction == FACTION_MARINE && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT) || faction == XENO_HIVE_NORMAL if(use_live_map && !map_holder) var/level = SSmapping.levels_by_trait(targeted_ztrait) From c55d3078dfc47895392ab3368ccae44c4c4d16c4 Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 13 Oct 2023 16:04:28 -0700 Subject: [PATCH 127/161] bug fix --- tgui/packages/tgui/interfaces/TacticalMap.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index a1ff120f0cf7..3183f78391bc 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -147,7 +147,7 @@ const ViewMapPanel = (props, context) => { const { data } = useBackend(context); // byond ui can't resist trying to render - if (data.canViewTacmap === 0) { + if (data.canViewTacmap === 0 || data.mapRef === null) { return ; } From 33a747acb4940e338afd4e00529e5fb5d9897269 Mon Sep 17 00:00:00 2001 From: doom Date: Fri, 13 Oct 2023 16:46:04 -0700 Subject: [PATCH 128/161] bug fix --- code/controllers/subsystem/minimap.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 823168d2e88f..b2f1bf359871 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -637,7 +637,7 @@ SUBSYSTEM_DEF(minimaps) old_map = get_tacmap_data_png(faction) current_svg = get_tacmap_data_svg(faction) - var/use_live_map = !new_current_map || faction == FACTION_MARINE && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT) || faction == XENO_HIVE_NORMAL + var/use_live_map = faction == FACTION_MARINE && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT) || faction == XENO_HIVE_NORMAL if(use_live_map && !map_holder) var/level = SSmapping.levels_by_trait(targeted_ztrait) @@ -691,7 +691,7 @@ SUBSYSTEM_DEF(minimaps) /datum/tacmap/ui_static_data(mob/user) var/list/data = list() - data["mapRef"] = map_holder.map_ref + data["mapRef"] = map_holder?.map_ref data["canDraw"] = FALSE data["mapFallback"] = wiki_map_fallback From c45d786af69f10d31a709ec3a60fd7ac89bb61e4 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Fri, 13 Oct 2023 21:23:24 -0700 Subject: [PATCH 129/161] Moar polish: I wish I didn't have to be so specific about pixel heights, but theres too much mixed in the layouting for now --- code/controllers/subsystem/minimap.dm | 24 +++++++++---------- tgui/packages/tgui/interfaces/CanvasLayer.js | 5 ++-- tgui/packages/tgui/interfaces/DrawnMap.js | 9 ++++--- tgui/packages/tgui/interfaces/TacticalMap.tsx | 22 ++++++++++------- 4 files changed, 34 insertions(+), 26 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index b2f1bf359871..90326f0f41b3 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -574,38 +574,36 @@ SUBSYSTEM_DEF(minimaps) var/static/wiki_map_fallback - // color selection for the tactical map canvas, defaults to black. + /// color selection for the tactical map canvas, defaults to black. var/toolbar_color_selection = "black" var/toolbar_updated_selection = "black" var/canvas_cooldown_time = 4 MINUTES var/flatten_map_cooldown_time = 3 MINUTES - //flatten cooldown for xenos,queen,marines. Cic has their own that is globally defined. + /// flatten cooldown for xenos,queen,marines. Cic has their own that is globally defined. COOLDOWN_DECLARE(flatten_map_cooldown) - //tacmap holder for holding the minimap + /// tacmap holder for holding the minimap var/datum/tacmap_holder/map_holder - // boolean value to keep track if the canvas has been updated or not, the value is used in tgui state. + /// boolean value to keep track if the canvas has been updated or not, the value is used in tgui state. var/updated_canvas = FALSE - // datums for holding both the flattend png asset reference and an svg overlay. It's best to keep them separate with the current implementation imo. - - // current flattend map + /// current flattend map var/datum/flattend_tacmap_png/new_current_map = new - // previous flattened map + /// previous flattened map var/datum/flattend_tacmap_png/old_map = new - // current svg + /// current svg var/datum/svg_overlay/current_svg = new var/action_queue_change = 0 - // a time set as key to trick react into updating the canvas + /// The last time the map has been flattened - used as a key to trick react into updating the canvas var/last_update_time = 0 - // a temporary lock out before we can open the new canvas tab to allow the tacmap time to fire + /// A temporary lock out time before we can open the new canvas tab to allow the tacmap time to fire var/tacmap_ready_time = 0 /datum/tacmap/New(atom/source, minimap_type) @@ -676,9 +674,9 @@ SUBSYSTEM_DEF(minimaps) data["toolbarUpdatedSelection"] = toolbar_updated_selection if(isxeno(user)) - data["canvasCooldown"] = GLOB.xeno_canvas_cooldown - world.time + data["canvasCooldown"] = max(GLOB.xeno_canvas_cooldown - world.time, 0) else - data["canvasCooldown"] = GLOB.uscm_canvas_cooldown - world.time + data["canvasCooldown"] = max(GLOB.uscm_canvas_cooldown - world.time, 0) data["nextCanvasTime"] = canvas_cooldown_time data["updatedCanvas"] = updated_canvas diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index 5757bf26b45f..668875585d19 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -1,3 +1,4 @@ +import { Box } from '../components'; import { Component, createRef } from 'inferno'; // this file should probably not be in interfaces, should move it later. @@ -228,11 +229,11 @@ export class CanvasLayer extends Component { {this.state.mapLoad ? ( ) : ( -
+

Please wait a few minutes before attempting to access the canvas.

-
+ )}
); diff --git a/tgui/packages/tgui/interfaces/DrawnMap.js b/tgui/packages/tgui/interfaces/DrawnMap.js index 58652f64f32d..48ebd6273c4f 100644 --- a/tgui/packages/tgui/interfaces/DrawnMap.js +++ b/tgui/packages/tgui/interfaces/DrawnMap.js @@ -1,3 +1,4 @@ +import { Box } from '../components'; import { Component, createRef } from 'inferno'; export class DrawnMap extends Component { @@ -53,7 +54,9 @@ export class DrawnMap extends Component { return (
{this.state.loadingBackup && !this.state.mapLoad && ( -

Loading map...

+ +

Loading map...

+
)} {this.img && this.state.mapLoad && ( {parsedSvgData.map((line, index) => ( { justify="space-evenly"> - + {PAGES.map((page, i) => { if (page.canAccess(data) === 0) { return; @@ -175,11 +175,17 @@ const OldMapPanel = (props, context) => { justify="center" align="center" fontSize="30px"> - + {data.canViewCanvas ? ( + + ) : ( + +

Unauthorized.

+
+ )}
); }; @@ -188,7 +194,7 @@ const DrawMapPanel = (props, context) => { const { data, act } = useBackend(context); const timeLeftPct = data.canvasCooldown / data.nextCanvasTime; - const canUpdate = data.canvasCooldown < 0 && !data.updatedCanvas; + const canUpdate = data.canvasCooldown <= 0 && !data.updatedCanvas; const handleTacMapExport = (image: any) => { data.exportedTacMapImage = image; @@ -286,7 +292,7 @@ const DrawMapPanel = (props, context) => { position="absolute" width="98%" style={{ 'z-index': '1' }} - bottom="-55px"> + bottom="-40px"> {data.canvasCooldown > 0 && ( Date: Fri, 13 Oct 2023 21:25:01 -0700 Subject: [PATCH 130/161] Resizeable old canvas view --- tgui/packages/tgui/interfaces/DrawnMap.js | 19 ++++++++++++++----- tgui/packages/tgui/interfaces/TacticalMap.tsx | 3 +-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/tgui/packages/tgui/interfaces/DrawnMap.js b/tgui/packages/tgui/interfaces/DrawnMap.js index 48ebd6273c4f..cd5a9539f847 100644 --- a/tgui/packages/tgui/interfaces/DrawnMap.js +++ b/tgui/packages/tgui/interfaces/DrawnMap.js @@ -48,8 +48,17 @@ export class DrawnMap extends Component { return lines; } + getSize() { + const ratio = Math.min( + (self.innerWidth - 50) / 650, + (self.innerHeight - 150) / 600 + ); + return { width: 650 * ratio, height: 600 * ratio }; + } + render() { const parsedSvgData = this.parseSvgData(this.svg); + const size = this.getSize(); return (
@@ -66,16 +75,16 @@ export class DrawnMap extends Component { zIndex: 0, left: '18px', }} - width={650} - height={600} + width={size.width} + height={size.height} /> )} {parsedSvgData && this.state.mapLoad && ( { return (
From f37968a8eba731c1a1fdac6ad2116dc98b87720b Mon Sep 17 00:00:00 2001 From: Drulikar Date: Fri, 13 Oct 2023 22:26:21 -0700 Subject: [PATCH 131/161] mouseUp will now reset the update canvas button (I could draw, update canvas, draw and it wouldn't submit the svg drawing) --- code/controllers/subsystem/minimap.dm | 16 ++++++++-------- tgui/packages/tgui/interfaces/CanvasLayer.js | 1 + tgui/packages/tgui/interfaces/TacticalMap.tsx | 1 + 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 90326f0f41b3..1eb974fb4c3c 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -759,24 +759,21 @@ SUBSYSTEM_DEF(minimaps) old_map = get_tacmap_data_png(faction) current_svg = get_tacmap_data_svg(faction) - . = TRUE - if ("updateCanvas") // forces state change, this will export the svg. toolbar_updated_selection = "export" updated_canvas = TRUE action_queue_change += 1 - . = TRUE if ("clearCanvas") toolbar_updated_selection = "clear" + updated_canvas = FALSE action_queue_change += 1 - . = TRUE if ("undoChange") toolbar_updated_selection = "undo" + updated_canvas = FALSE action_queue_change += 1 - . = TRUE if ("selectColor") var/newColor = params["color"] @@ -784,11 +781,13 @@ SUBSYSTEM_DEF(minimaps) toolbar_color_selection = newColor toolbar_updated_selection = newColor action_queue_change += 1 - . = TRUE + + if ("onDraw") + updated_canvas = FALSE if ("selectAnnouncement") if(!istype(params["image"], /list)) // potentially very serious? - return + return FALSE if(faction == FACTION_MARINE) GLOB.uscm_flat_tacmap_png_asset += new_current_map @@ -813,7 +812,8 @@ SUBSYSTEM_DEF(minimaps) toolbar_updated_selection = toolbar_color_selection message_admins("[key_name(user)] has updated the tactical map") updated_canvas = FALSE - . = TRUE + + return TRUE /datum/tacmap/ui_status(mob/user) if(!(isatom(owner))) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index 668875585d19..e8f5118354d5 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -114,6 +114,7 @@ export class CanvasLayer extends Component { this.lineStack.push([...this.currentLine]); this.currentLine = []; this.ctx.beginPath(); + this.props.onDraw(); }; handleSelectionChange = () => { diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 5bc27c0c6587..74912a6a6666 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -321,6 +321,7 @@ const DrawMapPanel = (props, context) => { onUndo={(value) => act('selectColor', { color: findColorValue(value) }) } + onDraw={() => act('onDraw')} />
From f1844f03fba4421d17259e489fcaadc72050a180 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Fri, 13 Oct 2023 22:27:01 -0700 Subject: [PATCH 132/161] Possible fix for 0x2f78 error: suspected issue with addEventListeners prior to image load. --- tgui/packages/tgui/interfaces/CanvasLayer.js | 27 ++++++-------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index e8f5118354d5..5429791a31b5 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -48,24 +48,6 @@ export class CanvasLayer extends Component { }; this.drawCanvas(); - - this.canvasRef.current.addEventListener('mousedown', this.handleMouseDown); - this.canvasRef.current.addEventListener('mousemove', this.handleMouseMove); - this.canvasRef.current.addEventListener('mouseup', this.handleMouseUp); - } - - componentWillUnmount() { - // otherwise we get a runtime - if (!this.state.mapLoad) return; - this.canvasRef.current.removeEventListener( - 'mousedown', - this.handleMouseDown - ); - this.canvasRef.current.removeEventListener( - 'mousemove', - this.handleMouseMove - ); - this.canvasRef.current.removeEventListener('mouseup', this.handleMouseUp); } handleMouseDown = (e) => { @@ -228,7 +210,14 @@ export class CanvasLayer extends Component { return (
{this.state.mapLoad ? ( - + this.handleMouseDown(e)} + onMouseUp={(e) => this.handleMouseUp(e)} + onMouseMove={(e) => this.handleMouseMove(e)} + /> ) : (

From f6c1eaed7b2ed863edc5aaa2071dd379a09a5718 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Sat, 14 Oct 2023 00:54:51 -0700 Subject: [PATCH 133/161] Hives now each have their own live tacmaps (only normal can draw) --- code/__DEFINES/minimap.dm | 18 ++++--- code/controllers/subsystem/minimap.dm | 48 +++++++++++++++++-- .../structures/special/pylon_core.dm | 2 +- code/modules/cm_aliens/structures/tunnel.dm | 2 +- .../desert_dam/motion_sensor/sensortower.dm | 2 +- .../mob/living/carbon/xenomorph/Xenomorph.dm | 6 ++- .../living/carbon/xenomorph/xeno_defines.dm | 1 + code/modules/vehicles/apc/apc_command.dm | 2 +- 8 files changed, 66 insertions(+), 15 deletions(-) diff --git a/code/__DEFINES/minimap.dm b/code/__DEFINES/minimap.dm index 71d0ed8e7445..003d723600c4 100644 --- a/code/__DEFINES/minimap.dm +++ b/code/__DEFINES/minimap.dm @@ -5,7 +5,17 @@ #define MINIMAP_FLAG_UPP (1<<3) #define MINIMAP_FLAG_CLF (1<<4) #define MINIMAP_FLAG_YAUTJA (1<<5) -#define MINIMAP_FLAG_ALL (1<<6) - 1 +#define MINIMAP_FLAG_XENO_CORRUPTED (1<<6) +#define MINIMAP_FLAG_XENO_ALPHA (1<<7) +#define MINIMAP_FLAG_XENO_BRAVO (1<<8) +#define MINIMAP_FLAG_XENO_CHARLIE (1<<9) +#define MINIMAP_FLAG_XENO_DELTA (1<<10) +#define MINIMAP_FLAG_XENO_FERAL (1<<11) +#define MINIMAP_FLAG_XENO_TAMED (1<<12) +#define MINIMAP_FLAG_XENO_MUTATED (1<<13) +#define MINIMAP_FLAG_XENO_FORSAKEN (1<<14) +#define MINIMAP_FLAG_XENO_RENEGADE (1<<15) +#define MINIMAP_FLAG_ALL (1<<16) - 1 ///Converts the overworld x and y to minimap x and y values #define MINIMAP_SCALE 2 @@ -77,9 +87,3 @@ GLOBAL_LIST_INIT(all_minimap_flags, bitfield2list(MINIMAP_FLAG_ALL)) #define TACMAP_BASE_OCCLUDED "Occluded" #define TACMAP_BASE_OPEN "Open" - -#define TACMAP_DEFAULT "Default" -#define TACMAP_XENO "Xeno" -#define TACMAP_YAUTJA "Yautja" -#define TACMAP_FACTION "Faction" - diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 1eb974fb4c3c..88dd92ab8138 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -627,7 +627,8 @@ SUBSYSTEM_DEF(minimaps) /datum/tacmap/tgui_interact(mob/user, datum/tgui/ui) var/mob/living/carbon/xenomorph/xeno = user - var/faction = istype(xeno) ? xeno.hivenumber : user.faction + var/is_xeno = istype(xeno) + var/faction = is_xeno ? xeno.hivenumber : user.faction if(user.faction == FACTION_NEUTRAL && isobserver(user)) faction = allowed_flags == MINIMAP_FLAG_XENO ? XENO_HIVE_NORMAL : FACTION_MARINE if(faction == FACTION_MARINE || faction == XENO_HIVE_NORMAL) @@ -635,7 +636,7 @@ SUBSYSTEM_DEF(minimaps) old_map = get_tacmap_data_png(faction) current_svg = get_tacmap_data_svg(faction) - var/use_live_map = faction == FACTION_MARINE && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT) || faction == XENO_HIVE_NORMAL + var/use_live_map = faction == FACTION_MARINE && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT) || is_xeno if(use_live_map && !map_holder) var/level = SSmapping.levels_by_trait(targeted_ztrait) @@ -791,7 +792,7 @@ SUBSYSTEM_DEF(minimaps) if(faction == FACTION_MARINE) GLOB.uscm_flat_tacmap_png_asset += new_current_map - else //if(faction == XENO_HIVE_NORMAL) + else if(faction == XENO_HIVE_NORMAL) GLOB.xeno_flat_tacmap_png_asset += new_current_map store_current_svg_coords(faction, params["image"]) @@ -862,3 +863,44 @@ SUBSYSTEM_DEF(minimaps) /datum/svg_overlay/New(svg_data) src.svg_data = svg_data + +/// Gets the MINIMAP_FLAG for the provided faction or hivenumber if one exists +/proc/get_minimap_flag_for_faction(faction) + switch(faction) + if(XENO_HIVE_NORMAL) + return MINIMAP_FLAG_XENO + if(FACTION_MARINE) + return MINIMAP_FLAG_USCM + if(FACTION_UPP) + return MINIMAP_FLAG_UPP + if(FACTION_WY) + return MINIMAP_FLAG_USCM + if(FACTION_CLF) + return MINIMAP_FLAG_CLF + if(FACTION_PMC) + return MINIMAP_FLAG_PMC + if(FACTION_YAUTJA) + return MINIMAP_FLAG_YAUTJA + if(XENO_HIVE_CORRUPTED) + return MINIMAP_FLAG_XENO_CORRUPTED + if(XENO_HIVE_ALPHA) + return MINIMAP_FLAG_XENO_ALPHA + if(XENO_HIVE_BRAVO) + return MINIMAP_FLAG_XENO_BRAVO + if(XENO_HIVE_CHARLIE) + return MINIMAP_FLAG_XENO_CHARLIE + if(XENO_HIVE_DELTA) + return MINIMAP_FLAG_XENO_DELTA + if(XENO_HIVE_FERAL) + return MINIMAP_FLAG_XENO_FERAL + if(XENO_HIVE_TAMED) + return MINIMAP_FLAG_XENO_TAMED + if(XENO_HIVE_MUTATED) + return MINIMAP_FLAG_XENO_MUTATED + if(XENO_HIVE_FORSAKEN) + return MINIMAP_FLAG_XENO_FORSAKEN + if(XENO_HIVE_YAUTJA) + return MINIMAP_FLAG_YAUTJA + if(XENO_HIVE_RENEGADE) + return MINIMAP_FLAG_XENO_RENEGADE + return 0 diff --git a/code/modules/cm_aliens/structures/special/pylon_core.dm b/code/modules/cm_aliens/structures/special/pylon_core.dm index 96ded23c8ac7..062204f30622 100644 --- a/code/modules/cm_aliens/structures/special/pylon_core.dm +++ b/code/modules/cm_aliens/structures/special/pylon_core.dm @@ -248,7 +248,7 @@ /obj/effect/alien/resin/special/pylon/core/proc/update_minimap_icon() SSminimaps.remove_marker(src) - SSminimaps.add_marker(src, z, MINIMAP_FLAG_XENO, "core[health < (initial(health) * 0.5) ? "_warn" : "_passive"]") + SSminimaps.add_marker(src, z, get_minimap_flag_for_faction(linked_hive?.hivenumber), "core[health < (initial(health) * 0.5) ? "_warn" : "_passive"]") /obj/effect/alien/resin/special/pylon/core/process() . = ..() diff --git a/code/modules/cm_aliens/structures/tunnel.dm b/code/modules/cm_aliens/structures/tunnel.dm index f716d69b5b7e..185bee06c513 100644 --- a/code/modules/cm_aliens/structures/tunnel.dm +++ b/code/modules/cm_aliens/structures/tunnel.dm @@ -48,7 +48,7 @@ if(resin_trap) qdel(resin_trap) - SSminimaps.add_marker(src, z, MINIMAP_FLAG_XENO, "xenotunnel") + SSminimaps.add_marker(src, z, get_minimap_flag_for_faction(hivenumber), "xenotunnel") /obj/structure/tunnel/Destroy() if(hive) diff --git a/code/modules/desert_dam/motion_sensor/sensortower.dm b/code/modules/desert_dam/motion_sensor/sensortower.dm index 5783d0ce9f20..4ef11c32245d 100644 --- a/code/modules/desert_dam/motion_sensor/sensortower.dm +++ b/code/modules/desert_dam/motion_sensor/sensortower.dm @@ -68,7 +68,7 @@ return SSminimaps.remove_marker(current_xeno) - current_xeno.add_minimap_marker(MINIMAP_FLAG_USCM|MINIMAP_FLAG_XENO) + current_xeno.add_minimap_marker(MINIMAP_FLAG_USCM|get_minimap_flag_for_faction(current_xeno.hivenumber)) minimap_added += WEAKREF(current_xeno) /obj/structure/machinery/sensortower/proc/checkfailure() diff --git a/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm b/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm index 90c22e19c483..5cff90dd408a 100644 --- a/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm +++ b/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm @@ -520,7 +520,11 @@ if(queen.can_not_harm(src)) return COMPONENT_SCREECH_ACT_CANCEL -/mob/living/carbon/xenomorph/proc/add_minimap_marker(flags = MINIMAP_FLAG_XENO) +/// Adds a minimap marker for this xeno using the provided flags. +/// If flags is 0, it will use get_minimap_flag_for_faction for this xeno +/mob/living/carbon/xenomorph/proc/add_minimap_marker(flags) + if(!flags) + flags = get_minimap_flag_for_faction(hivenumber) if(IS_XENO_LEADER(src)) SSminimaps.add_marker(src, z, hud_flags = flags, given_image = caste.get_minimap_icon(), overlay_iconstates = list(caste.minimap_leadered_overlay)) return diff --git a/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm b/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm index a74fa7413804..7df4873fb5ef 100644 --- a/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm +++ b/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm @@ -371,6 +371,7 @@ hive_ui = new(src) mark_ui = new(src) faction_ui = new(src) + minimap_type = get_minimap_flag_for_faction(hivenumber) tacmap = new(src, minimap_type) if(!internal_faction) internal_faction = name diff --git a/code/modules/vehicles/apc/apc_command.dm b/code/modules/vehicles/apc/apc_command.dm index c5bd55928362..ace9df2b2a25 100644 --- a/code/modules/vehicles/apc/apc_command.dm +++ b/code/modules/vehicles/apc/apc_command.dm @@ -59,7 +59,7 @@ continue SSminimaps.remove_marker(current_xeno) - current_xeno.add_minimap_marker(MINIMAP_FLAG_USCM|MINIMAP_FLAG_XENO) + current_xeno.add_minimap_marker(MINIMAP_FLAG_USCM|get_minimap_flag_for_faction(current_xeno.hivenumber)) minimap_added += WEAKREF(current_xeno) else if(WEAKREF(current_xeno) in minimap_added) From 0a651ba698ceae2224bdfdb5889c2aab7a13b86b Mon Sep 17 00:00:00 2001 From: Drulikar Date: Sat, 14 Oct 2023 04:00:59 -0700 Subject: [PATCH 134/161] Simply frequency of drawn nodes and warn when approaching an estimate that seems problematic Improve handling of dragging off the window (now ends the path, but still is sort of in a drag state) --- tgui/packages/tgui/interfaces/CanvasLayer.js | 92 +++++++++++++++++--- 1 file changed, 81 insertions(+), 11 deletions(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index 5429791a31b5..e6546fcac391 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -1,4 +1,4 @@ -import { Box } from '../components'; +import { Box, Icon, Tooltip } from '../components'; import { Component, createRef } from 'inferno'; // this file should probably not be in interfaces, should move it later. @@ -28,6 +28,8 @@ export class CanvasLayer extends Component { this.isPainting = false; this.lastX = null; this.lastY = null; + + this.complexity = 0; } componentDidMount() { @@ -67,6 +69,11 @@ export class CanvasLayer extends Component { if (!this.isPainting || !this.state.selection) { return; } + if (e.buttons === 0) { + // We probably dragged off the window - lets not get stuck drawing + this.handleMouseUp(e); + return; + } this.ctx.strokeStyle = this.state.selection; @@ -75,6 +82,11 @@ export class CanvasLayer extends Component { const y = e.clientY - rect.top; if (this.lastX !== null && this.lastY !== null) { + // this controls how often we make new strokes + if (Math.abs(this.lastX - x) + Math.abs(this.lastY - y) < 25) { + return; + } + this.ctx.moveTo(this.lastX, this.lastY); this.ctx.lineTo(x, y); this.ctx.stroke(); @@ -91,11 +103,40 @@ export class CanvasLayer extends Component { this.lastY = y; }; - handleMouseUp = () => { + handleMouseUp = (e) => { + if ( + this.isPainting && + this.state.selection && + this.lastX !== null && + this.lastY !== null + ) { + const rect = this.canvasRef.current.getBoundingClientRect(); + const x = e.clientX - rect.left; + const y = e.clientY - rect.top; + + this.ctx.moveTo(this.lastX, this.lastY); + this.ctx.lineTo(x, y); + this.ctx.stroke(); + this.currentLine.push([ + this.lastX, + this.lastY, + x, + y, + this.ctx.strokeStyle, + ]); + } + this.isPainting = false; + this.lastX = null; + this.lastY = null; + + if (this.currentLine.length === 0) { + return; + } + this.lineStack.push([...this.currentLine]); this.currentLine = []; - this.ctx.beginPath(); + this.complexity = this.getComplexity(); this.props.onDraw(); }; @@ -118,6 +159,7 @@ export class CanvasLayer extends Component { ); this.lineStack = []; + this.complexity = 0; return; } @@ -158,6 +200,7 @@ export class CanvasLayer extends Component { }); }); + this.complexity = this.getComplexity(); this.setState({ selection: prevColor }); this.props.onUndo(prevColor); return; @@ -205,19 +248,46 @@ export class CanvasLayer extends Component { return combinedArray; } + getComplexity() { + let count = 0; + this.lineStack.forEach((item) => { + count += item.length; + }); + return count; + } + render() { // edge case where a new user joins and tries to draw on the canvas before they cached the png return (
{this.state.mapLoad ? ( - this.handleMouseDown(e)} - onMouseUp={(e) => this.handleMouseUp(e)} - onMouseMove={(e) => this.handleMouseMove(e)} - /> +
+ {this.complexity > 500 && ( + + + + )} + this.handleMouseDown(e)} + onMouseUp={(e) => this.handleMouseUp(e)} + onMouseMove={(e) => this.handleMouseMove(e)} + /> +
) : (

From 38aae8693172b187e139a0df85299e1bfcb50fde Mon Sep 17 00:00:00 2001 From: Drulikar Date: Sat, 14 Oct 2023 06:51:14 -0700 Subject: [PATCH 135/161] Ghost alerts! --- code/__DEFINES/hud.dm | 2 ++ code/controllers/subsystem/minimap.dm | 11 ++++++++--- code/modules/maptext_alerts/screen_alerts.dm | 5 +++++ code/modules/mob/dead/observer/observer.dm | 4 ++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/code/__DEFINES/hud.dm b/code/__DEFINES/hud.dm index 38e5693dcbe5..deee80c7a91d 100644 --- a/code/__DEFINES/hud.dm +++ b/code/__DEFINES/hud.dm @@ -23,3 +23,5 @@ #define NOTIFY_ATTACK "attack" #define NOTIFY_ORBIT "orbit" #define NOTIFY_JOIN_XENO "join_xeno" +#define NOTIFY_XENO_TACMAP "xeno_tacmap" +#define NOTIFY_USCM_TACMAP "uscm_tacmap" diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 88dd92ab8138..504147f976aa 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -755,6 +755,7 @@ SUBSYSTEM_DEF(minimaps) else distribute_current_map_png(faction) last_update_time = world.time + // An attempt to get the image to load on first try in the interface, but doesn't seem always reliable new_current_map = get_unannounced_tacmap_data_png(faction) old_map = get_tacmap_data_png(faction) @@ -800,18 +801,22 @@ SUBSYSTEM_DEF(minimaps) old_map = get_tacmap_data_png(faction) if(faction == FACTION_MARINE) + COOLDOWN_START(GLOB, uscm_canvas_cooldown, canvas_cooldown_time) 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 progress...", "Tactical Map:") human_leader.visible_message(SPAN_BOLDNOTICE("Tactical map update in progress...")) playsound_client(human_leader.client, "sound/effects/sos-morse-code.ogg") - COOLDOWN_START(GLOB, uscm_canvas_cooldown, canvas_cooldown_time) + notify_ghosts(header = "Tactical Map", message = "The USCM tactical map has been updated.", action = NOTIFY_USCM_TACMAP, enter_link = "uscm_tacmap=1", enter_text = "View", source = owner) + else if(faction == XENO_HIVE_NORMAL) - xeno_maptext("The Queen has updated your hive mind map", "You sense something unusual...", faction) + var/mutable_appearance/appearance = mutable_appearance(icon('icons/mob/hud/actions_xeno.dmi'), "toggle_queen_zoom") COOLDOWN_START(GLOB, xeno_canvas_cooldown, canvas_cooldown_time) + xeno_maptext("The Queen has updated your hive mind map", "You sense something unusual...", faction) + notify_ghosts(header = "Tactical Map", message = "The Xenomorph tactical map has been updated.", action = NOTIFY_XENO_TACMAP, enter_link = "xeno_tacmap=1", enter_text = "View", source = user, alert_overlay = appearance) toolbar_updated_selection = toolbar_color_selection - message_admins("[key_name(user)] has updated the tactical map") + message_admins("[key_name(user)] has updated the tactical map for [faction]") updated_canvas = FALSE return TRUE diff --git a/code/modules/maptext_alerts/screen_alerts.dm b/code/modules/maptext_alerts/screen_alerts.dm index 820c64301bc2..0b923f7dc753 100644 --- a/code/modules/maptext_alerts/screen_alerts.dm +++ b/code/modules/maptext_alerts/screen_alerts.dm @@ -246,3 +246,8 @@ ghost_user.do_observe(target) if(NOTIFY_JOIN_XENO) ghost_user.join_as_alien() + if(NOTIFY_USCM_TACMAP) + GLOB.uscm_tacmap_status.tgui_interact(ghost_user) + if(NOTIFY_XENO_TACMAP) + GLOB.xeno_tacmap_status.tgui_interact(ghost_user) + diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 8a39ac2e3d35..663f10a40325 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -377,6 +377,10 @@ handle_joining_as_freed_mob(locate(href_list["claim_freed"])) if(href_list["join_xeno"]) join_as_alien() + if(href_list[NOTIFY_USCM_TACMAP]) + GLOB.uscm_tacmap_status.tgui_interact(src) + if(href_list[NOTIFY_XENO_TACMAP]) + GLOB.xeno_tacmap_status.tgui_interact(src) /mob/dead/observer/proc/set_huds_from_prefs() if(!client || !client.prefs) From 1061a0b41ae91e1878a1ac088ce095239ce31162 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Sat, 14 Oct 2023 08:22:48 -0700 Subject: [PATCH 136/161] Add ghost alert sfx --- code/controllers/subsystem/minimap.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 504147f976aa..1c2820d36453 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -807,13 +807,13 @@ SUBSYSTEM_DEF(minimaps) current_squad.send_maptext("Tactical map update in progress...", "Tactical Map:") human_leader.visible_message(SPAN_BOLDNOTICE("Tactical map update in progress...")) playsound_client(human_leader.client, "sound/effects/sos-morse-code.ogg") - notify_ghosts(header = "Tactical Map", message = "The USCM tactical map has been updated.", action = NOTIFY_USCM_TACMAP, enter_link = "uscm_tacmap=1", enter_text = "View", source = owner) + notify_ghosts(header = "Tactical Map", message = "The USCM tactical map has been updated.", ghost_sound = "sound/effects/sos-morse-code.ogg", notify_volume = 80, action = NOTIFY_USCM_TACMAP, enter_link = "uscm_tacmap=1", enter_text = "View", source = owner) else if(faction == XENO_HIVE_NORMAL) var/mutable_appearance/appearance = mutable_appearance(icon('icons/mob/hud/actions_xeno.dmi'), "toggle_queen_zoom") COOLDOWN_START(GLOB, xeno_canvas_cooldown, canvas_cooldown_time) xeno_maptext("The Queen has updated your hive mind map", "You sense something unusual...", faction) - notify_ghosts(header = "Tactical Map", message = "The Xenomorph tactical map has been updated.", action = NOTIFY_XENO_TACMAP, enter_link = "xeno_tacmap=1", enter_text = "View", source = user, alert_overlay = appearance) + notify_ghosts(header = "Tactical Map", message = "The Xenomorph tactical map has been updated.", ghost_sound = "sound/voice/alien_distantroar_3.ogg", notify_volume = 50, action = NOTIFY_XENO_TACMAP, enter_link = "xeno_tacmap=1", enter_text = "View", source = user, alert_overlay = appearance) toolbar_updated_selection = toolbar_color_selection message_admins("[key_name(user)] has updated the tactical map for [faction]") From 1242b40da8b00eaa8baceba2106e7eaf0600e21a Mon Sep 17 00:00:00 2001 From: Drulikar Date: Sat, 14 Oct 2023 08:23:47 -0700 Subject: [PATCH 137/161] Return to automatic map flattening on initial load but now only after we know the tacmap has fired to receive icons. --- code/controllers/subsystem/minimap.dm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 1c2820d36453..f941883499b8 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -656,7 +656,8 @@ SUBSYSTEM_DEF(minimaps) qdel(new_map) if(use_live_map) - tacmap_ready_time = SSminimaps.next_fire + tacmap_ready_time = SSminimaps.next_fire + 2 SECONDS + addtimer(CALLBACK(src, PROC_REF(on_tacmap_fire), faction), SSminimaps.next_fire) user.client.register_map_obj(map_holder.map) ui = new(user, src, "TacticalMap") @@ -869,6 +870,11 @@ SUBSYSTEM_DEF(minimaps) /datum/svg_overlay/New(svg_data) src.svg_data = svg_data +/// Callback when timer indicates the tacmap is flattenable now +/datum/tacmap/proc/on_tacmap_fire(faction) + distribute_current_map_png(faction) + last_update_time = world.time + /// Gets the MINIMAP_FLAG for the provided faction or hivenumber if one exists /proc/get_minimap_flag_for_faction(faction) switch(faction) From 0a3b2d8457d81e8efa6e7c2689cc1ae91e05182f Mon Sep 17 00:00:00 2001 From: doom Date: Sat, 14 Oct 2023 14:38:30 -0700 Subject: [PATCH 138/161] ... --- html/statbrowser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/statbrowser.js b/html/statbrowser.js index 423558faf216..09fd7fac1437 100644 --- a/html/statbrowser.js +++ b/html/statbrowser.js @@ -359,7 +359,7 @@ function draw_debug() { document.getElementById("statcontent").appendChild(table3); } function draw_status() { - const satus_tab_map_href_exception = + var satus_tab_map_href_exception = "View Tactical Map"; if (!document.getElementById("Status")) { createStatusTab("Status"); From 2924cab6ca6358c6d00ff124c15073d8f6a9d073 Mon Sep 17 00:00:00 2001 From: doom Date: Sat, 14 Oct 2023 14:44:40 -0700 Subject: [PATCH 139/161] typo --- html/statbrowser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/statbrowser.js b/html/statbrowser.js index 09fd7fac1437..55c3208fcc10 100644 --- a/html/statbrowser.js +++ b/html/statbrowser.js @@ -359,7 +359,7 @@ function draw_debug() { document.getElementById("statcontent").appendChild(table3); } function draw_status() { - var satus_tab_map_href_exception = + var status_tab_map_href_exception = "View Tactical Map"; if (!document.getElementById("Status")) { createStatusTab("Status"); @@ -373,7 +373,7 @@ function draw_status() { .appendChild(document.createElement("br")); } else if ( // hardcoded for testing purposes .includes() seems to be breaking things for some reason. - status_tab_parts[i] == satus_tab_map_href_exception + status_tab_parts[i] == status_tab_map_href_exception ) { var maplink = document.createElement("a"); maplink.innerHTML = status_tab_parts[i]; From de70ffb28e34afdc5997e02b617c0872877cd36a Mon Sep 17 00:00:00 2001 From: Drulikar Date: Sun, 15 Oct 2023 13:20:51 -0700 Subject: [PATCH 140/161] Cleanup --- code/controllers/subsystem/minimap.dm | 34 +++++++++++++-------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index f941883499b8..90d10ac3de3f 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -572,6 +572,10 @@ SUBSYSTEM_DEF(minimaps) var/targeted_ztrait = ZTRAIT_GROUND var/atom/owner + /// tacmap holder for holding the minimap + var/datum/tacmap_holder/map_holder + + /// A url that will point to the wiki map for the current map as a fall back image var/static/wiki_map_fallback /// color selection for the tactical map canvas, defaults to black. @@ -581,23 +585,14 @@ SUBSYSTEM_DEF(minimaps) var/canvas_cooldown_time = 4 MINUTES var/flatten_map_cooldown_time = 3 MINUTES - /// flatten cooldown for xenos,queen,marines. Cic has their own that is globally defined. - COOLDOWN_DECLARE(flatten_map_cooldown) - - /// tacmap holder for holding the minimap - var/datum/tacmap_holder/map_holder - /// boolean value to keep track if the canvas has been updated or not, the value is used in tgui state. var/updated_canvas = FALSE - /// current flattend map - var/datum/flattend_tacmap_png/new_current_map = new - + var/datum/flattend_tacmap_png/new_current_map /// previous flattened map - var/datum/flattend_tacmap_png/old_map = new - + var/datum/flattend_tacmap_png/old_map /// current svg - var/datum/svg_overlay/current_svg = new + var/datum/svg_overlay/current_svg var/action_queue_change = 0 @@ -623,18 +618,21 @@ SUBSYSTEM_DEF(minimaps) /datum/tacmap/Destroy() map_holder = null owner = null + new_current_map = null + old_map = null + current_svg = null return ..() /datum/tacmap/tgui_interact(mob/user, datum/tgui/ui) var/mob/living/carbon/xenomorph/xeno = user var/is_xeno = istype(xeno) var/faction = is_xeno ? xeno.hivenumber : user.faction - if(user.faction == FACTION_NEUTRAL && isobserver(user)) + if(faction == FACTION_NEUTRAL && isobserver(user)) faction = allowed_flags == MINIMAP_FLAG_XENO ? XENO_HIVE_NORMAL : FACTION_MARINE - if(faction == FACTION_MARINE || faction == XENO_HIVE_NORMAL) - new_current_map = get_unannounced_tacmap_data_png(faction) - old_map = get_tacmap_data_png(faction) - current_svg = get_tacmap_data_svg(faction) + + new_current_map = get_unannounced_tacmap_data_png(faction) + old_map = get_tacmap_data_png(faction) + current_svg = get_tacmap_data_svg(faction) var/use_live_map = faction == FACTION_MARINE && skillcheck(user, SKILL_LEADERSHIP, SKILL_LEAD_EXPERT) || is_xeno @@ -744,7 +742,7 @@ SUBSYSTEM_DEF(minimaps) var/mob/user = ui.user var/mob/living/carbon/xenomorph/xeno = user var/faction = istype(xeno) ? xeno.hivenumber : user.faction - if(user.faction == FACTION_NEUTRAL && isobserver(user)) + if(faction == FACTION_NEUTRAL && isobserver(user)) faction = allowed_flags == MINIMAP_FLAG_XENO ? XENO_HIVE_NORMAL : FACTION_MARINE switch (action) From c9a1c45a825f21899f0f4c2c858eb392a07eeeb0 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Sun, 15 Oct 2023 19:43:28 -0700 Subject: [PATCH 141/161] Admin panel and some refactoring to accommodate the new recorded data --- code/__HELPERS/icons.dm | 7 +- code/_globalvars/global_lists.dm | 10 +- code/controllers/subsystem/minimap.dm | 50 ++++-- code/modules/admin/admin_verbs.dm | 1 + .../admin/tacmap_panel/tacmap_admin_panel.dm | 9 + .../tacmap_panel/tacmap_admin_panel_tgui.dm | 145 +++++++++++++++ code/modules/client/client_procs.dm | 3 + code/modules/escape_menu/admin_buttons.dm | 26 ++- colonialmarines.dme | 2 + .../tgui/interfaces/TacmapAdminPanel.js | 168 ++++++++++++++++++ 10 files changed, 391 insertions(+), 30 deletions(-) create mode 100644 code/modules/admin/tacmap_panel/tacmap_admin_panel.dm create mode 100644 code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm create mode 100644 tgui/packages/tgui/interfaces/TacmapAdminPanel.js diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index 60d2681a1d1a..3a4bbf14773f 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -682,8 +682,9 @@ world * * moving - whether or not to use a moving state for the given icon * * sourceonly - if TRUE, only generate the asset and send back the asset url, instead of tags that display the icon to players * * extra_clases - string of extra css classes to use when returning the icon string + * * keyonly - if TRUE, only returns the asset key to use get_asset_url manually. Overrides sourceonly. */ -/proc/icon2html(atom/thing, client/target, icon_state, dir = SOUTH, frame = 1, moving = FALSE, sourceonly = FALSE, extra_classes = null) +/proc/icon2html(atom/thing, client/target, icon_state, dir = SOUTH, frame = 1, moving = FALSE, sourceonly = FALSE, extra_classes = null, keyonly = FALSE) if (!thing) return @@ -714,6 +715,8 @@ world SSassets.transport.register_asset(name, thing) for (var/thing2 in targets) SSassets.transport.send_assets(thing2, name) + if(keyonly) + return name if(sourceonly) return SSassets.transport.get_asset_url(name) return "" @@ -755,6 +758,8 @@ world SSassets.transport.register_asset(key, rsc_ref, file_hash, icon_path) for (var/client_target in targets) SSassets.transport.send_assets(client_target, key) + if(keyonly) + return key if(sourceonly) return SSassets.transport.get_asset_url(key) return "" diff --git a/code/_globalvars/global_lists.dm b/code/_globalvars/global_lists.dm index 4e1250c61df1..c0cf70b2306f 100644 --- a/code/_globalvars/global_lists.dm +++ b/code/_globalvars/global_lists.dm @@ -9,13 +9,13 @@ 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 -//datum containing only a reference to the flattend map png, the actual png is stored in the user's cache. -GLOBAL_LIST_EMPTY(uscm_flat_tacmap_png_asset) -GLOBAL_LIST_EMPTY(xeno_flat_tacmap_png_asset) +//datum containing a reference to the flattend map png url, the actual png is stored in the user's cache. +GLOBAL_LIST_EMPTY(uscm_flat_tacmap_data) +GLOBAL_LIST_EMPTY(xeno_flat_tacmap_data) //datum containing the svg overlay coords in array format. -GLOBAL_LIST_EMPTY(uscm_svg_overlay) -GLOBAL_LIST_EMPTY(xeno_svg_overlay) +GLOBAL_LIST_EMPTY(uscm_svg_tacmap_data) +GLOBAL_LIST_EMPTY(xeno_svg_tacmap_data) GLOBAL_LIST_EMPTY(failed_fultons) //A list of fultoned items which weren't collected and fell back down GLOBAL_LIST_EMPTY(larva_burst_by_hive) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 90d10ac3de3f..9d5ec935587d 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -348,9 +348,9 @@ SUBSYSTEM_DEF(minimaps) var/list/map_list if(faction == FACTION_MARINE) - map_list = GLOB.uscm_flat_tacmap_png_asset + map_list = GLOB.uscm_flat_tacmap_data else if(faction == XENO_HIVE_NORMAL) - map_list = GLOB.xeno_flat_tacmap_png_asset + map_list = GLOB.xeno_flat_tacmap_data else return null @@ -385,9 +385,9 @@ SUBSYSTEM_DEF(minimaps) var/list/map_list if(faction == FACTION_MARINE) - map_list = GLOB.uscm_svg_overlay + map_list = GLOB.uscm_svg_tacmap_data else if(faction == XENO_HIVE_NORMAL) - map_list = GLOB.xeno_svg_overlay + map_list = GLOB.xeno_svg_tacmap_data else return null @@ -433,8 +433,9 @@ SUBSYSTEM_DEF(minimaps) else if(client_mob.faction == faction) faction_clients += client - var/flat_tacmap_png = icon2html(flat_map, faction_clients, sourceonly = TRUE) - var/datum/flattend_tacmap_png/new_flat = new(flat_tacmap_png) + var/flat_tacmap_key = icon2html(flat_map, faction_clients, keyonly = TRUE) + var/flat_tacmap_png = SSassets.transport.get_asset_url(flat_tacmap_key) + var/datum/flattend_tacmap/new_flat = new(flat_tacmap_png, flat_tacmap_key) if(faction == FACTION_MARINE) GLOB.uscm_unannounced_map = new_flat @@ -449,14 +450,15 @@ SUBSYSTEM_DEF(minimaps) * Arguments: * * faction: which faction to save the data for: FACTION_MARINE or XENO_HIVE_NORMAL * * svg_coords: an array of coordinates corresponding to an svg. + * * ckey: the ckey of the user who submitted this */ -/datum/tacmap/proc/store_current_svg_coords(faction, svg_coords) - var/datum/svg_overlay/svg_store_overlay = new(svg_coords) +/datum/tacmap/proc/store_current_svg_coords(faction, svg_coords, ckey) + var/datum/svg_overlay/svg_store_overlay = new(svg_coords, ckey) if(faction == FACTION_MARINE) - GLOB.uscm_svg_overlay += svg_store_overlay + GLOB.uscm_svg_tacmap_data += svg_store_overlay else if(faction == XENO_HIVE_NORMAL) - GLOB.xeno_svg_overlay += svg_store_overlay + GLOB.xeno_svg_tacmap_data += svg_store_overlay /datum/controller/subsystem/minimaps/proc/fetch_tacmap_datum(zlevel, flags) var/hash = "[zlevel]-[flags]" @@ -588,9 +590,9 @@ SUBSYSTEM_DEF(minimaps) /// boolean value to keep track if the canvas has been updated or not, the value is used in tgui state. var/updated_canvas = FALSE /// current flattend map - var/datum/flattend_tacmap_png/new_current_map + var/datum/flattend_tacmap/new_current_map /// previous flattened map - var/datum/flattend_tacmap_png/old_map + var/datum/flattend_tacmap/old_map /// current svg var/datum/svg_overlay/current_svg @@ -791,11 +793,11 @@ SUBSYSTEM_DEF(minimaps) return FALSE if(faction == FACTION_MARINE) - GLOB.uscm_flat_tacmap_png_asset += new_current_map + GLOB.uscm_flat_tacmap_data += new_current_map else if(faction == XENO_HIVE_NORMAL) - GLOB.xeno_flat_tacmap_png_asset += new_current_map + GLOB.xeno_flat_tacmap_data += new_current_map - store_current_svg_coords(faction, params["image"]) + store_current_svg_coords(faction, params["image"], user) current_svg = get_tacmap_data_svg(faction) old_map = get_tacmap_data_png(faction) @@ -815,7 +817,7 @@ SUBSYSTEM_DEF(minimaps) notify_ghosts(header = "Tactical Map", message = "The Xenomorph tactical map has been updated.", ghost_sound = "sound/voice/alien_distantroar_3.ogg", notify_volume = 50, action = NOTIFY_XENO_TACMAP, enter_link = "xeno_tacmap=1", enter_text = "View", source = user, alert_overlay = appearance) toolbar_updated_selection = toolbar_color_selection - message_admins("[key_name(user)] has updated the tactical map for [faction]") + message_admins("[key_name(user)] has updated the tactical map for [faction].") updated_canvas = FALSE return TRUE @@ -856,17 +858,27 @@ SUBSYSTEM_DEF(minimaps) map = null return ..() -/datum/flattend_tacmap_png +/datum/flattend_tacmap var/flat_tacmap + var/asset_key + var/time -/datum/flattend_tacmap_png/New(flat_tacmap) +/datum/flattend_tacmap/New(flat_tacmap, asset_key) src.flat_tacmap = flat_tacmap + src.asset_key = asset_key + src.time = time_stamp() /datum/svg_overlay var/svg_data + var/ckey + var/name + var/time -/datum/svg_overlay/New(svg_data) +/datum/svg_overlay/New(svg_data, mob/user) src.svg_data = svg_data + src.ckey = user?.persistent_ckey + src.name = user?.real_name + src.time = time_stamp() /// Callback when timer indicates the tacmap is flattenable now /datum/tacmap/proc/on_tacmap_fire(faction) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 7d9127313094..5d02917f70ee 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -69,6 +69,7 @@ var/list/admin_verbs_default = list( /client/proc/toggle_ares_ping, /client/proc/cmd_admin_say, /*staff-only ooc chat*/ /client/proc/cmd_mod_say, /* alternate way of typing asay, no different than cmd_admin_say */ + /client/proc/cmd_admin_tacmaps_panel, ) var/list/admin_verbs_admin = list( diff --git a/code/modules/admin/tacmap_panel/tacmap_admin_panel.dm b/code/modules/admin/tacmap_panel/tacmap_admin_panel.dm new file mode 100644 index 000000000000..dcc8c7d5b664 --- /dev/null +++ b/code/modules/admin/tacmap_panel/tacmap_admin_panel.dm @@ -0,0 +1,9 @@ +/client/proc/cmd_admin_tacmaps_panel() + set name = "Tacmaps Panel" + set category = "Admin.Panels" + + if(!check_rights(R_ADMIN|R_MOD)) + to_chat(src, "Only administrators may use this command.") + return + + GLOB.tacmap_admin_panel.tgui_interact(mob) diff --git a/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm b/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm new file mode 100644 index 000000000000..92446a4e6b59 --- /dev/null +++ b/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm @@ -0,0 +1,145 @@ +GLOBAL_DATUM_INIT(tacmap_admin_panel, /datum/tacmap_admin_panel, new) + +/datum/tacmap_admin_panel + var/name = "Tacmap Panel" + /// The index picked last for USCM (zero indexed), -1 will try to select latest if it exists + var/uscm_selection = -1 + /// The index picked last for Xenos (zero indexed), -1 will try to select latest if it exists + var/xeno_selection = -1 + /// A url that will point to the wiki map for the current map as a fall back image + var/static/wiki_map_fallback + /// The last time the map selection was changed - used as a key to trick react into updating the map + var/last_update_time = 0 + +/datum/tacmap_admin_panel/tgui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + if(!wiki_map_fallback) + var/wiki_url = CONFIG_GET(string/wikiurl) + var/obj/item/map/current_map/new_map = new + if(wiki_url && new_map.html_link) + wiki_map_fallback ="[wiki_url]/[new_map.html_link]" + else + debug_log("Failed to determine fallback wiki map! Attempted '[wiki_url]/[new_map.html_link]'") + qdel(new_map) + + ui = new(user, src, "TacmapAdminPanel", "Tacmap Panel") + ui.open() + +/datum/tacmap_admin_panel/ui_state(mob/user) + return GLOB.admin_state + +/datum/tacmap_admin_panel/ui_data(mob/user) + var/list/data = list() + var/list/uscm_ckeys = list() + var/list/xeno_ckeys = list() + var/list/uscm_names = list() + var/list/xeno_names = list() + var/list/uscm_times = list() + var/list/xeno_times = list() + + // Assumption: Length of flat_tacmap_data is the same as svg_tacmap_data + var/uscm_length = length(GLOB.uscm_svg_tacmap_data) + if(uscm_selection < 0 || uscm_selection >= uscm_length) + uscm_selection = uscm_length - 1 + for(var/i = 1, i <= uscm_length, i++) + var/datum/svg_overlay/current_svg = GLOB.uscm_svg_tacmap_data[i] + uscm_ckeys += current_svg.ckey + uscm_names += current_svg.name + uscm_times += current_svg.time + data["uscm_ckeys"] = uscm_ckeys + data["uscm_names"] = uscm_names + data["uscm_times"] = uscm_times + + var/xeno_length = length(GLOB.xeno_svg_tacmap_data) + if(xeno_selection < 0 || xeno_selection >= xeno_length) + xeno_selection = xeno_length - 1 + for(var/i = 1, i <= xeno_length, i++) + var/datum/svg_overlay/current_svg = GLOB.xeno_svg_tacmap_data[i] + xeno_ckeys += current_svg.ckey + xeno_names += current_svg.name + xeno_times += current_svg.time + data["xeno_ckeys"] = xeno_ckeys + data["xeno_names"] = xeno_names + data["xeno_times"] = xeno_times + + if(uscm_selection == -1) + data["uscm_map"] = null + data["uscm_svg"] = null + else + var/datum/flattend_tacmap/selected_flat = GLOB.uscm_flat_tacmap_data[uscm_selection + 1] + var/datum/svg_overlay/selected_svg = GLOB.uscm_svg_tacmap_data[uscm_selection + 1] + data["uscm_map"] = selected_flat.flat_tacmap + data["uscm_svg"] = selected_svg.svg_data + + if(xeno_selection == -1) + data["xeno_map"] = null + data["xeno_svg"] = null + else + var/datum/flattend_tacmap/selected_flat = GLOB.xeno_flat_tacmap_data[xeno_selection + 1] + var/datum/svg_overlay/selected_svg = GLOB.xeno_svg_tacmap_data[xeno_selection + 1] + data["xeno_map"] = selected_flat.flat_tacmap + data["xeno_svg"] = selected_svg.svg_data + + data["uscm_selection"] = uscm_selection + data["xeno_selection"] = xeno_selection + data["map_fallback"] = wiki_map_fallback + data["last_update_time"] = last_update_time + + return data + +/datum/tacmap_admin_panel/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) + . = ..() + if(.) + return + + var/mob/user = ui.user + var/client/client_user = user.client + if(!client_user) + return // Is this even possible? + + switch(action) + if("recache") + var/is_uscm = params["uscm"] + var/datum/flattend_tacmap/selected_flat + if(is_uscm) + if(uscm_selection == -1) + return TRUE + selected_flat = GLOB.uscm_flat_tacmap_data[uscm_selection + 1] + else + if(xeno_selection == -1) + return TRUE + selected_flat = GLOB.xeno_flat_tacmap_data[xeno_selection + 1] + SSassets.transport.send_assets(client_user, selected_flat.asset_key) + last_update_time = world.time + return TRUE + + if("change_selection") + var/is_uscm = params["uscm"] + if(is_uscm) + uscm_selection = params["index"] + else + xeno_selection = params["index"] + last_update_time = world.time + return TRUE + + if("delete") + var/is_uscm = params["uscm"] + var/datum/svg_overlay/selected_svg + if(is_uscm) + if(uscm_selection == -1) + return TRUE + selected_svg = GLOB.uscm_svg_tacmap_data[uscm_selection + 1] + else + if(xeno_selection == -1) + return TRUE + selected_svg = GLOB.uscm_svg_tacmap_data[xeno_selection + 1] + selected_svg.svg_data = null + last_update_time = world.time + message_admins("[key_name_admin(usr)] deleted the tactical map drawing by [selected_svg.ckey].") + return TRUE + +/datum/tacmap_admin_panel/ui_close(mob/user) + . = ..() + uscm_selection = -1 + xeno_selection = -1 diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index 6c5c8d74d634..604e443541d4 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -164,6 +164,9 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list( else if(href_list["medals_panel"]) GLOB.medals_panel.tgui_interact(mob) + else if(href_list["tacmaps_panel"]) + GLOB.tacmap_admin_panel.tgui_interact(mob) + else if(href_list["MapView"]) if(isxeno(mob)) return diff --git a/code/modules/escape_menu/admin_buttons.dm b/code/modules/escape_menu/admin_buttons.dm index e6771d05bf68..661901c1b77a 100644 --- a/code/modules/escape_menu/admin_buttons.dm +++ b/code/modules/escape_menu/admin_buttons.dm @@ -46,7 +46,7 @@ new /atom/movable/screen/escape_menu/home_button( null, src, - "Medal Panel", + "Medals Panel", /* offset = */ 5, CALLBACK(src, PROC_REF(home_medal)), ) @@ -56,8 +56,18 @@ new /atom/movable/screen/escape_menu/home_button( null, src, - "Teleport Panel", + "Tacmaps Panel", /* offset = */ 6, + CALLBACK(src, PROC_REF(home_tacmaps)), + ) + ) + + page_holder.give_screen_object( + new /atom/movable/screen/escape_menu/home_button( + null, + src, + "Teleport Panel", + /* offset = */ 7, CALLBACK(src, PROC_REF(home_teleport)), ) ) @@ -67,7 +77,7 @@ null, src, "Inview Panel", - /* offset = */ 7, + /* offset = */ 8, CALLBACK(src, PROC_REF(home_inview)), ) ) @@ -77,7 +87,7 @@ null, src, "Unban Panel", - /* offset = */ 8, + /* offset = */ 9, CALLBACK(src, PROC_REF(home_unban)), ) ) @@ -87,7 +97,7 @@ null, src, "Shuttle Manipulator", - /* offset = */ 9, + /* offset = */ 10, CALLBACK(src, PROC_REF(home_shuttle)), ) ) @@ -117,6 +127,12 @@ GLOB.medals_panel.tgui_interact(client?.mob) +/datum/escape_menu/proc/home_tacmaps() + if(!client?.admin_holder.check_for_rights(R_ADMIN|R_MOD)) + return + + GLOB.tacmap_admin_panel.tgui_interact(client?.mob) + /datum/escape_menu/proc/home_teleport() if(!client?.admin_holder.check_for_rights(R_MOD)) return diff --git a/colonialmarines.dme b/colonialmarines.dme index 63140be5e458..7efb7e21944f 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -1340,6 +1340,8 @@ s// DM Environment file for colonialmarines.dme. #include "code\modules\admin\tabs\event_tab.dm" #include "code\modules\admin\tabs\round_tab.dm" #include "code\modules\admin\tabs\server_tab.dm" +#include "code\modules\admin\tacmap_panel\tacmap_admin_panel.dm" +#include "code\modules\admin\tacmap_panel\tacmap_admin_panel_tgui.dm" #include "code\modules\admin\topic\topic.dm" #include "code\modules\admin\topic\topic_chems.dm" #include "code\modules\admin\topic\topic_events.dm" diff --git a/tgui/packages/tgui/interfaces/TacmapAdminPanel.js b/tgui/packages/tgui/interfaces/TacmapAdminPanel.js new file mode 100644 index 000000000000..104c4f10500c --- /dev/null +++ b/tgui/packages/tgui/interfaces/TacmapAdminPanel.js @@ -0,0 +1,168 @@ +import { useBackend, useLocalState } from '../backend'; +import { Tabs, Section, Button, Fragment, Stack, Flex } from '../components'; +import { DrawnMap } from './DrawnMap'; +import { Window } from '../layouts'; + +const PAGES = [ + { + title: 'USCM', + component: () => FactionPage, + color: 'blue', + icon: 'medal', + }, + { + title: 'Hive', + component: () => FactionPage, + color: 'purple', + icon: 'star', + }, +]; + +export const TacmapAdminPanel = (props, context) => { + const { data } = useBackend(context); + const { + uscm_map, + xeno_map, + uscm_svg, + xeno_svg, + uscm_ckeys, + xeno_ckeys, + uscm_names, + xeno_names, + uscm_times, + xeno_times, + uscm_selection, + xeno_selection, + map_fallback, + last_update_time, + } = data; + + const [pageIndex, setPageIndex] = useLocalState(context, 'pageIndex', 0); + + const PageComponent = PAGES[pageIndex].component(); + + return ( + + + + + + {PAGES.map((page, i) => { + if (page.canAccess && !page.canAccess(data)) { + return; + } + + return ( + setPageIndex(i)}> + {page.title} + + ); + })} + + + + + + +
+ +
+
+
+
+
+ ); +}; + +const FactionPage = (props, context) => { + const { act } = useBackend(context); + const { svg, ckeys, names, times, selected_map, is_uscm } = props; + + return ( +
+ act('recache', { + uscm: is_uscm, + }) + } + /> + }> + + {Object(ckeys).map((ckey, ckey_index) => ( + + + + act('change_selection', { + uscm: is_uscm, + index: ckey_index, + }) + } + /> + + + {names[ckey_index]} ({ckey}) - {times[ckey_index]} + + + + act('delete', { + uscm: is_uscm, + index: ckey_index, + }) + } + /> + + + ))} + +
+ ); +}; From d47dd5d6f54eded092ed456dd4be6eff25e29e78 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Sun, 15 Oct 2023 19:43:57 -0700 Subject: [PATCH 142/161] Fix edgecase should a wrong faction somehow manage to get to drawing panel --- code/controllers/subsystem/minimap.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 9d5ec935587d..cf9cd34776e5 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -459,6 +459,9 @@ SUBSYSTEM_DEF(minimaps) GLOB.uscm_svg_tacmap_data += svg_store_overlay else if(faction == XENO_HIVE_NORMAL) GLOB.xeno_svg_tacmap_data += svg_store_overlay + else + qdel(svg_store_overlay) + debug_log("SVG coordinates for [faction] are not implemented!") /datum/controller/subsystem/minimaps/proc/fetch_tacmap_datum(zlevel, flags) var/hash = "[zlevel]-[flags]" From d91f171feb717565fe56c22a222f3ad0c633a269 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Sun, 15 Oct 2023 21:57:09 -0700 Subject: [PATCH 143/161] Fix timer for delayed tacmap flattening --- code/controllers/subsystem/minimap.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index cf9cd34776e5..044312201dc7 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -420,7 +420,7 @@ SUBSYSTEM_DEF(minimaps) var/icon/flat_map = getFlatIcon(map_holder.map, appearance_flags = TRUE) if(!flat_map) - to_chat(usr, SPAN_WARNING("The tacmap filckers and then shuts off, a critical error has occurred! Contact a coder.")) // tf2heavy: "Oh, this is bad!" + to_chat(usr, SPAN_WARNING("A critical error has occurred! Contact a coder.")) // tf2heavy: "Oh, this is bad!" return FALSE var/list/faction_clients = list() @@ -660,7 +660,7 @@ SUBSYSTEM_DEF(minimaps) if(use_live_map) tacmap_ready_time = SSminimaps.next_fire + 2 SECONDS - addtimer(CALLBACK(src, PROC_REF(on_tacmap_fire), faction), SSminimaps.next_fire) + addtimer(CALLBACK(src, PROC_REF(on_tacmap_fire), faction), SSminimaps.next_fire - world.time + 1 SECONDS) user.client.register_map_obj(map_holder.map) ui = new(user, src, "TacticalMap") From 5eba2d3b78e2132f9367f909f2b46969620b6760 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Sun, 15 Oct 2023 22:07:25 -0700 Subject: [PATCH 144/161] Drawing subtypes to give legacy usage to other faction tacmaps like predators --- code/_globalvars/misc.dm | 4 +- code/controllers/subsystem/minimap.dm | 57 ++++++++++++++----- .../game/machinery/computer/communications.dm | 2 +- .../computer/groundside_operations.dm | 17 +++++- code/game/objects/items/devices/cictablet.dm | 7 ++- code/modules/almayer/machinery.dm | 19 ++++++- code/modules/cm_preds/yaut_machines.dm | 5 ++ .../living/carbon/xenomorph/xeno_defines.dm | 2 +- 8 files changed, 92 insertions(+), 21 deletions(-) diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index 8bfa57cd54d1..c30294e16383 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -27,8 +27,8 @@ GLOBAL_VAR_INIT(uscm_unannounced_map, null) GLOBAL_VAR_INIT(xeno_unannounced_map, null) //global tacmaps for action button access -GLOBAL_DATUM_INIT(uscm_tacmap_status, /datum/tacmap/status_tab_view, new) -GLOBAL_DATUM_INIT(xeno_tacmap_status, /datum/tacmap/status_tab_view/xeno, new) +GLOBAL_DATUM_INIT(uscm_tacmap_status, /datum/tacmap/drawing/status_tab_view, new) +GLOBAL_DATUM_INIT(xeno_tacmap_status, /datum/tacmap/drawing/status_tab_view/xeno, new) /// List of roles that can be setup for each gamemode GLOBAL_LIST_INIT(gamemode_roles, list()) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 044312201dc7..25fefa4b5336 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -406,7 +406,7 @@ SUBSYSTEM_DEF(minimaps) * Return: * * returns a boolean value, true if the operation was successful, false if it was not. */ -/datum/tacmap/proc/distribute_current_map_png(faction) +/datum/tacmap/drawing/proc/distribute_current_map_png(faction) if(faction == FACTION_MARINE) if(!COOLDOWN_FINISHED(GLOB, uscm_flatten_map_icon_cooldown)) return FALSE @@ -433,7 +433,11 @@ SUBSYSTEM_DEF(minimaps) else if(client_mob.faction == faction) faction_clients += client + // This may be unnecessary to do this way if the asset url is always the same as the lookup key var/flat_tacmap_key = icon2html(flat_map, faction_clients, keyonly = TRUE) + if(!flat_tacmap_key) + to_chat(usr, SPAN_WARNING("A critical error has occurred! Contact a coder.")) + return FALSE var/flat_tacmap_png = SSassets.transport.get_asset_url(flat_tacmap_key) var/datum/flattend_tacmap/new_flat = new(flat_tacmap_png, flat_tacmap_key) @@ -452,7 +456,7 @@ SUBSYSTEM_DEF(minimaps) * * svg_coords: an array of coordinates corresponding to an svg. * * ckey: the ckey of the user who submitted this */ -/datum/tacmap/proc/store_current_svg_coords(faction, svg_coords, ckey) +/datum/tacmap/drawing/proc/store_current_svg_coords(faction, svg_coords, ckey) var/datum/svg_overlay/svg_store_overlay = new(svg_coords, ckey) if(faction == FACTION_MARINE) @@ -580,6 +584,7 @@ SUBSYSTEM_DEF(minimaps) /// tacmap holder for holding the minimap var/datum/tacmap_holder/map_holder +/datum/tacmap/drawing /// A url that will point to the wiki map for the current map as a fall back image var/static/wiki_map_fallback @@ -610,25 +615,41 @@ SUBSYSTEM_DEF(minimaps) allowed_flags = minimap_type owner = source -/datum/tacmap/status_tab_view/New() - var/datum/tacmap/status_tab_view/uscm_tacmap +/datum/tacmap/drawing/status_tab_view/New() + var/datum/tacmap/drawing/status_tab_view/uscm_tacmap allowed_flags = MINIMAP_FLAG_USCM owner = uscm_tacmap -/datum/tacmap/status_tab_view/xeno/New() - var/datum/tacmap/status_tab_view/xeno/xeno_tacmap +/datum/tacmap/drawing/status_tab_view/xeno/New() + var/datum/tacmap/drawing/status_tab_view/xeno/xeno_tacmap allowed_flags = MINIMAP_FLAG_XENO owner = xeno_tacmap /datum/tacmap/Destroy() map_holder = null owner = null + return ..() + +/datum/tacmap/drawing/Destroy() new_current_map = null old_map = null current_svg = null return ..() /datum/tacmap/tgui_interact(mob/user, datum/tgui/ui) + if(!map_holder) + var/level = SSmapping.levels_by_trait(targeted_ztrait) + if(!level[1]) + return + map_holder = SSminimaps.fetch_tacmap_datum(level[1], allowed_flags) + + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + user.client.register_map_obj(map_holder.map) + ui = new(user, src, "TacticalMap") + ui.open() + +/datum/tacmap/drawing/tgui_interact(mob/user, datum/tgui/ui) var/mob/living/carbon/xenomorph/xeno = user var/is_xeno = istype(xeno) var/faction = is_xeno ? xeno.hivenumber : user.faction @@ -666,7 +687,7 @@ SUBSYSTEM_DEF(minimaps) ui = new(user, src, "TacticalMap") ui.open() -/datum/tacmap/ui_data(mob/user) +/datum/tacmap/drawing/ui_data(mob/user) var/list/data = list() data["newCanvasFlatImage"] = new_current_map?.flat_tacmap @@ -693,6 +714,16 @@ SUBSYSTEM_DEF(minimaps) /datum/tacmap/ui_static_data(mob/user) var/list/data = list() + data["mapRef"] = map_holder?.map_ref + data["canDraw"] = FALSE + data["canViewTacmap"] = TRUE + data["canViewCanvas"] = FALSE + data["isXeno"] = FALSE + + return data + +/datum/tacmap/drawing/ui_static_data(mob/user) + var/list/data = list() data["mapRef"] = map_holder?.map_ref data["canDraw"] = FALSE @@ -712,7 +743,7 @@ SUBSYSTEM_DEF(minimaps) return data -/datum/tacmap/status_tab_view/ui_static_data(mob/user) +/datum/tacmap/drawing/status_tab_view/ui_static_data(mob/user) var/list/data = list() data["mapFallback"] = wiki_map_fallback data["canDraw"] = FALSE @@ -722,7 +753,7 @@ SUBSYSTEM_DEF(minimaps) return data -/datum/tacmap/status_tab_view/xeno/ui_static_data(mob/user) +/datum/tacmap/drawing/status_tab_view/xeno/ui_static_data(mob/user) var/list/data = list() data["mapFallback"] = wiki_map_fallback data["canDraw"] = FALSE @@ -732,14 +763,14 @@ SUBSYSTEM_DEF(minimaps) return data -/datum/tacmap/ui_close(mob/user) +/datum/tacmap/drawing/ui_close(mob/user) . = ..() action_queue_change = 0 updated_canvas = FALSE toolbar_color_selection = "black" toolbar_updated_selection = "black" -/datum/tacmap/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) +/datum/tacmap/drawing/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) . = ..() if(.) return @@ -837,7 +868,7 @@ SUBSYSTEM_DEF(minimaps) else return UI_CLOSE -/datum/tacmap/xeno/ui_status(mob/user) +/datum/tacmap/drawing/xeno/ui_status(mob/user) if(!isxeno(user)) return UI_CLOSE @@ -884,7 +915,7 @@ SUBSYSTEM_DEF(minimaps) src.time = time_stamp() /// Callback when timer indicates the tacmap is flattenable now -/datum/tacmap/proc/on_tacmap_fire(faction) +/datum/tacmap/drawing/proc/on_tacmap_fire(faction) distribute_current_map_png(faction) last_update_time = world.time diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index f7ea31fba36a..f5cd63d4356d 100644 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -43,7 +43,7 @@ var/stat_msg1 var/stat_msg2 - var/datum/tacmap/tacmap + var/datum/tacmap/drawing/tacmap var/minimap_type = MINIMAP_FLAG_USCM processing = TRUE diff --git a/code/game/machinery/computer/groundside_operations.dm b/code/game/machinery/computer/groundside_operations.dm index 5f1abeb84899..fdb4df3e8f5b 100644 --- a/code/game/machinery/computer/groundside_operations.dm +++ b/code/game/machinery/computer/groundside_operations.dm @@ -25,7 +25,7 @@ add_pmcs = FALSE else if(SSticker.current_state < GAME_STATE_PLAYING) RegisterSignal(SSdcs, COMSIG_GLOB_MODE_PRESETUP, PROC_REF(disable_pmc)) - tacmap = new(src, minimap_type) + tacmap = new /datum/tacmap/drawing(src, minimap_type) return ..() @@ -331,6 +331,11 @@ has_squad_overwatch = FALSE minimap_type = MINIMAP_FLAG_UPP +/obj/structure/machinery/computer/groundside_operations/upp/Initialize() + . = ..() + qdel(tacmap) + tacmap = new(src, minimap_type) // Non-drawing version + /obj/structure/machinery/computer/groundside_operations/clf announcement_title = CLF_COMMAND_ANNOUNCE announcement_faction = FACTION_CLF @@ -339,9 +344,19 @@ has_squad_overwatch = FALSE minimap_type = MINIMAP_FLAG_CLF +/obj/structure/machinery/computer/groundside_operations/clf/Initialize() + . = ..() + qdel(tacmap) + tacmap = new(src, minimap_type) // Non-drawing version + /obj/structure/machinery/computer/groundside_operations/pmc announcement_title = PMC_COMMAND_ANNOUNCE announcement_faction = FACTION_PMC lz_selection = FALSE has_squad_overwatch = FALSE minimap_type = MINIMAP_FLAG_PMC + +/obj/structure/machinery/computer/groundside_operations/pmc/Initialize() + . = ..() + qdel(tacmap) + tacmap = new(src, minimap_type) // Non-drawing version diff --git a/code/game/objects/items/devices/cictablet.dm b/code/game/objects/items/devices/cictablet.dm index fc9bb015ece0..b535454fe85b 100644 --- a/code/game/objects/items/devices/cictablet.dm +++ b/code/game/objects/items/devices/cictablet.dm @@ -24,7 +24,7 @@ COOLDOWN_DECLARE(distress_cooldown) /obj/item/device/cotablet/Initialize() - tacmap = new(src, minimap_type) + tacmap = new /datum/tacmap/drawing(src, minimap_type) if(SSticker.mode && MODE_HAS_FLAG(MODE_FACTION_CLASH)) add_pmcs = FALSE else if(SSticker.current_state < GAME_STATE_PLAYING) @@ -174,3 +174,8 @@ announcement_faction = FACTION_PMC minimap_type = MINIMAP_FLAG_PMC + +/obj/item/device/cotablet/pmc/Initialize() + . = ..() + qdel(tacmap) + tacmap = new(src, minimap_type) // Non-drawing version diff --git a/code/modules/almayer/machinery.dm b/code/modules/almayer/machinery.dm index cb90db9e8535..2f4347187d2b 100644 --- a/code/modules/almayer/machinery.dm +++ b/code/modules/almayer/machinery.dm @@ -80,13 +80,13 @@ use_power = USE_POWER_IDLE density = TRUE idle_power_usage = 2 - ///flags that we want to be shown when you interact with this table var/datum/tacmap/map + ///flags that we want to be shown when you interact with this table var/minimap_type = MINIMAP_FLAG_USCM /obj/structure/machinery/prop/almayer/CICmap/Initialize() . = ..() - map = new(src, minimap_type) + map = new /datum/tacmap/drawing(src, minimap_type) /obj/structure/machinery/prop/almayer/CICmap/Destroy() QDEL_NULL(map) @@ -100,12 +100,27 @@ /obj/structure/machinery/prop/almayer/CICmap/upp minimap_type = MINIMAP_FLAG_UPP +/obj/structure/machinery/prop/almayer/CICmap/upp/Initialize() + . = ..() + qdel(map) + map = new(src, minimap_type) // Non-drawing version + /obj/structure/machinery/prop/almayer/CICmap/clf minimap_type = MINIMAP_FLAG_CLF +/obj/structure/machinery/prop/almayer/CICmap/clf/Initialize() + . = ..() + qdel(map) + map = new(src, minimap_type) // Non-drawing version + /obj/structure/machinery/prop/almayer/CICmap/pmc minimap_type = MINIMAP_FLAG_PMC +/obj/structure/machinery/prop/almayer/CICmap/pmc/Initialize() + . = ..() + qdel(map) + map = new(src, minimap_type) // Non-drawing version + //Nonpower using props /obj/structure/prop/almayer diff --git a/code/modules/cm_preds/yaut_machines.dm b/code/modules/cm_preds/yaut_machines.dm index a1782ca22b85..b1d2fbb045f9 100644 --- a/code/modules/cm_preds/yaut_machines.dm +++ b/code/modules/cm_preds/yaut_machines.dm @@ -7,6 +7,11 @@ minimap_type = MINIMAP_FLAG_ALL +/obj/structure/machinery/prop/almayer/CICmap/yautja/Initialize() + . = ..() + qdel(map) + map = new(src, minimap_type) // Non-drawing version + /obj/structure/machinery/autolathe/yautja name = "yautja autolathe" desc = "It produces items using metal and glass." diff --git a/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm b/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm index 7df4873fb5ef..b739425346be 100644 --- a/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm +++ b/code/modules/mob/living/carbon/xenomorph/xeno_defines.dm @@ -363,7 +363,7 @@ /// 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/tacmap + var/datum/tacmap/drawing/xeno/tacmap var/minimap_type = MINIMAP_FLAG_XENO /datum/hive_status/New() From 079ec4614a1220460710ac8f7fea2f3214f79308 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Sun, 15 Oct 2023 22:27:46 -0700 Subject: [PATCH 145/161] Restore tactical map button to overwatch consoles (only drawing capabilities if marine faction) --- code/modules/cm_marines/overwatch.dm | 18 ++++++++++++++++++ .../tgui/interfaces/OverwatchConsole.js | 3 +++ 2 files changed, 21 insertions(+) diff --git a/code/modules/cm_marines/overwatch.dm b/code/modules/cm_marines/overwatch.dm index 744967bd1be8..797a3bb7ec96 100644 --- a/code/modules/cm_marines/overwatch.dm +++ b/code/modules/cm_marines/overwatch.dm @@ -27,6 +27,9 @@ var/marine_filter_enabled = TRUE var/faction = FACTION_MARINE + var/datum/tacmap/tacmap + var/minimap_type = MINIMAP_FLAG_USCM + ///List of saved coordinates, format of ["x", "y", "comment"] var/list/saved_coordinates = list() @@ -37,8 +40,13 @@ /obj/structure/machinery/computer/overwatch/Initialize() . = ..() + if (faction == FACTION_MARINE) + tacmap = new /datum/tacmap/drawing(src, minimap_type) + else + tacmap = new(src, minimap_type) // Non-drawing version /obj/structure/machinery/computer/overwatch/Destroy() + QDEL_NULL(tacmap) return ..() /obj/structure/machinery/computer/overwatch/attackby(obj/I as obj, mob/user as mob) //Can't break or disassemble. @@ -83,12 +91,20 @@ /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() @@ -433,6 +449,8 @@ else z_hidden = HIDE_NONE to_chat(user, "[icon2html(src, usr)] [SPAN_NOTICE("No location is ignored anymore.")]") + if("tacmap_unpin") + tacmap.tgui_interact(user) if("dropbomb") if(!params["x"] || !params["y"]) return diff --git a/tgui/packages/tgui/interfaces/OverwatchConsole.js b/tgui/packages/tgui/interfaces/OverwatchConsole.js index 99cbcd34f440..1805f231fb16 100644 --- a/tgui/packages/tgui/interfaces/OverwatchConsole.js +++ b/tgui/packages/tgui/interfaces/OverwatchConsole.js @@ -93,6 +93,9 @@ const SquadPanel = (props, context) => { onClick={() => setCategory('ob')}> Orbital Bombardment + act('tacmap_unpin')}> + Tactical Map + {category === 'monitor' && } {category === 'supply' && data.can_launch_crates && } From c2fbee7dd8fa8b912d4de42af4e1ba111fd766d8 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Sun, 15 Oct 2023 22:45:54 -0700 Subject: [PATCH 146/161] Check faction instead where possible to determine if it should be drawing subtype --- .../computer/groundside_operations.dm | 20 ++++--------------- code/game/objects/items/devices/cictablet.dm | 10 ++++------ 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/code/game/machinery/computer/groundside_operations.dm b/code/game/machinery/computer/groundside_operations.dm index fdb4df3e8f5b..0166c0ec4670 100644 --- a/code/game/machinery/computer/groundside_operations.dm +++ b/code/game/machinery/computer/groundside_operations.dm @@ -25,7 +25,10 @@ add_pmcs = FALSE else if(SSticker.current_state < GAME_STATE_PLAYING) RegisterSignal(SSdcs, COMSIG_GLOB_MODE_PRESETUP, PROC_REF(disable_pmc)) - tacmap = new /datum/tacmap/drawing(src, minimap_type) + if(announcement_faction == FACTION_MARINE) + tacmap = new /datum/tacmap/drawing(src, minimap_type) + else + tacmap = new(src, minimap_type) return ..() @@ -331,11 +334,6 @@ has_squad_overwatch = FALSE minimap_type = MINIMAP_FLAG_UPP -/obj/structure/machinery/computer/groundside_operations/upp/Initialize() - . = ..() - qdel(tacmap) - tacmap = new(src, minimap_type) // Non-drawing version - /obj/structure/machinery/computer/groundside_operations/clf announcement_title = CLF_COMMAND_ANNOUNCE announcement_faction = FACTION_CLF @@ -344,19 +342,9 @@ has_squad_overwatch = FALSE minimap_type = MINIMAP_FLAG_CLF -/obj/structure/machinery/computer/groundside_operations/clf/Initialize() - . = ..() - qdel(tacmap) - tacmap = new(src, minimap_type) // Non-drawing version - /obj/structure/machinery/computer/groundside_operations/pmc announcement_title = PMC_COMMAND_ANNOUNCE announcement_faction = FACTION_PMC lz_selection = FALSE has_squad_overwatch = FALSE minimap_type = MINIMAP_FLAG_PMC - -/obj/structure/machinery/computer/groundside_operations/pmc/Initialize() - . = ..() - qdel(tacmap) - tacmap = new(src, minimap_type) // Non-drawing version diff --git a/code/game/objects/items/devices/cictablet.dm b/code/game/objects/items/devices/cictablet.dm index b535454fe85b..3305e9a99879 100644 --- a/code/game/objects/items/devices/cictablet.dm +++ b/code/game/objects/items/devices/cictablet.dm @@ -24,7 +24,10 @@ COOLDOWN_DECLARE(distress_cooldown) /obj/item/device/cotablet/Initialize() - tacmap = new /datum/tacmap/drawing(src, minimap_type) + if(announcement_faction == FACTION_MARINE) + tacmap = new /datum/tacmap/drawing(src, minimap_type) + else + tacmap = new(src, minimap_type) if(SSticker.mode && MODE_HAS_FLAG(MODE_FACTION_CLASH)) add_pmcs = FALSE else if(SSticker.current_state < GAME_STATE_PLAYING) @@ -174,8 +177,3 @@ announcement_faction = FACTION_PMC minimap_type = MINIMAP_FLAG_PMC - -/obj/item/device/cotablet/pmc/Initialize() - . = ..() - qdel(tacmap) - tacmap = new(src, minimap_type) // Non-drawing version From 8a6df56686ede088020dde05d1facfacb18f08fe Mon Sep 17 00:00:00 2001 From: Drulikar Date: Sun, 15 Oct 2023 23:09:06 -0700 Subject: [PATCH 147/161] Improve cooldown bar visibility --- tgui/packages/tgui/interfaces/TacticalMap.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tgui/packages/tgui/interfaces/TacticalMap.tsx b/tgui/packages/tgui/interfaces/TacticalMap.tsx index 74912a6a6666..92996038719f 100644 --- a/tgui/packages/tgui/interfaces/TacticalMap.tsx +++ b/tgui/packages/tgui/interfaces/TacticalMap.tsx @@ -297,12 +297,13 @@ const DrawMapPanel = (props, context) => { - + {Math.ceil(data.canvasCooldown / 10)} seconds until the canvas changes can be updated From 7aa9c98fc5319435c1095c46731e320e84f46577 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Mon, 16 Oct 2023 11:19:38 -0700 Subject: [PATCH 148/161] Cleanup extra tacmap qdels --- .../computer/groundside_operations.dm | 2 +- code/game/objects/items/devices/cictablet.dm | 2 +- code/modules/almayer/machinery.dm | 26 +++++++------------ code/modules/cm_preds/yaut_machines.dm | 6 +---- 4 files changed, 13 insertions(+), 23 deletions(-) diff --git a/code/game/machinery/computer/groundside_operations.dm b/code/game/machinery/computer/groundside_operations.dm index 0166c0ec4670..f2b36276c8eb 100644 --- a/code/game/machinery/computer/groundside_operations.dm +++ b/code/game/machinery/computer/groundside_operations.dm @@ -28,7 +28,7 @@ if(announcement_faction == FACTION_MARINE) tacmap = new /datum/tacmap/drawing(src, minimap_type) else - tacmap = new(src, minimap_type) + tacmap = new(src, minimap_type) // Non-drawing version return ..() diff --git a/code/game/objects/items/devices/cictablet.dm b/code/game/objects/items/devices/cictablet.dm index 3305e9a99879..e8320b0273a2 100644 --- a/code/game/objects/items/devices/cictablet.dm +++ b/code/game/objects/items/devices/cictablet.dm @@ -27,7 +27,7 @@ if(announcement_faction == FACTION_MARINE) tacmap = new /datum/tacmap/drawing(src, minimap_type) else - tacmap = new(src, minimap_type) + tacmap = new(src, minimap_type) // Non-drawing version if(SSticker.mode && MODE_HAS_FLAG(MODE_FACTION_CLASH)) add_pmcs = FALSE else if(SSticker.current_state < GAME_STATE_PLAYING) diff --git a/code/modules/almayer/machinery.dm b/code/modules/almayer/machinery.dm index 2f4347187d2b..e72f4e7f9f52 100644 --- a/code/modules/almayer/machinery.dm +++ b/code/modules/almayer/machinery.dm @@ -83,10 +83,16 @@ var/datum/tacmap/map ///flags that we want to be shown when you interact with this table var/minimap_type = MINIMAP_FLAG_USCM + ///The faction that is intended to use this structure (determines type of tacmap used) + var/faction = FACTION_MARINE /obj/structure/machinery/prop/almayer/CICmap/Initialize() . = ..() - map = new /datum/tacmap/drawing(src, minimap_type) + + if (faction == FACTION_MARINE) + map = new /datum/tacmap/drawing(src, minimap_type) + else + map = new(src, minimap_type) // Non-drawing version /obj/structure/machinery/prop/almayer/CICmap/Destroy() QDEL_NULL(map) @@ -99,27 +105,15 @@ /obj/structure/machinery/prop/almayer/CICmap/upp minimap_type = MINIMAP_FLAG_UPP - -/obj/structure/machinery/prop/almayer/CICmap/upp/Initialize() - . = ..() - qdel(map) - map = new(src, minimap_type) // Non-drawing version + faction = FACTION_UPP /obj/structure/machinery/prop/almayer/CICmap/clf minimap_type = MINIMAP_FLAG_CLF - -/obj/structure/machinery/prop/almayer/CICmap/clf/Initialize() - . = ..() - qdel(map) - map = new(src, minimap_type) // Non-drawing version + faction = FACTION_CLF /obj/structure/machinery/prop/almayer/CICmap/pmc minimap_type = MINIMAP_FLAG_PMC - -/obj/structure/machinery/prop/almayer/CICmap/pmc/Initialize() - . = ..() - qdel(map) - map = new(src, minimap_type) // Non-drawing version + faction = FACTION_PMC //Nonpower using props diff --git a/code/modules/cm_preds/yaut_machines.dm b/code/modules/cm_preds/yaut_machines.dm index b1d2fbb045f9..f076c6782d9a 100644 --- a/code/modules/cm_preds/yaut_machines.dm +++ b/code/modules/cm_preds/yaut_machines.dm @@ -6,11 +6,7 @@ breakable = FALSE minimap_type = MINIMAP_FLAG_ALL - -/obj/structure/machinery/prop/almayer/CICmap/yautja/Initialize() - . = ..() - qdel(map) - map = new(src, minimap_type) // Non-drawing version + faction = FACTION_YAUTJA /obj/structure/machinery/autolathe/yautja name = "yautja autolathe" From 69544f0a5cd9d36f4c70a7a1c2698464fc243561 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Mon, 16 Oct 2023 11:20:17 -0700 Subject: [PATCH 149/161] Ensure ghosts receive flattened maps (somehow this seemed to be working regardless) --- code/controllers/subsystem/minimap.dm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 25fefa4b5336..55d8b0a0c92d 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -423,15 +423,20 @@ SUBSYSTEM_DEF(minimaps) to_chat(usr, SPAN_WARNING("A critical error has occurred! Contact a coder.")) // tf2heavy: "Oh, this is bad!" return FALSE + // Send to only relevant clients var/list/faction_clients = list() - for(var/client/client in GLOB.clients) + for(var/client/client as anything in GLOB.clients) + if(!client || !client.mob) + continue var/mob/client_mob = client.mob - if(isxeno(client_mob)) + if(client_mob.faction == faction) + faction_clients += client + else if(client_mob.faction == FACTION_NEUTRAL && isobserver(client_mob)) + faction_clients += client + else if(isxeno(client_mob)) var/mob/living/carbon/xenomorph/xeno = client_mob if(xeno.hivenumber == faction) faction_clients += client - else if(client_mob.faction == faction) - faction_clients += client // This may be unnecessary to do this way if the asset url is always the same as the lookup key var/flat_tacmap_key = icon2html(flat_map, faction_clients, keyonly = TRUE) From 644a9889b249e7c6961cc625cdd15f4423f6b632 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Mon, 16 Oct 2023 11:21:35 -0700 Subject: [PATCH 150/161] Tweak minimum distance for a path --- tgui/packages/tgui/interfaces/CanvasLayer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index e6546fcac391..d88a2a6f4441 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -83,7 +83,7 @@ export class CanvasLayer extends Component { if (this.lastX !== null && this.lastY !== null) { // this controls how often we make new strokes - if (Math.abs(this.lastX - x) + Math.abs(this.lastY - y) < 25) { + if (Math.abs(this.lastX - x) + Math.abs(this.lastY - y) < 20) { return; } From 942ae033d8934aa9d99a68ee9fb0d0b7a00bb049 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Mon, 16 Oct 2023 13:09:18 -0700 Subject: [PATCH 151/161] Fix deleting xeno tacmaps --- code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm b/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm index 92446a4e6b59..b1d960e68305 100644 --- a/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm +++ b/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm @@ -133,7 +133,7 @@ GLOBAL_DATUM_INIT(tacmap_admin_panel, /datum/tacmap_admin_panel, new) else if(xeno_selection == -1) return TRUE - selected_svg = GLOB.uscm_svg_tacmap_data[xeno_selection + 1] + selected_svg = GLOB.xeno_svg_tacmap_data[xeno_selection + 1] selected_svg.svg_data = null last_update_time = world.time message_admins("[key_name_admin(usr)] deleted the tactical map drawing by [selected_svg.ckey].") From 57fce31d61103376aef204a22bfaa9a44536cf0f Mon Sep 17 00:00:00 2001 From: Drulikar Date: Mon, 16 Oct 2023 13:13:41 -0700 Subject: [PATCH 152/161] Latejoin asset sending for tacmaps Minor refactoring --- code/controllers/subsystem/minimap.dm | 30 +++++++++++++++++++ code/game/gamemodes/cm_initialize.dm | 28 ++++++++--------- .../structures/special/pylon_core.dm | 2 +- code/modules/mob/new_player/new_player.dm | 12 ++++---- 4 files changed, 52 insertions(+), 20 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 55d8b0a0c92d..d49c237a08f1 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -398,6 +398,36 @@ SUBSYSTEM_DEF(minimaps) return map_list[map_length] +/** + * Sends relevant flattened tacmaps to a late joiner. + * + * Arguments: + * * user: The mob that is either an observer, marine, or xeno + */ +/datum/proc/send_tacmap_assets_latejoin(mob/user) + if(!user.client) + return + + var/is_observer = user.faction == FACTION_NEUTRAL && isobserver(user) + if(is_observer || user.faction == FACTION_MARINE) + // Send marine maps + var/datum/flattend_tacmap/latest = get_tacmap_data_png(FACTION_MARINE) + if(latest) + SSassets.transport.send_assets(user.client, latest.asset_key) + var/datum/flattend_tacmap/unannounced = get_unannounced_tacmap_data_png(FACTION_MARINE) + if(unannounced && (!latest || latest.asset_key != unannounced.asset_key)) + SSassets.transport.send_assets(user.client, unannounced.asset_key) + + var/mob/living/carbon/xenomorph/xeno = user + if(is_observer || istype(xeno) && xeno.hivenumber == XENO_HIVE_NORMAL) + // Send xeno maps + var/datum/flattend_tacmap/latest = get_tacmap_data_png(XENO_HIVE_NORMAL) + if(latest) + SSassets.transport.send_assets(user.client, latest.asset_key) + var/datum/flattend_tacmap/unannounced = get_unannounced_tacmap_data_png(XENO_HIVE_NORMAL) + if(unannounced && (!latest || latest.asset_key != unannounced.asset_key)) + SSassets.transport.send_assets(user.client, unannounced.asset_key) + /** * Flattens the current map and then distributes it for the specified faction as an unannounced map. * diff --git a/code/game/gamemodes/cm_initialize.dm b/code/game/gamemodes/cm_initialize.dm index effd3325f887..d0f0e3d40e6c 100644 --- a/code/game/gamemodes/cm_initialize.dm +++ b/code/game/gamemodes/cm_initialize.dm @@ -423,7 +423,7 @@ Additional game mode variables. for(var/mob_name in picked_hive.banished_ckeys) if(picked_hive.banished_ckeys[mob_name] == xeno_candidate.ckey) to_chat(xeno_candidate, SPAN_WARNING("You are banished from the [picked_hive], you may not rejoin unless the Queen re-admits you or dies.")) - return + return FALSE if(isnewplayer(xeno_candidate)) var/mob/new_player/noob = xeno_candidate noob.close_spawn_windows() @@ -443,9 +443,6 @@ Additional game mode variables. return FALSE new_xeno = userInput - if(!xeno_candidate) - return FALSE - if(!(new_xeno in GLOB.living_xeno_list) || new_xeno.stat == DEAD) to_chat(xeno_candidate, SPAN_WARNING("You cannot join if the xenomorph is dead.")) return FALSE @@ -479,14 +476,14 @@ Additional game mode variables. else new_xeno = pick(available_xenos_non_ssd) //Just picks something at random. if(istype(new_xeno) && xeno_candidate && xeno_candidate.client) if(isnewplayer(xeno_candidate)) - var/mob/new_player/N = xeno_candidate - N.close_spawn_windows() + var/mob/new_player/noob = xeno_candidate + noob.close_spawn_windows() for(var/mob_name in new_xeno.hive.banished_ckeys) if(new_xeno.hive.banished_ckeys[mob_name] == xeno_candidate.ckey) to_chat(xeno_candidate, SPAN_WARNING("You are banished from this hive, You may not rejoin unless the Queen re-admits you or dies.")) - return + return FALSE if(transfer_xeno(xeno_candidate, new_xeno)) - return 1 + return TRUE to_chat(xeno_candidate, "JAS01: Something went wrong, tell a coder.") /datum/game_mode/proc/attempt_to_join_as_facehugger(mob/xeno_candidate) @@ -614,20 +611,21 @@ Additional game mode variables. /datum/game_mode/proc/transfer_xeno(xeno_candidate, mob/living/new_xeno) if(!xeno_candidate || !isxeno(new_xeno) || QDELETED(new_xeno)) return FALSE + var/datum/mind/xeno_candidate_mind if(ismind(xeno_candidate)) xeno_candidate_mind = xeno_candidate else if(ismob(xeno_candidate)) - var/mob/M = xeno_candidate - if(M.mind) - xeno_candidate_mind = M.mind + var/mob/xeno_candidate_mob = xeno_candidate + if(xeno_candidate_mob.mind) + xeno_candidate_mind = xeno_candidate_mob.mind else - xeno_candidate_mind = new /datum/mind(M.key, M.ckey) + xeno_candidate_mind = new /datum/mind(xeno_candidate_mob.key, xeno_candidate_mob.ckey) xeno_candidate_mind.active = TRUE xeno_candidate_mind.current = new_xeno else if(isclient(xeno_candidate)) - var/client/C = xeno_candidate - xeno_candidate_mind = new /datum/mind(C.key, C.ckey) + var/client/xeno_candidate_client = xeno_candidate + xeno_candidate_mind = new /datum/mind(xeno_candidate_client.key, xeno_candidate_client.ckey) xeno_candidate_mind.active = TRUE xeno_candidate_mind.current = new_xeno else @@ -645,6 +643,8 @@ Additional game mode variables. SSround_recording.recorder.update_key(new_xeno) if(new_xeno.client) new_xeno.client.change_view(world_view_size) + if(isnewplayer(xeno_candidate)) + send_tacmap_assets_latejoin(new_xeno) msg_admin_niche("[new_xeno.key] has joined as [new_xeno].") if(isxeno(new_xeno)) //Dear lord diff --git a/code/modules/cm_aliens/structures/special/pylon_core.dm b/code/modules/cm_aliens/structures/special/pylon_core.dm index 062204f30622..a0db75b365b5 100644 --- a/code/modules/cm_aliens/structures/special/pylon_core.dm +++ b/code/modules/cm_aliens/structures/special/pylon_core.dm @@ -318,7 +318,7 @@ to_chat(new_xeno, SPAN_XENOANNOUNCE("You are a xenomorph larva awakened from slumber!")) playsound(new_xeno, 'sound/effects/xeno_newlarva.ogg', 50, 1) if(new_xeno.client) - if(new_xeno.client?.prefs.toggles_flashing & FLASH_POOLSPAWN) + if(new_xeno.client.prefs.toggles_flashing & FLASH_POOLSPAWN) window_flash(new_xeno.client) linked_hive.stored_larva-- diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 5da499dabc52..d18754221c8a 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -146,11 +146,12 @@ if(observer.client) observer.client.change_view(world_view_size) + send_tacmap_assets_latejoin(observer) observer.set_huds_from_prefs() qdel(src) - return 1 + return TRUE if("late_join") @@ -276,11 +277,12 @@ if(player.get_playtime(STATISTIC_HUMAN) == 0 && player.get_playtime(STATISTIC_XENO) == 0) msg_admin_niche("NEW JOIN: [key_name(character, 1, 1, 0)]. IP: [character.lastKnownIP], CID: [character.computer_id]") if(character.client) - var/client/C = character.client - if(C.player_data && C.player_data.playtime_loaded && length(C.player_data.playtimes) == 0) + var/client/client = character.client + if(client.player_data && client.player_data.playtime_loaded && length(client.player_data.playtimes) == 0) msg_admin_niche("NEW PLAYER: [key_name(character, 1, 1, 0)]. IP: [character.lastKnownIP], CID: [character.computer_id]") - if(C.player_data && C.player_data.playtime_loaded && ((round(C.get_total_human_playtime() DECISECONDS_TO_HOURS, 0.1)) <= 5)) - msg_sea("NEW PLAYER: [key_name(character, 0, 1, 0)] only has [(round(C.get_total_human_playtime() DECISECONDS_TO_HOURS, 0.1))] hours as a human. Current role: [get_actual_job_name(character)] - Current location: [get_area(character)]") + if(client.player_data && client.player_data.playtime_loaded && ((round(client.get_total_human_playtime() DECISECONDS_TO_HOURS, 0.1)) <= 5)) + msg_sea("NEW PLAYER: [key_name(character, 0, 1, 0)] only has [(round(client.get_total_human_playtime() DECISECONDS_TO_HOURS, 0.1))] hours as a human. Current role: [get_actual_job_name(character)] - Current location: [get_area(character)]") + send_tacmap_assets_latejoin(character) character.client.init_verbs() qdel(src) From cdca4032316078daf4ab18d1971e34984f45a676 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Tue, 24 Oct 2023 07:03:18 -0700 Subject: [PATCH 153/161] Flattened --- code/controllers/subsystem/minimap.dm | 18 +++++++++--------- .../tacmap_panel/tacmap_admin_panel_tgui.dm | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index d49c237a08f1..464d5609767a 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -411,20 +411,20 @@ SUBSYSTEM_DEF(minimaps) var/is_observer = user.faction == FACTION_NEUTRAL && isobserver(user) if(is_observer || user.faction == FACTION_MARINE) // Send marine maps - var/datum/flattend_tacmap/latest = get_tacmap_data_png(FACTION_MARINE) + var/datum/flattened_tacmap/latest = get_tacmap_data_png(FACTION_MARINE) if(latest) SSassets.transport.send_assets(user.client, latest.asset_key) - var/datum/flattend_tacmap/unannounced = get_unannounced_tacmap_data_png(FACTION_MARINE) + var/datum/flattened_tacmap/unannounced = get_unannounced_tacmap_data_png(FACTION_MARINE) if(unannounced && (!latest || latest.asset_key != unannounced.asset_key)) SSassets.transport.send_assets(user.client, unannounced.asset_key) var/mob/living/carbon/xenomorph/xeno = user if(is_observer || istype(xeno) && xeno.hivenumber == XENO_HIVE_NORMAL) // Send xeno maps - var/datum/flattend_tacmap/latest = get_tacmap_data_png(XENO_HIVE_NORMAL) + var/datum/flattened_tacmap/latest = get_tacmap_data_png(XENO_HIVE_NORMAL) if(latest) SSassets.transport.send_assets(user.client, latest.asset_key) - var/datum/flattend_tacmap/unannounced = get_unannounced_tacmap_data_png(XENO_HIVE_NORMAL) + var/datum/flattened_tacmap/unannounced = get_unannounced_tacmap_data_png(XENO_HIVE_NORMAL) if(unannounced && (!latest || latest.asset_key != unannounced.asset_key)) SSassets.transport.send_assets(user.client, unannounced.asset_key) @@ -474,7 +474,7 @@ SUBSYSTEM_DEF(minimaps) to_chat(usr, SPAN_WARNING("A critical error has occurred! Contact a coder.")) return FALSE var/flat_tacmap_png = SSassets.transport.get_asset_url(flat_tacmap_key) - var/datum/flattend_tacmap/new_flat = new(flat_tacmap_png, flat_tacmap_key) + var/datum/flattened_tacmap/new_flat = new(flat_tacmap_png, flat_tacmap_key) if(faction == FACTION_MARINE) GLOB.uscm_unannounced_map = new_flat @@ -633,9 +633,9 @@ SUBSYSTEM_DEF(minimaps) /// boolean value to keep track if the canvas has been updated or not, the value is used in tgui state. var/updated_canvas = FALSE /// current flattend map - var/datum/flattend_tacmap/new_current_map + var/datum/flattened_tacmap/new_current_map /// previous flattened map - var/datum/flattend_tacmap/old_map + var/datum/flattened_tacmap/old_map /// current svg var/datum/svg_overlay/current_svg @@ -927,12 +927,12 @@ SUBSYSTEM_DEF(minimaps) map = null return ..() -/datum/flattend_tacmap +/datum/flattened_tacmap var/flat_tacmap var/asset_key var/time -/datum/flattend_tacmap/New(flat_tacmap, asset_key) +/datum/flattened_tacmap/New(flat_tacmap, asset_key) src.flat_tacmap = flat_tacmap src.asset_key = asset_key src.time = time_stamp() diff --git a/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm b/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm index b1d960e68305..7ab4402886ba 100644 --- a/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm +++ b/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm @@ -67,7 +67,7 @@ GLOBAL_DATUM_INIT(tacmap_admin_panel, /datum/tacmap_admin_panel, new) data["uscm_map"] = null data["uscm_svg"] = null else - var/datum/flattend_tacmap/selected_flat = GLOB.uscm_flat_tacmap_data[uscm_selection + 1] + var/datum/flattened_tacmap/selected_flat = GLOB.uscm_flat_tacmap_data[uscm_selection + 1] var/datum/svg_overlay/selected_svg = GLOB.uscm_svg_tacmap_data[uscm_selection + 1] data["uscm_map"] = selected_flat.flat_tacmap data["uscm_svg"] = selected_svg.svg_data @@ -76,7 +76,7 @@ GLOBAL_DATUM_INIT(tacmap_admin_panel, /datum/tacmap_admin_panel, new) data["xeno_map"] = null data["xeno_svg"] = null else - var/datum/flattend_tacmap/selected_flat = GLOB.xeno_flat_tacmap_data[xeno_selection + 1] + var/datum/flattened_tacmap/selected_flat = GLOB.xeno_flat_tacmap_data[xeno_selection + 1] var/datum/svg_overlay/selected_svg = GLOB.xeno_svg_tacmap_data[xeno_selection + 1] data["xeno_map"] = selected_flat.flat_tacmap data["xeno_svg"] = selected_svg.svg_data @@ -101,7 +101,7 @@ GLOBAL_DATUM_INIT(tacmap_admin_panel, /datum/tacmap_admin_panel, new) switch(action) if("recache") var/is_uscm = params["uscm"] - var/datum/flattend_tacmap/selected_flat + var/datum/flattened_tacmap/selected_flat if(is_uscm) if(uscm_selection == -1) return TRUE From 9d55769b727ae5e932f39af3fd6d59d6815317a3 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Tue, 24 Oct 2023 07:12:32 -0700 Subject: [PATCH 154/161] Global var instead --- code/_globalvars/misc.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index c30294e16383..157bb01a271a 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -23,8 +23,8 @@ GLOBAL_VAR_INIT(uscm_flatten_map_icon_cooldown, 0) GLOBAL_VAR_INIT(xeno_flatten_map_icon_cooldown, 0) // latest unannounced flat tacmap for xenos and marines -GLOBAL_VAR_INIT(uscm_unannounced_map, null) -GLOBAL_VAR_INIT(xeno_unannounced_map, null) +GLOBAL_VAR(uscm_unannounced_map) +GLOBAL_VAR(xeno_unannounced_map) //global tacmaps for action button access GLOBAL_DATUM_INIT(uscm_tacmap_status, /datum/tacmap/drawing/status_tab_view, new) From e9bb91cdfeca8c43bfd614069dcaf0d920c5efed Mon Sep 17 00:00:00 2001 From: Drulikar Date: Tue, 24 Oct 2023 07:14:03 -0700 Subject: [PATCH 155/161] Global procs --- code/controllers/subsystem/minimap.dm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 464d5609767a..36383443f794 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -344,7 +344,7 @@ SUBSYSTEM_DEF(minimaps) * Arguments: * * faction: FACTION_MARINE or XENO_HIVE_NORMAL */ -/datum/proc/get_tacmap_data_png(faction) +/proc/get_tacmap_data_png(faction) var/list/map_list if(faction == FACTION_MARINE) @@ -367,7 +367,7 @@ SUBSYSTEM_DEF(minimaps) * Arguments: * * faction: FACTION_MARINE or XENO_HIVE_NORMAL */ -/datum/proc/get_unannounced_tacmap_data_png(faction) +/proc/get_unannounced_tacmap_data_png(faction) if(faction == FACTION_MARINE) return GLOB.uscm_unannounced_map else if(faction == XENO_HIVE_NORMAL) @@ -381,7 +381,7 @@ SUBSYSTEM_DEF(minimaps) * Arguments: * * faction: which faction get the map for: FACTION_MARINE or XENO_HIVE_NORMAL */ -/datum/proc/get_tacmap_data_svg(faction) +/proc/get_tacmap_data_svg(faction) var/list/map_list if(faction == FACTION_MARINE) @@ -404,7 +404,7 @@ SUBSYSTEM_DEF(minimaps) * Arguments: * * user: The mob that is either an observer, marine, or xeno */ -/datum/proc/send_tacmap_assets_latejoin(mob/user) +/proc/send_tacmap_assets_latejoin(mob/user) if(!user.client) return From dea773f7c173d524f7848e7c73e4893c11f2eb9e Mon Sep 17 00:00:00 2001 From: Drulikar Date: Tue, 24 Oct 2023 07:16:08 -0700 Subject: [PATCH 156/161] Wording --- code/modules/mob/dead/observer/observer.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 663f10a40325..c97b7464117e 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -914,7 +914,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp var/datum/hive_status/hive = GLOB.hive_datum[XENO_HIVE_NORMAL] if(!hive || !length(hive.totalXenos)) - to_chat(src, SPAN_ALERT("There seem to be no living hives at the moment")) + to_chat(src, SPAN_ALERT("There seems to be no living normal hive at the moment")) return GLOB.xeno_tacmap_status.tgui_interact(src) From 790358a7e493a56ce10618167ad325b7d0be6ea2 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Tue, 24 Oct 2023 07:22:35 -0700 Subject: [PATCH 157/161] Update comment --- html/statbrowser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/statbrowser.js b/html/statbrowser.js index 55c3208fcc10..c2dbce1215b6 100644 --- a/html/statbrowser.js +++ b/html/statbrowser.js @@ -372,7 +372,7 @@ function draw_status() { .getElementById("statcontent") .appendChild(document.createElement("br")); } else if ( - // hardcoded for testing purposes .includes() seems to be breaking things for some reason. + // hardcoded because merely using .includes() to test for a href seems unreliable for some reason. status_tab_parts[i] == status_tab_map_href_exception ) { var maplink = document.createElement("a"); From 84ae52d55278ccd93a6e65ae624ffb2282f5bf3f Mon Sep 17 00:00:00 2001 From: Drulikar Date: Mon, 6 Nov 2023 07:25:11 -0800 Subject: [PATCH 158/161] Remove unneeded fragment --- .../tgui/interfaces/TacmapAdminPanel.js | 92 +++++++++---------- 1 file changed, 44 insertions(+), 48 deletions(-) diff --git a/tgui/packages/tgui/interfaces/TacmapAdminPanel.js b/tgui/packages/tgui/interfaces/TacmapAdminPanel.js index 104c4f10500c..a5d00c688a2f 100644 --- a/tgui/packages/tgui/interfaces/TacmapAdminPanel.js +++ b/tgui/packages/tgui/interfaces/TacmapAdminPanel.js @@ -1,5 +1,5 @@ import { useBackend, useLocalState } from '../backend'; -import { Tabs, Section, Button, Fragment, Stack, Flex } from '../components'; +import { Tabs, Section, Button, Stack, Flex } from '../components'; import { DrawnMap } from './DrawnMap'; import { Window } from '../layouts'; @@ -116,53 +116,49 @@ const FactionPage = (props, context) => { } /> }> - - {Object(ckeys).map((ckey, ckey_index) => ( - - - - act('change_selection', { - uscm: is_uscm, - index: ckey_index, - }) - } - /> - - - {names[ckey_index]} ({ckey}) - {times[ckey_index]} - - - - act('delete', { - uscm: is_uscm, - index: ckey_index, - }) - } - /> - - - ))} - + {Object(ckeys).map((ckey, ckey_index) => ( + + + + act('change_selection', { + uscm: is_uscm, + index: ckey_index, + }) + } + /> + + + {names[ckey_index]} ({ckey}) - {times[ckey_index]} + + + + act('delete', { + uscm: is_uscm, + index: ckey_index, + }) + } + /> + + + ))}

); }; From 1a02644785f787c51b7cb6811e98df05a5ef5588 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Mon, 6 Nov 2023 07:53:50 -0800 Subject: [PATCH 159/161] Refactor ternary --- tgui/packages/tgui/interfaces/CanvasLayer.js | 80 +++++++++++--------- 1 file changed, 45 insertions(+), 35 deletions(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index d88a2a6f4441..e647ae765b1c 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -256,46 +256,56 @@ export class CanvasLayer extends Component { return count; } - render() { - // edge case where a new user joins and tries to draw on the canvas before they cached the png + displayCanvas() { return (
- {this.state.mapLoad ? ( -
- {this.complexity > 500 && ( - - - - )} - this.handleMouseDown(e)} - onMouseUp={(e) => this.handleMouseUp(e)} - onMouseMove={(e) => this.handleMouseMove(e)} + {this.complexity > 500 && ( + + -
- ) : ( - -

- Please wait a few minutes before attempting to access the canvas. -

-
+ )} + this.handleMouseDown(e)} + onMouseUp={(e) => this.handleMouseUp(e)} + onMouseMove={(e) => this.handleMouseMove(e)} + />
); } + + displayLoading() { + return ( +
+ +

+ Please wait a few minutes before attempting to access the canvas. +

+
+
+ ); + } + + render() { + if (this.state.mapLoad) { + return this.displayCanvas(); + } else { + // edge case where a new user joins and tries to draw on the canvas before they cached the png + return this.displayLoading(); + } + } } From ed05083e93d5e888143a325c1d92142660265c4f Mon Sep 17 00:00:00 2001 From: Drulikar Date: Fri, 10 Nov 2023 16:32:03 -0800 Subject: [PATCH 160/161] Define -1 --- .../tacmap_panel/tacmap_admin_panel_tgui.dm | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm b/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm index 7ab4402886ba..ca487d4b9e03 100644 --- a/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm +++ b/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm @@ -1,11 +1,13 @@ GLOBAL_DATUM_INIT(tacmap_admin_panel, /datum/tacmap_admin_panel, new) +#define LATEST_SELECTION -1 + /datum/tacmap_admin_panel var/name = "Tacmap Panel" /// The index picked last for USCM (zero indexed), -1 will try to select latest if it exists - var/uscm_selection = -1 + var/uscm_selection = LATEST_SELECTION /// The index picked last for Xenos (zero indexed), -1 will try to select latest if it exists - var/xeno_selection = -1 + var/xeno_selection = LATEST_SELECTION /// A url that will point to the wiki map for the current map as a fall back image var/static/wiki_map_fallback /// The last time the map selection was changed - used as a key to trick react into updating the map @@ -63,7 +65,7 @@ GLOBAL_DATUM_INIT(tacmap_admin_panel, /datum/tacmap_admin_panel, new) data["xeno_names"] = xeno_names data["xeno_times"] = xeno_times - if(uscm_selection == -1) + if(uscm_selection == LATEST_SELECTION) data["uscm_map"] = null data["uscm_svg"] = null else @@ -72,7 +74,7 @@ GLOBAL_DATUM_INIT(tacmap_admin_panel, /datum/tacmap_admin_panel, new) data["uscm_map"] = selected_flat.flat_tacmap data["uscm_svg"] = selected_svg.svg_data - if(xeno_selection == -1) + if(xeno_selection == LATEST_SELECTION) data["xeno_map"] = null data["xeno_svg"] = null else @@ -103,11 +105,11 @@ GLOBAL_DATUM_INIT(tacmap_admin_panel, /datum/tacmap_admin_panel, new) var/is_uscm = params["uscm"] var/datum/flattened_tacmap/selected_flat if(is_uscm) - if(uscm_selection == -1) + if(uscm_selection == LATEST_SELECTION) return TRUE selected_flat = GLOB.uscm_flat_tacmap_data[uscm_selection + 1] else - if(xeno_selection == -1) + if(xeno_selection == LATEST_SELECTION) return TRUE selected_flat = GLOB.xeno_flat_tacmap_data[xeno_selection + 1] SSassets.transport.send_assets(client_user, selected_flat.asset_key) @@ -127,11 +129,11 @@ GLOBAL_DATUM_INIT(tacmap_admin_panel, /datum/tacmap_admin_panel, new) var/is_uscm = params["uscm"] var/datum/svg_overlay/selected_svg if(is_uscm) - if(uscm_selection == -1) + if(uscm_selection == LATEST_SELECTION) return TRUE selected_svg = GLOB.uscm_svg_tacmap_data[uscm_selection + 1] else - if(xeno_selection == -1) + if(xeno_selection == LATEST_SELECTION) return TRUE selected_svg = GLOB.xeno_svg_tacmap_data[xeno_selection + 1] selected_svg.svg_data = null @@ -141,5 +143,7 @@ GLOBAL_DATUM_INIT(tacmap_admin_panel, /datum/tacmap_admin_panel, new) /datum/tacmap_admin_panel/ui_close(mob/user) . = ..() - uscm_selection = -1 - xeno_selection = -1 + uscm_selection = LATEST_SELECTION + xeno_selection = LATEST_SELECTION + +#undef LATEST_SELECTION From 3067be6d34519cd6e7d94c6083cd7218f9d5fe74 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Sun, 12 Nov 2023 05:13:03 -0800 Subject: [PATCH 161/161] Resend maps every ui open --- code/controllers/subsystem/minimap.dm | 13 +++++++------ code/game/gamemodes/cm_initialize.dm | 2 -- .../admin/tacmap_panel/tacmap_admin_panel_tgui.dm | 3 +++ code/modules/mob/new_player/new_player.dm | 2 -- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 36383443f794..d28fe916291a 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -256,8 +256,6 @@ SUBSYSTEM_DEF(minimaps) removal_cbs[target] = CALLBACK(src, PROC_REF(removeimage), blip, target) RegisterSignal(target, COMSIG_PARENT_QDELETING, PROC_REF(remove_marker)) - - /** * removes an image from raw tracked lists, invoked by callback */ @@ -399,12 +397,12 @@ SUBSYSTEM_DEF(minimaps) return map_list[map_length] /** - * Sends relevant flattened tacmaps to a late joiner. + * Re-sends relevant flattened tacmaps to a single client. * * Arguments: * * user: The mob that is either an observer, marine, or xeno */ -/proc/send_tacmap_assets_latejoin(mob/user) +/proc/resend_current_map_png(mob/user) if(!user.client) return @@ -432,9 +430,9 @@ SUBSYSTEM_DEF(minimaps) * Flattens the current map and then distributes it for the specified faction as an unannounced map. * * Arguments: - * * faction: which faction to distribute the map to: FACTION_MARINE or XENO_HIVE_NORMAL + * * faction: Which faction to distribute the map to: FACTION_MARINE or XENO_HIVE_NORMAL * Return: - * * returns a boolean value, true if the operation was successful, false if it was not. + * * Returns a boolean value, TRUE if the operation was successful, FALSE if it was not (on cooldown generally). */ /datum/tacmap/drawing/proc/distribute_current_map_png(faction) if(faction == FACTION_MARINE) @@ -714,6 +712,9 @@ SUBSYSTEM_DEF(minimaps) debug_log("Failed to determine fallback wiki map! Attempted '[wiki_url]/[new_map.html_link]'") qdel(new_map) + // Ensure we actually have the map image sent + resend_current_map_png(user) + if(use_live_map) tacmap_ready_time = SSminimaps.next_fire + 2 SECONDS addtimer(CALLBACK(src, PROC_REF(on_tacmap_fire), faction), SSminimaps.next_fire - world.time + 1 SECONDS) diff --git a/code/game/gamemodes/cm_initialize.dm b/code/game/gamemodes/cm_initialize.dm index d0f0e3d40e6c..17a255009089 100644 --- a/code/game/gamemodes/cm_initialize.dm +++ b/code/game/gamemodes/cm_initialize.dm @@ -643,8 +643,6 @@ Additional game mode variables. SSround_recording.recorder.update_key(new_xeno) if(new_xeno.client) new_xeno.client.change_view(world_view_size) - if(isnewplayer(xeno_candidate)) - send_tacmap_assets_latejoin(new_xeno) msg_admin_niche("[new_xeno.key] has joined as [new_xeno].") if(isxeno(new_xeno)) //Dear lord diff --git a/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm b/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm index ca487d4b9e03..e4b6f6846031 100644 --- a/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm +++ b/code/modules/admin/tacmap_panel/tacmap_admin_panel_tgui.dm @@ -25,6 +25,9 @@ GLOBAL_DATUM_INIT(tacmap_admin_panel, /datum/tacmap_admin_panel, new) debug_log("Failed to determine fallback wiki map! Attempted '[wiki_url]/[new_map.html_link]'") qdel(new_map) + // Ensure we actually have the latest map images sent (recache can handle older/different faction maps) + resend_current_map_png(user) + ui = new(user, src, "TacmapAdminPanel", "Tacmap Panel") ui.open() diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index ff9d9f6218ff..cebe265a673c 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -146,7 +146,6 @@ if(observer.client) observer.client.change_view(world_view_size) - send_tacmap_assets_latejoin(observer) observer.set_huds_from_prefs() @@ -282,7 +281,6 @@ msg_admin_niche("NEW PLAYER: [key_name(character, 1, 1, 0)]. IP: [character.lastKnownIP], CID: [character.computer_id]") if(client.player_data && client.player_data.playtime_loaded && ((round(client.get_total_human_playtime() DECISECONDS_TO_HOURS, 0.1)) <= 5)) msg_sea("NEW PLAYER: [key_name(character, 0, 1, 0)] only has [(round(client.get_total_human_playtime() DECISECONDS_TO_HOURS, 0.1))] hours as a human. Current role: [get_actual_job_name(character)] - Current location: [get_area(character)]") - send_tacmap_assets_latejoin(character) character.client.init_verbs() qdel(src)