mirror of
https://github.com/minetest/minetestmapper.git
synced 2025-02-22 06:50:25 +01:00
parent
0f51edcb1f
commit
ad403975fd
@ -2,8 +2,19 @@ local function get_tile(tiles, n)
|
||||
local tile = tiles[n]
|
||||
if type(tile) == 'table' then
|
||||
return tile.name or tile.image
|
||||
end
|
||||
elseif type(tile) == 'string' then
|
||||
return tile
|
||||
end
|
||||
end
|
||||
|
||||
local function strip_texture(tex)
|
||||
tex = (tex .. '^'):match('%(*(.-)%)*^') -- strip modifiers
|
||||
if tex:find("[combine", 1, true) then
|
||||
tex = tex:match('.-=([^:]-)') -- extract first texture
|
||||
elseif tex:find("[png", 1, true) then
|
||||
return nil -- can't
|
||||
end
|
||||
return tex
|
||||
end
|
||||
|
||||
local function pairs_s(dict)
|
||||
@ -20,7 +31,7 @@ core.register_chatcommand("dumpnodes", {
|
||||
func = function()
|
||||
local ntbl = {}
|
||||
for _, nn in pairs_s(minetest.registered_nodes) do
|
||||
local prefix, name = nn:match('(.*):(.*)')
|
||||
local prefix, name = nn:match('(.-):(.*)')
|
||||
if prefix == nil or name == nil then
|
||||
print("ignored(1): " .. nn)
|
||||
else
|
||||
@ -45,14 +56,15 @@ core.register_chatcommand("dumpnodes", {
|
||||
print("ignored(2): " .. nn)
|
||||
else
|
||||
local tex = get_tile(tiles, 1)
|
||||
tex = (tex .. '^'):match('%(*(.-)%)*^') -- strip modifiers
|
||||
if tex:find("[combine", 1, true) then
|
||||
tex = tex:match('.-=([^:]-)') -- extract first texture
|
||||
end
|
||||
tex = tex and strip_texture(tex)
|
||||
if not tex then
|
||||
print("ignored(3): " .. nn)
|
||||
else
|
||||
out:write(nn .. ' ' .. tex .. '\n')
|
||||
n = n + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
out:write('\n')
|
||||
end
|
||||
out:close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user