mirror of
https://github.com/SmallJoker/boost_cart.git
synced 2024-11-30 18:13:44 +01:00
Pitch-Rotate player model and unblock downwards-going view
This commit is contained in:
parent
be0c56edef
commit
6ac106c1a7
@ -351,6 +351,25 @@ function cart_entity:on_step(dtime)
|
|||||||
anim = {x=2, y=2}
|
anim = {x=2, y=2}
|
||||||
end
|
end
|
||||||
self.object:set_animation(anim, 1, 0)
|
self.object:set_animation(anim, 1, 0)
|
||||||
|
if player then
|
||||||
|
local feet = {x=0, y=0, z=0}
|
||||||
|
local eye = {x=0, y=-4, z=0}
|
||||||
|
feet.y = boost_cart.old_player_model and 6 or -4.2
|
||||||
|
if dir.y ~= 0 then
|
||||||
|
-- TODO: Find a better way to calculate this
|
||||||
|
if boost_cart.old_player_model then
|
||||||
|
feet.y = 6 + 1.5
|
||||||
|
feet.z = (dir.x - dir.z) * 7
|
||||||
|
else
|
||||||
|
feet.y = -4.2 + 3
|
||||||
|
feet.z = dir.x - dir.z
|
||||||
|
end
|
||||||
|
eye.z = eye.z - dir.y * 10
|
||||||
|
end
|
||||||
|
player:set_attach(self.object, "", feet,
|
||||||
|
{x=dir.y * -45, y=0, z=0})
|
||||||
|
player:set_eye_offset(eye, eye)
|
||||||
|
end
|
||||||
|
|
||||||
self.object:set_velocity(vel)
|
self.object:set_velocity(vel)
|
||||||
if update.pos then
|
if update.pos then
|
||||||
|
@ -18,8 +18,7 @@ function boost_cart:manage_attachment(player, obj)
|
|||||||
default.player_attached[player_name] = status
|
default.player_attached[player_name] = status
|
||||||
|
|
||||||
if status then
|
if status then
|
||||||
-- player_api came after the new model. Check for it.
|
local y_pos = self.old_player_model and 6 or -4.2
|
||||||
local y_pos = player_api and -4.5 or 6
|
|
||||||
player:set_attach(obj, "", {x=0, y=y_pos, z=0}, {x=0, y=0, z=0})
|
player:set_attach(obj, "", {x=0, y=y_pos, z=0}, {x=0, y=0, z=0})
|
||||||
player:set_eye_offset({x=0, y=-4, z=0},{x=0, y=-4, z=0})
|
player:set_eye_offset({x=0, y=-4, z=0},{x=0, y=-4, z=0})
|
||||||
else
|
else
|
||||||
|
4
init.lua
4
init.lua
@ -25,6 +25,10 @@ if not default.player_attached then
|
|||||||
default.player_attached = {}
|
default.player_attached = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.after(1, function()
|
||||||
|
boost_cart.old_player_model = type(player_api) ~= "table"
|
||||||
|
end)
|
||||||
|
|
||||||
dofile(boost_cart.modpath.."/functions.lua")
|
dofile(boost_cart.modpath.."/functions.lua")
|
||||||
dofile(boost_cart.modpath.."/rails.lua")
|
dofile(boost_cart.modpath.."/rails.lua")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user