mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 15:08:02 +01:00
Merge pull request #13599 from AffectedArc07/nanomaps-github-action
NanoMaps GitHub Action
This commit is contained in:
@@ -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/map_files/**'
|
||||
|
||||
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 }}
|
||||
@@ -3,6 +3,7 @@
|
||||
[](http://isitmaintained.com/project/paradisess13/paradise "Average time to resolve an issue")
|
||||
[](http://isitmaintained.com/project/paradisess13/paradise "Percentage of issues still open")
|
||||
[](http://www.krihelinator.xyz)
|
||||

|
||||
|
||||
[](http://forthebadge.com)
|
||||
[](http://forthebadge.com)
|
||||
|
||||
@@ -17,7 +17,6 @@ GLOBAL_LIST_INIT(admin_verbs_show_debug_verbs, list(
|
||||
/client/proc/print_jobban_old,
|
||||
/client/proc/print_jobban_old_filter,
|
||||
/client/proc/forceEvent,
|
||||
/client/proc/nanomapgen_DumpImage,
|
||||
/client/proc/admin_redo_space_transitions,
|
||||
/client/proc/make_turf_space_map,
|
||||
/client/proc/vv_by_ref
|
||||
|
||||
@@ -1,90 +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 1024
|
||||
|
||||
#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 = "Mapping"
|
||||
|
||||
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(file("nano/mapbase1024.png"))
|
||||
if(Tile.Width() != NANOMAP_MAX_ICON_DIMENSION || Tile.Height() != NANOMAP_MAX_ICON_DIMENSION)
|
||||
log_world("NanoMapGen: <B>ERROR: BASE IMAGE DIMENSIONS ARE NOT [NANOMAP_MAX_ICON_DIMENSION]x[NANOMAP_MAX_ICON_DIMENSION]</B>")
|
||||
sleep(3)
|
||||
return NANOMAP_TERMINALERR
|
||||
|
||||
log_world("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)
|
||||
log_world("NanoMapGen: <B>[count] tiles done</B>")
|
||||
sleep(1)
|
||||
|
||||
var/mapFilename = "nanomap_z[currentZ]-new.png"
|
||||
|
||||
log_world("NanoMapGen: <B>sending [mapFilename] to client</B>")
|
||||
|
||||
usr << browse(Tile, "window=picture;file=[mapFilename];display=0")
|
||||
|
||||
log_world("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
|
||||
@@ -21,10 +21,10 @@
|
||||
{{:helper.link('Hide Map', 'close', {'showMap' : 0})}}
|
||||
<div style="float: right; width: 240px;">
|
||||
<span style="float: left;">Zoom Level: </span>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="4">x1.0</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="6">x1.5</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="8">x2.0</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="12">x2.5</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="2">x1</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="4">x2</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="8">x4</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="16">x8</div>
|
||||
</div>
|
||||
<!-- Add a template with the key "mapHeader" to have it rendered here -->
|
||||
</div>
|
||||
@@ -44,4 +44,4 @@
|
||||
</div>
|
||||
<div id='uiContent' unselectable="on">
|
||||
<div id='uiLoadingNotice'>Initiating...</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -58,10 +58,10 @@
|
||||
{{:helper.link('Hide Map', 'close', {'showMap' : 0})}}
|
||||
<div style="float: right; width: 240px;">
|
||||
<span style="float: left;">Zoom Level: </span>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="4">x1.0</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="6">x1.5</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="8">x2.0</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="12">x2.5</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="2">x1</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="4">x2</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="8">x4</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="16">x8</div>
|
||||
</div>
|
||||
<!-- Add a template with the key "mapHeader" to have it rendered here -->
|
||||
</div>
|
||||
@@ -82,4 +82,4 @@
|
||||
|
||||
<div class="clearBoth" id='uiContent' unselectable="on">
|
||||
<div id='uiLoadingNotice'>Initiating...</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{{:helper.link('Show Detail List', 'file-text', {'showMap' : 0})}}
|
||||
<div style="float: right; width: 240px;">
|
||||
<span style="float: left;">Zoom Level: </span>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="4">x1.0</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="6">x1.5</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="8">x2.0</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="12">x2.5</div>
|
||||
</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="2">x1</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="4">x2</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="8">x4</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="16">x8</div>
|
||||
</div>
|
||||
|
||||
@@ -16,8 +16,8 @@ Used In File(s): \code\game\machinery\computer\camera.dm
|
||||
</div>
|
||||
<div style="float: right; width: 240px;">
|
||||
<span style="float: left;">Zoom Level: </span>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="4">x1.0</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="6">x1.5</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="8">x2.0</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="12">x2.5</div>
|
||||
</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="2">x1</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="4">x2</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="8">x4</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="16">x8</div>
|
||||
</div>
|
||||
|
||||
@@ -2116,7 +2116,6 @@
|
||||
#include "code\modules\modular_computers\NTNet\NTNet_relay.dm"
|
||||
#include "code\modules\modular_computers\NTNet\NTNRC\conversation.dm"
|
||||
#include "code\modules\nano\nanoexternal.dm"
|
||||
#include "code\modules\nano\nanomapgen.dm"
|
||||
#include "code\modules\nano\nanoui.dm"
|
||||
#include "code\modules\nano\subsystem.dm"
|
||||
#include "code\modules\nano\interaction\admin.dm"
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# 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
|
||||
- `nanomap-renderer-invoker.sh` - A script which invokes the render tool and clones the maps to the correct directory
|
||||
Executable
BIN
Binary file not shown.
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
# Generate maps
|
||||
tools/github-actions/nanomap-renderer minimap "./_maps/map_files/cyberiad/cyberiad.dmm"
|
||||
tools/github-actions/nanomap-renderer minimap "./_maps/map_files/Delta/delta.dmm"
|
||||
tools/github-actions/nanomap-renderer minimap "./_maps/map_files/MetaStation/MetaStation.v41A.II.dmm"
|
||||
# Move and rename files so the game understands them
|
||||
cd "data/nanomaps"
|
||||
mv "cyberiad_nanomap_z1.png" "Cyberiad_nanomap_z1.png"
|
||||
mv "delta_nanomap_z1.png" "Delta_nanomap_z1.png"
|
||||
mv "MetaStation.v41A.II_nanomap_z1.png" "MetaStation_nanomap_z1.png"
|
||||
cd "../../"
|
||||
cp "data/nanomaps/Cyberiad_nanomap_z1.png" "nano/images"
|
||||
cp "data/nanomaps/Delta_nanomap_z1.png" "nano/images"
|
||||
cp "data/nanomaps/MetaStation_nanomap_z1.png" "nano/images"
|
||||
Reference in New Issue
Block a user