diff --git a/rsc/scripts/map_maker.lua b/rsc/scripts/map_maker.lua index c48f6bf..aec9cdd 100644 --- a/rsc/scripts/map_maker.lua +++ b/rsc/scripts/map_maker.lua @@ -7,6 +7,7 @@ function mapMaker.Sqr(x) return x*x end function mapMaker.Dist(x, y, i, j) return math.sqrt(mapMaker.Sqr(x - i) + mapMaker.Sqr(y - j)) end --tile macros, mapped to the tilesheet "overworld.bmp" +mapMaker.blank = 0 mapMaker.water = 18 + 3 * 0 mapMaker.sand = 18 + 3 * 1 mapMaker.plains = 18 + 3 * 2 @@ -61,6 +62,24 @@ function mapMaker.SmoothEdgesSimple(r) end end +function mapMaker.PlaceMonsterSpawn(r, x, y, script) + --place monster spawns here, highlighted by dirt patches + + --wrong region + if x < Region.GetX(r) or x >= Region.GetX(r) + Region.GetWidth(r) or + y < Region.GetY(r) or y >= Region.GetY(r) + Region.GetHeight(r) + then + return + end + + --place a dirt tile, clearing the above layers + Region.SetTile(r, x - Region.GetX(r), y - Region.GetY(r), 1, mapMaker.dirt) + Region.SetTile(r, x - Region.GetX(r), y - Region.GetY(r), 2, mapMaker.blank) + Region.SetTile(r, x - Region.GetX(r), y - Region.GetY(r), 3, mapMaker.blank) + + --TODO: (1) create a monster spawn trigger using the given script +end + --custom generation systems here function mapMaker.DebugIsland(r) --basic distance check for each tile, placing an island around the world origin @@ -90,6 +109,9 @@ function mapMaker.DebugIsland(r) --A generic edge system mapMaker.SmoothEdgesSimple(r) + + --place monster spawns + mapMaker.PlaceMonsterSpawn(r, -5, -5, nil) end return mapMaker \ No newline at end of file