mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 08:35:20 +02:00
Fix default item callbacks to work with nil users (#5819)
* Fix default item callbacks to work with nil users * item.lua: Handle node drops for invalid players The if-condition for the dropping loop is the same as `inv`, which means that the 2nd possible definition of `give_item` is never used. Remove redundant `local _, dropped_item`
This commit is contained in:
@@ -667,8 +667,8 @@ core.register_chatcommand("pulverize", {
|
||||
core.rollback_punch_callbacks = {}
|
||||
|
||||
core.register_on_punchnode(function(pos, node, puncher)
|
||||
local name = puncher:get_player_name()
|
||||
if core.rollback_punch_callbacks[name] then
|
||||
local name = puncher and puncher:get_player_name()
|
||||
if name and core.rollback_punch_callbacks[name] then
|
||||
core.rollback_punch_callbacks[name](pos, node, puncher)
|
||||
core.rollback_punch_callbacks[name] = nil
|
||||
end
|
||||
|
Reference in New Issue
Block a user