diff --git a/.gitignore b/.gitignore index 49dd053..991efe0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,3 @@ mapserver -world.mt output test-output -map.sqlite -mapserver.tiles -mapserver.sqlite -mapserver.sqlite-journal -mapserver.json -debug.txt diff --git a/create_map.sh b/create_map.sh deleted file mode 100755 index 2d81381..0000000 --- a/create_map.sh +++ /dev/null @@ -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 < world.mt -gameid = minetest -backend = sqlite3 -creative_mode = false -enable_damage = false -player_backend = files -EOF - -cat < ${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 . diff --git a/dev/.gitignore b/dev/.gitignore deleted file mode 100644 index 1269488..0000000 --- a/dev/.gitignore +++ /dev/null @@ -1 +0,0 @@ -data diff --git a/dev/mapserver.json b/dev/mapserver.json new file mode 100644 index 0000000..c920d60 --- /dev/null +++ b/dev/mapserver.json @@ -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" + ] +} \ No newline at end of file diff --git a/dev/minetest.conf b/dev/minetest.conf index d8a2bf4..f07838f 100644 --- a/dev/minetest.conf +++ b/dev/minetest.conf @@ -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 diff --git a/dev/start_minetest.sh b/dev/start_minetest.sh deleted file mode 100755 index 289a2a6..0000000 --- a/dev/start_minetest.sh +++ /dev/null @@ -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 diff --git a/dev/worldmods/mapserver_emerge/.luacheckrc b/dev/worldmods/mapserver_emerge/.luacheckrc new file mode 100644 index 0000000..5ef37d5 --- /dev/null +++ b/dev/worldmods/mapserver_emerge/.luacheckrc @@ -0,0 +1,13 @@ + +read_globals = { + -- Stdlib + string = {fields = {"split"}}, + table = {fields = {"copy", "getn"}}, + + -- Minetest + "minetest", + "vector", "ItemStack", + "dump", + + "mapserver" +} diff --git a/dev/worldmods/mapserver_emerge/init.lua b/dev/worldmods/mapserver_emerge/init.lua new file mode 100644 index 0000000..d1cbdae --- /dev/null +++ b/dev/worldmods/mapserver_emerge/init.lua @@ -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) \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8d5e9a2 --- /dev/null +++ b/docker-compose.yml @@ -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: {} \ No newline at end of file