1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +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

@ -2,7 +2,7 @@
local walk_speed = 2
local walk_distance = 10
minetest.register_entity("soundstuff:bigfoot", {
core.register_entity("soundstuff:bigfoot", {
initial_properties = {
physical = false,
collisionbox = {-1, -1, -1, 1, 1, 1},
@ -31,18 +31,18 @@ minetest.register_entity("soundstuff:bigfoot", {
end,
})
minetest.register_chatcommand("spawn_bigfoot", {
core.register_chatcommand("spawn_bigfoot", {
params = "",
description = "Spawn a big foot object that makes footstep sounds",
func = function(name, _param)
local player = minetest.get_player_by_name(name)
local player = core.get_player_by_name(name)
if not player then
return false, "No player."
end
local pos = player:get_pos()
pos.y = pos.y + player:get_properties().collisionbox[2]
pos.y = pos.y - (-1) -- bigfoot collisionbox goes 1 down
minetest.add_entity(pos, "soundstuff:bigfoot")
core.add_entity(pos, "soundstuff:bigfoot")
return true
end,
})

View file

@ -1,5 +1,5 @@
local path = minetest.get_modpath("soundstuff") .. "/"
local path = core.get_modpath("soundstuff") .. "/"
dofile(path .. "sound_event_items.lua")
dofile(path .. "jukebox.lua")
dofile(path .. "bigfoot.lua")

View file

@ -1,4 +1,4 @@
local F = minetest.formspec_escape
local F = core.formspec_escape
-- hashed node pos -> sound handle
local played_sounds = {}
@ -57,8 +57,8 @@ local function get_all_metadata(meta)
end
local function log_msg(msg)
minetest.log("action", msg)
minetest.chat_send_all(msg)
core.log("action", msg)
core.chat_send_all(msg)
end
local function try_call(f, ...)
@ -74,11 +74,11 @@ local function try_call(f, ...)
end
local function show_formspec(pos, player)
local meta = minetest.get_meta(pos)
local meta = core.get_meta(pos)
local md = get_all_metadata(meta)
local pos_hash = minetest.hash_node_position(pos)
local pos_hash = core.hash_node_position(pos)
local sound_handle = played_sounds[pos_hash]
local fs = {}
@ -195,17 +195,17 @@ local function show_formspec(pos, player)
button_exit[10.75,11;3,0.75;btn_save_quit;Save & Quit]
]])
minetest.show_formspec(player:get_player_name(), "soundstuff:jukebox@"..pos:to_string(),
core.show_formspec(player:get_player_name(), "soundstuff:jukebox@"..pos:to_string(),
table.concat(fs))
end
minetest.register_node("soundstuff:jukebox", {
core.register_node("soundstuff:jukebox", {
description = "Jukebox\nAllows to play arbitrary sounds.",
tiles = {"soundstuff_jukebox.png"},
groups = {dig_immediate = 2},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local meta = core.get_meta(pos)
-- SimpleSoundSpec
meta:set_string("sss.name", "")
meta:set_string("sss.gain", "")
@ -236,18 +236,18 @@ minetest.register_node("soundstuff:jukebox", {
end,
})
minetest.register_on_player_receive_fields(function(player, formname, fields)
core.register_on_player_receive_fields(function(player, formname, fields)
if formname:sub(1, 19) ~= "soundstuff:jukebox@" then
return false
end
local pos = vector.from_string(formname, 20)
if not pos or pos ~= pos:round() then
minetest.log("error", "[soundstuff:jukebox] Invalid formname.")
core.log("error", "[soundstuff:jukebox] Invalid formname.")
return true
end
local meta = minetest.get_meta(pos)
local meta = core.get_meta(pos)
for _, k in ipairs(meta_keys) do
if fields[k] then
@ -256,7 +256,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
meta:mark_as_private(meta_keys)
local pos_hash = minetest.hash_node_position(pos)
local pos_hash = core.hash_node_position(pos)
local sound_handle = played_sounds[pos_hash]
if not sound_handle then
@ -274,17 +274,17 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
pitch = tonumber(md.sparam.pitch),
fade = tonumber(md.sparam.fade),
start_time = tonumber(md.sparam.start_time),
loop = minetest.is_yes(md.sparam.loop),
loop = core.is_yes(md.sparam.loop),
pos = vector.from_string(md.sparam.pos),
object = testtools.get_branded_object(md.sparam.object),
to_player = md.sparam.to_player,
exclude_player = md.sparam.exclude_player,
max_hear_distance = tonumber(md.sparam.max_hear_distance),
}
local ephemeral = minetest.is_yes(md.ephemeral)
local ephemeral = core.is_yes(md.ephemeral)
log_msg(string.format(
"[soundstuff:jukebox] Playing sound: minetest.sound_play(%s, %s, %s)",
"[soundstuff:jukebox] Playing sound: core.sound_play(%s, %s, %s)",
string.format("{name=\"%s\", gain=%s, pitch=%s, fade=%s}",
sss.name, sss.gain, sss.pitch, sss.fade),
string.format("{gain=%s, pitch=%s, fade=%s, start_time=%s, loop=%s, pos=%s, "
@ -295,7 +295,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
sparam.max_hear_distance),
tostring(ephemeral)))
sound_handle = try_call(minetest.sound_play, sss, sparam, ephemeral)
sound_handle = try_call(core.sound_play, sss, sparam, ephemeral)
played_sounds[pos_hash] = sound_handle
show_formspec(pos, player)
@ -303,9 +303,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
else
if fields.btn_stop then
log_msg("[soundstuff:jukebox] Stopping sound: minetest.sound_stop(<handle>)")
log_msg("[soundstuff:jukebox] Stopping sound: core.sound_stop(<handle>)")
try_call(minetest.sound_stop, sound_handle)
try_call(core.sound_stop, sound_handle)
elseif fields.btn_release then
log_msg("[soundstuff:jukebox] Releasing handle.")
@ -320,10 +320,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local gain = tonumber(md.fade.gain)
log_msg(string.format(
"[soundstuff:jukebox] Fading sound: minetest.sound_fade(<handle>, %s, %s)",
"[soundstuff:jukebox] Fading sound: core.sound_fade(<handle>, %s, %s)",
step, gain))
try_call(minetest.sound_fade, sound_handle, step, gain)
try_call(core.sound_fade, sound_handle, step, gain)
end
end

View file

@ -2,7 +2,7 @@
local drive_speed = 20
local drive_distance = 30
minetest.register_entity("soundstuff:racecar", {
core.register_entity("soundstuff:racecar", {
initial_properties = {
physical = false,
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},

View file

@ -7,7 +7,7 @@ local simple_nodes = {
}
for k,v in pairs(simple_nodes) do
minetest.register_node("soundstuff:"..k, {
core.register_node("soundstuff:"..k, {
description = v[1].."\n"..v[3],
tiles = {"soundstuff_node_sound.png","soundstuff_node_sound.png",v[2]},
groups = {dig_immediate=2},
@ -17,7 +17,7 @@ for k,v in pairs(simple_nodes) do
})
end
minetest.register_node("soundstuff:place_failed_attached", {
core.register_node("soundstuff:place_failed_attached", {
description = "Attached Place Failed Sound Node".."\n"..
"Attached to the floor; plays a sound when you try to place it but failed",
tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_place_failed.png"},
@ -33,7 +33,7 @@ minetest.register_node("soundstuff:place_failed_attached", {
},
})
minetest.register_node("soundstuff:fall", {
core.register_node("soundstuff:fall", {
description = "Fall Sound Node".."\n"..
"Falls and plays sound if node below is gone",
tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_fall.png"},
@ -43,7 +43,7 @@ minetest.register_node("soundstuff:fall", {
}
})
minetest.register_node("soundstuff:fall_attached", {
core.register_node("soundstuff:fall_attached", {
description = "Attached Fall Sound Node".."\n"..
"Drops as item and plays sound if node below is gone",
tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_fall.png"},
@ -59,7 +59,7 @@ minetest.register_node("soundstuff:fall_attached", {
}
})
minetest.register_node("soundstuff:footstep_liquid", {
core.register_node("soundstuff:footstep_liquid", {
description = "Liquid Footstep Sound Node".."\n"..
"Plays sound when moving inside it; swimmable",
drawtype = "liquid",
@ -92,7 +92,7 @@ minetest.register_node("soundstuff:footstep_liquid", {
}
})
minetest.register_node("soundstuff:footstep_climbable", {
core.register_node("soundstuff:footstep_climbable", {
description = "Climbable Footstep Sound Node".."\n"..
"Plays sound when moving inside it; can climb up and down here",
drawtype = "allfaces",
@ -112,17 +112,17 @@ minetest.register_node("soundstuff:footstep_climbable", {
minetest.register_craftitem("soundstuff:eat", {
core.register_craftitem("soundstuff:eat", {
description = "Eat Sound Item".."\n"..
"Makes a sound when 'eaten' (with punch key)",
inventory_image = "soundstuff_eat.png",
on_use = minetest.item_eat(0),
on_use = core.item_eat(0),
sound = {
eat = { name = "soundstuff_mono", gain = 1.0 },
}
})
minetest.register_tool("soundstuff:breaks", {
core.register_tool("soundstuff:breaks", {
description = "Break Sound Tool".."\n"..
"Digs cracky=3 and more".."\n"..
"Makes a sound when it breaks",
@ -142,7 +142,7 @@ minetest.register_tool("soundstuff:breaks", {
})
minetest.register_tool("soundstuff:punch_use", {
core.register_tool("soundstuff:punch_use", {
description = "Punch Use Sound Tool\n"..
"Digs cracky=3 and more\n"..
"Makes a sound when used on node or entity",
@ -161,7 +161,7 @@ minetest.register_tool("soundstuff:punch_use", {
},
})
minetest.register_tool("soundstuff:punch_use_air", {
core.register_tool("soundstuff:punch_use_air", {
description = "Punch Use (Air) Sound Tool\n"..
"Makes a sound when used pointing at nothing",
inventory_image = "soundstuff_node_dig.png",
@ -171,26 +171,26 @@ minetest.register_tool("soundstuff:punch_use_air", {
})
-- Plays sound repeatedly
minetest.register_node("soundstuff:positional", {
core.register_node("soundstuff:positional", {
description = "Positional Sound Node".."\n"..
"Repeatedly plays a sound at the node location",
on_construct = function(pos)
local timer = minetest.get_node_timer(pos)
local timer = core.get_node_timer(pos)
timer:start(0)
end,
on_timer = function(pos, elapsed)
local node = minetest.get_node(pos)
local node = core.get_node(pos)
local dist = node.param2
if dist == 0 then
dist = nil
end
minetest.sound_play("soundstuff_mono", { pos = pos, max_hear_distance = dist })
local timer = minetest.get_node_timer(pos)
core.sound_play("soundstuff_mono", { pos = pos, max_hear_distance = dist })
local timer = core.get_node_timer(pos)
timer:start(0.7)
end,
on_rightclick = function(pos, node, clicker)
node.param2 = (node.param2 + 1) % 64
minetest.set_node(pos, node)
core.set_node(pos, node)
if clicker and clicker:is_player() then
local dist = node.param2
local diststr
@ -199,7 +199,7 @@ minetest.register_node("soundstuff:positional", {
else
diststr = tostring(dist)
end
minetest.chat_send_player(clicker:get_player_name(), "max_hear_distance = " .. diststr)
core.chat_send_player(clicker:get_player_name(), "max_hear_distance = " .. diststr)
end
end,