fix crash when fake player dig slade (#46)

When a fake player, for example a node, dig slade, it return player ~= nil but it is not a current player, the server_diggable_only function tries to check the privs of the node, then this crashes

Here we use the built-in check player:is_player() so the node privs are not checked

This crash occurred in the technic mod when the corium eats the slade
This commit is contained in:
Github is a non-free platform owned by Microsoft. Reasonable alternatives exist, such as Gitea, Sourcehut. We need a federated, mastodon-like forge based on ForgeFed. See: https://forgefed.org 2023-12-03 08:33:53 +01:00 committed by GitHub
parent 2f2577eada
commit 8edf220213
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -3,7 +3,7 @@ local S = minetest.get_translator(minetest.get_current_modname())
local invulnerable = df_underworld_items.config.invulnerable_slade and not minetest.settings:get_bool("creative_mode")
local server_diggable_only = function(pos, player)
if player then
if player and player:is_player() then
return minetest.check_player_privs(player, "server")
end
return false
@ -181,4 +181,4 @@ end
if minetest.get_modpath("mesecons_mvps") and df_underworld_items.config.invulnerable_slade then
mesecon.register_mvps_stopper("df_underworld_items:slade")
end
end