From f0c6e2b3472b0e02800da609db6fcc0b18dc84e4 Mon Sep 17 00:00:00 2001 From: Alexsandro Percy Date: Sun, 29 May 2022 14:39:02 -0300 Subject: [PATCH] removed mobkit dependency --- ju52_crafts.lua | 2 +- ju52_custom_physics.lua | 16 ++++++++-------- ju52_entities.lua | 10 +++++----- ju52_utilities.lua | 10 +++++----- mod.conf | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/ju52_crafts.lua b/ju52_crafts.lua index e43ee88..b16849b 100644 --- a/ju52_crafts.lua +++ b/ju52_crafts.lua @@ -33,7 +33,7 @@ minetest.register_craftitem("ju52:ju52", { ent.owner = owner new_ju52:set_yaw(placer:get_look_horizontal()) itemstack:take_item() - ent.object:set_acceleration({x=0,y=mobkit.gravity,z=0}) + ent.object:set_acceleration({x=0,y=airutils.gravity,z=0}) airutils.create_inventory(ent, ju52.trunk_slots, owner) end diff --git a/ju52_custom_physics.lua b/ju52_custom_physics.lua index cb318a3..295e654 100644 --- a/ju52_custom_physics.lua +++ b/ju52_custom_physics.lua @@ -49,17 +49,17 @@ function ju52.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 @@ -74,16 +74,16 @@ function ju52.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,accell) + airutils.set_acceleration(self.object,accell) else self.isinliquid = false self.object:move_to(self.object:get_pos()) - mobkit.set_acceleration(self.object,{x=0,y=mobkit.gravity,z=0}) + airutils.set_acceleration(self.object,{x=0,y=airutils.gravity,z=0}) end end diff --git a/ju52_entities.lua b/ju52_entities.lua index 00b58a7..ab83e19 100644 --- a/ju52_entities.lua +++ b/ju52_entities.lua @@ -133,7 +133,7 @@ minetest.register_entity("ju52:ju52", { 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 @@ -216,11 +216,11 @@ minetest.register_entity("ju52:ju52", { 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() @@ -304,8 +304,8 @@ minetest.register_entity("ju52:ju52", { if airutils.set_paint(self, puncher, itmstck, ju52.skin_texture) == 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("ju52_collision", { object = self.object, diff --git a/ju52_utilities.lua b/ju52_utilities.lua index 73b4a8b..c7c6a1d 100755 --- a/ju52_utilities.lua +++ b/ju52_utilities.lua @@ -315,7 +315,7 @@ function ju52.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) > 4 then - local noded = mobkit.nodeatpos(mobkit.pos_shift(p,{y=-2.8})) + local noded = airutils.nodeatpos(airutils.pos_shift(p,{y=-2.8})) if (noded and noded.drawtype ~= 'airlike') then collision = true else @@ -333,7 +333,7 @@ function ju52.testDamage(self, velocity, position) end if impact > 1 and self._longit_speed > 2 then - local noded = mobkit.nodeatpos(mobkit.pos_shift(p,{y=-2.8})) + local noded = airutils.nodeatpos(airutils.pos_shift(p,{y=-2.8})) if (noded and noded.drawtype ~= 'airlike') then minetest.sound_play("ju52_touch", { --to_player = self.driver_name, @@ -643,7 +643,7 @@ function ju52.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) @@ -769,7 +769,7 @@ function ju52.flightstep(self) --lift calculation accel.y = accel_y - --accel.y = accel.y + mobkit.gravity + --accel.y = accel.y + airutils.gravity --lets apply some bob in water if self.isinliquid then @@ -813,7 +813,7 @@ function ju52.flightstep(self) --[[if player then ju52.attach(self, player) end]]-- - mobkit.set_acceleration(self.object, new_accel) + airutils.set_acceleration(self.object, new_accel) elseif stop == true then self._last_accell = {x=0, y=0, z=0} self.object:set_velocity({x=0,y=0,z=0}) diff --git a/mod.conf b/mod.conf index 2fcabce..c511751 100644 --- a/mod.conf +++ b/mod.conf @@ -1,5 +1,5 @@ name = ju52 -depends = mobkit,default,biofuel,airutils +depends = default,biofuel,airutils author = APercy description = Adds a Ju52 airplane title = Ju52