mirror of
https://github.com/APercy/automobiles_pck
synced 2025-10-02 15:46:24 +02:00
delorean improvements
This commit is contained in:
parent
3d4b653974
commit
c017d5ee53
@ -78,20 +78,12 @@ initial_properties = {
|
|||||||
"automobiles_black.png", --conductors
|
"automobiles_black.png", --conductors
|
||||||
"automobiles_black.png", --ok
|
"automobiles_black.png", --ok
|
||||||
"automobiles_delorean_brass.png", --ok
|
"automobiles_delorean_brass.png", --ok
|
||||||
"automobiles_metal.png", --time panel
|
|
||||||
"automobiles_delorean_time.png", --time panel
|
|
||||||
"automobiles_metal.png", --base circuit switch
|
"automobiles_metal.png", --base circuit switch
|
||||||
"automobiles_red.png", --red button
|
"automobiles_red.png", --red button
|
||||||
"automobiles_dark_grey.png", --ok
|
"automobiles_dark_grey.png", --ok
|
||||||
"automobiles_delorean_brass.png", --ok
|
"automobiles_delorean_brass.png", --ok
|
||||||
"automobiles_black.png", --electric switch
|
"automobiles_black.png", --electric switch
|
||||||
"automobiles_metal.png", -- flux capacitor
|
|
||||||
"automobiles_delorean_flux.png", --flux capacitor
|
|
||||||
"automobiles_black.png", --flux capacitor
|
|
||||||
"automobiles_dark_grey.png", --base
|
"automobiles_dark_grey.png", --base
|
||||||
"automobiles_dark_grey.png", --roof panel
|
|
||||||
"automobiles_delorean_roof_1.png", --root panel
|
|
||||||
"automobiles_delorean_roof_2.png", --roof panel
|
|
||||||
"automobiles_metal.png", --f bump
|
"automobiles_metal.png", --f bump
|
||||||
"automobiles_dark_grey.png", --f bump
|
"automobiles_dark_grey.png", --f bump
|
||||||
"automobiles_metal.png"},
|
"automobiles_metal.png"},
|
||||||
@ -113,6 +105,42 @@ initial_properties = {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_entity('automobiles_delorean:time_machine_kit_instruments',{
|
||||||
|
initial_properties = {
|
||||||
|
physical = true,
|
||||||
|
collide_with_objects=true,
|
||||||
|
collisionbox = {-0.5, 0, -0.5, 0.5, 1, 0.5},
|
||||||
|
pointable=false,
|
||||||
|
visual = "mesh",
|
||||||
|
mesh = "automobiles_delorean_time_machine_instruments.b3d",
|
||||||
|
textures = {
|
||||||
|
"automobiles_metal.png", --time panel
|
||||||
|
"automobiles_delorean_time.png", --time panel
|
||||||
|
"automobiles_metal.png", -- flux capacitor
|
||||||
|
"automobiles_delorean_flux.png", --flux capacitor
|
||||||
|
"automobiles_black.png", --flux capacitor
|
||||||
|
"automobiles_dark_grey.png", --roof panel
|
||||||
|
"automobiles_delorean_roof_1.png", --root panel
|
||||||
|
"automobiles_delorean_roof_2.png", --roof panel
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
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_delorean:front_suspension',{
|
minetest.register_entity('automobiles_delorean:front_suspension',{
|
||||||
initial_properties = {
|
initial_properties = {
|
||||||
@ -583,41 +611,8 @@ minetest.register_entity("automobiles_delorean:delorean", {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--to fix the load on first time
|
--to fix the load on first time and turn on the lights of time machine
|
||||||
if self._delorean_type == 1 then
|
delorean.set_mode(self, is_attached, curr_pos, velocity, player, dtime)
|
||||||
local ent_propertioes = self.normal_kit:get_properties()
|
|
||||||
if ent_propertioes.mesh ~= "automobiles_delorean_time_machine_accessories.b3d" then
|
|
||||||
delorean.set_kit(self)
|
|
||||||
end
|
|
||||||
--start flight functions
|
|
||||||
if self._is_flying == 1 then
|
|
||||||
if is_attached then
|
|
||||||
delorean.control_flight(self, player)
|
|
||||||
end
|
|
||||||
delorean.gravity_auto_correction(self, dtime)
|
|
||||||
|
|
||||||
--check if is near the ground, so revert the flight mode
|
|
||||||
local noded = automobiles_lib.nodeatpos(automobiles_lib.pos_shift(curr_pos,{y=-0.6}))
|
|
||||||
if (noded and noded.drawtype ~= 'airlike') then
|
|
||||||
if noded.drawtype ~= 'liquid' then
|
|
||||||
self._is_flying = 0
|
|
||||||
end
|
|
||||||
--avoid liquids
|
|
||||||
if noded.drawtype == 'liquid' then
|
|
||||||
self._car_gravity = 5
|
|
||||||
local fixed_vel = velocity
|
|
||||||
fixed_vel.y = 0.1
|
|
||||||
self.lastvelocity.y = fixed_vel.y --do not compute collision after
|
|
||||||
self.object:set_velocity(fixed_vel)
|
|
||||||
--curr_pos.y = curr_pos.y + 0.5
|
|
||||||
--self.object:move_to(curr_pos)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
else
|
|
||||||
self._car_gravity = -automobiles_lib.gravity
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local is_breaking = false
|
local is_breaking = false
|
||||||
if is_attached then
|
if is_attached then
|
||||||
@ -949,8 +944,8 @@ minetest.register_entity("automobiles_delorean:delorean", {
|
|||||||
--is the owner, okay, lets attach
|
--is the owner, okay, lets attach
|
||||||
automobiles_lib.attach_driver(self, clicker)
|
automobiles_lib.attach_driver(self, clicker)
|
||||||
-- sound
|
-- sound
|
||||||
self.sound_handle = minetest.sound_play({name = "automobiles_engine"},
|
self.sound_handle = minetest.sound_play({name = delorean.engine_sound},
|
||||||
{object = self.object, gain = 4, pitch = 1, max_hear_distance = 30, loop = true,})
|
{object = self.object, gain = 1.5, pitch = 1, max_hear_distance = 30, loop = true,})
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
--minetest.chat_send_all("clicou")
|
--minetest.chat_send_all("clicou")
|
||||||
|
@ -13,6 +13,11 @@ function delorean.set_kit(self)
|
|||||||
normal_kit:set_attach(self.object,'',{x=0,y=0,z=0},{x=0,y=0,z=0})
|
normal_kit:set_attach(self.object,'',{x=0,y=0,z=0},{x=0,y=0,z=0})
|
||||||
self.normal_kit = normal_kit
|
self.normal_kit = normal_kit
|
||||||
self.normal_kit:set_properties({is_visible=true})
|
self.normal_kit:set_properties({is_visible=true})
|
||||||
|
|
||||||
|
local instruments = minetest.add_entity(pos,'automobiles_delorean:time_machine_kit_instruments')
|
||||||
|
instruments:set_attach(self.object,'',{x=0,y=0,z=0},{x=0,y=0,z=0})
|
||||||
|
self.instruments = instruments
|
||||||
|
self.instruments:set_properties({is_visible=true})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -89,3 +94,68 @@ function delorean.turn_flight_mode(self)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function delorean.set_mode(self, is_attached, curr_pos, velocity, player, dtime)
|
||||||
|
if self._delorean_type == 1 then
|
||||||
|
local ent_propertioes = self.normal_kit:get_properties()
|
||||||
|
if ent_propertioes.mesh ~= "automobiles_delorean_time_machine_accessories.b3d" then
|
||||||
|
delorean.set_kit(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
if is_attached == true then
|
||||||
|
self.instruments:set_properties(
|
||||||
|
{
|
||||||
|
textures={
|
||||||
|
"automobiles_metal.png", --time panel
|
||||||
|
"automobiles_delorean_time.png", --time panel
|
||||||
|
"automobiles_metal.png", -- flux capacitor
|
||||||
|
"automobiles_delorean_flux.png", --flux capacitor
|
||||||
|
"automobiles_black.png", --flux capacitor
|
||||||
|
"automobiles_dark_grey.png", --roof panel
|
||||||
|
"automobiles_delorean_roof_1.png", --root panel
|
||||||
|
"automobiles_delorean_roof_2.png", --roof panel
|
||||||
|
}, glow=15}
|
||||||
|
)
|
||||||
|
else
|
||||||
|
self.instruments:set_properties(
|
||||||
|
{
|
||||||
|
textures={
|
||||||
|
"automobiles_metal.png", --time panel
|
||||||
|
"automobiles_delorean_time_off.png", --time panel
|
||||||
|
"automobiles_metal.png", -- flux capacitor
|
||||||
|
"automobiles_delorean_flux_off.png", --flux capacitor
|
||||||
|
"automobiles_black.png", --flux capacitor
|
||||||
|
"automobiles_dark_grey.png", --roof panel
|
||||||
|
"automobiles_delorean_roof_1_off.png", --root panel
|
||||||
|
"automobiles_delorean_roof_2_off.png", --roof panel
|
||||||
|
}, glow=0}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
--start flight functions
|
||||||
|
if self._is_flying == 1 then
|
||||||
|
if is_attached then
|
||||||
|
delorean.control_flight(self, player)
|
||||||
|
end
|
||||||
|
delorean.gravity_auto_correction(self, dtime)
|
||||||
|
|
||||||
|
--check if is near the ground, so revert the flight mode
|
||||||
|
local noded = automobiles_lib.nodeatpos(automobiles_lib.pos_shift(curr_pos,{y=-0.6}))
|
||||||
|
if (noded and noded.drawtype ~= 'airlike') then
|
||||||
|
if noded.drawtype ~= 'liquid' then
|
||||||
|
self._is_flying = 0
|
||||||
|
end
|
||||||
|
--avoid liquids
|
||||||
|
if noded.drawtype == 'liquid' then
|
||||||
|
self._car_gravity = 5
|
||||||
|
local fixed_vel = velocity
|
||||||
|
fixed_vel.y = 0.1
|
||||||
|
self.lastvelocity.y = fixed_vel.y --do not compute collision after
|
||||||
|
self.object:set_velocity(fixed_vel)
|
||||||
|
--curr_pos.y = curr_pos.y + 0.5
|
||||||
|
--self.object:move_to(curr_pos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ delorean.max_acc_factor = 8
|
|||||||
delorean.max_fuel = 10
|
delorean.max_fuel = 10
|
||||||
delorean.trunk_slots = 8
|
delorean.trunk_slots = 8
|
||||||
delorean.ideal_step = 0.2
|
delorean.ideal_step = 0.2
|
||||||
|
delorean.engine_sound = "delorean_engine"
|
||||||
|
|
||||||
DELOREAN_GAUGE_FUEL_POSITION = {x=-4.66,y=6.2,z=17.9}
|
DELOREAN_GAUGE_FUEL_POSITION = {x=-4.66,y=6.2,z=17.9}
|
||||||
|
|
||||||
|
Binary file not shown.
BIN
automobiles_delorean/models/automobiles_delorean_time_machine_instruments.b3d
Executable file
BIN
automobiles_delorean/models/automobiles_delorean_time_machine_instruments.b3d
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
BIN
automobiles_delorean/textures/automobiles_delorean_flux_off.png
Normal file
BIN
automobiles_delorean/textures/automobiles_delorean_flux_off.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.9 KiB |
BIN
automobiles_delorean/textures/automobiles_delorean_time_off.png
Normal file
BIN
automobiles_delorean/textures/automobiles_delorean_time_off.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
@ -37,6 +37,7 @@ function delorean.destroy(self, puncher)
|
|||||||
if self.r_lights then self.r_lights:remove() end
|
if self.r_lights then self.r_lights:remove() end
|
||||||
if self.reverse_lights then self.reverse_lights:remove() end
|
if self.reverse_lights then self.reverse_lights:remove() end
|
||||||
if self.normal_kit then self.normal_kit:remove() end
|
if self.normal_kit then self.normal_kit:remove() end
|
||||||
|
if self.instruments then self.instruments:remove() end
|
||||||
if self.turn_l_light then self.turn_l_light:remove() end
|
if self.turn_l_light then self.turn_l_light:remove() end
|
||||||
if self.turn_r_light then self.turn_r_light:remove() end
|
if self.turn_r_light then self.turn_r_light:remove() end
|
||||||
|
|
||||||
@ -67,8 +68,8 @@ function delorean.engineSoundPlay(self)
|
|||||||
--sound
|
--sound
|
||||||
if self.sound_handle then minetest.sound_stop(self.sound_handle) end
|
if self.sound_handle then minetest.sound_stop(self.sound_handle) end
|
||||||
if self.object then
|
if self.object then
|
||||||
self.sound_handle = minetest.sound_play({name = "automobiles_engine"},
|
self.sound_handle = minetest.sound_play({name = delorean.engine_sound},
|
||||||
{object = self.object, gain = 8,
|
{object = self.object, gain = 2,
|
||||||
pitch = 1 + ((self._longit_speed/10)/2),
|
pitch = 1 + ((self._longit_speed/10)/2),
|
||||||
max_hear_distance = 10,
|
max_hear_distance = 10,
|
||||||
loop = true,})
|
loop = true,})
|
||||||
|
Loading…
Reference in New Issue
Block a user