Deprecated: move some deprecated stuffs

This commit is contained in:
MoNTE48 2020-08-30 20:57:39 +02:00
parent 8070f6337f
commit 695a842913
11 changed files with 199 additions and 132 deletions

View File

@ -26,6 +26,7 @@ read_globals = {
"playerphysics",
"screwdriver",
"sscsm",
"workbench",
-- Silence errors about custom table methods.
table = { fields = { "copy", "indexof" } },
-- Silence warnings about accessing undefined fields of global 'math'
@ -36,6 +37,7 @@ globals = {"intllib", "hud", "Sl"}
exclude_files = {
"files/bluestone/mesecons/internal.lua",
"files/deprecated/init.lua",
"files/mobs/mobs_redo/api.lua",
"files/signs/slugify.lua",
"files/workbench/init.lua",

View File

@ -1,24 +1,3 @@
-- mods/default/aliases.lua
-- Aliases to support loading worlds using nodes following the old naming convention
-- Pinetree
minetest.register_alias("default:pinetree", "default:pine_tree")
minetest.register_alias("default:pinewood", "default:pine_wood")
-- Gold Nugget
minetest.register_alias("default:gold_nugget", "default:gold_ingot")
-- Sandstone Carved
minetest.register_alias("default:sandstonecarved", "default:sandstonesmooth")
minetest.register_alias("default:redsandstonecarved", "default:redsandstonesmooth")
-- Ladder
minetest.register_alias("default:ladder", "default:ladder_wood")
-- Sugarcane
minetest.register_alias("default:reeds", "default:sugarcane")
minetest.register_alias("default:papyrus", "default:sugarcane")
-- Hardened Clay
minetest.register_alias("hardened_clay:hardened_clay", "default:hardened_clay")

View File

@ -45,4 +45,3 @@ dofile(default_path .. "/tools.lua")
dofile(default_path .. "/craftitems.lua")
dofile(default_path .. "/crafting.lua")
dofile(default_path .. "/mapgen.lua")
dofile(default_path .. "/aliases.lua")

View File

@ -737,7 +737,7 @@ minetest.register_node("default:birch_sapling", {
minetest.register_node("default:stone_with_coal", {
description = "Coal Ore",
tiles = {"default_stone.png^default_mineral_coal.png"},
groups = {cracky = 3},
groups = {cracky = 3, not_cuttable = 1},
drop = "default:coal_lump",
sounds = default.node_sound_stone_defaults()
})
@ -753,7 +753,7 @@ minetest.register_node("default:coalblock", {
minetest.register_node("default:stone_with_iron", {
description = "Iron Ore",
tiles = {"default_stone.png^default_mineral_iron.png"},
groups = {cracky = 2},
groups = {cracky = 2, not_cuttable = 1},
sounds = default.node_sound_stone_defaults()
})
@ -775,7 +775,7 @@ minetest.register_node("default:lapisblock", {
minetest.register_node("default:stone_with_bluestone", {
description = "Bluestone Ore",
tiles = {"default_stone.png^default_mineral_bluestone.png"},
groups = {cracky = 2},
groups = {cracky = 2, not_cuttable = 1},
drop = "mesecons:wire_00000000_off 8",
sounds = default.node_sound_stone_defaults()
})
@ -783,7 +783,7 @@ minetest.register_node("default:stone_with_bluestone", {
minetest.register_node("default:stone_with_lapis", {
description = "Lapis Lazuli Ore",
tiles = {"default_stone.png^default_mineral_lapis.png"},
groups = {cracky = 2},
groups = {cracky = 2, not_cuttable = 1},
drop = {
max_items = 2,
items = {
@ -801,7 +801,7 @@ minetest.register_node("default:stone_with_lapis", {
minetest.register_node("default:stone_with_gold", {
description = "Gold Ore",
tiles = {"default_stone.png^default_mineral_gold.png"},
groups = {cracky = 2},
groups = {cracky = 2, not_cuttable = 1},
sounds = default.node_sound_stone_defaults()
})
@ -816,7 +816,7 @@ minetest.register_node("default:goldblock", {
minetest.register_node("default:stone_with_emerald", {
description = default.colors.emerald .. Sl("Emerald Ore"),
tiles = {"default_stone.png^default_mineral_emerald.png"},
groups = {cracky = 2},
groups = {cracky = 2, not_cuttable = 1},
drop = "default:emerald",
sounds = default.node_sound_stone_defaults()
})
@ -838,7 +838,7 @@ minetest.register_node("default:rubyblock", {
minetest.register_node("default:stone_with_diamond", {
description = "Diamonds in Stone",
tiles = {"default_stone.png^default_mineral_diamond.png"},
groups = {cracky = 1},
groups = {cracky = 1, not_cuttable = 1},
sounds = default.node_sound_stone_defaults()
})
@ -1293,6 +1293,10 @@ local function update_bookshelf(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local invlist = inv:get_list("books")
if not invlist then
inv:set_size("books", 9 * 2)
invlist = inv:get_list("books")
end
local formspec = bookshelf_formspec
-- Inventory slots overlay
@ -1328,6 +1332,20 @@ local function update_bookshelf(pos)
end
end
-- LBM for updating Bookshelf
minetest.register_lbm({
label = "Bookshelf updater",
name = "default:bookshelf_updater",
nodenames = "default:bookshelf",
action = function(pos)
local meta = minetest.get_meta(pos)
if meta:get_string("version") ~= "2" then
update_bookshelf(pos)
meta:set_string("version", "2")
end
end
})
minetest.register_node("default:bookshelf", {
description = "Bookshelf",
tiles = {"default_wood.png", "default_wood.png", "default_wood.png",
@ -1343,6 +1361,7 @@ minetest.register_node("default:bookshelf", {
inv:set_size("books", 9 * 2)
inv:set_size("split", 1)
update_bookshelf(pos)
meta:set_string("version", "2")
end,
can_dig = function(pos)
local inv = minetest.get_meta(pos):get_inventory()

View File

@ -2,3 +2,5 @@ default
mesecons_pistons
mesecons_solarpanel
pep
workbench
carts

View File

@ -3,60 +3,177 @@
local path = minetest.get_modpath("deprecated")
-- Localization for better performance
local register_alias = minetest.register_alias
--== default ==--
local default = {
{"default:pinetree", "default:pine_tree"},
{"default:pinewood", "default:pine_wood"},
{"default:gold_nugget", "default:gold_ingot"},
{"default:sandstonecarved", "default:sandstonesmooth"},
{"default:redsandstonecarved", "default:redsandstonesmooth"},
{"default:ladder", "default:ladder_wood"},
{"default:reeds", "default:sugarcane"},
{"default:papyrus", "default:sugarcane"},
{"hardened_clay:hardened_clay", "default:hardened_clay"},
{"fences:fence_wood", "default:fence_wood"}
}
for _, d in pairs(default) do
register_alias(d[1], d[2])
end
for _, f in pairs({"1", "2", "3", "11", "12", "13", "14",
"21", "22", "23", "24", "32", "33", "34", "35"}) do
register_alias("fences:fence_wood_" .. f, "default:fence_wood")
end
--== mesecons_pistons ==--
dofile(path .. "/mesecons_pistons.lua")
--== throwing ==--
minetest.register_entity(":throwing:arrow_entity", {
is_visible = false,
on_activate = function(self)
self.object:remove()
end
})
--== split ==--
local split_inv = minetest.create_detached_inventory("split", {
allow_put = function(_, _, _, stack, _)
return stack:get_count() / 2
end
})
split_inv:set_size("main", 1)
-- Fences alias
minetest.register_alias("fences:fence_wood", "default:fence_wood")
for _, n in pairs({"1", "2", "3", "11", "12", "13", "14",
"21", "22", "23", "24", "32", "33", "34", "35"}) do
minetest.register_alias("fences:fence_wood_" .. n, "default:fence_wood")
end
--== mesecons_solarpanel ==--
minetest.register_lbm({
label = "Enable timer on ABM Solar Panels",
name = ":mesecons_solarpanel:timer_start",
nodenames = {"mesecons_solarpanel:solar_panel_off", "mesecons_solarpanel:solar_panel_on"},
run_at_every_load = false,
action = function(pos)
minetest.get_node_timer(pos):start(mesecon.setting("spanel_interval", 1))
end
})
minetest.register_alias("mesecons_solarpanel:solar_panel_inverted_off", "mesecons_solarpanel:solar_panel_off")
minetest.register_alias("mesecons_solarpanel:solar_panel_inverted_on", "mesecons_solarpanel:solar_panel_on")
register_alias("mesecons_solarpanel:solar_panel_inverted_off", "mesecons_solarpanel:solar_panel_off")
register_alias("mesecons_solarpanel:solar_panel_inverted_on", "mesecons_solarpanel:solar_panel_on")
--== Potions ==--
minetest.register_alias("potions:glass_bottle", "vessels:glass_bottle")
minetest.register_alias("potionspack:antigravity", "pep:grav0")
minetest.register_alias("potionspack:antigravityii", "pep:gravreset")
minetest.register_alias("potionspack:speed", "pep:speedminus")
minetest.register_alias("potionspack:speedii", "pep:speedplus")
minetest.register_alias("potionspack:inversion", "pep:invisible")
minetest.register_alias("potionspack:confusion", "pep:breath")
minetest.register_alias("potionspack:whatwillthisdo", "pep:mole")
minetest.register_alias("potionspack:instanthealth", "pep:regen")
minetest.register_alias("potionspack:instanthealthii", "pep:regen2")
minetest.register_alias("potionspack:regen", "pep:regen")
minetest.register_alias("potionspack:regenii", "pep:regen2")
minetest.register_alias("potionspack:harming", "pep:gravreset")
minetest.register_alias("potionspack:harmingii", "pep:gravreset")
minetest.register_alias("pep:jumpreset", "pep:nightvision")
minetest.register_alias("pep:speedreset", "pep:invisible")
local potions = {
{"potions:glass_bottle", "vessels:glass_bottle"},
{"potionspack:antigravity", "pep:grav0"},
{"potionspack:antigravityii", "pep:gravreset"},
{"potionspack:speed", "pep:speedminus"},
{"potionspack:speedii", "pep:speedplus"},
{"potionspack:inversion", "pep:invisible"},
{"potionspack:confusion", "pep:breath"},
{"potionspack:whatwillthisdo", "pep:mole"},
{"potionspack:instanthealth", "pep:regen"},
{"potionspack:instanthealthii", "pep:regen2"},
{"potionspack:regen", "pep:regen"},
{"potionspack:regenii", "pep:regen2"},
{"potionspack:harming", "pep:gravreset"},
{"potionspack:harmingii", "pep:gravreset"},
{"pep:jumpreset", "pep:nightvision"},
{"pep:speedreset", "pep:invisible"}
}
for _, p in pairs(potions) do
register_alias(p[1], p[2])
end
--== carts ==--
local carts = {
{"railcart:cart", "carts:cart"},
{"railcart:cart_entity", "carts:cart"},
{"default:rail", "carts:rail"},
{"boost_cart:rail", "carts:rail"},
{"railtrack:powerrail", "carts:powerrail"},
{"railtrack:superrail", "carts:powerrail"},
{"railtrack:brakerail", "carts:brakerail"},
{"railtrack:switchrail", "carts:brakerail"},
{"boost_cart:detectorrail", "carts:detectorrail"},
{"boost_cart:startstoprail", "carts:brakerail"},
{"railtrack:fixer", "default:stick"},
{"railtrack:inspector", "default:stick"},
{"carts:startstoprail", "carts:brakerail"}
}
for _, c in pairs(carts) do
register_alias(c[1], c[2])
end
--== workbench ==--
minetest.after(2, function()
--
-- [Delete aliases after December 2020]
--
local function match_any(needles, haystack, regex)
for _, needle in pairs(needles) do
if haystack:match(regex) == needle then
return true
end
end
return false
end
local aliased_nodes = {}
local aliased_mods = {"default", "farming", "mobs", "wool"}
for node, _ in pairs(workbench.nodes) do
if match_any(aliased_mods, node, "(.*):") then
aliased_nodes[node] = true
end
end
local stairs_aliases = {
{"corner", "outerstair"},
{"invcorner", "outerstair"},
{"stair_outer", "innerstair"},
{"stair_inner", "innerstair"},
{"nanoslab", "microslab"}
}
for node, _ in pairs(aliased_nodes) do
for _, d in pairs(workbench.defs) do
register_alias("stairs:" .. d[1] .. "_" .. node:match(":(.*)"), "stairs:" .. d[1] .. "_" .. node:gsub(":", "_"))
register_alias(node .. "_" .. d[1], "stairs:" .. d[1] .. "_" .. node:gsub(":", "_"))
end
for _, e in pairs(stairs_aliases) do
register_alias("stairs:" .. e[1] .. "_" .. node:match(":(.*)"), "stairs:" .. e[2] .. "_" .. node:gsub(":", "_"))
register_alias("stairs:" .. e[1] .. "_" .. node:gsub(":", "_"), "stairs:" .. e[2] .. "_" .. node:gsub(":", "_"))
register_alias(node .. "_" .. e[1], "stairs:" .. e[2] .. "_" .. node:gsub(":", "_"))
end
end
for _, d in pairs(workbench.defs) do
register_alias("stairs:" .. d[1] .. "_coal", "stairs:" .. d[1] .. "_default_coalblock")
register_alias("stairs:" .. d[1] .. "_lapis_block", "stairs:" .. d[1] .. "_default_lapisblock")
end
for _, e in pairs(stairs_aliases) do
register_alias("stairs:" .. e[1] .. "_coal", "stairs:" .. e[2] .. "_default_coalblock")
register_alias("stairs:" .. e[1] .. "_lapis_block", "stairs:" .. e[2] .. "_default_lapisblock")
end
register_alias("stairs:stair_steel", "stairs:stair_default_steelblock")
register_alias("stairs:slab_steel", "stairs:slab_default_steelblock")
register_alias("stairs:corner_steel", "stairs:outerstair_default_steelblock")
register_alias("stairs:stair_gold", "stairs:stair_default_goldblock")
register_alias("stairs:slab_gold", "stairs:slab_default_goldblock")
register_alias("stairs:corner_gold", "stairs:outerstair_default_goldblock")
register_alias("stairs:stair_diamond", "stairs:stair_default_diamondblock")
register_alias("stairs:slab_diamond", "stairs:slab_default_diamondblock")
register_alias("stairs:corner_diamond", "stairs:outerstair_default_diamondblock")
--
-- Remove from Creative inventory [Never delete]
--
local remove_nodes = {
"default:stone_with_bluestone",
"default:stone_with_coal",
"default:stone_with_diamond",
"default:stone_with_emerald",
"default:stone_with_iron",
"default:stone_with_gold",
"default:stone_with_lapis",
"farming_addons:pumpkin_fruit",
"sponge:sponge"
}
for _, n in pairs(remove_nodes) do
for _, e in pairs(workbench.defs) do
register_alias("stairs:" .. e[1] .. "_" .. n:gsub(":", "_"), n)
end
end
end)

View File

@ -1,5 +1,5 @@
-- From mesecons_pistons mod
-- License and Readme here: https://github.com/MultiCraft/MultiCraft/tree/master/games/default/files/bluestone
-- License and Readme here: https://github.com/MultiCraft/MultiCraft_game/tree/master/files/bluestone
-- Added 17 Jul 2019
local ground_dir = {
@ -22,7 +22,6 @@ minetest.register_lbm({
"mesecons_pistons:piston_up_sticky_on",
"mesecons_pistons:piston_up_pusher_sticky"
},
run_at_every_load = false,
action = function(pos, node)
local dir = ground_dir[math.floor(node.param2/4)]
node.param2 = minetest.dir_to_facedir(dir, true)
@ -42,7 +41,6 @@ minetest.register_lbm({
"mesecons_pistons:piston_down_sticky_on",
"mesecons_pistons:piston_down_pusher_sticky"
},
run_at_every_load = false,
action = function(pos, node)
local dir = vector.multiply(ground_dir[math.floor(node.param2/4)], -1)
node.param2 = minetest.dir_to_facedir(dir, true)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 841 B

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 715 B

After

Width:  |  Height:  |  Size: 68 B

View File

@ -37,7 +37,7 @@ minetest.register_node("farming_addons:pumpkin_fruit", {
paramtype2 = "facedir",
sounds = default.node_sound_wood_defaults(),
is_ground_content = false,
groups = {snappy = 3, flammable = 4, fall_damage_add_percent = -30, food = 1, falling_node = 1},
groups = {snappy = 3, flammable = 4, fall_damage_add_percent = -30, food = 1, not_cuttable = 1, falling_node = 1},
after_dig_node = function(_, _, oldmetadata)
local parent = oldmetadata.fields.parent
local parent_pos_from_child = minetest.string_to_pos(parent)

View File

@ -3,8 +3,8 @@ local workbench_label, workbench_back = "", ""
-- Nodes allowed to be cut
-- Only the regular, solid blocks without metas or explosivity can be cut
local nodes = {}
for node, def in pairs(minetest.registered_nodes) do
workbench.nodes = {}
for node, def in pairs(minetest.registered_workbench.nodes) do
if (def.drawtype == "normal" or def.drawtype:sub(1,5) == "glass" or def.drawtype:sub(1,8) == "allfaces") and
(def.tiles and type(def.tiles[1]) == "string") and
not def.on_rightclick and
@ -15,11 +15,11 @@ for node, def in pairs(minetest.registered_nodes) do
not def.groups.colorglass and
not def.mesecons
then
nodes[#nodes+1] = node
workbench.nodes[#workbench.nodes+1] = node
end
end
setmetatable(nodes, {
setmetatable(workbench.nodes, {
__concat = function(t1, t2)
for i=1, #t2 do
t1[#t1+1] = t2[i]
@ -29,7 +29,7 @@ setmetatable(nodes, {
})
local valid_block = {}
for _, v in pairs(nodes) do
for _, v in pairs(workbench.nodes) do
valid_block[v] = true
end
@ -341,9 +341,9 @@ minetest.register_lbm({
})
for _, d in pairs(workbench.defs) do
for i = 1, #nodes do
local node = nodes[i]
local def = minetest.registered_nodes[node]
for i = 1, #workbench.nodes do
local node = workbench.nodes[i]
local def = minetest.registered_workbench.nodes[node]
local groups, tiles, mesh, collision_box = {}, {}, {}, {}
local drawtype = "nodebox"
@ -406,55 +406,6 @@ for _, d in pairs(workbench.defs) do
end
end
-- Aliases. A lot of aliases...
-- [Delete aliases after July 2020]
local stairs_aliases = {
{"corner", "outerstair"},
{"invcorner", "outerstair"},
{"stair_outer", "innerstair"},
{"stair_inner", "innerstair"},
{"nanoslab", "microslab"}
}
for i = 1, #nodes do
local node = nodes[i]
for _, d in pairs(workbench.defs) do
minetest.register_alias("stairs:"..d[1].."_"..node:match(":(.*)"), "stairs:"..d[1].."_"..node:gsub(":", "_"))
minetest.register_alias(node.."_"..d[1], "stairs:"..d[1].."_"..node:gsub(":", "_"))
end
for _, e in pairs(stairs_aliases) do
minetest.register_alias("stairs:"..e[1].."_"..node:match(":(.*)"), "stairs:"..e[2].."_"..node:gsub(":", "_"))
minetest.register_alias("stairs:"..e[1].."_"..node:gsub(":", "_"), "stairs:"..e[2].."_"..node:gsub(":", "_"))
minetest.register_alias(node.."_"..e[1], "stairs:"..e[2].."_"..node:gsub(":", "_"))
end
end
for _, d in pairs(workbench.defs) do
minetest.register_alias("stairs:"..d[1].."_coal", "stairs:"..d[1].."_default_coalblock")
minetest.register_alias("stairs:"..d[1].."_lapis_block", "stairs:"..d[1].."_default_lapisblock")
end
for _, e in pairs(stairs_aliases) do
minetest.register_alias("stairs:"..e[1].."_coal", "stairs:"..e[2].."_default_coalblock")
minetest.register_alias("stairs:"..e[1].."_lapis_block", "stairs:"..e[2].."_default_lapisblock")
end
minetest.register_alias("stairs:stair_steel", "stairs:stair_default_steelblock")
minetest.register_alias("stairs:slab_steel", "stairs:slab_default_steelblock")
minetest.register_alias("stairs:corner_steel", "stairs:corner_default_steelblock")
minetest.register_alias("stairs:stair_gold", "stairs:stair_default_goldblock")
minetest.register_alias("stairs:slab_gold", "stairs:slab_default_goldblock")
minetest.register_alias("stairs:corner_gold", "stairs:corner_default_goldblock")
minetest.register_alias("stairs:stair_diamond", "stairs:stair_default_diamondblock")
minetest.register_alias("stairs:slab_diamond", "stairs:slab_default_diamondblock")
minetest.register_alias("stairs:corner_diamond", "stairs:corner_default_diamondblock")
-- Workbench
minetest.register_alias("crafting:workbench", "workbench:workbench")
minetest.register_alias("default:workbench", "workbench:workbench")
-- Craft items
minetest.register_tool("workbench:hammer", {