Break nodes into API and definitions
This commit is contained in:
parent
b2e108b8a9
commit
b8e6b4fca3
3
init.lua
3
init.lua
@ -7,7 +7,8 @@ local modname = minetest.get_current_modname()
|
||||
rawset(_G, modname, {})
|
||||
|
||||
include("names")
|
||||
include("node")
|
||||
include("nodeapi")
|
||||
include("nodedefs")
|
||||
include("migrate")
|
||||
include("item")
|
||||
include("ore")
|
||||
|
@ -239,21 +239,6 @@ function myapi.register_cat_spots(id, base, spot, ...)
|
||||
return myapi.register_cat(id, {txr}, ...)
|
||||
end
|
||||
|
||||
local function reg(legacyid, desc, ...)
|
||||
myapi.register_cat_spots(desc, ...)
|
||||
local id = desc2name(desc)
|
||||
for _, n in ipairs({":cat_", ":longcat_front_", ":longcat_mid_", ":longcat_back_"}) do
|
||||
minetest.register_alias(modname .. n .. legacyid, modname .. n .. id)
|
||||
end
|
||||
end
|
||||
reg(1, "Light Gray", "#c0c0c0", "#404040")
|
||||
reg(2, "Medium Gray", "#404040", "#202020")
|
||||
reg(3, "Dark Gray", "#202020", "#101010")
|
||||
reg(4, "Dark Orange", "#ff8000", "#804000")
|
||||
reg(5, "Light Orange", "#e0c040", "#ff8000")
|
||||
reg(6, "Dark Brown", "#804000", "#402000")
|
||||
reg(7, "Light Brown", "#c0a080", "#806020")
|
||||
|
||||
function myapi.makecat(pos, param2, creator)
|
||||
local all = {}
|
||||
for k, v in pairs(minetest.registered_nodes) do
|
26
nodedefs.lua
Normal file
26
nodedefs.lua
Normal file
@ -0,0 +1,26 @@
|
||||
-- LUALOCALS < ---------------------------------------------------------
|
||||
local ipairs, minetest, string
|
||||
= ipairs, minetest, string
|
||||
local string_gsub, string_lower
|
||||
= string.gsub, string.lower
|
||||
-- LUALOCALS > ---------------------------------------------------------
|
||||
|
||||
local modname = minetest.get_current_modname()
|
||||
local myapi = _G[modname]
|
||||
|
||||
local function desc2name(s) return string_gsub(string_lower(s), "%W+", "_") end
|
||||
|
||||
local function reg(legacyid, desc, ...)
|
||||
myapi.register_cat_spots(desc, ...)
|
||||
local id = desc2name(desc)
|
||||
for _, n in ipairs({":cat_", ":longcat_front_", ":longcat_mid_", ":longcat_back_"}) do
|
||||
minetest.register_alias(modname .. n .. legacyid, modname .. n .. id)
|
||||
end
|
||||
end
|
||||
reg(1, "Light Gray", "#c0c0c0", "#404040")
|
||||
reg(2, "Medium Gray", "#404040", "#202020")
|
||||
reg(3, "Dark Gray", "#202020", "#101010")
|
||||
reg(4, "Dark Orange", "#ff8000", "#804000")
|
||||
reg(5, "Light Orange", "#e0c040", "#ff8000")
|
||||
reg(6, "Dark Brown", "#804000", "#402000")
|
||||
reg(7, "Light Brown", "#c0a080", "#806020")
|
Loading…
x
Reference in New Issue
Block a user