mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +00:00
Rename minetest.*
to core.*
in devtest
This commit is contained in:
parent
d849d51c2d
commit
88c7a54e08
78 changed files with 914 additions and 914 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue