7df5d33d02
move function `starts_with`, which was declared twice in separate files, to the api, and make those files use that function instead.
23 lines
622 B
Lua
23 lines
622 B
Lua
-- rename from bg_core to bg_terrain.
|
|
minetest.register_lbm({
|
|
name = "bg_terrain:rename_core_mod",
|
|
nodenames = {
|
|
"core:stone",
|
|
"core:cobblestone",
|
|
"core:dirt",
|
|
"core:grass",
|
|
"bg_core:stone",
|
|
"bg_core:cobblestone",
|
|
"bg_core:dirt",
|
|
"bg_core:grass",
|
|
},
|
|
run_at_every_load = true,
|
|
action = function (pos, node)
|
|
local prefix = ""
|
|
if blockgame.starts_with(node.name, "core") then prefix = "core"
|
|
elseif blockgame.starts_with(node.name, "bg_core") then prefix = "bg_core" end
|
|
|
|
local name = string.sub(node.name, string.len(prefix) + 1)
|
|
minetest.set_node(pos, {name = "bg_terrain" .. name})
|
|
end,
|
|
})
|