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

Update 1.1

This commit is contained in:
echoes91 2015-03-31 20:14:17 +02:00
parent 0650a511f2
commit b64a278837
8 changed files with 10 additions and 713 deletions

View File

@ -20,7 +20,13 @@ Grahpics & sounds: CC-BY 3.0 (see http://creativecommons.org/licenses/by/3.0/leg
Changelog: Changelog:
Update 1.0 Update 1.1:
- Added crossbow
- Code shring
- Offensive arrows go through flora's and farming's
- Small fixes
Update 1.0:
- Definitive reload, unload and shot system based on tool metadata, new global functions, no more "throw" privilege - Definitive reload, unload and shot system based on tool metadata, new global functions, no more "throw" privilege
- New textures for loaded bows - New textures for loaded bows
- Fireworks arrows to celebrate! - Fireworks arrows to celebrate!

303
bows.lua
View File

@ -1,303 +0,0 @@
--~
--~ Bows
--~
if not DISABLE_WOODEN_BOW then
minetest.register_tool("throwing:bow_wood", {
description = "Wooden Bow",
inventory_image = "throwing_bow_wood.png",
wield_scale = {x=1, y=1, z=0.5},
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
local reload_time = 0.8
local loaded = "throwing:bow_wood_loaded"
local is_cross = false
local pos = user:getpos()
minetest.after(reload_time, throwing_reload, itemstack, user, pos, is_cross, loaded)
return itemstack
end,
})
minetest.register_tool("throwing:bow_wood_loaded", {
description = "Wooden Bow",
inventory_image = "throwing_bow_wood_loaded.png",
wield_scale = {x=1, y=1, z=0.5},
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
local stiffness = 11
local wear = itemstack:get_wear()
local is_cross = false
if not minetest.setting_getbool("creative_mode") then
wear = wear + (65535/50)
end
local unloaded = "throwing:bow_wood"
throwing_shoot_arrow(itemstack, user, stiffness, is_cross)
minetest.after(0.01, throwing_unload, itemstack, user, unloaded, wear)
return itemstack
end,
on_drop = function(itemstack, dropper, pointed_thing)
local wear = itemstack:get_wear()
local unloaded = "throwing:bow_wood"
minetest.after(0.01, throwing_unload, itemstack, dropper, unloaded, wear)
end,
groups = {not_in_creative_inventory=1},
})
minetest.register_craft({
output = 'throwing:bow_wood',
recipe = {
{'', 'default:stick', ''},
{'farming:string', '', 'default:stick'},
{'', 'default:stick', ''},
}
})
minetest.register_craft({
output = 'throwing:bow_wood',
recipe = {
{'', 'default:stick', ''},
{'default:stick', '', 'farming:string'},
{'', 'default:stick', ''},
}
})
end
if not DISABLE_LONGBOW then
minetest.register_tool("throwing:longbow", {
description = "Longbow",
inventory_image = "throwing_longbow.png",
wield_scale = {x=1, y=2.5, z=0.5},
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
local reload_time = 1.8
local loaded = "throwing:longbow_loaded"
local is_cross = false
local pos = user:getpos()
minetest.after(reload_time, throwing_reload, itemstack, user, pos, is_cross, loaded)
return itemstack
end,
})
minetest.register_tool("throwing:longbow_loaded", {
description = "Longbow",
inventory_image = "throwing_longbow_loaded.png",
wield_scale = {x=1, y=2.5, z=0.5},
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
local stiffness = 17
local wear = itemstack:get_wear()
local is_cross = false
if not minetest.setting_getbool("creative_mode") then
wear = wear + (65535/100)
end
local unloaded = "throwing:longbow"
throwing_shoot_arrow(itemstack, user, stiffness, is_cross)
minetest.after(0.01, throwing_unload, itemstack, user, unloaded, wear)
return itemstack
end,
on_drop = function(itemstack, dropper, pointed_thing)
local wear = itemstack:get_wear()
local unloaded = "throwing:longbow"
minetest.after(0.01, throwing_unload, itemstack, dropper, unloaded, wear)
end,
groups = {not_in_creative_inventory=1},
})
minetest.register_craft({
output = 'throwing:longbow',
recipe = {
{'farming:string', 'group:wood', ''},
{'farming:string', '', 'group:wood'},
{'farming:string', 'group:wood', ''},
}
})
minetest.register_craft({
output = 'throwing:longbow',
recipe = {
{'', 'group:wood', 'farming:string'},
{'group:wood', '', 'farming:string'},
{'', 'group:wood', 'farming:string'},
}
})
end
if not DISABLE_COMPOSITE_BOW then
minetest.register_tool("throwing:bow_composite", {
description = "Composite Bow",
inventory_image = "throwing_bow_composite.png",
wield_scale = {x=1, y=1.4, z=0.5},
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
local reload_time = 1
local loaded = "throwing:bow_composite_loaded"
local is_cross = false
local pos = user:getpos()
minetest.after(reload_time, throwing_reload, itemstack, user, pos, is_cross, loaded)
return itemstack
end,
})
minetest.register_tool("throwing:bow_composite_loaded", {
description = "Composite Bow",
inventory_image = "throwing_bow_composite_loaded.png",
wield_scale = {x=1, y=1.4, z=0.5},
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
local stiffness = 17
local wear = itemstack:get_wear()
local is_cross = false
if not minetest.setting_getbool("creative_mode") then
wear = wear + (65535/150)
end
local unloaded = "throwing:bow_composite"
throwing_shoot_arrow(itemstack, user, stiffness, is_cross)
minetest.after(0.01, throwing_unload, itemstack, user, unloaded, wear)
return itemstack
end,
on_drop = function(itemstack, dropper, pointed_thing)
local wear = itemstack:get_wear()
local unloaded = "throwing:bow_composite"
minetest.after(0.01, throwing_unload, itemstack, dropper, unloaded, wear)
end,
groups = {not_in_creative_inventory=1},
})
minetest.register_craft({
output = 'throwing:bow_composite',
recipe = {
{'farming:string', 'group:wood', ''},
{'farming:string', '', 'default:steel_ingot'},
{'farming:string', 'group:wood', ''},
}
})
minetest.register_craft({
output = 'throwing:bow_composite',
recipe = {
{'', 'group:wood', 'farming:string'},
{'default:steel_ingot', '', 'farming:string'},
{'', 'group:wood', 'farming:string'},
}
})
end
if not DISABLE_STEEL_BOW then
minetest.register_tool("throwing:bow_steel", {
description = "Steel Bow",
inventory_image = "throwing_bow_steel.png",
wield_scale = {x=1, y=1.4, z=0.5},
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
local reload_time = 1.2
local loaded = "throwing:bow_steel_loaded"
local is_cross = false
local pos = user:getpos()
minetest.after(reload_time, throwing_reload, itemstack, user, pos, is_cross, loaded)
return itemstack
end,
})
minetest.register_tool("throwing:bow_steel_loaded", {
description = "Steel Bow",
inventory_image = "throwing_bow_steel_loaded.png",
wield_scale = {x=1, y=1.4, z=0.5},
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
local stiffness = 20
local wear = itemstack:get_wear()
local is_cross = false
if not minetest.setting_getbool("creative_mode") then
wear = wear + (65535/250)
end
local unloaded = "throwing:bow_steel"
throwing_shoot_arrow(itemstack, user, stiffness, is_cross)
minetest.after(0.01, throwing_unload, itemstack, user, unloaded, wear)
return itemstack
end,
on_drop = function(itemstack, dropper, pointed_thing)
local wear = itemstack:get_wear()
local unloaded = "throwing:bow_steel"
minetest.after(0.01, throwing_unload, itemstack, dropper, unloaded, wear)
end,
groups = {not_in_creative_inventory=1},
})
minetest.register_craft({
output = 'throwing:bow_steel',
recipe = {
{'farming:string', 'default:steel_ingot', ''},
{'farming:string', '', 'default:steel_ingot'},
{'farming:string', 'default:steel_ingot', ''},
}
})
minetest.register_craft({
output = 'throwing:bow_steel',
recipe = {
{'', 'default:steel_ingot', 'farming:string'},
{'default:steel_ingot', '', 'farming:string'},
{'', 'default:steel_ingot', 'farming:string'},
}
})
end
if not DISABLE_ROYAL_BOW then
minetest.register_tool("throwing:bow_royal", {
description = "Royal Bow",
inventory_image = "throwing_bow_royal.png",
wield_scale = {x=1, y=1.4, z=0.5},
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
local reload_time = 1.2
local loaded = "throwing:bow_royal_loaded"
local is_cross = false
local pos = user:getpos()
minetest.after(reload_time, throwing_reload, itemstack, user, pos, is_cross, loaded)
return itemstack
end,
})
minetest.register_tool("throwing:bow_royal_loaded", {
description = "Royal Bow",
inventory_image = "throwing_bow_royal_loaded.png",
wield_scale = {x=1, y=1.4, z=0.5},
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
local stiffness = 18
local wear = itemstack:get_wear()
local is_cross = false
if not minetest.setting_getbool("creative_mode") then
wear = wear + (65535/750)
end
local unloaded = "throwing:bow_royal"
throwing_shoot_arrow(itemstack, user, stiffness, is_cross)
minetest.after(0.01, throwing_unload, itemstack, user, unloaded, wear)
return itemstack
end,
on_drop = function(itemstack, dropper, pointed_thing)
local wear = itemstack:get_wear()
local unloaded = "throwing:bow_royal"
minetest.after(0.01, throwing_unload, itemstack, dropper, unloaded, wear)
end,
groups = {not_in_creative_inventory=1},
})
minetest.register_craft({
output = 'throwing:bow_royal',
recipe = {
{'farming:string', 'group:wood', 'default:diamond'},
{'farming:string', '', 'default:gold_ingot'},
{'farming:string', 'group:wood', 'default:diamond'},
}
})
minetest.register_craft({
output = 'throwing:bow_royal',
recipe = {
{'default:diamond', 'group:wood', 'farming:string'},
{'default:gold_ingot', '', 'farming:string'},
{'default:diamond', 'group:wood', 'farming:string'},
}
})
end

View File

@ -1,98 +0,0 @@
minetest.register_craftitem("throwing:arrow_diamond", {
description = "Diamond arrow",
inventory_image = "throwing_arrow_diamond.png",
})
minetest.register_node("throwing:arrow_diamond_box", {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
-- Shaft
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
--Spitze
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
--Federn
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
}
},
tiles = {"throwing_arrow_diamond.png", "throwing_arrow_diamond.png", "throwing_arrow_diamond_back.png", "throwing_arrow_diamond_front.png", "throwing_arrow_diamond_2.png", "throwing_arrow_diamond.png"},
groups = {not_in_creative_inventory=1},
})
local THROWING_ARROW_ENTITY={
physical = false,
timer=0,
visual = "wielditem",
visual_size = {x=0.1, y=0.1},
textures = {"throwing:arrow_diamond_box"},
lastpos={},
collisionbox = {0,0,0,0,0,0},
}
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
self.timer=self.timer+dtime
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer>0.2 then
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "throwing:arrow_diamond_entity" and obj:get_luaentity().name ~= "__builtin:item" then
local speed = vector.length(self.object:getvelocity())
local damage = ((speed + 10)^1.2)/10
obj:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=damage},
}, nil)
self.object:remove()
local toughness = 0.97
if math.random() < toughness then
minetest.add_item(self.lastpos, 'throwing:arrow_diamond')
else
minetest.add_item(self.lastpos, 'default:stick')
end
end
end
end
end
if self.lastpos.x~=nil then
if node.name ~= "air" then
self.object:remove()
local toughness = 0.95
if math.random() < toughness then
minetest.add_item(self.lastpos, 'throwing:arrow_diamond')
else
minetest.add_item(self.lastpos, 'default:stick')
end
end
end
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
end
minetest.register_entity("throwing:arrow_diamond_entity", THROWING_ARROW_ENTITY)
minetest.register_craft({
output = 'throwing:arrow_diamond 16',
recipe = {
{'default:stick', 'default:stick', 'default:diamond'},
}
})
minetest.register_craft({
output = 'throwing:arrow_diamond 16',
recipe = {
{'default:diamond', 'default:stick', 'default:stick'},
}
})

View File

@ -23,19 +23,9 @@ end
dofile(minetest.get_modpath("throwing").."/functions.lua") dofile(minetest.get_modpath("throwing").."/functions.lua")
dofile(minetest.get_modpath("throwing").."/bows.lua") dofile(minetest.get_modpath("throwing").."/tools.lua")
if not DISABLE_STEEL_ARROW then dofile(minetest.get_modpath("throwing").."/standard_arrows.lua")
dofile(minetest.get_modpath("throwing").."/steel_arrow.lua")
end
if not DISABLE_STONE_ARROW then
dofile(minetest.get_modpath("throwing").."/stone_arrow.lua")
end
if not DISABLE_STONE_ARROW then
dofile(minetest.get_modpath("throwing").."/obsidian_arrow.lua")
end
if not DISABLE_FIRE_ARROW then if not DISABLE_FIRE_ARROW then
dofile(minetest.get_modpath("throwing").."/fire_arrow.lua") dofile(minetest.get_modpath("throwing").."/fire_arrow.lua")
@ -61,10 +51,6 @@ if not DISABLE_TORCH_ARROW then
dofile(minetest.get_modpath("throwing").."/torch_arrow.lua") dofile(minetest.get_modpath("throwing").."/torch_arrow.lua")
end end
if not DISABLE_DIAMOND_ARROW then
dofile(minetest.get_modpath("throwing").."/diamond_arrow.lua")
end
if not DISABLE_SHELL_ARROW then if not DISABLE_SHELL_ARROW then
dofile(minetest.get_modpath("throwing").."/shell_arrow.lua") dofile(minetest.get_modpath("throwing").."/shell_arrow.lua")
end end

View File

@ -1,98 +0,0 @@
minetest.register_craftitem("throwing:arrow_obsidian", {
description = "Obsidian arrow",
inventory_image = "throwing_arrow_obsidian.png",
})
minetest.register_node("throwing:arrow_obsidian_box", {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
-- Shaft
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
--Spitze
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
--Federn
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
}
},
tiles = {"throwing_arrow_obsidian.png", "throwing_arrow_obsidian.png", "throwing_arrow_obsidian_back.png", "throwing_arrow_obsidian_front.png", "throwing_arrow_obsidian_2.png", "throwing_arrow_obsidian.png"},
groups = {not_in_creative_inventory=1},
})
local THROWING_ARROW_ENTITY={
physical = false,
timer=0,
visual = "wielditem",
visual_size = {x=0.1, y=0.1},
textures = {"throwing:arrow_obsidian_box"},
lastpos={},
collisionbox = {0,0,0,0,0,0},
}
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
self.timer=self.timer+dtime
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer>0.2 then
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "throwing:arrow_obsidian_entity" and obj:get_luaentity().name ~= "__builtin:item" then
local speed = vector.length(self.object:getvelocity())
local damage = ((speed + 15)^1.2)/10
obj:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=damage},
}, nil)
self.object:remove()
local toughness = 0.94
if math.random() < toughness then
minetest.add_item(self.lastpos, 'throwing:arrow_obsidian')
else
minetest.add_item(self.lastpos, 'default:stick')
end
end
end
end
end
if self.lastpos.x~=nil then
if node.name ~= "air" then
self.object:remove()
local toughness = 0.88
if math.random() < toughness then
minetest.add_item(self.lastpos, 'throwing:arrow_obsidian')
else
minetest.add_item(self.lastpos, 'default:stick')
end
end
end
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
end
minetest.register_entity("throwing:arrow_obsidian_entity", THROWING_ARROW_ENTITY)
minetest.register_craft({
output = 'throwing:arrow_obsidian 16',
recipe = {
{'default:stick', 'default:stick', 'default:obsidian'},
}
})
minetest.register_craft({
output = 'throwing:arrow_obsidian 16',
recipe = {
{'default:obsidian', 'default:stick', 'default:stick'},
}
})

View File

@ -93,7 +93,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
end end
if self.lastpos.x~=nil then if self.lastpos.x~=nil then
if node.name ~= "air" then if node.name ~= "air" and not string.find(node.name, 'default:grass') and not string.find(node.name, 'default:junglegrass') and not string.find(node.name, 'flowers:') and not string.find(node.name, 'farming:') then
self.object:remove() self.object:remove()
boom(self.lastpos) boom(self.lastpos)
end end

View File

@ -1,98 +0,0 @@
minetest.register_craftitem("throwing:arrow_steel", {
description = "Steel arrow",
inventory_image = "throwing_arrow_steel.png",
})
minetest.register_node("throwing:arrow_steel_box", {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
-- Shaft
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
--Spitze
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
--Federn
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
}
},
tiles = {"throwing_arrow_steel.png", "throwing_arrow_steel.png", "throwing_arrow_steel_back.png", "throwing_arrow_steel_front.png", "throwing_arrow_steel_2.png", "throwing_arrow_steel.png"},
groups = {not_in_creative_inventory=1},
})
local THROWING_ARROW_ENTITY={
physical = false,
timer=0,
visual = "wielditem",
visual_size = {x=0.1, y=0.1},
textures = {"throwing:arrow_steel_box"},
lastpos={},
collisionbox = {0,0,0,0,0,0},
}
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
self.timer=self.timer+dtime
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer>0.2 then
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "throwing:arrow_steel_entity" and obj:get_luaentity().name ~= "__builtin:item" then
local speed = vector.length(self.object:getvelocity())
local damage = ((speed + 5)^1.2)/10
obj:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=damage},
}, nil)
self.object:remove()
local toughness = 0.95
if math.random() < toughness then
minetest.add_item(self.lastpos, 'throwing:arrow_steel')
else
minetest.add_item(self.lastpos, 'default:stick')
end
end
end
end
end
if self.lastpos.x~=nil then
if node.name ~= "air" then
self.object:remove()
local toughness = 0.9
if math.random() < toughness then
minetest.add_item(self.lastpos, 'throwing:arrow_steel')
else
minetest.add_item(self.lastpos, 'default:stick')
end
end
end
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
end
minetest.register_entity("throwing:arrow_steel_entity", THROWING_ARROW_ENTITY)
minetest.register_craft({
output = 'throwing:arrow_steel 16',
recipe = {
{'default:stick', 'default:stick', 'default:steel_ingot'},
}
})
minetest.register_craft({
output = 'throwing:arrow_steel 16',
recipe = {
{'default:steel_ingot', 'default:stick', 'default:stick'},
}
})

View File

@ -1,98 +0,0 @@
minetest.register_craftitem("throwing:arrow_stone", {
description = "Stone arrow",
inventory_image = "throwing_arrow_stone.png",
})
minetest.register_node("throwing:arrow_stone_box", {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
-- Shaft
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
--Spitze
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
--Federn
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
}
},
tiles = {"throwing_arrow_stone.png", "throwing_arrow_stone.png", "throwing_arrow_stone_back.png", "throwing_arrow_stone_front.png", "throwing_arrow_stone_2.png", "throwing_arrow_stone.png"},
groups = {not_in_creative_inventory=1},
})
local THROWING_ARROW_ENTITY={
physical = false,
timer=0,
visual = "wielditem",
visual_size = {x=0.1, y=0.1},
textures = {"throwing:arrow_stone_box"},
lastpos={},
collisionbox = {0,0,0,0,0,0},
}
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
self.timer=self.timer+dtime
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer>0.2 then
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "throwing:arrow_stone_entity" and obj:get_luaentity().name ~= "__builtin:item" then
local speed = vector.length(self.object:getvelocity())
local damage = ((speed)^1.2)/10
obj:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=damage},
}, nil)
self.object:remove()
local toughness = 0.94
if math.random() < toughness then
minetest.add_item(self.lastpos, 'throwing:arrow_stone')
else
minetest.add_item(self.lastpos, 'default:stick')
end
end
end
end
end
if self.lastpos.x~=nil then
if node.name ~= "air" then
self.object:remove()
local toughness = 0.88
if math.random() < toughness then
minetest.add_item(self.lastpos, 'throwing:arrow_stone')
else
minetest.add_item(self.lastpos, 'default:stick')
end
end
end
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
end
minetest.register_entity("throwing:arrow_stone_entity", THROWING_ARROW_ENTITY)
minetest.register_craft({
output = 'throwing:arrow_stone 16',
recipe = {
{'default:stick', 'default:stick', 'group:stone'},
}
})
minetest.register_craft({
output = 'throwing:arrow_stone 16',
recipe = {
{'group:stone', 'default:stick', 'default:stick'},
}
})