Skip to content
Snippets Groups Projects
Commit 39ff81f4 authored by DarkGod's avatar DarkGod
Browse files

Moved greater vaults into data/maps/vaults/auto/greater; any files that addons...

Moved greater vaults into data/maps/vaults/auto/greater; any files that addons add there will automatically be added to the list (for zones that do not enforce a specific list)
parent a97047c7
No related branches found
No related tags found
No related merge requests found
Showing
with 33 additions and 15 deletions
......@@ -217,15 +217,19 @@ function _M:tmxLoad(file)
end
local m = { w=w, h=h }
local function populate(i, j, c, tid)
local ii, jj = i, j
local function rotate_coords(i, j)
local ii, jj = i, j
if rotate == "flipx" then ii, jj = m.w - i + 1, j
elseif rotate == "flipy" then ii, jj = i, m.h - j + 1
elseif rotate == "90" then ii, jj = j, m.w - i + 1
elseif rotate == "180" then ii, jj = m.w - i + 1, m.h - j + 1
elseif rotate == "270" then ii, jj = m.h - j + 1, i
end
return ii, jj
end
local function populate(i, j, c, tid)
local ii, jj = rotate_coords(i, j)
m[ii] = m[ii] or {}
if type(c) == "string" then
......@@ -291,6 +295,8 @@ function _M:tmxLoad(file)
end
end
self.add_attrs_later = {}
for _, og in ipairs(map:findAll("objectgroup")) do
for _, o in ipairs(map:findAll("object")) do
local props = o:findOne("properties"):findAllAttrs("property", "name", "value")
......@@ -301,14 +307,26 @@ function _M:tmxLoad(file)
if props['end'] then m.endx = x m.endy = y end
if props.type and props.subtype then
for i = x, x + w do for j = y, y + h do
local i, j = rotate_coords(i, j)
g.addSpot({i, j}, props.type, props.subtype)
end end
end
elseif og.attr.name:find("^addZone") then
local x, y, w, h = math.floor(tonumber(o.attr.x) / tw), math.floor(tonumber(o.attr.y) / th), math.floor(tonumber(o.attr.width) / tw), math.floor(tonumber(o.attr.height) / th)
if props.type and props.subtype then
local i1, j2 = rotate_coords(x, y)
local i2, j2 = rotate_coords(x + w, y + h)
g.addZone({x, y, x + w, y + h}, props.type, props.subtype)
end
elseif og.attr.name:find("^attrs") then
local x, y, w, h = math.floor(tonumber(o.attr.x) / tw), math.floor(tonumber(o.attr.y) / th), math.floor(tonumber(o.attr.width) / tw), math.floor(tonumber(o.attr.height) / th)
for k, v in pairs(props) do
for i = x, x + w do for j = y, y + h do
local i, j = rotate_coords(i, j)
self.add_attrs_later[#self.add_attrs_later+1] = {x=i, y=j, key=k, value=self:loadLuaInEnv(g, nil, "return "..v)}
print("====", i, j, k)
end end
end
end
end
end
......@@ -530,6 +548,10 @@ function _M:generate(lev, old_lev)
end
end end
if self.add_attrs_later then for _, attr in ipairs(self.add_attrs_later) do
self.level.map.attrs(attr.x, attr.y, attr.key, attr.value)
end end
self:triggerHook{"MapGeneratorStatic:subgenRegister", mapfile=self.data.map, list=self.subgen}
for i = 1, #self.subgen do
......
......@@ -1689,6 +1689,9 @@ function _M:setupCommands()
g:getMapObjects(game.level.map.tiles, mos, 1)
table.print(mos)
print("===============")
local attrs = game.level.map.attrs[self.player.x + self.player.y * self.level.map.w]
table.print(attrs)
print("===============")
end end,
[{"_g","ctrl"}] = function() if config.settings.cheat then
self:changeLevel(5, "orcs+slumbering-caves")
......
......@@ -58,7 +58,7 @@ function _M:generate(lev, old_lev)
if self.map:checkEntity(2 + room.w - 1, j, Map.TERRAIN, "is_door") then possible_entrances[#possible_entrances+1] = {x=2 + room.w, y=j} end
end
local sx, sy, ex, ey = 1, 1, 1, 1
local sx, sy, ex, ey = 1, 2, 1, 2
if #possible_entrances > 0 then
local e = rng.table(possible_entrances)
......
......@@ -24,13 +24,6 @@ if not x then return false end
local id = "sub-vault"..game.turn.."-"..rng.range(1,9999)
local changer = function(id)
local list = {
"double-t", "crypt", "treasure1", "diggers", "hillbert_curve", "quiet", "lightning-vault", "water-vault",
"32-chambers", "demon-nest-1", "demon-nest-2", "demon-nest-3", "frost-dragon-lair", "greater-money-vault",
"trapped-hexagon", "yin-yang", "zigzag-chambers", "paladin-vs-vampire", "orc-hatred", "lich-lair",
"greater-crypt", "trickvault", "spider-den", "acidic-vault",
}
local grid_list = mod.class.Grid:loadList{"/data/general/grids/basic.lua", "/data/general/grids/water.lua", "/data/general/grids/lava.lua"}
local npc_list = table.clone(game.zone.npc_list)
npc_list.__loaded_files = table.clone(npc_list.__loaded_files, true) -- Separate full cloning to not alter the base
......@@ -64,7 +57,7 @@ local changer = function(id)
class = "mod.class.generator.map.VaultLevel",
["#"] = walltype,
up = "UP_SUB_VAULT_BACK",
greater_vaults_list = game.level.data.generator.map.greater_vaults_list or list,
greater_vaults_list = game.level.data.generator.map.greater_vaults_list or nil,
},
actor = {
class = "mod.class.generator.actor.Random",
......
......@@ -372,7 +372,7 @@ newEntity{
door_opened = "GENERIC_LEVER_DOOR_OPEN",
on_lever_change = function(self, x, y, who, val, oldval)
local toggle = game.level.map.attrs(x, y, "lever_toggle")
local trigger = game.level.map.attrs(x, y, "lever_action")
local trigger = game.level.map.attrs(x, y, "lever_action") or 1
if toggle or (val > oldval and val >= trigger) then
game.level.map(x, y, engine.Map.TERRAIN, game.zone.grid_list[self.door_opened])
game.log("#VIOLET#You hear a door opening.")
......@@ -380,8 +380,8 @@ newEntity{
end
end,
}
newEntity{ base = "GENERIC_LEVER_DOOR", define_as = "GENERIC_LEVER_DOOR_HORIZ", image = "terrain/granite_door1.png", add_displays = {class.new{image="terrain/granite_wall3.png", z=18, display_y=-1, add_mos={{image="terrain/padlock2.png", display_y=0.1}}}}, door_opened = "DOOR_HORIZ_OPEN"}
newEntity{ base = "GENERIC_LEVER_DOOR", define_as = "GENERIC_LEVER_DOOR_VERT", image = "terrain/marble_floor.png", add_displays = {class.new{image="terrain/granite_door1_vert.png", z=17, add_mos={{image="terrain/padlock2.png", display_x=0.2, display_y=-0.4}}}, class.new{image="terrain/granite_door1_vert_north.png", z=18, display_y=-1}}, door_opened = "DOOR_OPEN_VERT"}
newEntity{ base = "GENERIC_LEVER_DOOR", define_as = "GENERIC_LEVER_DOOR_HORIZ", image = "terrain/granite_door1.png", add_displays = {class.new{image="terrain/granite_wall3.png", z=18, display_y=-1, add_mos={{image="terrain/padlock2.png", display_y=0.1}}}}, door_opened = "GENERIC_LEVER_GENERIC_LEVER_DOOR_HORIZ_OPEN"}
newEntity{ base = "GENERIC_LEVER_DOOR", define_as = "GENERIC_LEVER_DOOR_VERT", image = "terrain/marble_floor.png", add_displays = {class.new{image="terrain/granite_door1_vert.png", z=17, add_mos={{image="terrain/padlock2.png", display_x=0.2, display_y=-0.4}}}, class.new{image="terrain/granite_door1_vert_north.png", z=18, display_y=-1}}, door_opened = "GENERIC_LEVER_DOOR_OPEN_VERT"}
newEntity{
define_as = "GENERIC_LEVER_DOOR_OPEN",
......@@ -395,7 +395,7 @@ newEntity{
door_player_stop = "This door seems to have been sealed off. You need to find a way to close it.",
on_lever_change = function(self, x, y, who, val, oldval)
local toggle = game.level.map.attrs(x, y, "lever_toggle")
local trigger = game.level.map.attrs(x, y, "lever_action")
local trigger = game.level.map.attrs(x, y, "lever_action") or 1
if toggle or (val < oldval and val < trigger) then
game.level.map(x, y, engine.Map.TERRAIN, game.zone.grid_list[self.door_closed])
game.log("#VIOLET#You hear a door closing.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment