Skip to content
Snippets Groups Projects
Commit 6fb5236b authored by DarkGod's avatar DarkGod
Browse files

fix stuff

parent c57a30e2
No related branches found
No related tags found
No related merge requests found
......@@ -191,7 +191,7 @@ function _M:tmxLoad(file)
local g = self:getLoader(t)
local map = lom.parse(data)
local mapprops = {}
if map:findOne("properties") then mapprops = map:findOne("properties"):findAllAttrs("property", "name", "value") end
if map:findOne("properties", nil, nil, true) then mapprops = map:findOne("properties", nil, nil, true):findAllAttrsValueOrBody("property", "name", "value") end
local w, h = tonumber(map.attr.width), tonumber(map.attr.height)
local tw, th = tonumber(map.attr.tilewidth), tonumber(map.attr.tileheight)
local chars = {}
......
......@@ -66,6 +66,7 @@ newEntity{
block_sight = true,
is_door = true,
door_opened = "SOLID_DOOR_OPEN",
door_sound = "ambient/door_creaks/scifi_door",
dig = "FLOOR",
}
newEntity{
......@@ -75,6 +76,7 @@ newEntity{
display = "'", color_r=238, color_g=154, color_b=77, back_color=colors.DARK_GREY,
always_remember = true,
door_closed = "SOLID_DOOR",
door_sound = "ambient/door_creaks/scifi_door",
}
newEntity{ base = "SOLID_DOOR", define_as = "SOLID_DOOR_HORIZ", image = "terrain/solidwall/solid_floor1.png", add_mos={{image = "terrain/solidwall/solid_wall_closed_doors1.png"}}, add_displays = {class.new{image="terrain/solidwall/solid_wall_top_block1.png", z=18, display_y=-1}}, door_opened = "SOLID_DOOR_HORIZ_OPEN"}
newEntity{ base = "SOLID_DOOR_OPEN", define_as = "SOLID_DOOR_HORIZ_OPEN", image = "terrain/solidwall/solid_floor1.png", add_mos={{image = "terrain/solidwall/solid_wall_open_doors1.png"}}, add_displays = {class.new{image="terrain/solidwall/solid_wall_top_block1.png", z=18, display_y=-1}}, door_closed = "SOLID_DOOR_HORIZ"}
......@@ -94,6 +96,7 @@ newEntity{
block_esp = true,
door_player_stop = "This door seems to be sealed.",
is_door = true,
door_sound = "ambient/door_creaks/scifi_door",
door_opened = "SOLID_DOOR_OPEN",
}
newEntity{ base = "SOLID_DOOR_SEALED", define_as = "SOLID_DOOR_SEALED_HORIZ", image = "terrain/solidwall/solid_floor1.png", add_mos={{image = "terrain/solidwall/solid_wall_closed_doors1.png"}}, add_displays = {class.new{image="terrain/solidwall/solid_wall_top_block1.png", z=18, display_y=-1, add_mos={{image="terrain/padlock2.png", display_y=0.1}}}}, door_opened = "SOLID_DOOR_HORIZ_OPEN"}
......
File added
......@@ -54,6 +54,20 @@ function CXML:findAllAttrs(tag, key, value)
end
return attrs
end
function CXML:findAllAttrsValueOrBody(tag, key, value)
local list = self:findAll(tag)
local attrs = {}
for i, node in ipairs(list) do
if node.attr[key] then
if node.attr[value] then
attrs[node.attr[key]] = node.attr[value]
else
attrs[node.attr[key]] = node[1]
end
end
end
return attrs
end
local function starttag (p, tag, attr)
local stack = p:getcallbacks().stack
......
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