Tweaked debug map generator scripts
This commit is contained in:
@@ -40,7 +40,6 @@ public:
|
|||||||
virtual bool GetSolid(int x, int y);
|
virtual bool GetSolid(int x, int y);
|
||||||
|
|
||||||
//region manipulation
|
//region manipulation
|
||||||
__attribute__ ((deprecated))
|
|
||||||
virtual Region* GetRegion(int x, int y);
|
virtual Region* GetRegion(int x, int y);
|
||||||
virtual Region* FindRegion(int x, int y);
|
virtual Region* FindRegion(int x, int y);
|
||||||
virtual Region* PushRegion(Region* const);
|
virtual Region* PushRegion(Region* const);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ characterAPI = require("character")
|
|||||||
|
|
||||||
networkAPI = require("network")
|
networkAPI = require("network")
|
||||||
|
|
||||||
function doorUtility.createTrigger(handle, room, x, y, script)
|
function doorUtility.CreateTrigger(handle, room, x, y, script)
|
||||||
local pager = roomAPI.GetPager(room)
|
local pager = roomAPI.GetPager(room)
|
||||||
|
|
||||||
--place the indicator tile
|
--place the indicator tile
|
||||||
@@ -53,7 +53,7 @@ function doorUtility.createTrigger(handle, room, x, y, script)
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function doorUtility.createDoorPair(handle, roomOne, Xone, Yone, roomTwo, Xtwo, Ytwo)
|
function doorUtility.CreateDoorPair(handle, roomOne, Xone, Yone, roomTwo, Xtwo, Ytwo)
|
||||||
--create the scripts
|
--create the scripts
|
||||||
local function scriptOne(entity)
|
local function scriptOne(entity)
|
||||||
if entityAPI.GetType(entity) ~= "character" then return end
|
if entityAPI.GetType(entity) ~= "character" then return end
|
||||||
@@ -82,8 +82,8 @@ function doorUtility.createDoorPair(handle, roomOne, Xone, Yone, roomTwo, Xtwo,
|
|||||||
end
|
end
|
||||||
|
|
||||||
--create the triggers proper
|
--create the triggers proper
|
||||||
doorUtility.createTrigger(handle, roomOne, Xone, Yone, scriptOne)
|
doorUtility.CreateTrigger(handle, roomOne, Xone, Yone, scriptOne)
|
||||||
doorUtility.createTrigger(handle, roomTwo, Xtwo, Ytwo, scriptTwo)
|
doorUtility.CreateTrigger(handle, roomTwo, Xtwo, Ytwo, scriptTwo)
|
||||||
end
|
end
|
||||||
|
|
||||||
return doorUtility
|
return doorUtility
|
||||||
@@ -109,7 +109,7 @@ function mapMaker.DebugIsland(r)
|
|||||||
end
|
end
|
||||||
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
|
for j = 1, regionAPI.GetHeight(r) do
|
||||||
regionAPI.SetTile(r, 3, j, 1, mapMaker.dirt)
|
regionAPI.SetTile(r, 3, j, 1, mapMaker.dirt)
|
||||||
@@ -127,10 +127,19 @@ function mapMaker.DebugGrassland(r)
|
|||||||
--debug
|
--debug
|
||||||
io.write("map_maker:DebugGrassland(", regionAPI.GetX(r), ", ", regionAPI.GetY(r), ")\n")
|
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 i = 1, regionAPI.GetWidth(r) do
|
||||||
for j = 1, regionAPI.GetHeight(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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ local region = require("region")
|
|||||||
|
|
||||||
local mapSaver = {}
|
local mapSaver = {}
|
||||||
|
|
||||||
|
--TODO: save and load trigger, creatures
|
||||||
|
|
||||||
function mapSaver.Load(r)
|
function mapSaver.Load(r)
|
||||||
--empty
|
--empty
|
||||||
-- io.write("map_saver:Load(", region.GetX(r), ", ", region.GetY(r), ")\n")
|
-- io.write("map_saver:Load(", region.GetX(r), ", ", region.GetY(r), ")\n")
|
||||||
|
|||||||
@@ -58,4 +58,4 @@ local underworld, uidTwo = roomManagerAPI.CreateRoom("underworld", "overworld.bm
|
|||||||
roomAPI.Initialize(underworld, mapSaver.Load, mapSaver.Save, mapMaker.DebugGrassland, mapSaver.Save)
|
roomAPI.Initialize(underworld, mapSaver.Load, mapSaver.Save, mapMaker.DebugGrassland, mapSaver.Save)
|
||||||
|
|
||||||
--call the monstrosity
|
--call the monstrosity
|
||||||
doorUtility.createDoorPair("pair 1", overworld, -64, -64, underworld, 64, 64)
|
doorUtility.CreateDoorPair("pair 1", overworld, -64, -64, underworld, 64, 64)
|
||||||
|
|||||||
Reference in New Issue
Block a user