From 75d0325ff2fa96a138733bb39398ba28addcede0 Mon Sep 17 00:00:00 2001 From: ShadowLarkens Date: Fri, 3 Jul 2020 19:05:06 -0700 Subject: [PATCH] Final adjustments to the crew monitor, calling this good and happy. --- code/modules/tgui/modules/crew_monitor.dm | 10 - tgui/packages/tgui/components/NanoMap.js | 16 +- tgui/packages/tgui/interfaces/CrewMonitor.js | 346 ++++++++++++------ tgui/packages/tgui/public/tgui.bundle.css | 2 +- tgui/packages/tgui/public/tgui.bundle.js | 6 +- .../tgui/styles/components/NanoMap.scss | 13 +- 6 files changed, 257 insertions(+), 136 deletions(-) diff --git a/code/modules/tgui/modules/crew_monitor.dm b/code/modules/tgui/modules/crew_monitor.dm index c4d901d5f6..e781732edb 100644 --- a/code/modules/tgui/modules/crew_monitor.dm +++ b/code/modules/tgui/modules/crew_monitor.dm @@ -1,6 +1,5 @@ /datum/tgui_module/crew_monitor name = "Crew monitor" - var/mapZoom = 1 /datum/tgui_module/crew_monitor/tgui_act(action, params) if(..()) @@ -19,11 +18,6 @@ if(hassensorlevel(H, SUIT_SENSOR_TRACKING)) AI.ai_actual_track(H) return TRUE - if("changeZoom") - var/newZoom = params["newZoom"] - mapZoom = newZoom - return TRUE - /datum/tgui_module/crew_monitor/tgui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/tgui_state/state = GLOB.tgui_default_state) var/z = get_z(tgui_host()) @@ -56,8 +50,4 @@ for(var/zlevel in map_levels) data["crewmembers"] += crew_repository.health_data(zlevel) - data["zoomLevels"] = list(1, 1.25, 1.5, 1.75, 2) - - data["mapZoom"] = mapZoom - return data diff --git a/tgui/packages/tgui/components/NanoMap.js b/tgui/packages/tgui/components/NanoMap.js index 5c16aee921..a1d8500073 100644 --- a/tgui/packages/tgui/components/NanoMap.js +++ b/tgui/packages/tgui/components/NanoMap.js @@ -9,7 +9,6 @@ export class NanoMap extends Component { this.state = { offsetX: 0, offsetY: 0, - transform: 'none', dragging: false, originX: null, originY: null, @@ -64,8 +63,17 @@ export class NanoMap extends Component { render() { const { config } = useBackend(this.context); - const { offsetX, offsetY } = this.state; - const { children, zoom } = this.props; + let { offsetX, offsetY } = this.state; + const { children, zoom, reset } = this.props; + + if (reset) { + this.setState({ + offsetX: 0, + offsetY: 0, + }); + offsetX = 0; + offsetY = 0; + } const newStyle = { width: 508 * zoom + 'px', @@ -106,7 +114,7 @@ const NanoMapMarker = props => { position="absolute" className="NanoMap__marker" top={((255 - y) * 2 * zoom) - 8 + 'px'} - left={((x * 2 * zoom)) - 8 + 'px'} > + left={(((x - 1) * 2 * zoom)) - 6 + 'px'} > { @@ -9,116 +9,244 @@ export const CrewMonitor = (props, context) => { const crew = sortBy( crewmember => crewmember.name, )(data.crewmembers || []); + + const [zoom, setZoom] = useLocalState(context, 'zoom', 1); + const [reset, setReset] = useLocalState(context, 'reset', 0); + const [tabIndex, setTabIndex] = useLocalState(context, 'tabIndex', 0); + + let body; + + if (tabIndex === 0) { + body = ( + + + + + Name + + + Status + + + Location + + + {crew + .map(crewmember => ( + + + {crewmember.name} ({crewmember.assignment}) + + + + {crewmember.dead ? 'Deceased' : 'Living'} + + {crewmember.sensor_type >= 2 ? ( + + {'('} + + {crewmember.brute} + + {'|'} + + {crewmember.fire} + + {'|'} + + {crewmember.tox} + + {'|'} + + {crewmember.oxy} + + {')'} + + ) : null} + + + {crewmember.sensor_type === 3 ? ( + data.isAI ? ( +
+
+ ); + } else if (tabIndex === 1) { + body = ( + + + + + Level: + {data.map_levels.map(level => ( +