diff --git a/code/datums/repositories/crew.dm b/code/datums/repositories/crew.dm index 7a748049bc..c45202194b 100644 --- a/code/datums/repositories/crew.dm +++ b/code/datums/repositories/crew.dm @@ -38,9 +38,10 @@ var/global/datum/repository/crew/crew_repository = new() crewmemberData["assignment"] = H.get_assignment(if_no_id="Unknown", if_no_job="No Job") if(C.sensor_mode >= SUIT_SENSOR_BINARY) - crewmemberData["dead"] = H.stat > UNCONSCIOUS + crewmemberData["dead"] = H.stat == DEAD if(C.sensor_mode >= SUIT_SENSOR_VITAL) + crewmemberData["stat"] = H.stat crewmemberData["oxy"] = round(H.getOxyLoss(), 1) crewmemberData["tox"] = round(H.getToxLoss(), 1) crewmemberData["fire"] = round(H.getFireLoss(), 1) diff --git a/code/modules/asset_cache/asset_list_items.dm b/code/modules/asset_cache/asset_list_items.dm index bb43597d95..815d250dcc 100644 --- a/code/modules/asset_cache/asset_list_items.dm +++ b/code/modules/asset_cache/asset_list_items.dm @@ -490,16 +490,14 @@ // It REALLY doesnt matter too much if these arent up to date // They are relatively big assets = list( - "southern_cross_nanomap_z1.png" = 'icons/_nanomaps/southern_cross_nanomap_z1.png', - "southern_cross_nanomap_z10.png" = 'icons/_nanomaps/southern_cross_nanomap_z10.png', - "southern_cross_nanomap_z2.png" = 'icons/_nanomaps/southern_cross_nanomap_z2.png', - "southern_cross_nanomap_z3.png" = 'icons/_nanomaps/southern_cross_nanomap_z3.png', - "southern_cross_nanomap_z5.png" = 'icons/_nanomaps/southern_cross_nanomap_z5.png', - "southern_cross_nanomap_z6.png" = 'icons/_nanomaps/southern_cross_nanomap_z6.png', + // VOREStation Edit: We don't need Southern Cross + // "southern_cross_nanomap_z1.png" = 'icons/_nanomaps/southern_cross_nanomap_z1.png', + // "southern_cross_nanomap_z10.png" = 'icons/_nanomaps/southern_cross_nanomap_z10.png', + // "southern_cross_nanomap_z2.png" = 'icons/_nanomaps/southern_cross_nanomap_z2.png', + // "southern_cross_nanomap_z3.png" = 'icons/_nanomaps/southern_cross_nanomap_z3.png', + // "southern_cross_nanomap_z5.png" = 'icons/_nanomaps/southern_cross_nanomap_z5.png', + // "southern_cross_nanomap_z6.png" = 'icons/_nanomaps/southern_cross_nanomap_z6.png', "tether_nanomap_z1.png" = 'icons/_nanomaps/tether_nanomap_z1.png', - "tether_nanomap_z10.png" = 'icons/_nanomaps/tether_nanomap_z10.png', - "tether_nanomap_z13.png" = 'icons/_nanomaps/tether_nanomap_z13.png', - "tether_nanomap_z14.png" = 'icons/_nanomaps/tether_nanomap_z14.png', "tether_nanomap_z2.png" = 'icons/_nanomaps/tether_nanomap_z2.png', "tether_nanomap_z3.png" = 'icons/_nanomaps/tether_nanomap_z3.png', "tether_nanomap_z4.png" = 'icons/_nanomaps/tether_nanomap_z4.png', @@ -508,4 +506,8 @@ "tether_nanomap_z7.png" = 'icons/_nanomaps/tether_nanomap_z7.png', "tether_nanomap_z8.png" = 'icons/_nanomaps/tether_nanomap_z8.png', "tether_nanomap_z9.png" = 'icons/_nanomaps/tether_nanomap_z9.png', + "tether_nanomap_z10.png" = 'icons/_nanomaps/tether_nanomap_z10.png', + "tether_nanomap_z13.png" = 'icons/_nanomaps/tether_nanomap_z13.png', + "tether_nanomap_z14.png" = 'icons/_nanomaps/tether_nanomap_z14.png', + // VOREStation Edit End ) \ No newline at end of file diff --git a/icons/_nanomaps/tether_nanomap_z1.png b/icons/_nanomaps/tether_nanomap_z1.png index c463bd04b7..03aad88117 100644 Binary files a/icons/_nanomaps/tether_nanomap_z1.png and b/icons/_nanomaps/tether_nanomap_z1.png differ diff --git a/icons/_nanomaps/tether_nanomap_z13.png b/icons/_nanomaps/tether_nanomap_z13.png index 6f87d9911f..83792e9db4 100644 Binary files a/icons/_nanomaps/tether_nanomap_z13.png and b/icons/_nanomaps/tether_nanomap_z13.png differ diff --git a/icons/_nanomaps/tether_nanomap_z14.png b/icons/_nanomaps/tether_nanomap_z14.png index 84d106a5ac..aa62758eb1 100644 Binary files a/icons/_nanomaps/tether_nanomap_z14.png and b/icons/_nanomaps/tether_nanomap_z14.png differ diff --git a/icons/_nanomaps/tether_nanomap_z2.png b/icons/_nanomaps/tether_nanomap_z2.png index 5ccd461808..8b52113523 100644 Binary files a/icons/_nanomaps/tether_nanomap_z2.png and b/icons/_nanomaps/tether_nanomap_z2.png differ diff --git a/icons/_nanomaps/tether_nanomap_z3.png b/icons/_nanomaps/tether_nanomap_z3.png index 0761eed916..e3838796e0 100644 Binary files a/icons/_nanomaps/tether_nanomap_z3.png and b/icons/_nanomaps/tether_nanomap_z3.png differ diff --git a/icons/_nanomaps/tether_nanomap_z4.png b/icons/_nanomaps/tether_nanomap_z4.png index f6465c7c13..34759796d5 100644 Binary files a/icons/_nanomaps/tether_nanomap_z4.png and b/icons/_nanomaps/tether_nanomap_z4.png differ diff --git a/icons/_nanomaps/tether_nanomap_z5.png b/icons/_nanomaps/tether_nanomap_z5.png index d8aece303d..394c1052a7 100644 Binary files a/icons/_nanomaps/tether_nanomap_z5.png and b/icons/_nanomaps/tether_nanomap_z5.png differ diff --git a/icons/_nanomaps/tether_nanomap_z6.png b/icons/_nanomaps/tether_nanomap_z6.png index 7fb5111527..6d67bae632 100644 Binary files a/icons/_nanomaps/tether_nanomap_z6.png and b/icons/_nanomaps/tether_nanomap_z6.png differ diff --git a/icons/_nanomaps/tether_nanomap_z7.png b/icons/_nanomaps/tether_nanomap_z7.png index 7645d78d09..8e03cc03fc 100644 Binary files a/icons/_nanomaps/tether_nanomap_z7.png and b/icons/_nanomaps/tether_nanomap_z7.png differ diff --git a/icons/_nanomaps/tether_nanomap_z8.png b/icons/_nanomaps/tether_nanomap_z8.png index c973b2b784..3d2acaf6b4 100644 Binary files a/icons/_nanomaps/tether_nanomap_z8.png and b/icons/_nanomaps/tether_nanomap_z8.png differ diff --git a/icons/_nanomaps/tether_nanomap_z9.png b/icons/_nanomaps/tether_nanomap_z9.png index bff91820dd..734f44dd95 100644 Binary files a/icons/_nanomaps/tether_nanomap_z9.png and b/icons/_nanomaps/tether_nanomap_z9.png differ diff --git a/tgui/packages/tgui/components/NanoMap.js b/tgui/packages/tgui/components/NanoMap.js index 261fb8b1d3..2d7f969890 100644 --- a/tgui/packages/tgui/components/NanoMap.js +++ b/tgui/packages/tgui/components/NanoMap.js @@ -1,38 +1,44 @@ -import { Box, Icon, Tooltip } from '.'; import { Component } from 'inferno'; +import { Box, Button, Icon, Tooltip, LabeledList, Slider } from '.'; import { useBackend } from "../backend"; -import { resolveAsset } from '../assets'; -import { logger } from '../logging'; + +const pauseEvent = e => { + if (e.stopPropagation) { e.stopPropagation(); } + if (e.preventDefault) { e.preventDefault(); } + e.cancelBubble = true; + e.returnValue = false; + return false; +}; export class NanoMap extends Component { constructor(props) { super(props); // Auto center based on window size + const Xcenter = (window.innerWidth / 2) - 256; + const Ycenter = (window.innerHeight / 2) - 256; + this.state = { - offsetX: 0, - offsetY: 0, + offsetX: Xcenter, + offsetY: Ycenter, transform: 'none', dragging: false, originX: null, originY: null, + zoom: 1, }; + // Dragging this.handleDragStart = e => { - document.body.style['pointer-events'] = 'none'; this.ref = e.target; this.setState({ dragging: false, originX: e.screenX, originY: e.screenY, }); - this.timer = setTimeout(() => { - this.setState({ - dragging: true, - }); - }, 250); document.addEventListener('mousemove', this.handleDragMove); document.addEventListener('mouseup', this.handleDragEnd); + pauseEvent(e); }; this.handleDragMove = e => { @@ -41,8 +47,8 @@ export class NanoMap extends Component { const newOffsetX = e.screenX - state.originX; const newOffsetY = e.screenY - state.originY; if (prevState.dragging) { - state.offsetX += (newOffsetX / this.props.zoom); - state.offsetY += (newOffsetY / this.props.zoom); + state.offsetX += newOffsetX; + state.offsetY += newOffsetY; state.originX = e.screenX; state.originY = e.screenY; } else { @@ -50,11 +56,10 @@ export class NanoMap extends Component { } return state; }); + pauseEvent(e); }; this.handleDragEnd = e => { - document.body.style['pointer-events'] = 'auto'; - clearTimeout(this.timer); this.setState({ dragging: false, originX: null, @@ -62,28 +67,54 @@ export class NanoMap extends Component { }); document.removeEventListener('mousemove', this.handleDragMove); document.removeEventListener('mouseup', this.handleDragEnd); + pauseEvent(e); }; + + this.handleZoom = (_e, value) => { + this.setState(state => { + const newZoom = Math.min(Math.max(value, 1), 8); + let zoomDiff = (newZoom - state.zoom) * 1.5; + state.zoom = newZoom; + + let newOffsetX = state.offsetX - 262 * zoomDiff; + if (newOffsetX < -500) { newOffsetX = -500; } + if (newOffsetX > 500) { newOffsetX = 500; } + + let newOffsetY = state.offsetY - 256 * zoomDiff; + if (newOffsetY < -200) { newOffsetY = -200; } + if (newOffsetY > 200) { newOffsetY = 200; } + + state.offsetX = newOffsetX; + state.offsetY = newOffsetY; + if (props.onZoom) { + props.onZoom(state.zoom); + } + return state; + }); + }; + } render() { const { config } = useBackend(this.context); - const { offsetX, offsetY } = this.state; - const { children, zoom, reset } = this.props; + const { dragging, offsetX, offsetY, zoom = 1 } = this.state; + const { children } = this.props; - let matrix - = `matrix(${zoom}, 0, 0, ${zoom}, ${offsetX * zoom}, ${offsetY * zoom})`; - + const mapUrl = config.map + "_nanomap_z" + config.mapZLevel + ".png"; + // (x * zoom), x Needs to be double the turf- map size. (for virgo, 140x140) + const mapSize = (280 * zoom) + 'px'; const newStyle = { - width: '560px', - height: '560px', + width: mapSize, + height: mapSize, + "margin-top": offsetY + "px", + "margin-left": offsetX + "px", "overflow": "hidden", "position": "relative", - "padding": "0px", - "background-image": - "url("+config.map+"_nanomap_z"+config.mapZLevel+".png)", + "background-image": "url(" + mapUrl + ")", "background-size": "cover", + "background-repeat": "no-repeat", "text-align": "center", - "transform": matrix, + "cursor": dragging ? "move" : "auto", }; return ( @@ -96,6 +127,7 @@ export class NanoMap extends Component { {children} + ); } @@ -105,31 +137,73 @@ const NanoMapMarker = (props, context) => { const { x, y, - zoom, + zoom = 1, icon, tooltip, color, onClick, } = props; - const rx = (x * 4) - 5; - const ry = (y * 4) - 4; + const handleOnClick = e => { + pauseEvent(e); + onClick(e); + }; + + const rx = ((x * 2 * zoom) - zoom) - 3; + const ry = ((y * 2 * zoom) - zoom) - 3; return ( - - - - +
+ + + + +
); }; NanoMap.Marker = NanoMapMarker; + +const NanoMapZoomer = (props, context) => { + const { act, config, data } = useBackend(context); + return ( + + + + v + "x"} + value={props.zoom} + onDrag={(e, v) => props.onZoom(e, v)} + /> + + + {data.map_levels + .sort((a, b) => Number(a) - Number(b)) + .map(level => ( +