1
0
forked from MTSR/mapserver

dev cleanup/reorg

This commit is contained in:
BuckarooBanzay 2021-06-22 19:24:22 +02:00
parent 4ba2a86973
commit 0a7509f755
9 changed files with 126 additions and 65 deletions

7
.gitignore vendored
View File

@ -1,10 +1,3 @@
mapserver
world.mt
output
test-output
map.sqlite
mapserver.tiles
mapserver.sqlite
mapserver.sqlite-journal
mapserver.json
debug.txt

View File

@ -1,47 +0,0 @@
#!/bin/sh
# creates an example/test map.sqlite
MTDIR=/tmp/mt
WORLDDIR=${MTDIR}/worlds/world
WORLDMODDIR=${WORLDDIR}/worldmods
rm -rf ${WORLDDIR}
mkdir -p ${WORLDMODDIR}/mapgen
cat <<EOF > world.mt
gameid = minetest
backend = sqlite3
creative_mode = false
enable_damage = false
player_backend = files
EOF
cat <<EOF > ${WORLDMODDIR}/mapgen/init.lua
local function execute_mapgen(callback)
local pos1 = { x=-100, y=-100, z=-100 }
local pos2 = { x=100, y=100, z=100 }
minetest.emerge_area(pos1, pos2, function(blockpos, _, calls_remaining)
minetest.log("action", "Emerged: " .. minetest.pos_to_string(blockpos))
if calls_remaining > 0 then
return
end
callback()
end)
end
minetest.after(1, function()
execute_mapgen(function()
minetest.request_shutdown("success")
end)
end)
EOF
chmod 777 ${MTDIR} -R
docker run --rm -i \
-v ${CFG}:/etc/minetest/minetest.conf:ro \
-v ${MTDIR}:/var/lib/minetest/.minetest \
registry.gitlab.com/minetest/minetest/server:5.2.0
cp ${WORLDDIR}/map.sqlite .

1
dev/.gitignore vendored
View File

@ -1 +0,0 @@
data

74
dev/mapserver.json Normal file
View File

@ -0,0 +1,74 @@
{
"configversion": 1,
"port": 8080,
"enableprometheus": true,
"enablerendering": true,
"enablesearch": true,
"enableinitialrendering": true,
"enabletransparency": false,
"enablemediarepository": false,
"webdev": false,
"webapi": {
"enablemapblock": false,
"secretkey": "bUpZTaxtjnXbNUbA"
},
"layers": [
{
"id": 0,
"name": "Ground",
"from": -1,
"to": 10
},
{
"id": 1,
"name": "Sky",
"from": 11,
"to": 24
}
],
"renderingfetchlimit": 10000,
"renderingjobs": 8,
"renderingqueue": 100,
"incrementalrenderingtimer": "5s",
"mapobjects": {
"areas": true,
"bones": true,
"protector": true,
"xpprotector": true,
"privprotector": true,
"technic_quarry": true,
"technic_switch": true,
"technic_anchor": true,
"technic_reactor": true,
"luacontroller": true,
"digiterms": true,
"digilines": true,
"travelnet": true,
"mapserver_player": true,
"mapserver_poi": true,
"mapserver_label": true,
"mapserver_trainline": true,
"mapserver_border": true,
"tileserverlegacy": true,
"mission": true,
"jumpdrive": true,
"smartshop": true,
"fancyvend": true,
"atm": true,
"train": true,
"trainsignal": true,
"minecart": false,
"locator": false,
"signs": true
},
"mapblockaccessor": {
"expiretime": "15s",
"purgetime": "30s",
"maxitems": 500
},
"defaultoverlays": [
"mapserver_poi",
"mapserver_label",
"mapserver_player"
]
}

View File

@ -1,3 +1,3 @@
default_privs = fast, home, fly, noclip, privs
secure.http_mods = mapserver
mapserver.url = http://127.0.0.1:8080
mapserver.url = http://mapserver:8080

View File

@ -1,9 +0,0 @@
#!/bin/sh
docker run --rm -it \
-u root:root \
-v $(pwd)/minetest.conf:/etc/minetest/minetest.conf \
-v $(pwd)/worldmods:/root/.minetest/worlds/world/worldmods \
-v $(pwd)/data:/root/.minetest/worlds/world \
--network host \
registry.gitlab.com/minetest/minetest/server:5.2.0

View File

@ -0,0 +1,13 @@
read_globals = {
-- Stdlib
string = {fields = {"split"}},
table = {fields = {"copy", "getn"}},
-- Minetest
"minetest",
"vector", "ItemStack",
"dump",
"mapserver"
}

View File

@ -0,0 +1,7 @@
minetest.after(5, function()
minetest.log("action", "[mapserver_emerge] emerging area")
local pos1 = { x=0, y=-50, z=0 }
local pos2 = { x=50, y=50, z=0 }
minetest.emerge_area(pos1, pos2)
end)

31
docker-compose.yml Normal file
View File

@ -0,0 +1,31 @@
version: "3.6"
services:
mapserver:
image: golang:1.16.0
depends_on:
- minetest
volumes:
- "dev_home:/root"
- "world_data:/data/world"
- ".:/data"
- "./dev/mapserver.json:/data/world/mapserver.json"
ports:
- "8080:8080"
working_dir: /data/world
command: ["go", "run", ".."]
minetest:
image: registry.gitlab.com/minetest/minetest/server:5.4.0
user: root
volumes:
- "world_data:/root/.minetest/worlds/world"
- "./dev/worldmods:/root/.minetest/worlds/world/worldmods"
- "./dev/minetest.conf:/etc/minetest/minetest.conf"
- "./dev/mapserver.json:/root/.minetest/worlds/world/mapserver.json"
ports:
- "30000:30000/udp"
volumes:
world_data: {}
dev_home: {}