From f36c129d64aa0ecd7289b24358446da550292a2e Mon Sep 17 00:00:00 2001 From: Alexsandro Percy Date: Tue, 10 Oct 2023 22:12:23 -0300 Subject: [PATCH 1/3] improving plane movement --- lib_planes/entities.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib_planes/entities.lua b/lib_planes/entities.lua index ed001f2..5afc491 100644 --- a/lib_planes/entities.lua +++ b/lib_planes/entities.lua @@ -481,11 +481,12 @@ function airutils.logic(self) if stop ~= true then --maybe == nil self._last_accell = new_accel self.object:move_to(curr_pos) - --self.object:set_velocity(velocity) - --[[if player then - airutils.attach(self, player, self._instruction_mode) - end]]-- - airutils.set_acceleration(self.object, new_accel) + --airutils.set_acceleration(self.object, new_accel) + local limit = 100 + local vel_to_add = vector.multiply(new_accel,self.dtime) + vel_to_add.y = 0 + self.object:add_velocity(vel_to_add) + self.object:set_acceleration({x=0,y=new_accel.y, z=0}) else if stop == true then self._last_accell = self.object:get_acceleration() From 3f12d89a8db734bbee234030d2954d99d9369d07 Mon Sep 17 00:00:00 2001 From: Alexsandro Percy Date: Wed, 11 Oct 2023 19:51:55 -0300 Subject: [PATCH 2/3] changed custom physics to use add_velocity instead of set_velocity --- lib_planes/custom_physics.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib_planes/custom_physics.lua b/lib_planes/custom_physics.lua index fba2bb3..a394f54 100755 --- a/lib_planes/custom_physics.lua +++ b/lib_planes/custom_physics.lua @@ -51,6 +51,7 @@ function airutils.physics(self) new_velocity = {x=new_velocity.x*friction, y=new_velocity.y, z=new_velocity.z*friction} + -- bounciness if self.springiness and self.springiness > 0 and self.buoyancy >= 1 then local vnew = vector.new(new_velocity) @@ -82,7 +83,10 @@ function airutils.physics(self) end --damage the plane if it have hard friction end - self.object:set_velocity(new_velocity) + --self.object:set_velocity(new_velocity) + local vel_sum = vector.subtract(new_velocity,vel) + self.object:add_velocity(vel_sum) + end end From 1f8c1a635c0219e4f20db0539d2a005c650560aa Mon Sep 17 00:00:00 2001 From: Alexsandro Percy Date: Fri, 13 Oct 2023 10:15:17 -0300 Subject: [PATCH 3/3] hiding plane while landed --- lib_planes/entities.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib_planes/entities.lua b/lib_planes/entities.lua index 5afc491..20065e2 100644 --- a/lib_planes/entities.lua +++ b/lib_planes/entities.lua @@ -177,6 +177,19 @@ function airutils.logic(self) local co_pilot = nil if self.co_pilot and self._have_copilot then co_pilot = minetest.get_player_by_name(self.co_pilot) end + local plane_properties = self.object:get_properties() + if self.isonground then + if plane_properties.show_on_minimap == true then + plane_properties.show_on_minimap = false + self.object:set_properties(plane_properties) + end + else + if plane_properties.show_on_minimap == false then + plane_properties.show_on_minimap = true + self.object:set_properties(plane_properties) + end + end + if player then local ctrl = player:get_player_control() ---------------------