From ae8ec994012e4ad9edd40c9fa3539b9a7e51acb8 Mon Sep 17 00:00:00 2001 From: Alexsandro Percy Date: Sun, 29 May 2022 14:20:15 -0300 Subject: [PATCH] removed mobkit dependency --- hidroplane_custom_physics.lua | 18 +++++++++--------- hidroplane_entities.lua | 10 +++++----- hidroplane_utilities.lua | 12 ++++++------ mod.conf | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/hidroplane_custom_physics.lua b/hidroplane_custom_physics.lua index 800d58a..72d6058 100644 --- a/hidroplane_custom_physics.lua +++ b/hidroplane_custom_physics.lua @@ -34,17 +34,17 @@ function hidroplane.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 hidroplane.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 diff --git a/hidroplane_entities.lua b/hidroplane_entities.lua index e6adce3..65b423b 100644 --- a/hidroplane_entities.lua +++ b/hidroplane_entities.lua @@ -236,7 +236,7 @@ minetest.register_entity("hidroplane:hidro", { 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 @@ -322,11 +322,11 @@ minetest.register_entity("hidroplane:hidro", { 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() @@ -408,8 +408,8 @@ minetest.register_entity("hidroplane:hidro", { 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 ~= 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("hidroplane_collision", { object = self.object, diff --git a/hidroplane_utilities.lua b/hidroplane_utilities.lua index b90bcde..747f9a5 100644 --- a/hidroplane_utilities.lua +++ b/hidroplane_utilities.lua @@ -208,7 +208,7 @@ function hidroplane.testImpact(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=-2.8})) + local noded = airutils.nodeatpos(airutils.pos_shift(p,{y=-2.8})) if (noded and noded.drawtype ~= 'airlike') then collision = true else @@ -227,7 +227,7 @@ function hidroplane.testImpact(self, velocity, position) end if impact > 1.0 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 if noded.drawtype ~= 'liquid' then minetest.sound_play("hidroplane_touch", { @@ -246,7 +246,7 @@ function hidroplane.testImpact(self, velocity, position) 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})) + local noded = airutils.nodeatpos(airutils.pos_shift(p,{y=-2.8})) if (noded and noded.drawtype ~= 'airlike') then if noded.drawtype == 'liquid' then minetest.sound_play("hidroplane_touch_water", { @@ -447,7 +447,7 @@ function hidroplane.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) @@ -461,7 +461,7 @@ function hidroplane.flightstep(self) local accel = vector.add(longit_drag,later_drag) local stop = false - local node_bellow = mobkit.nodeatpos(mobkit.pos_shift(curr_pos,{y=-3})) + local node_bellow = airutils.nodeatpos(airutils.pos_shift(curr_pos,{y=-3})) local is_flying = true if node_bellow and node_bellow.drawtype ~= 'airlike' then is_flying = false end --if is_flying then minetest.chat_send_all('is flying') end @@ -587,7 +587,7 @@ function hidroplane.flightstep(self) if accel == nil then accel = {x=0,y=0,z=0} end --lift calculation - --accel.y = accel_y --accel.y + mobkit.gravity --accel_y + --accel.y = accel_y --accel.y + airutils.gravity --accel_y --lets apply some bob in water if self.isinliquid then diff --git a/mod.conf b/mod.conf index 1bffb81..9a543e1 100644 --- a/mod.conf +++ b/mod.conf @@ -1,5 +1,5 @@ name = hidroplane -depends = mobkit,default,biofuel,airutils +depends = default,biofuel,airutils author = APercy description = Adds a craftable hydroplane title = Super Duck Hydroplane