mirror of
https://github.com/mt-mods/unifieddyes.git
synced 2024-12-24 09:40:29 +01:00
add sanity checks for when what should be a player/digger is nil
This commit is contained in:
parent
b55c87411d
commit
17e87a8162
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
*~
|
|
6
init.lua
6
init.lua
@ -161,7 +161,8 @@ minetest.register_on_placenode(
|
|||||||
|
|
||||||
if not def
|
if not def
|
||||||
or not def.palette
|
or not def.palette
|
||||||
or def.after_place_node then
|
or def.after_place_node
|
||||||
|
or not placer then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -192,6 +193,7 @@ minetest.register_on_placenode(
|
|||||||
-- The complementary function: strip-off the color if the node being dug is still white/neutral
|
-- The complementary function: strip-off the color if the node being dug is still white/neutral
|
||||||
|
|
||||||
local function move_item(item, pos, inv, digger)
|
local function move_item(item, pos, inv, digger)
|
||||||
|
if not digger then return end
|
||||||
local creative = creative_mode or minetest.check_player_privs(digger, "creative")
|
local creative = creative_mode or minetest.check_player_privs(digger, "creative")
|
||||||
if inv:room_for_item("main", item)
|
if inv:room_for_item("main", item)
|
||||||
and (not creative or not inv:contains_item("main", item, true)) then
|
and (not creative or not inv:contains_item("main", item, true)) then
|
||||||
@ -203,7 +205,7 @@ local function move_item(item, pos, inv, digger)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function unifieddyes.on_dig(pos, node, digger)
|
function unifieddyes.on_dig(pos, node, digger)
|
||||||
|
if not digger then return end
|
||||||
local playername = digger:get_player_name()
|
local playername = digger:get_player_name()
|
||||||
if minetest.is_protected(pos, playername) then
|
if minetest.is_protected(pos, playername) then
|
||||||
minetest.record_protection_violation(pos, playername)
|
minetest.record_protection_violation(pos, playername)
|
||||||
|
Loading…
Reference in New Issue
Block a user