From 64c726beb8ee16aa0cf8d694138cc9839282750e Mon Sep 17 00:00:00 2001 From: ".kkrill" Date: Sat, 28 Dec 2024 20:47:25 +0300 Subject: [PATCH 1/2] fix waterwash + improvements --- lua/entities/base_glide/init.lua | 3 +++ lua/entities/base_glide_aircraft/init.lua | 8 ++++++++ lua/entities/base_glide_heli/init.lua | 11 ++++++++++- lua/entities/glide_rotor.lua | 5 ++--- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/lua/entities/base_glide/init.lua b/lua/entities/base_glide/init.lua index 21c69e6..4951db1 100644 --- a/lua/entities/base_glide/init.lua +++ b/lua/entities/base_glide/init.lua @@ -541,3 +541,6 @@ function ENT:GetSpawnColor() local color = colors[math.random( #colors )] return Color( color.r, color.g, color.b ) end + +function ENT:RotorStartSpinningFast( _rotor ) end +function ENT:RotorStopSpinningFast( _rotor ) end \ No newline at end of file diff --git a/lua/entities/base_glide_aircraft/init.lua b/lua/entities/base_glide_aircraft/init.lua index 911a764..5e36184 100644 --- a/lua/entities/base_glide_aircraft/init.lua +++ b/lua/entities/base_glide_aircraft/init.lua @@ -502,3 +502,11 @@ function ENT:TriggerInput( name, value ) self:SelectWeaponIndex( Clamp( value, 1, self.weaponCount ) ) end end + +function ENT:RotorStartSpinningFast( rotor ) + rotor:SetModel( rotor.modelFast or rotor.modelSlow ) +end + +function ENT:RotorStopSpinningFast( rotor ) + rotor:SetModel( rotor.modelSlow ) +end \ No newline at end of file diff --git a/lua/entities/base_glide_heli/init.lua b/lua/entities/base_glide_heli/init.lua index d6c510e..16f635b 100644 --- a/lua/entities/base_glide_heli/init.lua +++ b/lua/entities/base_glide_heli/init.lua @@ -40,7 +40,7 @@ function ENT:Repair() self.mainRotor:SetBaseAngles( self.MainRotorAngle ) end - -- Create tail rotor, if it doesn't exist and we have a model for it + -- Create tail rotor, if it doesn't exist and we have a model for it if not IsValid( self.tailRotor ) then self.tailRotor = self:CreateRotor( self.TailRotorOffset, self.TailRotorRadius, self.TailRotorModel, self.TailRotorFastModel ) self.tailRotor:SetBaseAngles( self.TailRotorAngle ) @@ -247,3 +247,12 @@ function ENT:OnSimulatePhysics( phys, _, outLin, outAng ) self:SimulateHelicopter( phys, params, effectiveness, outLin, outAng ) end end + + +function ENT:RotorStartSpinningFast( _rotor ) + self:CreateRotorWash() +end + +function ENT:RotorStopSpinningFast( _rotor ) + self:RemoveRotorWash() +end \ No newline at end of file diff --git a/lua/entities/glide_rotor.lua b/lua/entities/glide_rotor.lua index e91deb1..e976c2e 100644 --- a/lua/entities/glide_rotor.lua +++ b/lua/entities/glide_rotor.lua @@ -136,11 +136,10 @@ function ENT:Think() if self.isSpinningFast ~= isSpinningFast then self.isSpinningFast = isSpinningFast - self:SetModel( isSpinningFast and self.modelFast or self.modelSlow ) if isSpinningFast then - self:GetParent():CreateRotorWash() + self:GetParent():RotorStartSpinningFast( self ) else - self:GetParent():RemoveRotorWash() + self:GetParent():RotorStopSpinningFast( self ) end end From a3777b7c45c9cab1d8953f3f6887a804dc9144b9 Mon Sep 17 00:00:00 2001 From: ".kkrill" Date: Sat, 28 Dec 2024 20:51:20 +0300 Subject: [PATCH 2/2] Update init.lua --- lua/entities/base_glide_heli/init.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/entities/base_glide_heli/init.lua b/lua/entities/base_glide_heli/init.lua index 16f635b..94b3dc4 100644 --- a/lua/entities/base_glide_heli/init.lua +++ b/lua/entities/base_glide_heli/init.lua @@ -249,10 +249,12 @@ function ENT:OnSimulatePhysics( phys, _, outLin, outAng ) end -function ENT:RotorStartSpinningFast( _rotor ) +function ENT:RotorStartSpinningFast( rotor ) + BaseClass.RotorStartSpinningFast( self, rotor ) self:CreateRotorWash() end -function ENT:RotorStopSpinningFast( _rotor ) +function ENT:RotorStopSpinningFast( rotor ) + BaseClass.RotorStopSpinningFast( self, rotor ) self:RemoveRotorWash() end \ No newline at end of file