mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-06 17:41:04 +00: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:
parent
2efccb3536
commit
a5d5728f24
4 changed files with 97 additions and 62 deletions
|
@ -1270,7 +1270,9 @@ minetest.register_node("default:chest_locked", {
|
|||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("owner", placer:get_player_name() or "")
|
||||
local pname =
|
||||
placer and placer:get_player_name() or ""
|
||||
meta:set_string("owner", pname)
|
||||
meta:set_string("infotext", "Locked Chest (owned by "..
|
||||
meta:get_string("owner")..")")
|
||||
end,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue