Lazily committing the entire splice at once (read more)
(this message is copied from my blog) So I took the lazy route and just committed the entire splice between the jam branch and the development branch all at once. It is exactly as terrible as you think it is, but I've been out of coding for 2 weeks, and I want to get some shit done. I'll pick through each piece one by one, by comparing the diffs from the develop branch to the current jam-merge branch. Those developers I met on Monday said they were impressed by my ability to manage a large codebase, but if they saw this I'd expect they'd probably take that back. And oh god it's been 3 weeks since I touched the main branch WTF?
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
--overwriting the existing hard coded methods
|
||||
function Region.Load(region)
|
||||
--the return value signals if this succeeded or failed
|
||||
return false
|
||||
end
|
||||
|
||||
function Region.Save(region)
|
||||
--
|
||||
end
|
||||
@@ -0,0 +1,16 @@
|
||||
--uber lazy declarations
|
||||
function math.sqr(x) return x*x end
|
||||
function math.dist(x, y, i, j) return math.sqrt(math.sqr(x-i) + math.sqr(y-j)) end
|
||||
|
||||
--define these
|
||||
function Region.Create(region)
|
||||
for i = 1, Region.GetWidth() do
|
||||
for j = 1, Region.GetHeight() do
|
||||
Region.SetTile(region, i, j, 1, 1) --to show the basics are working
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Region.Unload(region)
|
||||
--
|
||||
end
|
||||
@@ -0,0 +1,33 @@
|
||||
local sheet = TileSheet.GetTileSheet()
|
||||
local pager = RegionPager.GetRegionPager()
|
||||
|
||||
--the selected tilesheet
|
||||
TileSheet.Load(sheet, config.dir.tilesets .. "terrain.bmp", 32, 32)
|
||||
|
||||
--tile macros, mapped to this tilesheet
|
||||
local base = 14
|
||||
local shift = 36
|
||||
tiles = {
|
||||
plains = base + shift * 0,
|
||||
grass = base + shift * 1,
|
||||
dirt = base + shift * 2,
|
||||
sand = base + shift * 3,
|
||||
water = base + shift * 4
|
||||
}
|
||||
|
||||
--could set custom generation systems here, that differ from the global generators, etc.
|
||||
function Region.Create(region)
|
||||
for i = 1, Region.GetWidth() do
|
||||
for j = 1, Region.GetHeight() do
|
||||
local dist = math.dist(0, 0, i + Region.GetX(region) -1, j + Region.GetY(region) -1)
|
||||
if dist < 10 then
|
||||
Region.SetTile(region, i, j, 1, tiles.plains)
|
||||
elseif dist < 12 then
|
||||
Region.SetTile(region, i, j, 1, tiles.sand)
|
||||
else
|
||||
Region.SetTile(region, i, j, 1, tiles.water)
|
||||
Region.SetSolid(region, i, j, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -32,14 +32,4 @@ Region.OnCreate = function(region)
|
||||
return ret
|
||||
end
|
||||
|
||||
--Get some regions
|
||||
newRoom = RoomMgr.CreateRoom("overworld")
|
||||
pager = Room.GetPager(newRoom)
|
||||
regionTable = {
|
||||
RegionPager.GetRegion(pager, Region.GetWidth() * 0, Region.GetHeight() * 0),
|
||||
RegionPager.GetRegion(pager, Region.GetWidth() *-1, Region.GetHeight() * 0),
|
||||
RegionPager.GetRegion(pager, Region.GetWidth() * 0, Region.GetHeight() *-1),
|
||||
RegionPager.GetRegion(pager, Region.GetWidth() *-1, Region.GetHeight() *-1)
|
||||
}
|
||||
|
||||
print("Finished the lua script")
|
||||
Reference in New Issue
Block a user