Skip to content

Commit

Permalink
Merge pull request #24 from kirillbrest123/rotorwash-fix
Browse files Browse the repository at this point in the history
Rotorwash fix
  • Loading branch information
StyledStrike authored Dec 28, 2024
2 parents b370ec1 + a3777b7 commit b300ee8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
3 changes: 3 additions & 0 deletions lua/entities/base_glide/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions lua/entities/base_glide_aircraft/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 12 additions & 1 deletion lua/entities/base_glide_heli/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -247,3 +247,14 @@ function ENT:OnSimulatePhysics( phys, _, outLin, outAng )
self:SimulateHelicopter( phys, params, effectiveness, outLin, outAng )
end
end


function ENT:RotorStartSpinningFast( rotor )
BaseClass.RotorStartSpinningFast( self, rotor )
self:CreateRotorWash()
end

function ENT:RotorStopSpinningFast( rotor )
BaseClass.RotorStopSpinningFast( self, rotor )
self:RemoveRotorWash()
end
5 changes: 2 additions & 3 deletions lua/entities/glide_rotor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit b300ee8

Please sign in to comment.