Replace get_look_yaw with get_look_horizontal

This commit is contained in:
Lars 2022-03-05 11:00:58 -08:00
parent 64c94310ef
commit fcaa079a84
3 changed files with 13 additions and 13 deletions

@ -7,7 +7,7 @@ minetest.register_tool("rangedweapons:forcegun", {
local pos = user:get_pos()
local dir = user:get_look_dir()
local yaw = user:get_look_yaw()
local yaw = user:get_look_horizontal()
local inv = user:get_inventory()
if inv:contains_item("main", "rangedweapons:power_particle 40") then
if pos and dir then
@ -18,7 +18,7 @@ if inv:contains_item("main", "rangedweapons:power_particle 40") then
minetest.sound_play("rangedweapons_rocket", {object=obj})
obj:set_velocity({x=dir.x * 60, y=dir.y * 60, z=dir.z * 60})
obj:setyaw(yaw + math.pi)
obj:setyaw(yaw - math.pi/2)
proj_dir = dir
local ent = obj:get_luaentity()
if ent then

@ -63,11 +63,11 @@ pos.y = pos.y + 1.5
local pinEnt = minetest.add_entity(pos, "rangedweapons:grenade_pin")
if pinEnt then
local dir = user:get_look_dir()
local yaw = user:get_look_yaw()
local yaw = user:get_look_horizontal()
local svertical = user:get_look_vertical()
pinEnt:set_velocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
pinEnt:set_acceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
pinEnt:set_rotation({x=0,y=yaw + math.pi,z=-svertical})
pinEnt:set_rotation({x=0,y=yaw - math.pi/2,z=-svertical})
end
return itemstack end,
})
@ -84,14 +84,14 @@ minetest.register_craftitem("rangedweapons:hand_grenade_nopin", {
on_use = function(itemstack, user, pointed_thing)
local pos = user:get_pos()
local dir = user:get_look_dir()
local yaw = user:get_look_yaw()
local yaw = user:get_look_horizontal()
if pos and dir and yaw then
pos.y = pos.y + 1.6
local obj = minetest.add_entity(pos, "rangedweapons:grenade")
if obj then
obj:set_velocity({x=dir.x * 12, y=dir.y * 12, z=dir.z * 12})
obj:set_acceleration({x=0, y=-6, z=0})
obj:set_yaw(yaw + math.pi)
obj:set_yaw(yaw - math.pi/2)
btimer = gtimer
local ent = obj:get_luaentity()
if ent then

@ -145,7 +145,7 @@ player:hud_change(gunammo, "text", gunMeta:get_int("RW_bullets"))
if GunCaps.gun_magazine ~= nil then
local pos = player:get_pos()
local dir = player:get_look_dir()
local yaw = player:get_look_yaw()
local yaw = player:get_look_horizontal()
if pos and dir and yaw then
pos.y = pos.y + 1.4
local obj = minetest.add_entity(pos,"rangedweapons:mag")
@ -153,7 +153,7 @@ local obj = minetest.add_entity(pos,"rangedweapons:mag")
obj:set_properties({textures = {GunCaps.gun_magazine}})
obj:set_velocity({x=dir.x*2, y=dir.y*2, z=dir.z*2})
obj:set_acceleration({x=0, y=-5, z=0})
obj:set_rotation({x=0,y=yaw+math.pi,z=0})
obj:set_rotation({x=0,y=yaw - math.pi/2,z=0})
end end end
if GunCaps.gun_unloaded ~= nil then
@ -660,7 +660,7 @@ rangedweapons_launch_projectile = function(player,projNum,projDmg,projEnt,visual
----------------------------------
local pos = player:get_pos()
local dir = player:get_look_dir()
local yaw = player:get_look_yaw()
local yaw = player:get_look_horizontal()
local svertical = player:get_look_vertical()
if pos and dir and yaw then
@ -671,7 +671,7 @@ rangedweapons_launch_projectile = function(player,projNum,projDmg,projEnt,visual
local shl = minetest.add_entity(pos, shellEnt)
shl:set_velocity({x=dir.x * -10, y=dir.y * -10, z=dir.z * -10})
shl:set_acceleration({x=dir.x * -5, y= -10, z=dir.z * -5})
shl:set_rotation({x=0,y=yaw + math.pi,z=-svertical})
shl:set_rotation({x=0,y=yaw - math.pi/2,z=-svertical})
shl:set_properties({
textures = {shellTexture},
visual = shellVisual,})
@ -722,7 +722,7 @@ glow = proj_glow,}
local acc = ((( 100 - accuracy ) / 10) / skill_value ) or 0
obj:set_velocity({x=dir.x * combined_velocity + math.random(-acc,acc), y=dir.y * combined_velocity + math.random(-acc,acc), z=dir.z * combined_velocity + math.random(-acc,acc)})
obj:set_acceleration({x=0, y=-gravity, z=0})
obj:set_rotation({x=0,y=yaw + math.pi,z=-svertical})
obj:set_rotation({x=0,y=yaw - math.pi/2,z=-svertical})
end end end
@ -740,7 +740,7 @@ local bulletStack = ItemStack({name = gunMeta:get_string("RW_ammo_name")})
local pos = player:get_pos()
minetest.sound_play(rldsound, {pos = pos})
local dir = player:get_look_dir()
local yaw = player:get_look_yaw()
local yaw = player:get_look_horizontal()
if pos and dir and yaw then
pos.y = pos.y + 1.6
local obj = minetest.add_entity(pos, "rangedweapons:empty_shell")
@ -761,7 +761,7 @@ end
if obj then
obj:set_velocity({x=dir.x*-10, y=dir.y*-10, z=dir.z*-10})
obj:set_acceleration({x=dir.x*-5, y=-10, z=dir.z*-5})
obj:set_yaw(yaw + math.pi)
obj:set_yaw(yaw - math.pi/2)
end end end
---------------------------------------------------