给所以东西加上重力,给无司机的船加上浮力
This commit is contained in:
parent
ec014e7280
commit
dde25b0798
56
api.lua
56
api.lua
@ -525,3 +525,59 @@ function vehicles.on_punch(self, puncher)
|
||||
vehicles.explodinate(self, 5)
|
||||
end
|
||||
end
|
||||
|
||||
function vehicles.object_no_drive(entity, dtime, def)
|
||||
--definition
|
||||
local decell = def.decell or 0
|
||||
local gravity = def.gravity or 1
|
||||
local is_watercraft = def.is_watercraft or false
|
||||
local stand_anim = def.stand_anim
|
||||
|
||||
--variables
|
||||
local velo = entity.object:getvelocity()
|
||||
local pos = entity.object:getpos()
|
||||
local node = minetest.get_node(pos).name
|
||||
|
||||
--timer dependant variables
|
||||
local vec_stop = {x=velo.x*decell,y=velo.y-gravity,z=velo.z*decell}
|
||||
|
||||
--respond to controls
|
||||
--check for water
|
||||
local function is_water(node)
|
||||
return node == "default:river_water_source" or node == "default:water_source" or node == "default:river_water_flowing" or node == "default:water_flowing"
|
||||
end
|
||||
entity.on_water = is_water(node)
|
||||
entity.in_water = is_water(minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name) or is_water(minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z}).name)
|
||||
|
||||
--apply water effects
|
||||
if is_watercraft and entity.in_water then
|
||||
entity.object:setvelocity({x=velo.x*0.9, y=velo.y+5, z=velo.z*0.9})
|
||||
elseif is_watercraft and entity.on_water == false then
|
||||
entity.object:setvelocity({x=velo.x*decell,y=velo.y-1,z=velo.z*decell})
|
||||
elseif entity.on_water and not is_watercraft then
|
||||
entity.object:setvelocity({x=velo.x*0.9, y=-1, z=velo.z*0.9})
|
||||
else
|
||||
--stop
|
||||
entity.object:setvelocity(vec_stop)
|
||||
--animation
|
||||
if moving_anim ~= nil and entity.moving and not hovering then
|
||||
entity.object:set_animation(stand_anim, 20, 0)
|
||||
entity.moving = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function vehicles.on_step(self, dtime, def, have, no)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, def)
|
||||
if have ~= nil then
|
||||
have()
|
||||
end
|
||||
else
|
||||
vehicles.object_no_drive(self, dtime, def)
|
||||
if no ~= nil then
|
||||
no()
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
265
init.lua
265
init.lua
@ -297,8 +297,7 @@ minetest.register_entity("vehicles:tank", {
|
||||
end,
|
||||
on_punch = vehicles.on_punch,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 6,
|
||||
decell = 0.5,
|
||||
shoots = true,
|
||||
@ -308,9 +307,6 @@ minetest.register_entity("vehicles:tank", {
|
||||
stand_anim = {x=1, y=1},
|
||||
shoot_anim = {x=1, y=1},
|
||||
})
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
@ -372,8 +368,7 @@ minetest.register_entity("vehicles:assaultsuit", {
|
||||
end,
|
||||
on_punch = vehicles.on_punch,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 6,
|
||||
decell = 0.5,
|
||||
shoots = true,
|
||||
@ -390,16 +385,14 @@ minetest.register_entity("vehicles:assaultsuit", {
|
||||
shoot_anim2 = {x=40, y=51},
|
||||
shoot_y = 3.5,
|
||||
shoot_y2 = 4,
|
||||
})
|
||||
self.standing = false
|
||||
return false
|
||||
else
|
||||
if not standing then
|
||||
},
|
||||
function() self.standing = false end,
|
||||
function()
|
||||
if not self.standing then
|
||||
self.object:set_animation({x=1, y=1}, 20, 0)
|
||||
self.standing = true
|
||||
end
|
||||
end
|
||||
return true
|
||||
end)
|
||||
end,
|
||||
})
|
||||
|
||||
@ -424,8 +417,7 @@ minetest.register_entity("vehicles:firetruck", {
|
||||
end,
|
||||
on_punch = vehicles.on_punch,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 7,
|
||||
decell = 0.5,
|
||||
shoots = true,
|
||||
@ -435,9 +427,6 @@ minetest.register_entity("vehicles:firetruck", {
|
||||
driving_sound = "engine",
|
||||
sound_duration = 11,
|
||||
})
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
@ -477,8 +466,7 @@ minetest.register_entity("vehicles:geep", {
|
||||
self.nitro = true
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 14,
|
||||
decell = 0.6,
|
||||
boost = true,
|
||||
@ -486,7 +474,8 @@ minetest.register_entity("vehicles:geep", {
|
||||
boost_effect = "vehicles_nitro.png",
|
||||
sound_duration = 11,
|
||||
driving_sound = "engine"
|
||||
})
|
||||
},
|
||||
function()
|
||||
local pos = self.object:getpos()
|
||||
minetest.add_particlespawner(
|
||||
15, --amount
|
||||
@ -504,9 +493,7 @@ minetest.register_entity("vehicles:geep", {
|
||||
false, --collisiondetection
|
||||
"vehicles_dust.png" --texture
|
||||
)
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end)
|
||||
end,
|
||||
})
|
||||
|
||||
@ -547,15 +534,15 @@ minetest.register_entity("vehicles:ambulance", {
|
||||
self.nitro = true
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 13,
|
||||
decell = 0.6,
|
||||
moving_anim = {x=1, y=3},
|
||||
stand_anim = {x=1, y=1},
|
||||
driving_sound = "engine",
|
||||
sound_duration = 11,
|
||||
})
|
||||
},
|
||||
function()
|
||||
if not self.siren_ready then
|
||||
minetest.sound_play("ambulance",
|
||||
{gain = 0.1, max_hear_distance = 3, loop = false})
|
||||
@ -564,9 +551,7 @@ minetest.register_entity("vehicles:ambulance", {
|
||||
self.siren_ready = false
|
||||
end)
|
||||
end
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end)
|
||||
end,
|
||||
})
|
||||
|
||||
@ -606,8 +591,7 @@ minetest.register_entity("vehicles:ute", {
|
||||
self.nitro = true
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 14,
|
||||
decell = 0.6,
|
||||
boost = true,
|
||||
@ -615,7 +599,8 @@ minetest.register_entity("vehicles:ute", {
|
||||
boost_effect = "vehicles_nitro.png",
|
||||
driving_sound = "engine",
|
||||
sound_duration = 11,
|
||||
})
|
||||
},
|
||||
function()
|
||||
local pos = self.object:getpos()
|
||||
minetest.add_particlespawner(
|
||||
15, --amount
|
||||
@ -633,9 +618,7 @@ minetest.register_entity("vehicles:ute", {
|
||||
false, --collisiondetection
|
||||
"vehicles_dust.png" --texture
|
||||
)
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end)
|
||||
end,
|
||||
})
|
||||
|
||||
@ -675,8 +658,7 @@ minetest.register_entity("vehicles:ute2", {
|
||||
self.nitro = true
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 14,
|
||||
decell = 0.6,
|
||||
boost = true,
|
||||
@ -685,9 +667,6 @@ minetest.register_entity("vehicles:ute2", {
|
||||
driving_sound = "engine",
|
||||
sound_duration = 11,
|
||||
})
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
@ -721,8 +700,7 @@ minetest.register_entity("vehicles:astonmaaton", {
|
||||
self.nitro = true
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 14,
|
||||
decell = 0.8,
|
||||
boost = true,
|
||||
@ -731,9 +709,6 @@ minetest.register_entity("vehicles:astonmaaton", {
|
||||
driving_sound = "engine",
|
||||
sound_duration = 11,
|
||||
})
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
@ -767,8 +742,7 @@ minetest.register_entity("vehicles:nizzan", {
|
||||
self.nitro = true
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 14,
|
||||
decell = 0.8,
|
||||
boost = true,
|
||||
@ -776,7 +750,8 @@ minetest.register_entity("vehicles:nizzan", {
|
||||
boost_effect = "vehicles_nitro.png",
|
||||
driving_sound = "engine",
|
||||
sound_duration = 11,
|
||||
})
|
||||
},
|
||||
function()
|
||||
local pos = self.object:getpos()
|
||||
minetest.add_particlespawner(
|
||||
15, --amount
|
||||
@ -794,9 +769,7 @@ minetest.register_entity("vehicles:nizzan", {
|
||||
false, --collisiondetection
|
||||
"vehicles_dust.png" --texture
|
||||
)
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end)
|
||||
end,
|
||||
})
|
||||
|
||||
@ -830,8 +803,7 @@ minetest.register_entity("vehicles:nizzan2", {
|
||||
end,
|
||||
on_punch = vehicles.on_punch,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 14,
|
||||
decell = 0.8,
|
||||
boost = true,
|
||||
@ -839,7 +811,8 @@ minetest.register_entity("vehicles:nizzan2", {
|
||||
boost_effect = "vehicles_nitro.png",
|
||||
driving_sound = "engine",
|
||||
sound_duration = 11,
|
||||
})
|
||||
},
|
||||
function()
|
||||
local pos = self.object:getpos()
|
||||
minetest.add_particlespawner(
|
||||
15, --amount
|
||||
@ -857,9 +830,7 @@ minetest.register_entity("vehicles:nizzan2", {
|
||||
false, --collisiondetection
|
||||
"vehicles_dust.png" --texture
|
||||
)
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end)
|
||||
end,
|
||||
})
|
||||
|
||||
@ -893,8 +864,7 @@ minetest.register_entity("vehicles:lambogoni", {
|
||||
self.nitro = true
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 15,
|
||||
decell = 0.8,
|
||||
boost = true,
|
||||
@ -903,9 +873,6 @@ minetest.register_entity("vehicles:lambogoni", {
|
||||
driving_sound = "engine",
|
||||
sound_duration = 11,
|
||||
})
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
@ -939,8 +906,7 @@ minetest.register_entity("vehicles:lambogoni2", {
|
||||
self.nitro = true
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 15,
|
||||
decell = 0.8,
|
||||
boost = true,
|
||||
@ -949,9 +915,6 @@ minetest.register_entity("vehicles:lambogoni2", {
|
||||
driving_sound = "engine",
|
||||
sound_duration = 11,
|
||||
})
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
@ -985,8 +948,7 @@ minetest.register_entity("vehicles:masda", {
|
||||
self.nitro = true
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 15,
|
||||
decell = 0.95,
|
||||
boost = true,
|
||||
@ -995,14 +957,53 @@ minetest.register_entity("vehicles:masda", {
|
||||
driving_sound = "engine",
|
||||
sound_duration = 11,
|
||||
})
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
vehicles.register_spawner("vehicles:masda", "Masda (pink)", "vehicles_masda_inv.png")
|
||||
|
||||
minetest.register_entity("vehicles:masda2", {
|
||||
visual = "mesh",
|
||||
mesh = "masda.b3d",
|
||||
textures = {"vehicles_masda2.png"},
|
||||
velocity = 15,
|
||||
acceleration = -5,
|
||||
stepheight = step,
|
||||
hp_max = 200,
|
||||
physical = true,
|
||||
collisionbox = {-1, 0, -1, 1.3, 1, 1},
|
||||
on_rightclick = function(self, clicker)
|
||||
if self.driver and clicker == self.driver then
|
||||
object_detach(self, clicker, {x=1, y=0, z=1})
|
||||
elseif not self.driver then
|
||||
vehicles.object_attach(self, clicker, {x=0, y=5, z=4}, false, {x=0, y=2, z=4})
|
||||
minetest.sound_play("engine_start",
|
||||
{gain = 4, max_hear_distance = 3, loop = false})
|
||||
self.sound_ready = false
|
||||
minetest.after(14, function()
|
||||
self.sound_ready = true
|
||||
end)
|
||||
end
|
||||
end,
|
||||
on_activate = function(self)
|
||||
self.nitro = true
|
||||
end,
|
||||
on_punch = vehicles.on_punch,
|
||||
on_step = function(self, dtime)
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 15,
|
||||
decell = 0.85,
|
||||
boost = true,
|
||||
boost_duration = 4,
|
||||
boost_effect = "vehicles_nitro.png",
|
||||
driving_sound = "engine",
|
||||
sound_duration = 11,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
vehicles.register_spawner("vehicles:masda2", "Masda (orange)", "vehicles_masda_inv2.png")
|
||||
|
||||
minetest.register_entity("vehicles:policecar", {
|
||||
visual = "mesh",
|
||||
mesh = "policecar.b3d",
|
||||
@ -1031,8 +1032,7 @@ minetest.register_entity("vehicles:policecar", {
|
||||
end,
|
||||
on_punch = vehicles.on_punch,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 16,
|
||||
decell = 0.95,
|
||||
boost = true,
|
||||
@ -1041,9 +1041,6 @@ minetest.register_entity("vehicles:policecar", {
|
||||
driving_sound = "engine",
|
||||
sound_duration = 11,
|
||||
})
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
@ -1077,8 +1074,7 @@ minetest.register_entity("vehicles:musting", {
|
||||
end,
|
||||
on_punch = vehicles.on_punch,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 15,
|
||||
decell = 0.85,
|
||||
boost = true,
|
||||
@ -1087,9 +1083,6 @@ minetest.register_entity("vehicles:musting", {
|
||||
driving_sound = "engine",
|
||||
sound_duration = 11,
|
||||
})
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
@ -1123,8 +1116,7 @@ minetest.register_entity("vehicles:musting2", {
|
||||
self.nitro = true
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 15,
|
||||
decell = 0.85,
|
||||
boost = true,
|
||||
@ -1133,9 +1125,6 @@ minetest.register_entity("vehicles:musting2", {
|
||||
driving_sound = "engine",
|
||||
sound_duration = 11,
|
||||
})
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
@ -1180,8 +1169,7 @@ minetest.register_entity("vehicles:fewawi", {
|
||||
self.nitro = true
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 15,
|
||||
decell = 0.95,
|
||||
boost = true,
|
||||
@ -1190,9 +1178,6 @@ minetest.register_entity("vehicles:fewawi", {
|
||||
driving_sound = "engine",
|
||||
sound_duration = 11,
|
||||
})
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
@ -1237,8 +1222,7 @@ minetest.register_entity("vehicles:fewawi2", {
|
||||
self.nitro = true
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 15,
|
||||
decell = 0.95,
|
||||
boost = true,
|
||||
@ -1247,9 +1231,6 @@ minetest.register_entity("vehicles:fewawi2", {
|
||||
driving_sound = "engine",
|
||||
sound_duration = 11,
|
||||
})
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
@ -1283,8 +1264,7 @@ minetest.register_entity("vehicles:pooshe", {
|
||||
end,
|
||||
on_punch = vehicles.on_punch,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 15,
|
||||
decell = 0.95,
|
||||
boost = true,
|
||||
@ -1293,9 +1273,6 @@ minetest.register_entity("vehicles:pooshe", {
|
||||
driving_sound = "engine",
|
||||
sound_duration = 11,
|
||||
})
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
@ -1329,8 +1306,7 @@ minetest.register_entity("vehicles:pooshe2", {
|
||||
self.nitro = true
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 15,
|
||||
decell = 0.95,
|
||||
boost = true,
|
||||
@ -1339,60 +1315,11 @@ minetest.register_entity("vehicles:pooshe2", {
|
||||
driving_sound = "engine",
|
||||
sound_duration = 11,
|
||||
})
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
vehicles.register_spawner("vehicles:pooshe2", "Pooshe (yellow)", "vehicles_pooshe_inv2.png")
|
||||
|
||||
minetest.register_entity("vehicles:masda2", {
|
||||
visual = "mesh",
|
||||
mesh = "masda.b3d",
|
||||
textures = {"vehicles_masda2.png"},
|
||||
velocity = 15,
|
||||
acceleration = -5,
|
||||
stepheight = step,
|
||||
hp_max = 200,
|
||||
physical = true,
|
||||
collisionbox = {-1, 0, -1, 1.3, 1, 1},
|
||||
on_rightclick = function(self, clicker)
|
||||
if self.driver and clicker == self.driver then
|
||||
object_detach(self, clicker, {x=1, y=0, z=1})
|
||||
elseif not self.driver then
|
||||
vehicles.object_attach(self, clicker, {x=0, y=5, z=4}, false, {x=0, y=2, z=4})
|
||||
minetest.sound_play("engine_start",
|
||||
{gain = 4, max_hear_distance = 3, loop = false})
|
||||
self.sound_ready = false
|
||||
minetest.after(14, function()
|
||||
self.sound_ready = true
|
||||
end)
|
||||
end
|
||||
end,
|
||||
on_activate = function(self)
|
||||
self.nitro = true
|
||||
end,
|
||||
on_punch = vehicles.on_punch,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
speed = 15,
|
||||
decell = 0.85,
|
||||
boost = true,
|
||||
boost_duration = 4,
|
||||
boost_effect = "vehicles_nitro.png",
|
||||
driving_sound = "engine",
|
||||
sound_duration = 11,
|
||||
})
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
vehicles.register_spawner("vehicles:masda2", "Masda (orange)", "vehicles_masda_inv2.png")
|
||||
|
||||
minetest.register_entity("vehicles:boat", {
|
||||
visual = "mesh",
|
||||
mesh = "boat.b3d",
|
||||
@ -1412,18 +1339,12 @@ minetest.register_entity("vehicles:boat", {
|
||||
end,
|
||||
on_punch = vehicles.on_punch,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 10,
|
||||
decell = 0.85,
|
||||
is_watercraft = true,
|
||||
gravity = 0,
|
||||
})
|
||||
return false
|
||||
else
|
||||
self.object:setvelocity({x=0, y=0, z=0})
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
@ -1452,8 +1373,7 @@ minetest.register_entity("vehicles:jet", {
|
||||
end,
|
||||
on_punch = vehicles.on_punch,
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 14,
|
||||
decell = 0.95,
|
||||
shoots = true,
|
||||
@ -1464,10 +1384,6 @@ minetest.register_entity("vehicles:jet", {
|
||||
fly = true,
|
||||
fly_mode = "rise",
|
||||
})
|
||||
return false
|
||||
end
|
||||
self.object:setvelocity({x=0, y=-1, z=0})
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
@ -1495,22 +1411,21 @@ minetest.register_entity("vehicles:plane", {
|
||||
if self.anim and not self.driver then
|
||||
self.object:set_animation({x=1, y=1}, 5, 0)
|
||||
end
|
||||
if self.driver then
|
||||
vehicles.object_drive(self, dtime, {
|
||||
return vehicles.on_step(self, dtime, {
|
||||
speed = 10,
|
||||
decell = 0.95,
|
||||
fly = true,
|
||||
fly_mode = "hold",
|
||||
})
|
||||
},
|
||||
function()
|
||||
if not self.anim then
|
||||
self.object:set_animation({x=1, y=9}, 20, 0)
|
||||
self.anim = true
|
||||
end
|
||||
return false
|
||||
else
|
||||
end,
|
||||
function()
|
||||
self.anim = false
|
||||
end
|
||||
return true
|
||||
end)
|
||||
end,
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user