diff --git a/.github/workflows/render_nanomaps.yml b/.github/workflows/render_nanomaps.yml new file mode 100644 index 00000000000..32bde6d350a --- /dev/null +++ b/.github/workflows/render_nanomaps.yml @@ -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 }} diff --git a/README.md b/README.md index 943397b0fa8..2c0ababbe30 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/paradisess13/paradise.svg)](http://isitmaintained.com/project/paradisess13/paradise "Average time to resolve an issue") [![Percentage of issues still open](http://isitmaintained.com/badge/open/paradisess13/paradise.svg)](http://isitmaintained.com/project/paradisess13/paradise "Percentage of issues still open") [![Krihelimeter](http://www.krihelinator.xyz/badge/paradisess13/paradise)](http://www.krihelinator.xyz) +![Render Nanomaps](https://github.com/ParadiseSS13/Paradise/workflows/Render%20Nanomaps/badge.svg) [![forthebadge](http://forthebadge.com/images/badges/60-percent-of-the-time-works-every-time.svg)](http://forthebadge.com) [![forthebadge](http://forthebadge.com/images/badges/contains-technical-debt.svg)](http://forthebadge.com) diff --git a/code/modules/admin/verbs/toggledebugverbs.dm b/code/modules/admin/verbs/toggledebugverbs.dm index 328b5176e9a..38b49869298 100644 --- a/code/modules/admin/verbs/toggledebugverbs.dm +++ b/code/modules/admin/verbs/toggledebugverbs.dm @@ -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 diff --git a/code/modules/nano/nanomapgen.dm b/code/modules/nano/nanomapgen.dm deleted file mode 100644 index b0a8869191f..00000000000 --- a/code/modules/nano/nanomapgen.dm +++ /dev/null @@ -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: ERROR: currentZ ([currentZ]) must be between 1 and [world.maxz]") - - sleep(3) - return NANOMAP_TERMINALERR - - if(startX > endX) - to_chat(usr, "NanoMapGen: ERROR: startX ([startX]) cannot be greater than endX ([endX])") - - sleep(3) - return NANOMAP_TERMINALERR - - if(startY > endX) - to_chat(usr, "NanoMapGen: ERROR: startY ([startY]) cannot be greater than endY ([endY])") - 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: ERROR: BASE IMAGE DIMENSIONS ARE NOT [NANOMAP_MAX_ICON_DIMENSION]x[NANOMAP_MAX_ICON_DIMENSION]") - sleep(3) - return NANOMAP_TERMINALERR - - log_world("NanoMapGen: GENERATE MAP ([startX],[startY],[currentZ]) to ([endX],[endY],[currentZ])") - to_chat(usr, "NanoMapGen: GENERATE MAP ([startX],[startY],[currentZ]) to ([endX],[endY],[currentZ])") - - 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: [count] tiles done") - sleep(1) - - var/mapFilename = "nanomap_z[currentZ]-new.png" - - log_world("NanoMapGen: sending [mapFilename] to client") - - usr << browse(Tile, "window=picture;file=[mapFilename];display=0") - - log_world("NanoMapGen: Done.") - - to_chat(usr, "NanoMapGen: Done. File [mapFilename] uploaded to your cache.") - - if(Tile.Width() != NANOMAP_MAX_ICON_DIMENSION || Tile.Height() != NANOMAP_MAX_ICON_DIMENSION) - return NANOMAP_BADOUTPUT - - return NANOMAP_SUCCESS diff --git a/nano/layouts/layout_default.tmpl b/nano/layouts/layout_default.tmpl index 2c0953fc0a9..d3a86461a76 100644 --- a/nano/layouts/layout_default.tmpl +++ b/nano/layouts/layout_default.tmpl @@ -21,10 +21,10 @@ {{:helper.link('Hide Map', 'close', {'showMap' : 0})}}
Zoom Level:  - - - - + + + +
@@ -44,4 +44,4 @@
Initiating...
-
\ No newline at end of file + diff --git a/nano/layouts/layout_program.tmpl b/nano/layouts/layout_program.tmpl index eb0ac27c8bf..4d1dc615fc9 100644 --- a/nano/layouts/layout_program.tmpl +++ b/nano/layouts/layout_program.tmpl @@ -58,10 +58,10 @@ {{:helper.link('Hide Map', 'close', {'showMap' : 0})}}
Zoom Level:  - - - - + + + +
@@ -82,4 +82,4 @@
Initiating...
-
\ No newline at end of file + diff --git a/nano/templates/atmos_control_map_header.tmpl b/nano/templates/atmos_control_map_header.tmpl index 9a741a249e5..c64fce951f7 100644 --- a/nano/templates/atmos_control_map_header.tmpl +++ b/nano/templates/atmos_control_map_header.tmpl @@ -1,8 +1,8 @@ {{:helper.link('Show Detail List', 'file-text', {'showMap' : 0})}}
Zoom Level:  - - - - -
\ No newline at end of file + + + + + diff --git a/nano/templates/sec_camera_map_header.tmpl b/nano/templates/sec_camera_map_header.tmpl index 8052673efe1..ebe90da3015 100644 --- a/nano/templates/sec_camera_map_header.tmpl +++ b/nano/templates/sec_camera_map_header.tmpl @@ -16,8 +16,8 @@ Used In File(s): \code\game\machinery\computer\camera.dm
Zoom Level:  - - - - -
\ No newline at end of file + + + + + diff --git a/paradise.dme b/paradise.dme index 618fbf56599..5d4c43ea3de 100644 --- a/paradise.dme +++ b/paradise.dme @@ -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" diff --git a/tools/github-actions/README.MD b/tools/github-actions/README.MD new file mode 100644 index 00000000000..342dcbf3585 --- /dev/null +++ b/tools/github-actions/README.MD @@ -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 diff --git a/tools/github-actions/nanomap-renderer b/tools/github-actions/nanomap-renderer new file mode 100755 index 00000000000..69fa906c94e Binary files /dev/null and b/tools/github-actions/nanomap-renderer differ diff --git a/tools/github-actions/nanomap-renderer-invoker.sh b/tools/github-actions/nanomap-renderer-invoker.sh new file mode 100755 index 00000000000..b6fadfac5f1 --- /dev/null +++ b/tools/github-actions/nanomap-renderer-invoker.sh @@ -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"