1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-18 02:45:21 +02: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
78 changed files with 914 additions and 914 deletions

View File

@@ -18,7 +18,7 @@ local phasearmor = {
}
local max_phase = 12
minetest.register_entity("testentities:armorball", {
core.register_entity("testentities:armorball", {
initial_properties = {
hp_max = 20,
physical = false,
@@ -33,7 +33,7 @@ minetest.register_entity("testentities:armorball", {
_phase = 7,
on_activate = function(self, staticdata)
minetest.log("action", "[testentities] armorball.on_activate")
core.log("action", "[testentities] armorball.on_activate")
self.object:set_armor_groups(phasearmor[self._phase])
self.object:set_sprite({x=0, y=self._phase})
end,
@@ -56,6 +56,6 @@ minetest.register_entity("testentities:armorball", {
if not name then
return
end
minetest.chat_send_player(name, "time_from_last_punch="..string.format("%.3f", time_from_last_punch).."; damage="..tostring(damage))
core.chat_send_player(name, "time_from_last_punch="..string.format("%.3f", time_from_last_punch).."; damage="..tostring(damage))
end,
})

View File

@@ -1,5 +1,5 @@
dofile(minetest.get_modpath("testentities").."/visuals.lua")
dofile(minetest.get_modpath("testentities").."/observers.lua")
dofile(minetest.get_modpath("testentities").."/selectionbox.lua")
dofile(minetest.get_modpath("testentities").."/armor.lua")
dofile(minetest.get_modpath("testentities").."/pointable.lua")
dofile(core.get_modpath("testentities").."/visuals.lua")
dofile(core.get_modpath("testentities").."/observers.lua")
dofile(core.get_modpath("testentities").."/selectionbox.lua")
dofile(core.get_modpath("testentities").."/armor.lua")
dofile(core.get_modpath("testentities").."/pointable.lua")

View File

@@ -1,13 +1,13 @@
local function player_names_excluding(exclude_player_name)
local player_names = {}
for _, player in ipairs(minetest.get_connected_players()) do
for _, player in ipairs(core.get_connected_players()) do
player_names[player:get_player_name()] = true
end
player_names[exclude_player_name] = nil
return player_names
end
minetest.register_entity("testentities:observable", {
core.register_entity("testentities:observable", {
initial_properties = {
visual = "sprite",
textures = { "testentities_sprite.png" },

View File

@@ -3,7 +3,7 @@
-- Register wrapper for compactness
local function register_pointable_testentity(name, pointable)
local texture = "testnodes_"..name..".png"
minetest.register_entity("testentities:"..name, {
core.register_entity("testentities:"..name, {
initial_properties = {
visual = "cube",
visual_size = {x = 0.6, y = 0.6, z = 0.6},

View File

@@ -12,7 +12,7 @@ end
local active_selectionbox_entities = 0 -- count active entities
minetest.register_entity("testentities:selectionbox", {
core.register_entity("testentities:selectionbox", {
initial_properties = {
visual = "cube",
infotext = "Punch to randomize rotation, rightclick to toggle rotation"
@@ -45,16 +45,16 @@ minetest.register_entity("testentities:selectionbox", {
})
local hud_ids = {}
minetest.register_globalstep(function()
core.register_globalstep(function()
if active_selectionbox_entities == 0 then
return
end
for _, player in pairs(minetest.get_connected_players()) do
for _, player in pairs(core.get_connected_players()) do
local offset = player:get_eye_offset()
offset.y = offset.y + player:get_properties().eye_height
local pos1 = vector.add(player:get_pos(), offset)
local raycast = minetest.raycast(pos1, vector.add(pos1, vector.multiply(player:get_look_dir(), 10)), true, false)
local raycast = core.raycast(pos1, vector.add(pos1, vector.multiply(player:get_look_dir(), 10)), true, false)
local pointed_thing = raycast()
if pointed_thing.ref == player then
pointed_thing = raycast()
@@ -73,13 +73,13 @@ minetest.register_globalstep(function()
alignment = {x=0, y=0},
})
local shade = math.random(0, 0xFF)
minetest.add_particle({
core.add_particle({
-- Random shade of red for the intersection point
texture = color(0x10000 * shade),
pos = pointed_thing.intersection_point,
size = 0.1
})
minetest.add_particle({
core.add_particle({
-- Same shade of green for the corresponding intersection normal
texture = color(0x100 * shade),
pos = vector.add(pointed_thing.intersection_point, pointed_thing.intersection_normal * 0.1),

View File

@@ -1,13 +1,13 @@
-- Minimal test entities to test visuals
minetest.register_entity("testentities:sprite", {
core.register_entity("testentities:sprite", {
initial_properties = {
visual = "sprite",
textures = { "testentities_sprite.png" },
},
})
minetest.register_entity("testentities:upright_sprite", {
core.register_entity("testentities:upright_sprite", {
initial_properties = {
visual = "upright_sprite",
textures = {
@@ -17,7 +17,7 @@ minetest.register_entity("testentities:upright_sprite", {
},
})
minetest.register_entity("testentities:cube", {
core.register_entity("testentities:cube", {
initial_properties = {
visual = "cube",
textures = {
@@ -31,21 +31,21 @@ minetest.register_entity("testentities:cube", {
},
})
minetest.register_entity("testentities:item", {
core.register_entity("testentities:item", {
initial_properties = {
visual = "item",
wield_item = "testnodes:normal",
},
})
minetest.register_entity("testentities:wielditem", {
core.register_entity("testentities:wielditem", {
initial_properties = {
visual = "wielditem",
wield_item = "testnodes:normal",
},
})
minetest.register_entity("testentities:mesh", {
core.register_entity("testentities:mesh", {
initial_properties = {
visual = "mesh",
mesh = "testnodes_pyramid.obj",
@@ -55,7 +55,7 @@ minetest.register_entity("testentities:mesh", {
},
})
minetest.register_entity("testentities:mesh_unshaded", {
core.register_entity("testentities:mesh_unshaded", {
initial_properties = {
visual = "mesh",
mesh = "testnodes_pyramid.obj",
@@ -66,7 +66,7 @@ minetest.register_entity("testentities:mesh_unshaded", {
},
})
minetest.register_entity("testentities:sam", {
core.register_entity("testentities:sam", {
initial_properties = {
visual = "mesh",
mesh = "testentities_sam.b3d",
@@ -82,7 +82,7 @@ minetest.register_entity("testentities:sam", {
-- Advanced visual tests
-- An entity for testing animated and yaw-modulated sprites
minetest.register_entity("testentities:yawsprite", {
core.register_entity("testentities:yawsprite", {
initial_properties = {
selectionbox = {-0.3, -0.5, -0.3, 0.3, 0.3, 0.3},
visual = "sprite",
@@ -97,7 +97,7 @@ minetest.register_entity("testentities:yawsprite", {
})
-- An entity for testing animated upright sprites
minetest.register_entity("testentities:upright_animated", {
core.register_entity("testentities:upright_animated", {
initial_properties = {
visual = "upright_sprite",
textures = {"testnodes_anim.png"},
@@ -108,7 +108,7 @@ minetest.register_entity("testentities:upright_animated", {
end,
})
minetest.register_entity("testentities:nametag", {
core.register_entity("testentities:nametag", {
initial_properties = {
visual = "sprite",
textures = { "testentities_sprite.png" },
@@ -116,7 +116,7 @@ minetest.register_entity("testentities:nametag", {
on_activate = function(self, staticdata)
if staticdata ~= "" then
local data = minetest.deserialize(staticdata)
local data = core.deserialize(staticdata)
self.color = data.color
self.bgcolor = data.bgcolor
else
@@ -145,6 +145,6 @@ minetest.register_entity("testentities:nametag", {
end,
get_staticdata = function(self)
return minetest.serialize({ color = self.color, bgcolor = self.bgcolor })
return core.serialize({ color = self.color, bgcolor = self.bgcolor })
end,
})