1
0
mirror of https://gitlab.com/echoes91/throwing.git synced 2024-11-14 05:50:21 +01:00

Fixed build arrow across reboot

This commit is contained in:
echoes91 2015-03-24 13:01:32 +01:00
parent e6ba4d35af
commit f073dc1944

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