diff options
author | raymoo <raymoo@users.noreply.github.com> | 2017-10-28 01:30:50 -0700 |
---|---|---|
committer | SmallJoker <mk939@ymail.com> | 2018-06-03 17:32:00 +0200 |
commit | 7b8288d605260a92693a93a85134555a8c975bb9 (patch) | |
tree | 9c14b93d6f23213f912d7e3d8f58882ba2aeeac8 /games/minimal | |
parent | 2f969196b86a9ffd4ef3bce9b17fcfb49ec89cd2 (diff) | |
download | minetest-7b8288d605260a92693a93a85134555a8c975bb9.tar.gz minetest-7b8288d605260a92693a93a85134555a8c975bb9.tar.bz2 minetest-7b8288d605260a92693a93a85134555a8c975bb9.zip |
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`
Diffstat (limited to 'games/minimal')
-rw-r--r-- | games/minimal/mods/default/init.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/games/minimal/mods/default/init.lua b/games/minimal/mods/default/init.lua index fcdf93547..bfd938211 100644 --- a/games/minimal/mods/default/init.lua +++ b/games/minimal/mods/default/init.lua @@ -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, |