Use core instead of minetest

`core` is the preferred object to use, existing since Minetest 0.4 or something; `minetest` is just a backwards
compatibility alias for it.
This commit is contained in:
2025-12-06 14:29:16 +01:00
parent 57751d1b81
commit 31b85ba7c4
6 changed files with 49 additions and 49 deletions

View File

@@ -1,4 +1,4 @@
local max_stack = tonumber(minetest.settings:get("default_stack_max")) or 99
local max_stack = tonumber(core.settings:get("default_stack_max")) or 99
-- LuaFormatter off
local machine_formspec = "" ..
@@ -14,7 +14,7 @@ local machine_formspec = "" ..
"listring[current_player;main]"
-- LuaFormatter on
minetest.register_node(
core.register_node(
"stripped_tree:chiseling_machine", {
description = "Chiseling machine",
tiles = {
@@ -28,19 +28,19 @@ minetest.register_node(
groups = {cracky = 1},
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
local meta = core.get_meta(pos)
meta:set_string("formspec", machine_formspec)
end,
on_construct = function(pos)
local inv = minetest.get_meta(pos):get_inventory()
local inv = core.get_meta(pos):get_inventory()
inv:set_size("src", 1)
inv:set_size("dst", 2)
minetest.get_node_timer(pos):start(1.0)
core.get_node_timer(pos):start(1.0)
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
local inv = minetest.get_meta(pos):get_inventory()
local inv = core.get_meta(pos):get_inventory()
local src_stack = inv:get_stack("src", 1)
local dst_stack = inv:get_stack("dst", 1)
if listname == "src" and not src_stack:is_empty() then
@@ -48,7 +48,7 @@ minetest.register_node(
local src_count = src_stack:get_count()
local mod_name, node_name = unpack(src_name:split(":"))
local stripped_name = mod_name .. ":stripped_" .. node_name
local has_stripped = minetest.registered_nodes[stripped_name]
local has_stripped = core.registered_nodes[stripped_name]
local dst_count = dst_stack:get_count()
if has_stripped and dst_count < max_stack then
inv:add_item("dst", stripped_name .. " " .. src_count)
@@ -69,7 +69,7 @@ minetest.register_node(
}
)
minetest.register_craft(
core.register_craft(
{
output = "stripped_tree:chiseling_machine",
recipe = {