Fixed build arrow across reboot

This commit is contained in:
echoes91 2015-03-24 13:01:32 +01:00
parent e6ba4d35af
commit f073dc1944
1 changed files with 11 additions and 7 deletions

View File

@ -51,10 +51,12 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "throwing:arrow_build_entity" and obj:get_luaentity().name ~= "__builtin:item" then
self.object:remove()
if not minetest.setting_getbool("creative_mode") then
if self.inventory and self.stack and not minetest.setting_getbool("creative_mode") then
self.inventory:remove_item("main", {name=self.stack:get_name()})
end
minetest.add_item(self.lastpos, {name=self.stack:get_name()})
if self.stack then
minetest.add_item(self.lastpos, {name=self.stack:get_name()})
end
local toughness = 0.95
if math.random() < toughness then
minetest.add_item(self.lastpos, 'throwing:arrow_build')
@ -69,13 +71,15 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
if self.lastpos.x~=nil then
if node.name ~= "air" then
self.object:remove()
if not minetest.setting_getbool("creative_mode") then
if self.inventory and self.stack and not minetest.setting_getbool("creative_mode") then
self.inventory:remove_item("main", {name=self.stack:get_name()})
end
if not string.find(node.name, "water") and not string.find(node.name, "lava") and not string.find(node.name, "torch") and self.stack:get_definition().type == "node" and self.stack:get_name() ~= "default:torch" then
minetest.place_node(self.lastpos, {name=self.stack:get_name()})
else
minetest.add_item(self.lastpos, {name=self.stack:get_name()})
if self.stack then
if not string.find(node.name, "water") and not string.find(node.name, "lava") and not string.find(node.name, "torch") and self.stack:get_definition().type == "node" and self.stack:get_name() ~= "default:torch" then
minetest.place_node(self.lastpos, {name=self.stack:get_name()})
else
minetest.add_item(self.lastpos, {name=self.stack:get_name()})
end
end
minetest.add_item(self.lastpos, 'default:shovel_steel')
end