Merge pull request #9103 from ShadowLarkens/nanomaps_github_action
Nanomaps GitHub action & TGUI Improvements
35
.github/workflows/render_nanomaps.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
# GitHub action to autorender nanomaps outside the game
|
||||
# This kills off the awful verb we have that takes a full 50 seconds and hangs the whole server
|
||||
# The file names and locations are VERY important here
|
||||
# DO NOT EDIT THIS UNLESS YOU KNOW WHAT YOU ARE DOING
|
||||
# -aa
|
||||
name: 'Render Nanomaps'
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
paths:
|
||||
- 'maps/**'
|
||||
|
||||
jobs:
|
||||
generate_maps:
|
||||
name: 'Generate NanoMaps'
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: 'Update Branch'
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: 'Generate Maps'
|
||||
run: './tools/github-actions/nanomap-renderer-invoker.sh'
|
||||
|
||||
- name: 'Commit Maps'
|
||||
run: |
|
||||
git config --local user.email "action@github.com"
|
||||
git config --local user.name "NanoMap Generation"
|
||||
git pull origin master
|
||||
git commit -m "NanoMap Auto-Update (`date`)" -a || true
|
||||
- name: 'Push Maps'
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -8,6 +8,8 @@ Going to make a Pull Request? Make sure you read the [CONTRIBUTING.md](.github/C
|
||||
|
||||
VOREStation is a fork of the Polaris code branch, itself a fork of the Baystation12 code branch, for the game Space Station 13.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
### LICENSE
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -181,7 +181,6 @@ var/list/admin_verbs_server = list(
|
||||
/datum/admins/proc/toggle_space_ninja,
|
||||
/client/proc/toggle_random_events,
|
||||
/client/proc/check_customitem_activity,
|
||||
/client/proc/nanomapgen_DumpImage,
|
||||
/client/proc/modify_server_news,
|
||||
/client/proc/recipe_dump,
|
||||
/client/proc/panicbunker,
|
||||
|
||||
@@ -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
|
||||
)
|
||||
@@ -1,92 +0,0 @@
|
||||
// This file is a modified version of https://raw2.github.com/Baystation12/OldCode-BS12/master/code/TakePicture.dm
|
||||
|
||||
#define NANOMAP_ICON_SIZE 4
|
||||
#define NANOMAP_MAX_ICON_DIMENSION 1200
|
||||
|
||||
#define NANOMAP_TILES_PER_IMAGE (NANOMAP_MAX_ICON_DIMENSION / NANOMAP_ICON_SIZE)
|
||||
|
||||
#define NANOMAP_TERMINALERR 5
|
||||
#define NANOMAP_INPROGRESS 2
|
||||
#define NANOMAP_BADOUTPUT 2
|
||||
#define NANOMAP_SUCCESS 1
|
||||
#define NANOMAP_WATCHDOGSUCCESS 4
|
||||
#define NANOMAP_WATCHDOGTERMINATE 3
|
||||
|
||||
|
||||
//Call these procs to dump your world to a series of image files (!!)
|
||||
//NOTE: Does not explicitly support non 32x32 icons or stuff with large pixel_* values, so don't blame me if it doesn't work perfectly
|
||||
|
||||
/client/proc/nanomapgen_DumpImage()
|
||||
set name = "Generate NanoUI Map"
|
||||
set category = "Server"
|
||||
|
||||
if(holder)
|
||||
nanomapgen_DumpTile(1, 1, text2num(input(usr,"Enter the Z level to generate")))
|
||||
|
||||
/client/proc/nanomapgen_DumpTile(var/startX = 1, var/startY = 1, var/currentZ = 1, var/endX = -1, var/endY = -1)
|
||||
|
||||
if (endX < 0 || endX > world.maxx)
|
||||
endX = world.maxx
|
||||
|
||||
if (endY < 0 || endY > world.maxy)
|
||||
endY = world.maxy
|
||||
|
||||
if (currentZ < 0 || currentZ > world.maxz)
|
||||
to_chat(usr, "NanoMapGen: <B>ERROR: currentZ ([currentZ]) must be between 1 and [world.maxz]</B>")
|
||||
|
||||
sleep(3)
|
||||
return NANOMAP_TERMINALERR
|
||||
|
||||
if (startX > endX)
|
||||
to_chat(usr, "NanoMapGen: <B>ERROR: startX ([startX]) cannot be greater than endX ([endX])</B>")
|
||||
|
||||
sleep(3)
|
||||
return NANOMAP_TERMINALERR
|
||||
|
||||
if (startY > endX)
|
||||
to_chat(usr, "NanoMapGen: <B>ERROR: startY ([startY]) cannot be greater than endY ([endY])</B>")
|
||||
sleep(3)
|
||||
return NANOMAP_TERMINALERR
|
||||
|
||||
var/icon/Tile = icon('icons/_nanomaps/mapbase1200.png')
|
||||
if (Tile.Width() != NANOMAP_MAX_ICON_DIMENSION || Tile.Height() != NANOMAP_MAX_ICON_DIMENSION)
|
||||
to_world_log("NanoMapGen: <B>ERROR: BASE IMAGE DIMENSIONS ARE NOT [NANOMAP_MAX_ICON_DIMENSION]x[NANOMAP_MAX_ICON_DIMENSION]</B>")
|
||||
sleep(3)
|
||||
return NANOMAP_TERMINALERR
|
||||
|
||||
Tile.Scale((endX - startX + 1) * NANOMAP_ICON_SIZE, (endY - startY + 1) * NANOMAP_ICON_SIZE) // VOREStation Edit - Scale image to actual size mapped.
|
||||
|
||||
to_world_log("NanoMapGen: <B>GENERATE MAP ([startX],[startY],[currentZ]) to ([endX],[endY],[currentZ])</B>")
|
||||
to_chat(usr, "NanoMapGen: <B>GENERATE MAP ([startX],[startY],[currentZ]) to ([endX],[endY],[currentZ])</B>")
|
||||
|
||||
var/count = 0;
|
||||
for(var/WorldX = startX, WorldX <= endX, WorldX++)
|
||||
for(var/WorldY = startY, WorldY <= endY, WorldY++)
|
||||
|
||||
var/atom/Turf = locate(WorldX, WorldY, currentZ)
|
||||
|
||||
var/icon/TurfIcon = new(Turf.icon, Turf.icon_state)
|
||||
TurfIcon.Scale(NANOMAP_ICON_SIZE, NANOMAP_ICON_SIZE)
|
||||
|
||||
Tile.Blend(TurfIcon, ICON_OVERLAY, ((WorldX - 1) * NANOMAP_ICON_SIZE), ((WorldY - 1) * NANOMAP_ICON_SIZE))
|
||||
|
||||
count++
|
||||
|
||||
if (count % 8000 == 0)
|
||||
to_world_log("NanoMapGen: <B>[count] tiles done</B>")
|
||||
sleep(1)
|
||||
|
||||
var/mapFilename = "nanomap_z[currentZ]-new.png"
|
||||
|
||||
to_world_log("NanoMapGen: <B>sending [mapFilename] to client</B>")
|
||||
|
||||
usr << browse(Tile, "window=picture;file=[mapFilename];display=0")
|
||||
|
||||
to_world_log("NanoMapGen: <B>Done.</B>")
|
||||
|
||||
to_chat(usr, "NanoMapGen: <B>Done. File [mapFilename] uploaded to your cache.</B>")
|
||||
|
||||
if (Tile.Width() != NANOMAP_MAX_ICON_DIMENSION || Tile.Height() != NANOMAP_MAX_ICON_DIMENSION)
|
||||
return NANOMAP_BADOUTPUT
|
||||
|
||||
return NANOMAP_SUCCESS
|
||||
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 776 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 650 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 615 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 262 KiB |
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 372 KiB |
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 365 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 431 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 408 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 576 KiB |
@@ -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}
|
||||
</Box>
|
||||
</Box>
|
||||
<NanoMapZoomer zoom={zoom} onZoom={this.handleZoom} />
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -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 (
|
||||
<Box
|
||||
position="absolute"
|
||||
className="NanoMap__marker"
|
||||
lineHeight="0"
|
||||
bottom={ry + 'px'}
|
||||
left={rx + 'px'}
|
||||
onMouseDown={onClick} >
|
||||
<Icon
|
||||
name={icon}
|
||||
color={color}
|
||||
fontSize="4px"
|
||||
/>
|
||||
<Tooltip content={tooltip} scale={zoom} />
|
||||
</Box>
|
||||
<div>
|
||||
<Box
|
||||
position="absolute"
|
||||
className="NanoMap__marker"
|
||||
lineHeight="0"
|
||||
bottom={ry + "px"}
|
||||
left={rx + "px"}
|
||||
onMouseDown={handleOnClick}>
|
||||
<Icon
|
||||
name={icon}
|
||||
color={color}
|
||||
fontSize="6px"
|
||||
/>
|
||||
<Tooltip content={tooltip} />
|
||||
</Box>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
NanoMap.Marker = NanoMapMarker;
|
||||
|
||||
const NanoMapZoomer = (props, context) => {
|
||||
const { act, config, data } = useBackend(context);
|
||||
return (
|
||||
<Box className="NanoMap__zoomer">
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Zoom">
|
||||
<Slider
|
||||
minValue="1"
|
||||
maxValue="8"
|
||||
stepPixelSize="10"
|
||||
format={v => v + "x"}
|
||||
value={props.zoom}
|
||||
onDrag={(e, v) => props.onZoom(e, v)}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Z-Level">
|
||||
{data.map_levels
|
||||
.sort((a, b) => Number(a) - Number(b))
|
||||
.map(level => (
|
||||
<Button
|
||||
key={level}
|
||||
selected={~~level === ~~config.mapZLevel}
|
||||
content={level}
|
||||
onClick={() => {
|
||||
act("setZLevel", { "mapZLevel": level });
|
||||
}} />
|
||||
))}
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
NanoMap.Zoomer = NanoMapZoomer;
|
||||
|
||||
@@ -29,7 +29,7 @@ export const AtmosControlContent = (props, context) => {
|
||||
// sortedAlarms = sortedAlarms.slice(1, 3);
|
||||
|
||||
const [tabIndex, setTabIndex] = useLocalState(context, 'tabIndex', 0);
|
||||
const [mapZoom, setZoom] = useLocalState(context, 'mapZoom', 1);
|
||||
const [zoom, setZoom] = useLocalState(context, 'zoom', 1);
|
||||
|
||||
let body;
|
||||
// Alarms View
|
||||
@@ -54,30 +54,8 @@ export const AtmosControlContent = (props, context) => {
|
||||
// you MUST update styles/components/Tooltip.scss
|
||||
// and change the @for scss to match.
|
||||
body = (
|
||||
<Box textAlign="center">
|
||||
Zoom Level:
|
||||
<NumberInput
|
||||
animated
|
||||
width="40px"
|
||||
step={0.5}
|
||||
stepPixelSize="5"
|
||||
value={mapZoom}
|
||||
minValue={1}
|
||||
maxValue={8}
|
||||
onChange={(e, value) => setZoom(value)} />
|
||||
Z-Level:
|
||||
{data.map_levels
|
||||
.sort((a, b) => Number(a) - Number(b))
|
||||
.map(level => (
|
||||
<Button
|
||||
key={level}
|
||||
selected={~~level === ~~config.mapZLevel}
|
||||
content={level}
|
||||
onClick={() => {
|
||||
act("setZLevel", { "mapZLevel": level });
|
||||
}} />
|
||||
))}
|
||||
<NanoMap zoom={mapZoom}>
|
||||
<Box height="526px" mb="0.5rem" overflow="hidden">
|
||||
<NanoMap onZoom={v => setZoom(v)}>
|
||||
{sortedAlarms
|
||||
.filter(x =>
|
||||
(~~x.z === ~~config.mapZLevel)
|
||||
@@ -86,7 +64,7 @@ export const AtmosControlContent = (props, context) => {
|
||||
key={cm.ref}
|
||||
x={cm.x}
|
||||
y={cm.y}
|
||||
zoom={mapZoom}
|
||||
zoom={zoom}
|
||||
icon="bell"
|
||||
tooltip={cm.name}
|
||||
color={cm.danger ? 'red' : 'green'}
|
||||
|
||||
@@ -3,9 +3,28 @@ import { flow } from 'common/fp';
|
||||
import { useBackend, useLocalState } from "../backend";
|
||||
import { Window } from "../layouts";
|
||||
import { NanoMap, Box, Table, Button, Tabs, Icon, NumberInput } from "../components";
|
||||
import { TableCell } from '../components/Table';
|
||||
import { Fragment } from 'inferno';
|
||||
|
||||
const getStatText = cm => {
|
||||
if (cm.dead) {
|
||||
return "Deceased";
|
||||
}
|
||||
if (parseInt(cm.stat, 10) === 1) { // Unconscious
|
||||
return "Unconscious";
|
||||
}
|
||||
return "Living";
|
||||
};
|
||||
|
||||
const getStatColor = cm => {
|
||||
if (cm.dead) {
|
||||
return "red";
|
||||
}
|
||||
if (parseInt(cm.stat, 10) === 1) { // Unconscious
|
||||
return "orange";
|
||||
}
|
||||
return "green";
|
||||
};
|
||||
|
||||
export const CrewMonitor = () => {
|
||||
return (
|
||||
<Window
|
||||
@@ -30,10 +49,8 @@ export const CrewMonitorContent = (props, context) => {
|
||||
sortBy(cm => cm?.realZ),
|
||||
])(data.crewmembers || []);
|
||||
|
||||
const [
|
||||
mapZoom,
|
||||
setZoom,
|
||||
] = useLocalState(context, 'number', 1);
|
||||
const [zoom, setZoom] = useLocalState(context, 'zoom', 1);
|
||||
|
||||
let body;
|
||||
// Data view
|
||||
if (tabIndex === 0) {
|
||||
@@ -52,13 +69,13 @@ export const CrewMonitorContent = (props, context) => {
|
||||
</Table.Row>
|
||||
{crew.map(cm => (
|
||||
<Table.Row key={cm.ref}>
|
||||
<TableCell>
|
||||
<Table.Cell>
|
||||
{cm.name} ({cm.assignment})
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<Box inline
|
||||
color={cm.dead ? 'red' : 'green'}>
|
||||
{cm.dead ? 'Deceased' : 'Living'}
|
||||
color={getStatColor(cm)}>
|
||||
{getStatText(cm)}
|
||||
</Box>
|
||||
{cm.sensor_type >= 2 ? (
|
||||
<Box inline>
|
||||
@@ -85,8 +102,8 @@ export const CrewMonitorContent = (props, context) => {
|
||||
{')'}
|
||||
</Box>
|
||||
) : null}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
{cm.sensor_type === 3 ? (
|
||||
data.isAI ? (
|
||||
<Button fluid
|
||||
@@ -101,7 +118,7 @@ export const CrewMonitorContent = (props, context) => {
|
||||
cm.area+" ("+cm.x+", "+cm.y+", "+cm.z+")"
|
||||
)
|
||||
) : "Not Available"}
|
||||
</TableCell>
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
))}
|
||||
</Table>
|
||||
@@ -110,48 +127,7 @@ export const CrewMonitorContent = (props, context) => {
|
||||
// Please note, if you ever change the zoom values,
|
||||
// you MUST update styles/components/Tooltip.scss
|
||||
// and change the @for scss to match.
|
||||
body = (
|
||||
<Box textAlign="center">
|
||||
Zoom Level:
|
||||
<NumberInput
|
||||
animated
|
||||
width="40px"
|
||||
step={0.5}
|
||||
stepPixelSize="5"
|
||||
value={mapZoom}
|
||||
minValue={1}
|
||||
maxValue={8}
|
||||
onChange={(e, value) => setZoom(value)} />
|
||||
Z-Level:
|
||||
{data.map_levels
|
||||
.sort((a, b) => Number(a) - Number(b))
|
||||
.map(level => (
|
||||
<Button
|
||||
key={level}
|
||||
selected={~~level === ~~config.mapZLevel}
|
||||
content={level}
|
||||
onClick={() => {
|
||||
act("setZLevel", { "mapZLevel": level });
|
||||
}} />
|
||||
))}
|
||||
<NanoMap zoom={mapZoom}>
|
||||
{crew
|
||||
.filter(x =>
|
||||
(x.sensor_type === 3 && ~~x.realZ === ~~config.mapZLevel)
|
||||
).map(cm => (
|
||||
<NanoMap.Marker
|
||||
key={cm.ref}
|
||||
x={cm.x}
|
||||
y={cm.y}
|
||||
zoom={mapZoom}
|
||||
icon="circle"
|
||||
tooltip={cm.name}
|
||||
color={cm.dead ? 'red' : 'green'}
|
||||
/>
|
||||
))}
|
||||
</NanoMap>
|
||||
</Box>
|
||||
);
|
||||
body = <CrewMonitorMapView />;
|
||||
} else {
|
||||
body = "ERROR";
|
||||
}
|
||||
@@ -178,3 +154,27 @@ export const CrewMonitorContent = (props, context) => {
|
||||
</Fragment>
|
||||
);
|
||||
};
|
||||
|
||||
const CrewMonitorMapView = (props, context) => {
|
||||
const { act, config, data } = useBackend(context);
|
||||
const [zoom, setZoom] = useLocalState(context, 'zoom', 1);
|
||||
return (
|
||||
<Box height="526px" mb="0.5rem" overflow="hidden">
|
||||
<NanoMap onZoom={v => setZoom(v)}>
|
||||
{data.crewmembers.filter(x =>
|
||||
(x.sensor_type === 3 && ~~x.realZ === ~~config.mapZLevel)
|
||||
).map(cm => (
|
||||
<NanoMap.Marker
|
||||
key={cm.ref}
|
||||
x={cm.x}
|
||||
y={cm.y}
|
||||
zoom={zoom}
|
||||
icon="circle"
|
||||
tooltip={cm.name + " (" + cm.assignment + ")"}
|
||||
color={getStatColor(cm)}
|
||||
/>
|
||||
))}
|
||||
</NanoMap>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
$color-background: rgba(0, 0, 0, 0.33) !default;
|
||||
|
||||
.NanoMap__container {
|
||||
overflow: hidden;
|
||||
overflow: hiddden;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
@@ -10,3 +11,13 @@
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.NanoMap__zoomer {
|
||||
z-index: 20;
|
||||
background-color: $color-background;
|
||||
position: absolute;
|
||||
top: 30px;
|
||||
left: 0;
|
||||
padding: 0.5rem;
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
7
tools/github-actions/README.MD
Normal file
@@ -0,0 +1,7 @@
|
||||
# GitHub Actions Scripts
|
||||
|
||||
This folder contains all the script and tools required for GitHub actions. If you add something to this directory, **PLEASE** document it in here
|
||||
|
||||
- `nanomap-renderer` - A linux application to render NanoMap images of the ingame maps automatically. Based off of SpacemanDMM (Modified source [here](https://github.com/AffectedArc07/ParaSpacemanDMM), original source [here](https://github.com/Spacemaniac/SpacemanDMM))
|
||||
- `nanomap-renderer-invoker.sh` - A script which invokes the render tool and clones the maps to the correct directory
|
||||
- `doc-generator` - A linux application to generate documentation of game code automatically. Based off of SpacemanDMM (Modified source [here](https://github.com/AffectedArc07/ParaSpacemanDMM), original source [here](https://github.com/Spacemaniac/SpacemanDMM))
|
||||
BIN
tools/github-actions/nanomap-renderer
Normal file
35
tools/github-actions/nanomap-renderer-invoker.sh
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
# Generate maps
|
||||
map_files=(
|
||||
"./maps/tether/tether-01-surface1.dmm"
|
||||
"./maps/tether/tether-02-surface2.dmm"
|
||||
"./maps/tether/tether-03-surface3.dmm"
|
||||
"./maps/tether/tether-04-transit.dmm"
|
||||
"./maps/tether/tether-05-station1.dmm"
|
||||
"./maps/tether/tether-06-station2.dmm"
|
||||
"./maps/tether/tether-07-station3.dmm"
|
||||
"./maps/tether/tether-08-mining.dmm"
|
||||
"./maps/tether/tether-09-solars.dmm"
|
||||
"./maps/offmap_vr/talon/talon1.dmm"
|
||||
"./maps/offmap_vr/talon/talon2.dmm"
|
||||
)
|
||||
|
||||
tools/github-actions/nanomap-renderer minimap -w 2240 -h 2240 "${map_files[@]}"
|
||||
|
||||
# Move and rename files so the game understands them
|
||||
cd "data/nanomaps"
|
||||
|
||||
mv "talon1_nanomap_z1.png" "tether_nanomap_z13.png"
|
||||
mv "talon2_nanomap_z1.png" "tether_nanomap_z14.png"
|
||||
mv "tether-01-surface1_nanomap_z1.png" "tether_nanomap_z1.png"
|
||||
mv "tether-02-surface2_nanomap_z1.png" "tether_nanomap_z2.png"
|
||||
mv "tether-03-surface3_nanomap_z1.png" "tether_nanomap_z3.png"
|
||||
mv "tether-04-transit_nanomap_z1.png" "tether_nanomap_z4.png"
|
||||
mv "tether-05-station1_nanomap_z1.png" "tether_nanomap_z5.png"
|
||||
mv "tether-06-station2_nanomap_z1.png" "tether_nanomap_z6.png"
|
||||
mv "tether-07-station3_nanomap_z1.png" "tether_nanomap_z7.png"
|
||||
mv "tether-08-mining_nanomap_z1.png" "tether_nanomap_z8.png"
|
||||
mv "tether-09-solars_nanomap_z1.png" "tether_nanomap_z9.png"
|
||||
|
||||
cd "../../"
|
||||
cp data/nanomaps/* "icons/_nanomaps/"
|
||||
@@ -3555,7 +3555,6 @@
|
||||
#include "code\modules\tgs\includes.dm"
|
||||
#include "code\modules\tgui\external.dm"
|
||||
#include "code\modules\tgui\modal.dm"
|
||||
#include "code\modules\tgui\nanomapgen.dm"
|
||||
#include "code\modules\tgui\states.dm"
|
||||
#include "code\modules\tgui\tgui.dm"
|
||||
#include "code\modules\tgui\tgui_window.dm"
|
||||
|
||||