mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-20 15:21:29 +00:00
GitHub action for NanoMap generation
Number 1 Number 2 Number 3 God I wish there was a decent way to test these AAAAAAAAA Begin the null diffs Oh ffs wrong branch chmod Forgot to mod the renderer itself Number 23452354235 It just keeps going I think this might be it Lets try that again aaaaaaaaaa *scream *sigh Dont tell me that a newline broke it ... aaaaaaaaaaaaa *scream This worked THATS WHAT KILLED IT?!?!?!?!?!?!?!? ... I THINK ITS READY Ok final commit Line endings are the bane of my existence This has really made me feel stupid CRLF AAAAAAAAAA Changes DM side
This commit is contained in:
35
.github/workflows/render_nanomaps.yml
vendored
Normal file
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/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 }}
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 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>
|
||||
@@ -5,8 +5,8 @@ Used In File(s): \code\game\machinery\computer\crew.dm
|
||||
{{: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 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 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>
|
||||
@@ -2127,7 +2127,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"
|
||||
|
||||
6
tools/github-actions/README.MD
Normal file
6
tools/github-actions/README.MD
Normal file
@@ -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
|
||||
BIN
tools/github-actions/nanomap-renderer
Executable file
BIN
tools/github-actions/nanomap-renderer
Executable file
Binary file not shown.
14
tools/github-actions/nanomap-renderer-invoker.sh
Executable file
14
tools/github-actions/nanomap-renderer-invoker.sh
Executable file
@@ -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