removed mobkit dependency
parent
9f7825ab09
commit
a675511946
|
@ -34,17 +34,17 @@ function pa28.physics(self)
|
|||
--buoyancy
|
||||
local surface = nil
|
||||
local surfnodename = nil
|
||||
local spos = mobkit.get_stand_pos(self)
|
||||
local spos = airutils.get_stand_pos(self)
|
||||
spos.y = spos.y+0.01
|
||||
-- get surface height
|
||||
local snodepos = mobkit.get_node_pos(spos)
|
||||
local surfnode = mobkit.nodeatpos(spos)
|
||||
local snodepos = airutils.get_node_pos(spos)
|
||||
local surfnode = airutils.nodeatpos(spos)
|
||||
while surfnode and (surfnode.drawtype == 'liquid' or surfnode.drawtype == 'flowingliquid') do
|
||||
surfnodename = surfnode.name
|
||||
surface = snodepos.y +0.5
|
||||
if surface > spos.y+self.height then break end
|
||||
snodepos.y = snodepos.y+1
|
||||
surfnode = mobkit.nodeatpos(snodepos)
|
||||
surfnode = airutils.nodeatpos(snodepos)
|
||||
end
|
||||
|
||||
local new_velocity = nil
|
||||
|
@ -59,18 +59,18 @@ function pa28.physics(self)
|
|||
local height = self.height
|
||||
local submergence = min(surface-spos.y,height)/height
|
||||
-- local balance = self.buoyancy*self.height
|
||||
local buoyacc = mobkit.gravity*(self.buoyancy-submergence)
|
||||
--[[mobkit.set_acceleration(self.object,
|
||||
local buoyacc = airutils.gravity*(self.buoyancy-submergence)
|
||||
--[[airutils.set_acceleration(self.object,
|
||||
{x=-vel.x*self.water_drag,y=buoyacc-vel.y*abs(vel.y)*0.4,z=-vel.z*self.water_drag})]]--
|
||||
accell = {x=-vel.x*self.water_drag,y=buoyacc-(vel.y*abs(vel.y)*0.4),z=-vel.z*self.water_drag}
|
||||
--local v_accell = {x=0,y=buoyacc-(vel.y*abs(vel.y)*0.4),z=0}
|
||||
--mobkit.set_acceleration(self.object,v_accell)
|
||||
--airutils.set_acceleration(self.object,v_accell)
|
||||
new_velocity = vector.add(vel, vector.multiply(accell, self.dtime))
|
||||
|
||||
else
|
||||
mobkit.set_acceleration(self.object,{x=0,y=0,z=0})
|
||||
airutils.set_acceleration(self.object,{x=0,y=0,z=0})
|
||||
self.isinliquid = false
|
||||
new_velocity = vector.add(vel, {x=0,y=mobkit.gravity * self.dtime,z=0})
|
||||
new_velocity = vector.add(vel, {x=0,y=airutils.gravity * self.dtime,z=0})
|
||||
--self.object:set_velocity(new_velocity)
|
||||
end
|
||||
|
||||
|
@ -104,7 +104,7 @@ function pa28.physics(self)
|
|||
end
|
||||
|
||||
if pa28.mode == 2 then
|
||||
self.object:set_acceleration({x=0,y=mobkit.gravity,z=0})
|
||||
self.object:set_acceleration({x=0,y=airutils.gravity,z=0})
|
||||
end
|
||||
|
||||
end
|
||||
|
|
10
entities.lua
10
entities.lua
|
@ -211,7 +211,7 @@ minetest.register_entity("pa28:pa28", {
|
|||
end,
|
||||
|
||||
on_activate = function(self, staticdata, dtime_s)
|
||||
mobkit.actfunc(self, staticdata, dtime_s)
|
||||
airutils.actfunc(self, staticdata, dtime_s)
|
||||
if staticdata ~= "" and staticdata ~= nil then
|
||||
local data = minetest.deserialize(staticdata) or {}
|
||||
self._energy = data.stored_energy
|
||||
|
@ -288,11 +288,11 @@ minetest.register_entity("pa28:pa28", {
|
|||
end
|
||||
end,
|
||||
|
||||
--on_step = mobkit.stepfunc,
|
||||
--on_step = airutils.stepfunc,
|
||||
on_step = function(self,dtime,colinfo)
|
||||
self.dtime = math.min(dtime,0.2)
|
||||
self.colinfo = colinfo
|
||||
self.height = mobkit.get_box_height(self)
|
||||
self.height = airutils.get_box_height(self)
|
||||
|
||||
-- physics comes first
|
||||
local vel = self.object:get_velocity()
|
||||
|
@ -375,8 +375,8 @@ minetest.register_entity("pa28:pa28", {
|
|||
if airutils.set_paint(self, puncher, itmstck, "pa28_painting.png") == false then
|
||||
if not self.driver and toolcaps and toolcaps.damage_groups
|
||||
and toolcaps.damage_groups.fleshy and item_name ~= airutils.fuel then
|
||||
--mobkit.hurt(self,toolcaps.damage_groups.fleshy - 1)
|
||||
--mobkit.make_sound(self,'hit')
|
||||
--airutils.hurt(self,toolcaps.damage_groups.fleshy - 1)
|
||||
--airutils.make_sound(self,'hit')
|
||||
self.hp_max = self.hp_max - 10
|
||||
minetest.sound_play("pa28_collision", {
|
||||
object = self.object,
|
||||
|
|
2
mod.conf
2
mod.conf
|
@ -1,5 +1,5 @@
|
|||
name = pa28
|
||||
depends = mobkit,default,biofuel,airutils
|
||||
depends = default,biofuel,airutils
|
||||
optional_depends = compassgps
|
||||
author = APercy
|
||||
description = Adds a craftable PA28
|
||||
|
|
|
@ -253,7 +253,7 @@ function pa28.testDamage(self, velocity, position)
|
|||
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
|
||||
local noded = mobkit.nodeatpos(mobkit.pos_shift(p,{y=low_node_pos}))
|
||||
local noded = airutils.nodeatpos(airutils.pos_shift(p,{y=low_node_pos}))
|
||||
if (noded and noded.drawtype ~= 'airlike') then
|
||||
collision = true
|
||||
else
|
||||
|
@ -271,7 +271,7 @@ function pa28.testDamage(self, velocity, position)
|
|||
end
|
||||
|
||||
if impact > 1.2 and self._longit_speed > 3 then
|
||||
local noded = mobkit.nodeatpos(mobkit.pos_shift(p,{y=low_node_pos}))
|
||||
local noded = airutils.nodeatpos(airutils.pos_shift(p,{y=low_node_pos}))
|
||||
if (noded and noded.drawtype ~= 'airlike') then
|
||||
minetest.sound_play("pa28_touch", {
|
||||
--to_player = self.driver_name,
|
||||
|
@ -535,7 +535,7 @@ function pa28.flightstep(self)
|
|||
if newroll > 360 then newroll = newroll - 360 end
|
||||
if newroll < -360 then newroll = newroll + 360 end
|
||||
|
||||
local hull_direction = mobkit.rot_to_dir(rotation) --minetest.yaw_to_dir(yaw)
|
||||
local hull_direction = airutils.rot_to_dir(rotation) --minetest.yaw_to_dir(yaw)
|
||||
local nhdir = {x=hull_direction.z,y=0,z=-hull_direction.x} -- lateral unit vector
|
||||
|
||||
local longit_speed = vector.dot(velocity,hull_direction)
|
||||
|
@ -549,7 +549,7 @@ function pa28.flightstep(self)
|
|||
local accel = vector.add(longit_drag,later_drag)
|
||||
local stop = false
|
||||
|
||||
local node_bellow = mobkit.nodeatpos(mobkit.pos_shift(curr_pos,{y=-2.0}))
|
||||
local node_bellow = airutils.nodeatpos(airutils.pos_shift(curr_pos,{y=-2.0}))
|
||||
local is_flying = true
|
||||
if self.colinfo then
|
||||
is_flying = not self.colinfo.touching_ground
|
||||
|
@ -586,7 +586,7 @@ function pa28.flightstep(self)
|
|||
if longit_speed == 0 and is_flying == false and is_attached == false and self._engine_running == false then
|
||||
if pa28.mode == 1 then
|
||||
self.object:move_to(curr_pos)
|
||||
self.object:set_acceleration({x=0,y=mobkit.gravity,z=0})
|
||||
self.object:set_acceleration({x=0,y=airutils.gravity,z=0})
|
||||
end
|
||||
return
|
||||
end
|
||||
|
@ -738,7 +738,7 @@ function pa28.flightstep(self)
|
|||
--for mode==1, see at custom_physics
|
||||
if pa28.mode == 2 then
|
||||
self.object:move_to(curr_pos)
|
||||
mobkit.set_acceleration(self.object, new_accel)
|
||||
airutils.set_acceleration(self.object, new_accel)
|
||||
end
|
||||
else
|
||||
if stop == true then
|
||||
|
|
Loading…
Reference in New Issue