improved model, new sounds, new painting mode
parent
03f00eb047
commit
71f1d4b9aa
|
@ -91,7 +91,7 @@ function hidroplane.physics(self)
|
|||
if new_velocity.y < -max_factor then new_velocity.y = -vel_adjusted end
|
||||
-- end correction
|
||||
|
||||
self.object:set_pos(self.object:get_pos())
|
||||
self.object:move_to(self.object:get_pos())
|
||||
-- dumb friction
|
||||
if self.isonground and not self.isinliquid then
|
||||
self.object:set_velocity({x=new_velocity.x*friction,
|
||||
|
|
|
@ -247,12 +247,29 @@ minetest.register_entity("hidroplane:hidro", {
|
|||
visual = "mesh",
|
||||
mesh = "hidroplane_fuselage.b3d",
|
||||
stepheight = 0.5,
|
||||
textures = {"hidroplane_black.png", "hidroplane_black.png", "hidroplane_metal.png", "hidroplane_painting.png",
|
||||
"hidroplane_grey.png", "hidroplane_painting.png", "hidroplane_painting.png", "hidroplane_panel.png",
|
||||
"hidroplane_painting.png", "hidroplane_glass.png", "hidroplane_glass.png", "hidroplane_black.png",
|
||||
"hidroplane_grey.png", "hidroplane_black.png", "hidroplane_black2.png",
|
||||
"hidroplane_black.png", "hidroplane_glass.png", "hidroplane_black.png",
|
||||
"hidroplane_painting.png"},
|
||||
textures = {
|
||||
"hidroplane_painting.png", --superficies controle
|
||||
"hidroplane_black.png", --banco1
|
||||
"hidroplane_black.png", --banco2
|
||||
"hidroplane_metal.png", --motor
|
||||
"hidroplane_painting.png", --est horizontal
|
||||
"hidroplane_metal.png", --longarinas
|
||||
"hidroplane_painting.png", --montantes
|
||||
"hidroplane_painting.png", --flutuadores
|
||||
"hidroplane_panel.png", --painel
|
||||
"hidroplane_painting.png", --lado esquerdo
|
||||
"hidroplane_painting.png", --lado direito
|
||||
"hidroplane_glass.png", --parabrisa
|
||||
"hidroplane_glass.png", --janelas laterais
|
||||
"hidroplane_black.png", --entradas motor
|
||||
"hidroplane_grey.png", --interior
|
||||
"hidroplane_black.png", --cobertura painel
|
||||
"hidroplane_black.png", --fundo painel
|
||||
"hidroplane_black.png", --cabeçote
|
||||
"hidroplane_glass.png", --teto
|
||||
"hidroplane_black.png", --fendas flutuadores
|
||||
"hidroplane_painting.png", --asas
|
||||
},
|
||||
},
|
||||
textures = {},
|
||||
driver_name = nil,
|
||||
|
@ -330,22 +347,6 @@ minetest.register_entity("hidroplane:hidro", {
|
|||
engine:set_animation({x = 1, y = 12}, 0, 0, true)
|
||||
self.engine = engine
|
||||
|
||||
local rudder=minetest.add_entity(pos,'hidroplane:rudder')
|
||||
rudder:set_attach(self.object,'',{x=0,y=0.12,z=-36.85},{x=0,y=0,z=0})
|
||||
self.rudder = rudder
|
||||
|
||||
local right_aileron=minetest.add_entity(pos,'hidroplane:right_aileron')
|
||||
right_aileron:set_attach(self.object,'',{x=0,y=8.08,z=-7},{x=0,y=0,z=0})
|
||||
self.right_aileron = right_aileron
|
||||
|
||||
local left_aileron=minetest.add_entity(pos,'hidroplane:left_aileron')
|
||||
left_aileron:set_attach(self.object,'',{x=0,y=8.08,z=-7},{x=0,y=0,z=0})
|
||||
self.left_aileron = left_aileron
|
||||
|
||||
local elevator=minetest.add_entity(pos,'hidroplane:elevator')
|
||||
elevator:set_attach(self.object,'',{x=0,y=4,z=-35.5},{x=0,y=0,z=0})
|
||||
self.elevator = elevator
|
||||
|
||||
local wheels=minetest.add_entity(pos,'hidroplane:wheels')
|
||||
wheels:set_attach(self.object,'',{x=0,y=0,z=0},{x=0,y=0,z=0})
|
||||
-- set the animation once and later only change the speed
|
||||
|
@ -390,11 +391,7 @@ minetest.register_entity("hidroplane:hidro", {
|
|||
stick:set_attach(self.object,'',{x=0,y=-6.85,z=8},{x=0,y=0,z=0})
|
||||
self.stick = stick
|
||||
|
||||
hidroplane.paint(self, self.object, self._color, "hidroplane_painting.png")
|
||||
hidroplane.paint(self, self.elevator, self._color, "hidroplane_painting.png")
|
||||
hidroplane.paint(self, self.rudder, self._color, "hidroplane_painting.png")
|
||||
hidroplane.paint(self, self.right_aileron, self._color, "hidroplane_painting.png")
|
||||
hidroplane.paint(self, self.left_aileron, self._color, "hidroplane_painting.png")
|
||||
airutils.paint(self, self._color, "hidroplane_painting.png")
|
||||
|
||||
self.object:set_armor_groups({immortal=1})
|
||||
end,
|
||||
|
@ -482,25 +479,7 @@ minetest.register_entity("hidroplane:hidro", {
|
|||
|
||||
-- deal with painting or destroying
|
||||
if itmstck then
|
||||
local _,indx = item_name:find('dye:')
|
||||
if indx then
|
||||
|
||||
--lets paint!!!!
|
||||
local color = item_name:sub(indx+1)
|
||||
local colstr = hidroplane.colors[color]
|
||||
--minetest.chat_send_all(color ..' '.. dump(colstr))
|
||||
if colstr then
|
||||
hidroplane.paint(self, self.object, colstr, "hidroplane_painting.png")
|
||||
hidroplane.paint(self, self.elevator, colstr, "hidroplane_painting.png")
|
||||
hidroplane.paint(self, self.rudder, colstr, "hidroplane_painting.png")
|
||||
hidroplane.paint(self, self.right_aileron, colstr, "hidroplane_painting.png")
|
||||
hidroplane.paint(self, self.left_aileron, colstr, "hidroplane_painting.png")
|
||||
itmstck:set_count(itmstck:get_count()-1)
|
||||
puncher:set_wielded_item(itmstck)
|
||||
end
|
||||
-- end painting
|
||||
|
||||
else -- deal damage
|
||||
if airutils.set_paint(self, puncher, itmstck, "hidroplane_painting.png") == false then
|
||||
if not self.driver and toolcaps and toolcaps.damage_groups
|
||||
and toolcaps.damage_groups.fleshy and item_name ~= hidroplane.fuel then
|
||||
--mobkit.hurt(self,toolcaps.damage_groups.fleshy - 1)
|
||||
|
|
|
@ -189,11 +189,6 @@ function hidroplane.destroy(self)
|
|||
if self.wheels then self.wheels:remove() end
|
||||
if self.f_wheels then self.f_wheels:remove() end
|
||||
|
||||
if self.elevator then self.elevator:remove() end
|
||||
if self.rudder then self.rudder:remove() end
|
||||
if self.right_aileron then self.right_aileron:remove() end
|
||||
if self.left_aileron then self.left_aileron:remove() end
|
||||
|
||||
if self.stick then self.stick:remove() end
|
||||
|
||||
self.object:remove()
|
||||
|
@ -224,6 +219,7 @@ end
|
|||
function hidroplane.testImpact(self, velocity, position)
|
||||
local p = position --self.object:get_pos()
|
||||
local collision = false
|
||||
|
||||
if self._last_vel == nil then return end
|
||||
--lets calculate the vertical speed, to avoid the bug on colliding on floor with hard lag
|
||||
if abs(velocity.y - self._last_vel.y) > 2 then
|
||||
|
@ -255,6 +251,42 @@ function hidroplane.testImpact(self, velocity, position)
|
|||
end
|
||||
end
|
||||
|
||||
if impact > 1.0 and self._longit_speed > 2 then
|
||||
local noded = mobkit.nodeatpos(mobkit.pos_shift(p,{y=-2.8}))
|
||||
if (noded and noded.drawtype ~= 'airlike') then
|
||||
if noded.drawtype ~= 'liquid' then
|
||||
minetest.sound_play("hidroplane_touch", {
|
||||
--to_player = self.driver_name,
|
||||
object = self.object,
|
||||
max_hear_distance = 15,
|
||||
gain = 1.0,
|
||||
fade = 0.0,
|
||||
pitch = 1.0,
|
||||
}, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self._last_water_touch == nil then self._last_water_touch = 3 end
|
||||
if self._last_water_touch <= 3 then self._last_water_touch = self._last_water_touch + self.dtime end
|
||||
if impact > 0.2 and self._longit_speed > 1 and self._last_water_touch >=3 then
|
||||
self._last_water_touch = 0
|
||||
local noded = mobkit.nodeatpos(mobkit.pos_shift(p,{y=-2.8}))
|
||||
if (noded and noded.drawtype ~= 'airlike') then
|
||||
if noded.drawtype == 'liquid' then
|
||||
minetest.sound_play("hidroplane_touch_water", {
|
||||
--to_player = self.driver_name,
|
||||
object = self.object,
|
||||
max_hear_distance = 15,
|
||||
gain = 1.0,
|
||||
fade = 0.0,
|
||||
pitch = 1.0,
|
||||
}, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if collision then
|
||||
--self.object:set_velocity({x=0,y=0,z=0})
|
||||
local damage = impact / 2
|
||||
|
@ -645,12 +677,12 @@ function hidroplane.flightstep(self)
|
|||
--end
|
||||
|
||||
--adjust elevator pitch (3d model)
|
||||
self.elevator:set_attach(self.object,'',{x=0,y=4,z=-35.5},{x=-self._elevator_angle*2,y=0,z=0})
|
||||
self.object:set_bone_position("elevator", {x=0, y=4, z=-35.5}, {x=-self._elevator_angle*2 - 90, y=0, z=0})
|
||||
--adjust rudder
|
||||
self.rudder:set_attach(self.object,'',{x=0,y=0.12,z=-36.85},{x=0,y=self._rudder_angle,z=0})
|
||||
self.object:set_bone_position("rudder", {x=0,y=8.4,z=-36.85}, {x=0,y=self._rudder_angle,z=0})
|
||||
--adjust ailerons
|
||||
self.right_aileron:set_attach(self.object,'',{x=0,y=8.08,z=-7},{x=-self._rudder_angle,y=0,z=0})
|
||||
self.left_aileron:set_attach(self.object,'',{x=0,y=8.08,z=-7},{x=self._rudder_angle,y=0,z=0})
|
||||
self.object:set_bone_position("aileron.r", {x=30.377,y=8.2,z=-7}, {x=-self._rudder_angle - 90,y=0,z=0})
|
||||
self.object:set_bone_position("aileron.l", {x=-30.377,y=8.2,z=-7}, {x=self._rudder_angle - 90,y=0,z=0})
|
||||
--set stick position
|
||||
self.stick:set_attach(self.object,'',{x=0,y=-6,85,z=8},{x=self._elevator_angle/2,y=0,z=self._rudder_angle})
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue