1
0
mirror of https://gitlab.com/echoes91/throwing.git synced 2025-06-30 15:20:21 +02:00

Update 0.9.2: Introduced chance to break for many arrows, added golden bow

This commit is contained in:
echoes91
2015-03-10 16:40:18 +01:00
parent bdc555c290
commit ff044fb1f1
11 changed files with 168 additions and 31 deletions

View File

@ -56,6 +56,12 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
damage_groups={fleshy=damage},
}, nil)
self.object:remove()
local toughness = 0.9
if self.breaks < toughness then
minetest.add_item(self.lastpos, 'throwing:arrow_diamond')
else
minetest.add_item(self.lastpos, 'default:stick')
end
end
end
end
@ -64,9 +70,55 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
if self.lastpos.x~=nil then
if node.name ~= "air" then
self.object:remove()
local dir={x=pos.x-self.lastpos.x, y=pos.y-self.lastpos.y, z=pos.z-self.lastpos.z}
local wall=minetest.dir_to_wallmounted(dir)
minetest.add_node(self.lastpos, {name="default:torch", param2 = wall})
if not string.find(node.name, "water") and not string.find(node.name, "lava") and not string.find(node.name, "torch") then
local dir=vector.direction(self.lastpos, pos)
local wall=minetest.dir_to_wallmounted(dir)
minetest.add_node(self.lastpos, {name="default:torch", param2 = wall})
--~ if wall == 0 then Check doesn't help :(
--~ local check_pos={self.lastpos.x, self.lastpos.y+0.5, self.lastpos.z}
--~ if minetest.get_node(check_pos).name ~= "air" then
--~ minetest.add_node(self.lastpos, {name="default:torch", param2 = wall})
--~ self.object:remove()
--~ end
--~ elseif wall == 1 then
--~ local check_pos={self.lastpos.x, self.lastpos.y-0.5, self.lastpos.z}
--~ if minetest.get_node(check_pos).name ~= "air" then
--~ minetest.add_node(self.lastpos, {name="default:torch", param2 = wall})
--~ self.object:remove()
--~ end
--~ elseif wall == 2 then
--~ local check_pos={self.lastpos.x+0.5, self.lastpos.y, self.lastpos.z}
--~ if minetest.get_node(check_pos).name ~= "air" then
--~ minetest.add_node(self.lastpos, {name="default:torch", param2 = wall})
--~ self.object:remove()
--~ end
--~ elseif wall == 3 then
--~ local check_pos={self.lastpos.x-0.5, self.lastpos.y, self.lastpos.z}
--~ if minetest.get_node(check_pos).name ~= "air" then
--~ minetest.add_node(self.lastpos, {name="default:torch", param2 = wall})
--~ self.object:remove()
--~ end
--~ elseif wall == 4 then
--~ local check_pos={self.lastpos.x, self.lastpos.y, self.lastpos.z+0.5}
--~ if minetest.get_node(check_pos).name ~= "air" then
--~ minetest.add_node(self.lastpos, {name="default:torch", param2 = wall})
--~ self.object:remove()
--~ end
--~ elseif wall == 5 then
--~ local check_pos={self.lastpos.x, self.lastpos.y, self.lastpos.z-0.5}
--~ if minetest.get_node(check_pos).name ~= "air" then
--~ minetest.add_node(self.lastpos, {name="default:torch", param2 = wall})
--~ self.object:remove()
--~ end
--~ end
else
local toughness = 0.9
if self.breaks < toughness then
minetest.add_item(self.lastpos, 'throwing:arrow_torch')
else
minetest.add_item(self.lastpos, 'default:stick')
end
end
end
end
self.lastpos={x=pos.x, y=pos.y, z=pos.z}