more mods
@@ -0,0 +1,7 @@
|
||||
## Vespa
|
||||
|
||||
This mod adds a vespa motorcycle to Minetest.
|
||||
|
||||
## Licenses
|
||||
- Code: see [LICENSE](/LICENSE)
|
||||
- Media: see [license_media.txt](/license_media.txt)
|
||||
@@ -0,0 +1,26 @@
|
||||
--
|
||||
-- constants
|
||||
--
|
||||
vespa={}
|
||||
vespa.gravity = automobiles_lib.gravity
|
||||
|
||||
vespa.S = nil
|
||||
|
||||
if(minetest.get_translator ~= nil) then
|
||||
vespa.S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
else
|
||||
vespa.S = function ( s ) return s end
|
||||
|
||||
end
|
||||
|
||||
local S = vespa.S
|
||||
|
||||
dofile(minetest.get_modpath("automobiles_lib") .. DIR_DELIM .. "custom_physics.lua")
|
||||
dofile(minetest.get_modpath("automobiles_lib") .. DIR_DELIM .. "control.lua")
|
||||
dofile(minetest.get_modpath("automobiles_lib") .. DIR_DELIM .. "fuel_management.lua")
|
||||
dofile(minetest.get_modpath("automobiles_lib") .. DIR_DELIM .. "ground_detection.lua")
|
||||
dofile(minetest.get_modpath("automobiles_vespa") .. DIR_DELIM .. "vespa_player.lua")
|
||||
dofile(minetest.get_modpath("automobiles_vespa") .. DIR_DELIM .. "vespa_entities.lua")
|
||||
dofile(minetest.get_modpath("automobiles_vespa") .. DIR_DELIM .. "vespa_crafts.lua")
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# textdomain: automobiles_vespa
|
||||
### motorcycle_crafts.lua ###
|
||||
Vespa Body=Vespa Karrosserie
|
||||
Vespa Wheel=Vesta Rad
|
||||
Vespa=Vespa
|
||||
A very nice vespa!=Eine sehr schöne Vespa!
|
||||
Out of fuel=Kein Sprit mehr
|
||||
Go Offboard=Aussteigen
|
||||
Direction by mouse=Lenken mit Maus
|
||||
@@ -0,0 +1,9 @@
|
||||
# textdomain: automobiles_vespa
|
||||
### motorcycle_crafts.lua ###
|
||||
Vespa Body=Vespa Korpo
|
||||
Vespa Wheel=Vespa Rado
|
||||
Vespa=Vespa
|
||||
A very nice vespa!=
|
||||
Out of fuel=
|
||||
Go Offboard=
|
||||
Direction by mouse=
|
||||
@@ -0,0 +1,9 @@
|
||||
# textdomain: automobiles_vespa
|
||||
### motorcycle_crafts.lua ###
|
||||
Vespa Body=
|
||||
Vespa Wheel=
|
||||
Vespa=
|
||||
A very nice vespa!=
|
||||
Out of fuel=
|
||||
Go Offboard=
|
||||
Direction by mouse=
|
||||
@@ -0,0 +1,5 @@
|
||||
name=automobiles_vespa
|
||||
title=Vespa
|
||||
description=A Vespa motorcycle
|
||||
author=apercy
|
||||
depends=automobiles_lib
|
||||
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,80 @@
|
||||
local S = vespa.S
|
||||
|
||||
--
|
||||
-- items
|
||||
--
|
||||
|
||||
-- body
|
||||
minetest.register_craftitem("automobiles_vespa:body",{
|
||||
description = S("Vespa Body"),
|
||||
inventory_image = "automobiles_vespa_body.png",
|
||||
})
|
||||
-- wheel
|
||||
minetest.register_craftitem("automobiles_vespa:wheel",{
|
||||
description = S("Vespa Wheel"),
|
||||
inventory_image = "automobiles_vespa_wheel_icon.png",
|
||||
})
|
||||
|
||||
-- vespa
|
||||
minetest.register_tool("automobiles_vespa:vespa", {
|
||||
description = S("Vespa"),
|
||||
inventory_image = "automobiles_vespa.png",
|
||||
liquids_pointable = false,
|
||||
stack_max = 1,
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
local stack_meta = itemstack:get_meta()
|
||||
local staticdata = stack_meta:get_string("staticdata")
|
||||
|
||||
local pointed_pos = pointed_thing.above
|
||||
--pointed_pos.y=pointed_pos.y+0.2
|
||||
local car = minetest.add_entity(pointed_pos, "automobiles_vespa:vespa", staticdata)
|
||||
if car and placer then
|
||||
local ent = car:get_luaentity()
|
||||
local owner = placer:get_player_name()
|
||||
if ent then
|
||||
ent.owner = owner
|
||||
ent.hp = 50 --reset hp
|
||||
car:set_yaw(placer:get_look_horizontal())
|
||||
itemstack:take_item()
|
||||
ent.object:set_acceleration({x=0,y=-automobiles_lib.gravity,z=0})
|
||||
automobiles_lib.setText(ent, S("Vespa"))
|
||||
automobiles_lib.create_inventory(ent, ent._trunk_slots, owner)
|
||||
end
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
--
|
||||
-- crafting
|
||||
--
|
||||
if minetest.get_modpath("default") then
|
||||
minetest.register_craft({
|
||||
output = "automobiles_vespa:vespa",
|
||||
recipe = {
|
||||
{"automobiles_vespa:wheel", "automobiles_vespa:body", "automobiles_vespa:wheel"},
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "automobiles_vespa:body",
|
||||
recipe = {
|
||||
{"default:tin_ingot","",""},
|
||||
{"default:tin_ingot","","default:tin_ingot"},
|
||||
{"default:tin_ingot","automobiles_lib:engine", "default:tin_ingot"},
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "automobiles_vespa:wheel",
|
||||
recipe = {
|
||||
{"default:tin_ingot", "", "default:tin_ingot"},
|
||||
{"","default:steelblock", ""},
|
||||
{"default:tin_ingot", "", "default:tin_ingot"},
|
||||
}
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,278 @@
|
||||
--
|
||||
-- entity
|
||||
--
|
||||
|
||||
|
||||
minetest.register_entity('automobiles_vespa:front_suspension',{
|
||||
initial_properties = {
|
||||
physical = true,
|
||||
collide_with_objects=true,
|
||||
collisionbox = {-0.5, 0, -0.5, 0.5, 1, 0.5},
|
||||
pointable=false,
|
||||
visual = "sprite",
|
||||
textures = {"automobiles_alpha.png",},
|
||||
},
|
||||
|
||||
on_activate = function(self,std)
|
||||
self.sdata = minetest.deserialize(std) or {}
|
||||
if self.sdata.remove then self.object:remove() end
|
||||
end,
|
||||
|
||||
get_staticdata=function(self)
|
||||
self.sdata.remove=true
|
||||
return minetest.serialize(self.sdata)
|
||||
end,
|
||||
|
||||
--[[on_step = function(self, dtime, moveresult)
|
||||
minetest.chat_send_all(dump(moveresult))
|
||||
end,]]--
|
||||
|
||||
})
|
||||
|
||||
minetest.register_entity('automobiles_vespa:rear_suspension',{
|
||||
initial_properties = {
|
||||
physical = true,
|
||||
collide_with_objects=true,
|
||||
pointable=false,
|
||||
visual = "sprite",
|
||||
textures = {"automobiles_alpha.png",},
|
||||
},
|
||||
|
||||
on_activate = function(self,std)
|
||||
self.sdata = minetest.deserialize(std) or {}
|
||||
if self.sdata.remove then self.object:remove() end
|
||||
end,
|
||||
|
||||
get_staticdata=function(self)
|
||||
self.sdata.remove=true
|
||||
return minetest.serialize(self.sdata)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
minetest.register_entity('automobiles_vespa:lights',{
|
||||
initial_properties = {
|
||||
physical = false,
|
||||
collide_with_objects=false,
|
||||
pointable=false,
|
||||
glow = 0,
|
||||
visual = "mesh",
|
||||
mesh = "automobiles_vespa_lights.b3d",
|
||||
textures = {"automobiles_grey.png",},
|
||||
},
|
||||
|
||||
on_activate = function(self,std)
|
||||
self.sdata = minetest.deserialize(std) or {}
|
||||
if self.sdata.remove then self.object:remove() end
|
||||
end,
|
||||
|
||||
get_staticdata=function(self)
|
||||
self.sdata.remove=true
|
||||
return minetest.serialize(self.sdata)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
minetest.register_entity('automobiles_vespa:r_lights',{
|
||||
initial_properties = {
|
||||
physical = false,
|
||||
collide_with_objects=false,
|
||||
pointable=false,
|
||||
glow = 0,
|
||||
visual = "mesh",
|
||||
mesh = "automobiles_vespa_r_lights.b3d",
|
||||
textures = {"automobiles_red.png",},
|
||||
},
|
||||
|
||||
on_activate = function(self,std)
|
||||
self.sdata = minetest.deserialize(std) or {}
|
||||
if self.sdata.remove then self.object:remove() end
|
||||
end,
|
||||
|
||||
get_staticdata=function(self)
|
||||
self.sdata.remove=true
|
||||
return minetest.serialize(self.sdata)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
minetest.register_entity("automobiles_vespa:vespa", {
|
||||
initial_properties = {
|
||||
physical = true,
|
||||
collide_with_objects = true,
|
||||
collisionbox = {-0.1, -0.24, -0.1, 0.1, 1, 0.1},
|
||||
selectionbox = {-1.0, 0.0, -1.0, 1.0, 1, 1.0},
|
||||
stepheight = 0.65 + automobiles_lib.extra_stepheight,
|
||||
visual = "mesh",
|
||||
mesh = "automobiles_vespa_body.b3d",
|
||||
backface_culling = false,
|
||||
textures = {
|
||||
"automobiles_black.png", --bancos
|
||||
"automobiles_black.png", --escapamento
|
||||
"automobiles_metal.png", --eixo motor
|
||||
"automobiles_black.png", --motor
|
||||
"automobiles_painting.png", --pintura guidão e paralama
|
||||
"automobiles_black.png", --pneus
|
||||
"automobiles_metal.png", --rodas e aros
|
||||
"automobiles_painting.png", --pintura
|
||||
"automobiles_metal.png", --cromo
|
||||
},
|
||||
},
|
||||
textures = {},
|
||||
driver_name = nil,
|
||||
sound_handle = nil,
|
||||
owner = "",
|
||||
static_save = true,
|
||||
infotext = "A very nice vespa!",
|
||||
hp = 50,
|
||||
buoyancy = 2,
|
||||
physics = automobiles_lib.physics,
|
||||
lastvelocity = vector.new(),
|
||||
time_total = 0,
|
||||
_passenger = nil,
|
||||
_color = "#dc1818",
|
||||
_steering_angle = 0,
|
||||
_engine_running = false,
|
||||
_last_checkpoint = "",
|
||||
_total_laps = -1,
|
||||
_race_id = "",
|
||||
_energy = 1,
|
||||
_last_time_collision_snd = 0,
|
||||
_last_time_drift_snd = 0,
|
||||
_last_time_command = 0,
|
||||
_roll = math.rad(0),
|
||||
_pitch = 0,
|
||||
_longit_speed = 0,
|
||||
_show_rag = false,
|
||||
_show_lights = false,
|
||||
_light_old_pos = nil,
|
||||
_last_ground_check = 0,
|
||||
_last_light_move = 0,
|
||||
_last_engine_sound_update = 0,
|
||||
_turn_light_timer = 0,
|
||||
_inv = nil,
|
||||
_inv_id = "",
|
||||
_change_color = automobiles_lib.paint,
|
||||
_intensity = 2,
|
||||
_trunk_slots = 0,
|
||||
_engine_sound = "vespa_engine",
|
||||
_max_fuel = 3,
|
||||
_base_pitch = 0.7,
|
||||
|
||||
_vehicle_name = "Vespa",
|
||||
_drive_wheel_pos = {x=-4.26,y=6.01,z=14.18},
|
||||
_drive_wheel_angle = 0,
|
||||
_seat_pos = {{x=0.0,y=-1.1,z=5.5},{x=0.0,y=1,z=0.09}},
|
||||
|
||||
_front_suspension_ent = 'automobiles_vespa:front_suspension',
|
||||
_front_suspension_pos = {x=0,y=1.5,z=14.5},
|
||||
--_front_wheel_ent = 'automobiles_lib:wheel',
|
||||
_front_wheel_xpos = 0,
|
||||
_front_wheel_frames = {x = 1, y = 49},
|
||||
_rear_suspension_ent = 'automobiles_vespa:rear_suspension',
|
||||
_rear_suspension_pos = {x=0,y=1.5,z=0},
|
||||
--_rear_wheel_ent = 'automobiles_lib:wheel',
|
||||
_rear_wheel_xpos = 0,
|
||||
_rear_wheel_frames = {x = 1, y = 49},
|
||||
|
||||
_front_lights = 'automobiles_vespa:lights',
|
||||
_rear_lights = 'automobiles_vespa:r_lights',
|
||||
|
||||
_LONGIT_DRAG_FACTOR = 0.15*0.15,
|
||||
_LATER_DRAG_FACTOR = 25.0,
|
||||
_max_acc_factor = 6,
|
||||
_max_speed = 14,
|
||||
_min_later_speed = 5,
|
||||
_have_transmission = false,
|
||||
_is_motorcycle = true,
|
||||
_consumption_divisor = 150000,
|
||||
|
||||
_attach = vespa.attach_driver_stand,
|
||||
_dettach = vespa.dettach_driver_stand,
|
||||
_attach_pax = vespa.attach_pax_stand,
|
||||
_dettach_pax = vespa.dettach_pax_stand,
|
||||
|
||||
get_staticdata = automobiles_lib.get_staticdata,
|
||||
|
||||
on_deactivate = function(self)
|
||||
automobiles_lib.save_inventory(self)
|
||||
end,
|
||||
|
||||
on_activate = function(self, staticdata, dtime_s)
|
||||
automobiles_lib.on_activate(self, staticdata, dtime_s)
|
||||
|
||||
self.object:set_bone_position("guidao", {x=0, y=0, z=14}, {x=22, y=180, z=0})
|
||||
self.lights:set_bone_position("guidao", {x=0, y=0, z=14}, {x=22, y=180, z=0})
|
||||
|
||||
self.object:set_animation(self._rear_wheel_frames, 0, 0, true)
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
automobiles_lib.on_step(self, dtime)
|
||||
|
||||
local angle_factor = self._steering_angle / 10
|
||||
local anim_speed = self._longit_speed * (15 - angle_factor)
|
||||
--core.chat_send_all(dump(anim_speed))
|
||||
self.object:set_animation_frame_speed(anim_speed)
|
||||
--whell turn
|
||||
self.object:set_bone_position("eixo_direcao", {x=0, y=0, z=0}, {x=0, y=-self._steering_angle-angle_factor, z=0})
|
||||
self.lights:set_bone_position("eixo_direcao", {x=0, y=0, z=0}, {x=0, y=-self._steering_angle-angle_factor, z=0})
|
||||
|
||||
local player = nil
|
||||
local is_attached = false
|
||||
if self.driver_name then
|
||||
player = minetest.get_player_by_name(self.driver_name)
|
||||
|
||||
if player then
|
||||
local player_attach = player:get_attach()
|
||||
if player_attach then
|
||||
if self.driver_seat then
|
||||
if player_attach == self.driver_seat or player_attach == self.object then is_attached = true end
|
||||
end
|
||||
end
|
||||
|
||||
local steering_angle_max = 30
|
||||
-- -30 direita -> steering_angle_max
|
||||
-- +30 esquerda
|
||||
local arm_range = 2
|
||||
local range = steering_angle_max * 2
|
||||
local armZ = -((self._steering_angle+steering_angle_max) * arm_range) / 60
|
||||
|
||||
local left_arm_override = {
|
||||
position = { vec={x=3.0, y=5, z=-arm_range-armZ}, absolute = true},
|
||||
rotation = { vec={x=math.rad(70-(self._steering_angle/2)), y=0, z=0}, interpolation = 1, absolute = false }
|
||||
}
|
||||
local right_arm_override = {
|
||||
position = { vec={x=-3.0, y=5, z=armZ}, absolute = true},
|
||||
rotation = { vec={x=math.rad(70+(self._steering_angle/2)), y=0, z=0}, interpolation = 1, absolute = false }
|
||||
}
|
||||
if automobiles_lib.mot_anim_mode then
|
||||
player:set_bone_override("Arm_Left", left_arm_override)
|
||||
player:set_bone_override("Arm_Right", right_arm_override)
|
||||
end
|
||||
|
||||
--player:set_bone_position("Arm_Left", {x=3.0, y=5, z=-arm_range-armZ}, {x=240-(self._steering_angle/2), y=0, z=0})
|
||||
--player:set_bone_position("Arm_Right", {x=-3.0, y=5, z=armZ}, {x=240+(self._steering_angle/2), y=0, z=0})
|
||||
--[[if self.driver_mesh and automobiles_lib.mot_anim_mode then
|
||||
self.driver_mesh:set_bone_position("Arm_Left", {x=3.0, y=5, z=-armZ-0.5}, {x=180+76-(self._steering_angle/2), y=0, z=0})
|
||||
self.driver_mesh:set_bone_position("Arm_Right", {x=-3.0, y=5, z=armZ+1.5}, {x=180+76+(self._steering_angle/2), y=0, z=0})
|
||||
end]]--
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if is_attached == false then
|
||||
--core.chat_send_all("false")
|
||||
self.object:set_bone_position("descanso", {x=0, y=-0.4, z=6.2}, {x=-90, y=0, z=0})
|
||||
else
|
||||
--core.chat_send_all("true")
|
||||
self.object:set_bone_position("descanso", {x=0, y=-0.4, z=6.2}, {x=0, y=0, z=0})
|
||||
end
|
||||
|
||||
end,
|
||||
|
||||
on_punch = automobiles_lib.on_punch,
|
||||
on_rightclick = automobiles_lib.on_rightclick,
|
||||
})
|
||||
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
minetest.register_entity('automobiles_vespa:player_mesh',{
|
||||
initial_properties = {
|
||||
physical = false,
|
||||
collide_with_objects=false,
|
||||
pointable=false,
|
||||
visual = "mesh",
|
||||
mesh = "character.b3d",
|
||||
textures = {"character.png"},
|
||||
is_visible = false,
|
||||
},
|
||||
|
||||
on_activate = function(self,std)
|
||||
self.sdata = minetest.deserialize(std) or {}
|
||||
if self.sdata.remove then self.object:remove() end
|
||||
end,
|
||||
|
||||
get_staticdata=function(self)
|
||||
self.sdata.remove=true
|
||||
return minetest.serialize(self.sdata)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
-- attach player
|
||||
function vespa.attach_driver_stand(self, player)
|
||||
local name = player:get_player_name()
|
||||
self.driver_name = name
|
||||
--[[self.driver_properties = player:get_properties()
|
||||
self.driver_properties.selectionbox = nil
|
||||
self.driver_properties.pointable = false
|
||||
self.driver_properties.show_on_minimap = false
|
||||
self.driver_properties.static_save = nil
|
||||
self.driver_properties.makes_footstep_sound = nil]]--
|
||||
--minetest.chat_send_all(dump(self.driver_properties))
|
||||
|
||||
-- attach the driver
|
||||
local x_pos = 0 --WHY?! because after the 5.9.1 version the motorcycle got an strange shaking. But when I move it from the center, it ceases. Then I use the camera center bug.
|
||||
--player:set_attach(self.driver_seat, "", {x = x_pos, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
||||
player:set_attach(self.object, "", self._seat_pos[1], {x = 0, y = 0, z = 0})
|
||||
--player:set_eye_offset({x = 0, y = 0, z = 1.5}, {x = 0, y = 3, z = -30})
|
||||
player:set_eye_offset({x = self._seat_pos[1].x, y = 0, z = self._seat_pos[1].z}, {x = 0, y = 3, z = -30})
|
||||
if automobiles_lib.is_minetest then
|
||||
player_api.player_attached[name] = true
|
||||
elseif automobiles_lib.is_mcl then
|
||||
mcl_player.player_attached[name] = true
|
||||
end
|
||||
|
||||
-- makes it "invisible"
|
||||
--player:set_properties({mesh = "automobiles_pivot_mesh.b3d"})
|
||||
|
||||
|
||||
--create the dummy mesh
|
||||
--[[local pos = player:get_pos()
|
||||
local driver_mesh=minetest.add_entity(pos,'automobiles_vespa:player_mesh')
|
||||
driver_mesh:set_attach(player,'',{x=x_pos*-1,y=-0.0,z=0.0},{x=0,y=0,z=0})
|
||||
self.driver_mesh = driver_mesh
|
||||
self.driver_mesh:set_properties({is_visible=false})]]--
|
||||
|
||||
--position the dummy arms and legs
|
||||
--self.driver_mesh:set_properties(self.driver_properties)
|
||||
if automobiles_lib.mot_anim_mode then
|
||||
--self.driver_mesh:set_bone_position("Leg_Left", {x=1.1, y=1, z=0}, {x=180+12, y=0, z=7})
|
||||
--self.driver_mesh:set_bone_position("Leg_Right", {x=-1.1, y=1, z=0}, {x=180+12, y=0, z=-7})
|
||||
local left_leg_override = {
|
||||
position = { vec={x=1.1, y=1, z=0}, absolute = true},
|
||||
rotation = { vec={x=math.rad(12),y=0,z=math.rad(-7)}, interpolation = 1, absolute = false }
|
||||
}
|
||||
local right_leg_override = {
|
||||
position = { vec={x=-1.1, y=1, z=0}, absolute = true},
|
||||
rotation = { vec={x=math.rad(12),y=0,z=math.rad(7)}, interpolation = 1, absolute = false }
|
||||
}
|
||||
player:set_bone_override("Leg_Left", left_leg_override)
|
||||
player:set_bone_override("Leg_Right", right_leg_override)
|
||||
end
|
||||
--[[self.driver_mesh:set_properties({
|
||||
is_visible=true,
|
||||
})]]--
|
||||
end
|
||||
|
||||
function vespa.dettach_driver_stand(self, player)
|
||||
local name = self.driver_name
|
||||
|
||||
--self._engine_running = false
|
||||
|
||||
-- driver clicked the object => driver gets off the vehicle
|
||||
self.driver_name = nil
|
||||
|
||||
if self._engine_running then
|
||||
self._engine_running = false
|
||||
end
|
||||
-- sound and animation
|
||||
if self.sound_handle then
|
||||
minetest.sound_stop(self.sound_handle)
|
||||
self.sound_handle = nil
|
||||
end
|
||||
|
||||
-- detach the player
|
||||
if player then
|
||||
--automobiles_lib.remove_hud(player)
|
||||
|
||||
player:set_detach()
|
||||
player:set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})
|
||||
if automobiles_lib.is_minetest then
|
||||
if player_api.player_attached[name] then
|
||||
player_api.player_attached[name] = nil
|
||||
end
|
||||
player_api.set_animation(player, "stand")
|
||||
elseif automobiles_lib.is_mcl then
|
||||
if mcl_player.player_attached[name] then
|
||||
mcl_player.player_attached[name] = nil
|
||||
end
|
||||
mcl_player.player_set_animation(player, "stand")
|
||||
end
|
||||
|
||||
|
||||
--[[if self.driver_properties then
|
||||
player:set_properties({mesh = self.driver_properties.mesh})
|
||||
self.driver_properties = nil
|
||||
end]]--
|
||||
player:set_bone_override("Leg_Left", {})
|
||||
player:set_bone_override("Leg_Right", {})
|
||||
player:set_bone_override("Arm_Left", {})
|
||||
player:set_bone_override("Arm_Right", {})
|
||||
end
|
||||
|
||||
--player:set_properties({visual_size = {x=1, y=1}})
|
||||
if self.driver_mesh then
|
||||
self.driver_mesh:set_properties({is_visible=false})
|
||||
self.driver_mesh:remove()
|
||||
end
|
||||
self.driver = nil
|
||||
end
|
||||
|
||||
-- attach passenger
|
||||
function vespa.attach_pax_stand(self, player)
|
||||
local onside = onside or false
|
||||
local name = player:get_player_name()
|
||||
|
||||
--[[self.pax_properties = player:get_properties()
|
||||
self.pax_properties.selectionbox = nil
|
||||
self.pax_properties.pointable = false
|
||||
self.pax_properties.show_on_minimap = false
|
||||
self.pax_properties.static_save = nil
|
||||
self.pax_properties.makes_footstep_sound = nil]]--
|
||||
|
||||
if self._passenger == nil then
|
||||
self._passenger = name
|
||||
|
||||
-- attach the driver
|
||||
local x_pos = 0 --WHY?! because after the 5.9.1 version the motorcycle got an strange shaking. But when I move it from the center, it ceases. Then I use the camera center bug.
|
||||
--player:set_attach(self.passenger_seat, "", {x = x_pos, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
||||
player:set_attach(self.object, "", self._seat_pos[2], {x = 0, y = 0, z = 0})
|
||||
--player:set_eye_offset({x = 0, y = 3, z = 0}, {x = 0, y = 3, z = -30})
|
||||
player:set_eye_offset({x = self._seat_pos[2].x, y = 3, z = self._seat_pos[2].z}, {x = 0, y = 3, z = -30})
|
||||
if automobiles_lib.is_minetest then
|
||||
player_api.player_attached[name] = true
|
||||
elseif automobiles_lib.is_mcl then
|
||||
mcl_player.player_attached[name] = true
|
||||
end
|
||||
|
||||
-- makes it "invisible"
|
||||
--player:set_properties({mesh = "automobiles_pivot_mesh.b3d"})
|
||||
|
||||
--create the dummy mesh
|
||||
--[[local pos = player:get_pos()
|
||||
local pax_mesh=minetest.add_entity(pos,'automobiles_vespa:player_mesh')
|
||||
pax_mesh:set_attach(player,'',{x=x_pos*-1,y=-0.0,z=0.0},{x=0,y=0,z=0})
|
||||
self.pax_mesh = pax_mesh
|
||||
self.pax_mesh:set_properties({is_visible=false})]]--
|
||||
|
||||
--position the dummy arms and legs
|
||||
--self.pax_mesh:set_properties(self.pax_properties)
|
||||
if automobiles_lib.mot_anim_mode then
|
||||
--[[self.pax_mesh:set_bone_position("Leg_Left", {x=1.1, y=0, z=0}, {x=180+12, y=0, z=15})
|
||||
self.pax_mesh:set_bone_position("Leg_Right", {x=-1.1, y=0, z=0}, {x=180+12, y=0, z=-15})
|
||||
|
||||
self.pax_mesh:set_bone_position("Arm_Left", {x=3.0, y=5, z=0}, {x=180+45, y=0, z=0})
|
||||
self.pax_mesh:set_bone_position("Arm_Right", {x=-3.0, y=5, z=0}, {x=180+45, y=0, z=0})]]--
|
||||
|
||||
local left_leg_override = {
|
||||
position = { vec={x=1.1, y=0, z=0}, absolute = true},
|
||||
rotation = { vec={x=math.rad(12),y=0,z=math.rad(-15)}, interpolation = 1, absolute = false }
|
||||
}
|
||||
local right_leg_override = {
|
||||
position = { vec={x=-1.1, y=0, z=0}, absolute = true},
|
||||
rotation = { vec={x=math.rad(12),y=0,z=math.rad(15)}, interpolation = 1, absolute = false }
|
||||
}
|
||||
player:set_bone_override("Leg_Left", left_leg_override)
|
||||
player:set_bone_override("Leg_Right", right_leg_override)
|
||||
|
||||
local left_arm_override = {
|
||||
position = { vec={x=3.0, y=5, z=0}, absolute = true},
|
||||
rotation = { vec={x=math.rad(45),y=0,z=0}, interpolation = 1, absolute = false }
|
||||
}
|
||||
local right_arm_override = {
|
||||
position = { vec={x=-3.0, y=5, z=0}, absolute = true},
|
||||
rotation = { vec={x=math.rad(45),y=0,z=0}, interpolation = 1, absolute = false }
|
||||
}
|
||||
player:set_bone_override("Arm_Left", left_arm_override)
|
||||
player:set_bone_override("Arm_Right", right_arm_override)
|
||||
|
||||
end
|
||||
--[[self.pax_mesh:set_properties({
|
||||
is_visible=true,
|
||||
})]]--
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function vespa.dettach_pax_stand(self, player)
|
||||
if not player then return end
|
||||
local name = player:get_player_name() --self._passenger
|
||||
|
||||
-- passenger clicked the object => driver gets off the vehicle
|
||||
if self._passenger == name then
|
||||
self._passenger = nil
|
||||
end
|
||||
|
||||
-- detach the player
|
||||
if player then
|
||||
--player:set_properties({physical=true})
|
||||
player:set_detach()
|
||||
player:set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})
|
||||
|
||||
if automobiles_lib.is_minetest then
|
||||
if player_api.player_attached[name] then
|
||||
player_api.player_attached[name] = nil
|
||||
end
|
||||
player_api.set_animation(player, "stand")
|
||||
elseif automobiles_lib.is_mcl then
|
||||
if mcl_player.player_attached[name] then
|
||||
mcl_player.player_attached[name] = nil
|
||||
end
|
||||
mcl_player.player_set_animation(player, "stand")
|
||||
end
|
||||
|
||||
--[[if self.pax_properties then
|
||||
player:set_properties({mesh = self.pax_properties.mesh})
|
||||
self.pax_properties = nil
|
||||
end]]--
|
||||
player:set_bone_override("Leg_Left", {})
|
||||
player:set_bone_override("Leg_Right", {})
|
||||
player:set_bone_override("Arm_Left", {})
|
||||
player:set_bone_override("Arm_Right", {})
|
||||
end
|
||||
--player:set_properties({visual_size = {x=1, y=1}})
|
||||
if self.pax_mesh then
|
||||
self.pax_mesh:set_properties({is_visible=false})
|
||||
self.pax_mesh:remove()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||