Tweaked debug map generator scripts

This commit is contained in:
2016-03-22 07:04:11 +11:00
parent 12f86f22de
commit 1ed4f85d62
5 changed files with 19 additions and 9 deletions
-1
View File
@@ -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);
+4 -4
View File
@@ -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
+11 -2
View File
@@ -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
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
+2
View File
@@ -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")
+1 -1
View File
@@ -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)