fix crash with animated nodes

master
adrido 2017-02-08 08:58:27 +01:00
parent 2e2471bc8f
commit 9c22d990b4
1 changed files with 17 additions and 14 deletions

View File

@ -59,7 +59,7 @@ end
local function getTiles(nd)
return nd.tiles or nd.tile_images or nil
return nd.tiles or nd.tile_images
end
local function dumpNodes(playerName, param)
@ -78,8 +78,9 @@ local function dumpNodes(playerName, param)
local header = [[
# This file is generated by dumpnodes.
# You can use this to generate a colors.txt file that can be used by minetestmapper.
# To generate a colors.txt you can use the program you find here:
# To generate a colors.txt you can use the program you find here: https://bitbucket.org/adrido/makecolors
# Or you use MinetestMapperGui that have the conversation tool builtin.
# https://bitbucket.org/adrido/minetestmappergui
]]
out:write(header)
for nodeName, def in orderedPairs(minetest.registered_nodes) do
@ -87,19 +88,21 @@ local function dumpNodes(playerName, param)
if(def.drawtype ~="arilike" and tiles) then
local mod, name = nodeName:match('(.*):(.*)')
if mod~="" and name~="" then
local tile = tiles[1]
if type(tile) == 'table' then
tile = tile.name
local tile = (tiles[1] and tiles[1].name) or tiles[1] or tiles.name
if(type(tile) == "string") then
tile = (tile .. '^'):match('(.-)^')
if(mod ~= currentMod)then
out:write('\n# ' .. mod .. '\n')
currentMod = mod
end
out:write(nodeName .. ' ' .. tile .. '\n')
print(nodeName.." : " ..tile)
counter = counter +1 --lua sucks!
else
minetest.log("warning",nodeName..": ".. dump(def));
end
tile = (tile .. '^'):match('(.-)^')
if(mod ~= currentMod)then
out:write('\n# ' .. mod .. '\n')
currentMod = mod
end
out:write(nodeName .. ' ' .. tile .. '\n')
print(nodeName.." : " ..tile)
counter = counter +1 --lua sucks!
end
end
end