1
0
mirror of https://gitlab.com/echoes91/throwing.git synced 2025-06-30 07:10:22 +02:00
This commit is contained in:
Andrea Plati
2015-09-11 19:29:04 +02:00
parent 06e5d60f9e
commit 52cade5a78
31 changed files with 29 additions and 3 deletions

View File

@ -24,7 +24,7 @@ function throwing_shoot_arrow (itemstack, player, stiffness, is_cross)
local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, arrow)
local dir = player:get_look_dir()
obj:setvelocity({x=dir.x*stiffness, y=dir.y*stiffness, z=dir.z*stiffness})
obj:setacceleration({x=dir.x*-3, y=-10, z=dir.z*-3})
obj:setacceleration({x=dir.x*-3, y=-8.5, z=dir.z*-3})
obj:setyaw(player:get_look_yaw()+math.pi)
if is_cross then
minetest.sound_play("throwing_crossbow_sound", {pos=playerpos})
@ -129,3 +129,17 @@ function throwing_register_bow (name, desc, scale, stiffness, reload_time, tough
}
})
end
-- Spears
function throwing_shoot_spear (itemstack, player)
local spear = itemstack:get_name() .. '_entity'
local playerpos = player:getpos()
local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, spear)
local dir = player:get_look_dir()
obj:setvelocity({x=dir.x*14, y=dir.y*14, z=dir.z*14})
obj:setacceleration({x=-dir.x*1, y=-9.8, z=-dir.z*1})
obj:setyaw(player:get_look_yaw()+math.pi)
minetest.sound_play("throwing_bow_sound", {pos=playerpos})
return true
end