fix for deprecatede api call of get_look_yaw with new get_look_horizontal
* fixed https://codeberg.org/minenux/minetest-mod-mobs_doomed/issues/9
This commit is contained in:
parent
e8c5f23477
commit
e5f3a9575d
20
api.lua
20
api.lua
@ -60,7 +60,8 @@ function object_attach(entity, player, attach_at, eye_offset)
|
||||
minetest.after(0.2, function()
|
||||
default.player_set_animation(player, "sit" , 30)
|
||||
end)
|
||||
entity.object:set_yaw(player:get_look_yaw() - math.pi / 2)
|
||||
--entity.object:set_yaw(player:get_look_yaw() - math.pi / 2)
|
||||
entity.object:set_yaw(player:get_look_horizontal() - math.pi / 2)
|
||||
end
|
||||
|
||||
function object_detach(entity, player, offset)
|
||||
@ -107,6 +108,7 @@ end)
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
--mixed code(from this mod and lib_mount)
|
||||
local rotview = math.pi / 2
|
||||
|
||||
function object_drive(entity, dtime, speed, shoots, arrow, moving_anim, stand_anim, jumps)
|
||||
local ctrl = entity.driver:get_player_control()
|
||||
@ -114,7 +116,8 @@ function object_drive(entity, dtime, speed, shoots, arrow, moving_anim, stand_an
|
||||
local vec_forward = {x=dir.x*speed,y=-2,z=dir.z*speed}
|
||||
local vec_backward = {x=-dir.x*speed,y=-2,z=-dir.z*speed}
|
||||
local vec_stop = {x=0,y=0,z=0}
|
||||
local yaw = entity.driver:get_look_yaw();
|
||||
--local yaw = entity.driver:get_look_yaw()
|
||||
local yaw = entity.driver:get_look_horizontal()
|
||||
if ctrl.up then
|
||||
entity.object:set_yaw(yaw+math.pi+math.pi/2)
|
||||
entity.object:set_velocity(vec_forward)
|
||||
@ -129,7 +132,7 @@ function object_drive(entity, dtime, speed, shoots, arrow, moving_anim, stand_an
|
||||
local pos = entity.object:get_pos()
|
||||
local obj = minetest.add_entity({x=pos.x+0+dir.x*2,y=pos.y+1.5+dir.y,z=pos.z+0+dir.z*2}, arrow)
|
||||
local vec = {x=dir.x*6,y=dir.y*6,z=dir.z*6}
|
||||
local yaw = entity.driver:get_look_yaw();
|
||||
local yaw = entity.driver:get_look_horizontal() + rotview
|
||||
obj:set_yaw(yaw+math.pi/2)
|
||||
obj:set_velocity(vec)
|
||||
end
|
||||
@ -160,6 +163,9 @@ function object_drive(entity, dtime, speed, shoots, arrow, moving_anim, stand_an
|
||||
end
|
||||
|
||||
function object_fly(entity, dtime, speed, shoots, arrow, moving_anim, stand_anim)
|
||||
|
||||
if entity and not entity.driver:get_look_dir() then return end
|
||||
|
||||
local ctrl = entity.driver:get_player_control()
|
||||
local velo = entity.object:get_velocity()
|
||||
local dir = entity.driver:get_look_dir();
|
||||
@ -167,7 +173,7 @@ function object_fly(entity, dtime, speed, shoots, arrow, moving_anim, stand_anim
|
||||
local vec_backward = {x=-dir.x*speed,y=dir.y*speed+2,z=-dir.z*speed}
|
||||
local vec_rise = {x=velo.x,y=velo.y+0.2,z=velo.z}
|
||||
local vec_stop = {x=0,y=-0.2,z=0}
|
||||
local yaw = entity.driver:get_look_yaw();
|
||||
local yaw = entity.driver:get_look_horizontal() + rotview
|
||||
local pos = entity.object:get_pos()
|
||||
local node = minetest.get_node(pos).name
|
||||
|
||||
@ -192,7 +198,8 @@ function object_fly(entity, dtime, speed, shoots, arrow, moving_anim, stand_anim
|
||||
local pos = entity.object:get_pos()
|
||||
local obj = minetest.add_entity({x=pos.x+0+dir.x*2.5,y=pos.y+1.5+dir.y,z=pos.z+0+dir.z*2.5}, arrow)
|
||||
local vec = vector.multiply(dir, 12)
|
||||
local yaw = entity.driver:get_look_yaw();
|
||||
--local yaw = entity.driver:get_look_yaw()
|
||||
local yaw = entity.driver:get_look_horizontal()
|
||||
entity.loaded = true
|
||||
obj:set_yaw(yaw+math.pi/2)
|
||||
obj:set_velocity(vec)
|
||||
@ -257,7 +264,8 @@ function lib_mount.attach(entity, player, attach_at, eye_offset)
|
||||
minetest.after(0.2, function()
|
||||
default.player_set_animation(player, "sit" , 30)
|
||||
end)
|
||||
entity.object:set_yaw(player:get_look_yaw() - math.pi / 2)
|
||||
-- --entity.object:set_yaw(player:get_look_yaw() - math.pi / 2)
|
||||
-- entity.object:set_yaw(player:get_look_horizontal() - math.pi / 2)
|
||||
end
|
||||
|
||||
function lib_mount.detach(entity, player, offset)
|
||||
|
Loading…
x
Reference in New Issue
Block a user