#198 Fix a crash, step 10

This commit is contained in:
kay27 2022-02-14 06:15:03 +04:00
parent 636be37c85
commit 7e9388b80d
4 changed files with 13 additions and 8 deletions

View File

@ -6,9 +6,8 @@ local pool = {}
local tick = false local tick = false
minetest.register_on_joinplayer(function(player) minetest.register_on_authplayer(function(name, ip, is_success)
local name if not is_success then return end
name = player:get_player_name()
pool[name] = 0 pool[name] = 0
end) end)

View File

@ -21,11 +21,18 @@ local interact_priv = minetest.registered_privileges.interact
interact_priv.give_to_singleplayer = false interact_priv.give_to_singleplayer = false
interact_priv.give_to_admin = false interact_priv.give_to_admin = false
local is_player = mcl_playerplus.is_player
local overlay = mcl_enchanting.overlay local overlay = mcl_enchanting.overlay
local hud = "mcl_shield_hud.png" local hud = "mcl_shield_hud.png"
function is_player(obj)
if not obj then return end
if not obj:is_player() then return end
local name = obj:get_player_name()
if not name then return end
if possible_hackers[name] then return end
return true
end
minetest.register_tool("mcl_shields:shield", { minetest.register_tool("mcl_shields:shield", {
description = S("Shield"), description = S("Shield"),
_doc_items_longdesc = S("A shield is a tool used for protecting the player against attacks."), _doc_items_longdesc = S("A shield is a tool used for protecting the player against attacks."),

View File

@ -1,3 +1,4 @@
name = mcl_player name = mcl_player
author = celeron55 author = celeron55
description = Adds the 3D player model, taken from Minetest Game 0.4.16. description = Adds the 3D player model, taken from Minetest Game 0.4.16.
depends = mcl_shields

View File

@ -27,7 +27,7 @@ local mcl_playerplus_internal = {}
local time = 0 local time = 0
local look_pitch = 0 local look_pitch = 0
function mcl_playerplus.is_player(obj) function is_player(obj)
if not obj then return end if not obj then return end
if not obj:is_player() then return end if not obj:is_player() then return end
local name = obj:get_player_name() local name = obj:get_player_name()
@ -36,8 +36,6 @@ function mcl_playerplus.is_player(obj)
return true return true
end end
local is_player = mcl_playerplus.is_player
local function player_collision(player) local function player_collision(player)
local pos = player:get_pos() local pos = player:get_pos()