added driver_scale to ridable mobs

This commit is contained in:
TenPlus1 2017-01-19 15:01:58 +00:00
parent a33a52d140
commit 26d80126f5

View File

@ -80,6 +80,7 @@ local function force_detach(player)
default.player_attached[player:get_player_name()] = false default.player_attached[player:get_player_name()] = false
player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0}) player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
default.player_set_animation(player, "stand" , 30) default.player_set_animation(player, "stand" , 30)
player:set_properties({visual_size = {x = 1, y = 1} })
end end
@ -108,9 +109,10 @@ function mobs.attach(entity, player)
local attach_at, eye_offset = {}, {} local attach_at, eye_offset = {}, {}
if not entity.player_rotation then entity.player_rotation = entity.player_rotation or {x = 0, y = 0, z = 0}
entity.player_rotation = {x = 0, y = 0, z = 0} entity.driver_attach_at = entity.driver_attach_at or {x = 0, y = 0, z = 0}
end entity.driver_eye_offset = entity.driver_eye_offset or {x = 0, y = 0, z = 0}
entity.driver_scale = entity.driver_scale or {x = 1, y = 1}
local rot_view = 0 local rot_view = 0
@ -118,14 +120,6 @@ function mobs.attach(entity, player)
rot_view = math.pi/2 rot_view = math.pi/2
end end
if not entity.driver_attach_at then
entity.driver_attach_at = {x = 0, y = 0, z = 0}
end
if not entity.driver_eye_offset then
entity.driver_eye_offset = {x = 0, y = 0, z = 0}
end
attach_at = entity.driver_attach_at attach_at = entity.driver_attach_at
eye_offset = entity.driver_eye_offset eye_offset = entity.driver_eye_offset
entity.driver = player entity.driver = player
@ -135,7 +129,13 @@ function mobs.attach(entity, player)
player:set_attach(entity.object, "", attach_at, entity.player_rotation) player:set_attach(entity.object, "", attach_at, entity.player_rotation)
default.player_attached[player:get_player_name()] = true default.player_attached[player:get_player_name()] = true
player:set_eye_offset(eye_offset, {x = 0, y = 0, z = 0}) player:set_eye_offset(eye_offset, {x = 0, y = 0, z = 0})
player:set_properties({visual_size = {x=1, y=1}})
player:set_properties({
visual_size = {
x = entity.driver_scale.x,
y = entity.driver_scale.y
}
})
minetest.after(0.2, function() minetest.after(0.2, function()
default.player_set_animation(player, "sit" , 30) default.player_set_animation(player, "sit" , 30)