From 1ed4f85d629faacf1889a7224e79da343c3747a4 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Tue, 22 Mar 2016 07:04:11 +1100 Subject: [PATCH] Tweaked debug map generator scripts --- common/map/region_pager_base.hpp | 1 - rsc/scripts/door_utility.lua | 8 ++++---- rsc/scripts/map_maker.lua | 15 ++++++++++++--- rsc/scripts/map_saver.lua | 2 ++ rsc/scripts/setup_server.lua | 2 +- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/common/map/region_pager_base.hpp b/common/map/region_pager_base.hpp index d2cc404..a53083d 100644 --- a/common/map/region_pager_base.hpp +++ b/common/map/region_pager_base.hpp @@ -40,7 +40,6 @@ public: virtual bool GetSolid(int x, int y); //region manipulation - __attribute__ ((deprecated)) virtual Region* GetRegion(int x, int y); virtual Region* FindRegion(int x, int y); virtual Region* PushRegion(Region* const); diff --git a/rsc/scripts/door_utility.lua b/rsc/scripts/door_utility.lua index 49f272d..70d23de 100644 --- a/rsc/scripts/door_utility.lua +++ b/rsc/scripts/door_utility.lua @@ -37,7 +37,7 @@ characterAPI = require("character") networkAPI = require("network") -function doorUtility.createTrigger(handle, room, x, y, script) +function doorUtility.CreateTrigger(handle, room, x, y, script) local pager = roomAPI.GetPager(room) --place the indicator tile @@ -53,7 +53,7 @@ function doorUtility.createTrigger(handle, room, x, y, script) ) end -function doorUtility.createDoorPair(handle, roomOne, Xone, Yone, roomTwo, Xtwo, Ytwo) +function doorUtility.CreateDoorPair(handle, roomOne, Xone, Yone, roomTwo, Xtwo, Ytwo) --create the scripts local function scriptOne(entity) if entityAPI.GetType(entity) ~= "character" then return end @@ -82,8 +82,8 @@ function doorUtility.createDoorPair(handle, roomOne, Xone, Yone, roomTwo, Xtwo, end --create the triggers proper - doorUtility.createTrigger(handle, roomOne, Xone, Yone, scriptOne) - doorUtility.createTrigger(handle, roomTwo, Xtwo, Ytwo, scriptTwo) + doorUtility.CreateTrigger(handle, roomOne, Xone, Yone, scriptOne) + doorUtility.CreateTrigger(handle, roomTwo, Xtwo, Ytwo, scriptTwo) end return doorUtility \ No newline at end of file diff --git a/rsc/scripts/map_maker.lua b/rsc/scripts/map_maker.lua index 596570f..383e607 100644 --- a/rsc/scripts/map_maker.lua +++ b/rsc/scripts/map_maker.lua @@ -109,7 +109,7 @@ function mapMaker.DebugIsland(r) end end - --examples of the smoothing function NOT working correctly + --examples of the smoothing function NOT working correctly TODO: fix the smoothing system --[[ for j = 1, regionAPI.GetHeight(r) do regionAPI.SetTile(r, 3, j, 1, mapMaker.dirt) @@ -127,10 +127,19 @@ function mapMaker.DebugGrassland(r) --debug io.write("map_maker:DebugGrassland(", regionAPI.GetX(r), ", ", regionAPI.GetY(r), ")\n") - --all dirt + --all grass, ring of water for i = 1, regionAPI.GetWidth(r) do for j = 1, regionAPI.GetHeight(r) do - regionAPI.SetTile(r, i, j, 1, mapMaker.grass) + local dist = mapMaker.Dist(0, 0, i + regionAPI.GetX(r) -1, j + regionAPI.GetY(r) -1) + + if dist < 50 then + regionAPI.SetTile(r, i, j, 1, mapMaker.grass) + elseif dist < 55 then + regionAPI.SetTile(r, i, j, 1, mapMaker.water) + regionAPI.SetSolid(r, i, j, true) + else + regionAPI.SetTile(r, i, j, 1, mapMaker.grass) + end end end diff --git a/rsc/scripts/map_saver.lua b/rsc/scripts/map_saver.lua index f2f4ea0..72ca98a 100644 --- a/rsc/scripts/map_saver.lua +++ b/rsc/scripts/map_saver.lua @@ -26,6 +26,8 @@ local region = require("region") local mapSaver = {} +--TODO: save and load trigger, creatures + function mapSaver.Load(r) --empty -- io.write("map_saver:Load(", region.GetX(r), ", ", region.GetY(r), ")\n") diff --git a/rsc/scripts/setup_server.lua b/rsc/scripts/setup_server.lua index 4cb4972..ea1bb94 100644 --- a/rsc/scripts/setup_server.lua +++ b/rsc/scripts/setup_server.lua @@ -58,4 +58,4 @@ local underworld, uidTwo = roomManagerAPI.CreateRoom("underworld", "overworld.bm roomAPI.Initialize(underworld, mapSaver.Load, mapSaver.Save, mapMaker.DebugGrassland, mapSaver.Save) --call the monstrosity -doorUtility.createDoorPair("pair 1", overworld, -64, -64, underworld, 64, 64) +doorUtility.CreateDoorPair("pair 1", overworld, -64, -64, underworld, 64, 64)