mirror of
https://github.com/APercy/airutils.git
synced 2025-03-23 03:12:20 +00:00
Merge branch 'main' of https://github.com/berengma/airutils into main
This commit is contained in:
commit
cd58d6900f
2 changed files with 24 additions and 6 deletions
|
@ -51,6 +51,7 @@ function airutils.physics(self)
|
||||||
new_velocity = {x=new_velocity.x*friction,
|
new_velocity = {x=new_velocity.x*friction,
|
||||||
y=new_velocity.y,
|
y=new_velocity.y,
|
||||||
z=new_velocity.z*friction}
|
z=new_velocity.z*friction}
|
||||||
|
|
||||||
-- bounciness
|
-- bounciness
|
||||||
if self.springiness and self.springiness > 0 and self.buoyancy >= 1 then
|
if self.springiness and self.springiness > 0 and self.buoyancy >= 1 then
|
||||||
local vnew = vector.new(new_velocity)
|
local vnew = vector.new(new_velocity)
|
||||||
|
@ -82,7 +83,10 @@ function airutils.physics(self)
|
||||||
end --damage the plane if it have hard friction
|
end --damage the plane if it have hard friction
|
||||||
end
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -189,6 +189,19 @@ function airutils.logic(self)
|
||||||
local co_pilot = nil
|
local co_pilot = nil
|
||||||
if self.co_pilot and self._have_copilot then co_pilot = minetest.get_player_by_name(self.co_pilot) end
|
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
|
if player then
|
||||||
local ctrl = player:get_player_control()
|
local ctrl = player:get_player_control()
|
||||||
---------------------
|
---------------------
|
||||||
|
@ -493,11 +506,12 @@ function airutils.logic(self)
|
||||||
if stop ~= true then --maybe == nil
|
if stop ~= true then --maybe == nil
|
||||||
self._last_accell = new_accel
|
self._last_accell = new_accel
|
||||||
self.object:move_to(curr_pos)
|
self.object:move_to(curr_pos)
|
||||||
--self.object:set_velocity(velocity)
|
--airutils.set_acceleration(self.object, new_accel)
|
||||||
--[[if player then
|
local limit = 100
|
||||||
airutils.attach(self, player, self._instruction_mode)
|
local vel_to_add = vector.multiply(new_accel,self.dtime)
|
||||||
end]]--
|
vel_to_add.y = 0
|
||||||
airutils.set_acceleration(self.object, new_accel)
|
self.object:add_velocity(vel_to_add)
|
||||||
|
self.object:set_acceleration({x=0,y=new_accel.y, z=0})
|
||||||
else
|
else
|
||||||
if stop == true then
|
if stop == true then
|
||||||
self._last_accell = self.object:get_acceleration()
|
self._last_accell = self.object:get_acceleration()
|
||||||
|
|
Loading…
Add table
Reference in a new issue