Skip to content
Snippets Groups Projects
Commit 137bbb0c authored by DarkGod's avatar DarkGod
Browse files

fix

parent 5944eb39
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -87,6 +87,23 @@ function _M:point(x, y)
end
end
function _M:pointIterator(sx, sy, tx, ty)
sx = sx or 1
sy = sy or 1
tx = tx or self.data_w
ty = ty or self.data_h
local ps = {}
for i = sx, tx do for j = sy, ty do
ps[#ps+1] = self:point(i, j)
end end
local i = 0
return function()
if i >= #ps then return nil end
i = i + 1
return ps[i]
end
end
point_meta = {
__add = function(a, b)
if type(b) == "number" then return _M:point(a.x + b, a.y + b)
......@@ -603,6 +620,12 @@ group_meta = {
end
g:updateReverse()
end,
fill = function(g, map, ...)
local chars = {...}
for i, p in ipairs(g.list) do
map:put(p, (rng.table(chars)))
end
end,
hasPoint = function(g, x, y)
if type(x) == "table" then x, y = x.x, x.y end
return g.reverse[x] and g.reverse[x][y]
......
......@@ -606,6 +606,18 @@ function table.compareKeys(left, right)
return result
end
--- Checks if a (sub)subentry of a table exists
function table.has(t, ...)
if type(t) ~= 'table' then return false end
local args = {...}
local last = table.remove(args)
for _, key in ipairs(args) do
t = t[key]
if type(t) ~= 'table' then return false end
end
return t[last]
end
--[=[
Decends recursively through a table by the given list of keys.
......
......@@ -114,7 +114,7 @@ function _M:replaceAll(level)
local r = self.repl[i]
-- Safety check
local og = level.map(r[1], r[2], Map.TERRAIN)
if og and (og.change_zone or og.change_level) then
if og and (og.change_zone or og.change_level) and not og.change_level_allow_nice_tile then
print("[NICE TILER] *warning* refusing to remove zone/level changer at ", r[1], r[2], og.change_zone, og.change_level)
else
local no = overlay(self, level, "replace", r[1], r[2], r[3])
......
......@@ -89,7 +89,7 @@ newEntity{ base = "BASE_NPC_DEMON",
}
newEntity{ base = "BASE_NPC_DEMON",
name = "onilug", color=colors.LIGHT_GREY,
name = "onilug", color=colors.GREY,
desc = _t[[A gaunt vaguely humanoid shape featuring unadorned grey leathery skin. Its arms and legs seem somehow too long and it stands toll, projecting an ominous shadow even in darkness.
Its glowing red eyes shiny with both cruelty and a deep frightening intellect.]],
level_range = {10, nil}, exp_worth = 1,
......
......@@ -1767,8 +1767,8 @@ newEntity{ base = "BASE_GAUNTLETS", define_as = "STORM_BRINGER_GAUNTLETS",
talents_add_levels_filters = {
{desc=_t"+1 to all lightning damage spells", filter=function(who, t, lvl)
if t.is_spell and t.tactical and (
table.get(t.tactical, "attack", "LIGHTNING") or
table.get(t.tactical, "attackarea", "LIGHTNING")
table.has(t.tactical, "attack", "LIGHTNING") or
table.has(t.tactical, "attackarea", "LIGHTNING")
) then
return lvl + 1
end
......
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