1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-26 18:21:04 +00:00

Rename minetest.* to core.* in devtest

This commit is contained in:
Lars Müller 2024-10-28 15:57:54 +01:00 committed by GitHub
parent d849d51c2d
commit 88c7a54e08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
78 changed files with 914 additions and 914 deletions

View file

@ -1,8 +1,8 @@
-- Entities that test their callbacks
local message = function(msg)
minetest.log("action", "[callbacks] "..msg)
minetest.chat_send_all(msg)
core.log("action", "[callbacks] "..msg)
core.chat_send_all(msg)
end
local get_object_name = function(obj)
@ -18,11 +18,11 @@ local get_object_name = function(obj)
end
local spos = function(self)
return minetest.pos_to_string(vector.round(self.object:get_pos()))
return core.pos_to_string(vector.round(self.object:get_pos()))
end
-- Callback test entity (all callbacks except on_step)
minetest.register_entity("callbacks:callback", {
core.register_entity("callbacks:callback", {
initial_properties = {
visual = "upright_sprite",
textures = { "callbacks_callback_entity.png" },
@ -69,7 +69,7 @@ minetest.register_entity("callbacks:callback", {
})
-- Only test on_step callback
minetest.register_entity("callbacks:callback_step", {
core.register_entity("callbacks:callback_step", {
visual = "upright_sprite",
textures = { "callbacks_callback_entity_step.png" },
on_step = function(self, dtime)
@ -78,7 +78,7 @@ minetest.register_entity("callbacks:callback_step", {
})
-- Callback punch with nil puncher
minetest.register_entity("callbacks:callback_puncher", {
core.register_entity("callbacks:callback_puncher", {
initial_properties = {
visual = "upright_sprite",
textures = { "callbacks_callback_entity.png" },

View file

@ -1,4 +1,4 @@
dofile(minetest.get_modpath("callbacks").."/items.lua")
dofile(minetest.get_modpath("callbacks").."/nodes.lua")
dofile(minetest.get_modpath("callbacks").."/entities.lua")
dofile(minetest.get_modpath("callbacks").."/players.lua")
dofile(core.get_modpath("callbacks").."/items.lua")
dofile(core.get_modpath("callbacks").."/nodes.lua")
dofile(core.get_modpath("callbacks").."/entities.lua")
dofile(core.get_modpath("callbacks").."/players.lua")

View file

@ -3,11 +3,11 @@
--
local function print_to_everything(msg)
minetest.log("action", "[callbacks] " .. msg)
minetest.chat_send_all(msg)
core.log("action", "[callbacks] " .. msg)
core.chat_send_all(msg)
end
minetest.register_craftitem("callbacks:callback_item_1", {
core.register_craftitem("callbacks:callback_item_1", {
description = "Callback Test Item 1".."\n"..
"Tests callbacks: on_secondary_use, on_drop, on_pickup, on_use, after_use".."\n"..
"Punch/Drop + Sneak: Switch to Callback Test Item 2".."\n"..
@ -34,7 +34,7 @@ minetest.register_craftitem("callbacks:callback_item_1", {
itemstack:set_name("callbacks:callback_item_2")
end
return minetest.item_drop(itemstack, dropper, pos)
return core.item_drop(itemstack, dropper, pos)
end,
on_pickup = function(itemstack, picker, pointed_thing, ...)
@ -50,7 +50,7 @@ minetest.register_craftitem("callbacks:callback_item_1", {
-- Pick up one item of the other kind at once
local taken = itemstack:take_item()
taken:set_name("callbacks:callback_item_2")
local leftover = minetest.item_pickup(taken, picker, pointed_thing, ...)
local leftover = core.item_pickup(taken, picker, pointed_thing, ...)
leftover:set_name("callbacks:callback_item_1")
itemstack:add_item(leftover)
return itemstack
@ -59,10 +59,10 @@ minetest.register_craftitem("callbacks:callback_item_1", {
return
elseif ctrl.left then
-- Eat it
return minetest.do_item_eat(2, nil, itemstack, picker, pointed_thing)
return core.do_item_eat(2, nil, itemstack, picker, pointed_thing)
else
-- Normal: pick up everything
return minetest.item_pickup(itemstack, picker, pointed_thing, ...)
return core.item_pickup(itemstack, picker, pointed_thing, ...)
end
end,
@ -87,7 +87,7 @@ minetest.register_craftitem("callbacks:callback_item_1", {
end,
})
minetest.register_craftitem("callbacks:callback_item_2", {
core.register_craftitem("callbacks:callback_item_2", {
description = "Callback Test Item 2".."\n"..
"Punch to switch to Callback Test Item 1",
inventory_image = "callbacks_callback_item_2.png",
@ -102,7 +102,7 @@ minetest.register_craftitem("callbacks:callback_item_2", {
end,
})
minetest.register_on_item_pickup(function(itemstack, picker, pointed_thing, time_from_last_punch, ...)
core.register_on_item_pickup(function(itemstack, picker, pointed_thing, time_from_last_punch, ...)
assert(not pointed_thing or pointed_thing.ref:get_luaentity().name == "__builtin:item")
local item_name = itemstack:get_name()

View file

@ -1,29 +1,29 @@
local function print_to_everything(msg)
minetest.log("action", "[callbacks] " .. msg)
minetest.chat_send_all(msg)
core.log("action", "[callbacks] " .. msg)
core.chat_send_all(msg)
end
minetest.register_node("callbacks:callback_node", {
core.register_node("callbacks:callback_node", {
description = "Callback Test Node (construct/destruct/timer)".."\n"..
"Tests callbacks: on_construct, after_place_node, on_destruct, after_destruct, after_dig_node, on_timer",
tiles = {"callbacks_callback_node.png"},
groups = {callback_test=1, dig_immediate=3},
-- This was known to cause a bug in minetest.item_place_node() when used
-- via minetest.place_node(), causing a placer with no position
-- This was known to cause a bug in core.item_place_node() when used
-- via core.place_node(), causing a placer with no position
paramtype2 = "facedir",
drop = "",
on_construct = function(pos)
print_to_everything("callbacks:callback_node:on_construct("..minetest.pos_to_string(pos)..")")
local meta = minetest.get_meta(pos)
print_to_everything("callbacks:callback_node:on_construct("..core.pos_to_string(pos)..")")
local meta = core.get_meta(pos)
meta:set_string("mine", "test")
local timer = minetest.get_node_timer(pos)
local timer = core.get_node_timer(pos)
timer:start(4, 3)
end,
after_place_node = function(pos, placer)
print_to_everything("callbacks:callback_node:after_place_node("..minetest.pos_to_string(pos)..")")
local meta = minetest.get_meta(pos)
print_to_everything("callbacks:callback_node:after_place_node("..core.pos_to_string(pos)..")")
local meta = core.get_meta(pos)
if meta:get_string("mine") == "test" then
print_to_everything("correct metadata found")
else
@ -32,15 +32,15 @@ minetest.register_node("callbacks:callback_node", {
end,
on_destruct = function(pos)
print_to_everything("callbacks:callback_node:on_destruct("..minetest.pos_to_string(pos)..")")
print_to_everything("callbacks:callback_node:on_destruct("..core.pos_to_string(pos)..")")
end,
after_destruct = function(pos)
print_to_everything("callbacks:callback_node:after_destruct("..minetest.pos_to_string(pos)..")")
print_to_everything("callbacks:callback_node:after_destruct("..core.pos_to_string(pos)..")")
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
print_to_everything("callbacks:callback_node:after_dig_node("..minetest.pos_to_string(pos)..")")
print_to_everything("callbacks:callback_node:after_dig_node("..core.pos_to_string(pos)..")")
end,
on_timer = function(pos, elapsed)

View file

@ -1,7 +1,7 @@
local message = function(msg)
minetest.log("action", "[callbacks] "..msg)
minetest.chat_send_all(msg)
core.log("action", "[callbacks] "..msg)
core.chat_send_all(msg)
end
core.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)