Use core namespace instead of minetest

This commit is contained in:
Athozus 2024-10-25 23:00:27 +02:00
parent 8a992b7a29
commit 030a7a3fe8
No known key found for this signature in database
GPG key ID: B50895022E8484BF
29 changed files with 135 additions and 135 deletions

View file

@ -12,7 +12,7 @@ function mail.compile_contact_list(name, selected, playernames)
if i == 1 then length = l end
formspec[#formspec + 1] = ","
formspec[#formspec + 1] = ","
formspec[#formspec + 1] = minetest.formspec_escape(contact.name)
formspec[#formspec + 1] = core.formspec_escape(contact.name)
formspec[#formspec + 1] = ","
local note = contact.note
-- display an ellipsis if the note spans multiple lines
@ -20,7 +20,7 @@ function mail.compile_contact_list(name, selected, playernames)
if idx ~= nil then
note = string.sub(note, 1, idx-1) .. ' ...'
end
formspec[#formspec + 1] = minetest.formspec_escape(note)
formspec[#formspec + 1] = core.formspec_escape(note)
if type(selected) == "string" then
if string.lower(selected) == k then
selected = i
@ -43,7 +43,7 @@ function mail.compile_contact_list(name, selected, playernames)
for i,c in ipairs(playernames) do
formspec[#formspec + 1] = ","
formspec[#formspec + 1] = ","
formspec[#formspec + 1] = minetest.formspec_escape(c)
formspec[#formspec + 1] = core.formspec_escape(c)
formspec[#formspec + 1] = ","
if contacts[string.lower(c)] == nil then
formspec[#formspec + 1] = ""
@ -54,7 +54,7 @@ function mail.compile_contact_list(name, selected, playernames)
if idx ~= nil then
note = string.sub(note, 1, idx-1) .. ' ...'
end
formspec[#formspec + 1] = minetest.formspec_escape(note)
formspec[#formspec + 1] = core.formspec_escape(note)
end
if not selected then
if type(selected) == "string" then

View file

@ -1,5 +1,5 @@
-- sub files
local MP = minetest.get_modpath(minetest.get_current_modname())
local MP = core.get_modpath(core.get_current_modname())
dofile(MP .. "/util/normalize.lua")
dofile(MP .. "/util/colors.lua")
dofile(MP .. "/util/contact.lua")

View file

@ -74,7 +74,7 @@ end
function mail.settings.mute_list.check(name, value)
local valid_players = {}
for _, p in ipairs(value) do
if p ~= name and minetest.player_exists(p) then
if p ~= name and core.player_exists(p) then
table.insert(valid_players, p)
end
end
@ -82,9 +82,9 @@ function mail.settings.mute_list.check(name, value)
end
function mail.settings.mute_list.sync(name)
if minetest.get_modpath("beerchat") then
if core.get_modpath("beerchat") then
local players = {}
for other_player, _ in minetest.get_auth_handler().iterate() do
for other_player, _ in core.get_auth_handler().iterate() do
if beerchat.has_player_muted_player(name, other_player) then
table.insert(players, other_player)
end
@ -95,16 +95,16 @@ function mail.settings.mute_list.sync(name)
end
function mail.settings.mute_list.transfer(name, value)
if minetest.get_modpath("beerchat") then
for other_player, _ in minetest.get_auth_handler().iterate() do -- unmute all
if core.get_modpath("beerchat") then
for other_player, _ in core.get_auth_handler().iterate() do -- unmute all
if not beerchat.execute_callbacks("before_mute", name, other_player) then
return false
end
minetest.get_player_by_name(name):get_meta():set_string(
core.get_player_by_name(name):get_meta():set_string(
"beerchat:muted:" .. other_player, "")
end
for _, other_player in ipairs(value) do -- then mute only players in table
minetest.get_player_by_name(name):get_meta():set_string(
core.get_player_by_name(name):get_meta():set_string(
"beerchat:muted:" .. other_player, "true")
end
return true