aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparamat <paramat@users.noreply.github.com>2018-02-10 04:55:40 +0000
committerSmallJoker <mk939@ymail.com>2018-06-03 17:32:00 +0200
commit6d346a817be6882b9779e6564f9c902f55cfc951 (patch)
treee986368ff604615bab7558363e48cf89c48d408b
parent529f00a2403cdd185b1eb5902de8947d03bb3413 (diff)
downloadminetest-6d346a817be6882b9779e6564f9c902f55cfc951.tar.gz
minetest-6d346a817be6882b9779e6564f9c902f55cfc951.tar.bz2
minetest-6d346a817be6882b9779e6564f9c902f55cfc951.zip
Item entity: Delete in 'ignore' nodes
-rw-r--r--builtin/game/item_entity.lua19
1 files changed, 9 insertions, 10 deletions
diff --git a/builtin/game/item_entity.lua b/builtin/game/item_entity.lua
index c0e36be2d..caa759828 100644
--- a/builtin/game/item_entity.lua
+++ b/builtin/game/item_entity.lua
@@ -174,19 +174,18 @@ core.register_entity(":__builtin:item", {
local p = self.object:getpos()
p.y = p.y - 0.5
local node = core.get_node_or_nil(p)
- local in_unloaded = (node == nil)
- if in_unloaded then
- -- Don't infinetly fall into unloaded map
- self.object:setvelocity({x = 0, y = 0, z = 0})
- self.object:setacceleration({x = 0, y = 0, z = 0})
- self.physical_state = false
- self.object:set_properties({physical = false})
+ -- Delete in 'ignore' nodes
+ if node and node.name == "ignore" then
+ self.itemstring = ""
+ self.object:remove()
return
end
- local nn = node.name
- -- If node is not registered or node is walkably solid and resting on nodebox
+
+ -- If node is nil (unloaded area), or node is not registered, or node is
+ -- walkably solid and item is resting on nodebox
local v = self.object:getvelocity()
- if not core.registered_nodes[nn] or core.registered_nodes[nn].walkable and v.y == 0 then
+ if not node or not core.registered_nodes[node.name] or
+ core.registered_nodes[node.name].walkable and v.y == 0 then
if self.physical_state then
local own_stack = ItemStack(self.object:get_luaentity().itemstring)
-- Merge with close entities of the same item