Skip to content

Commit

Permalink
Keep track of all chaff for radars
Browse files Browse the repository at this point in the history
  • Loading branch information
CheezusChrust committed Aug 7, 2024
1 parent 597634c commit 8f163ba
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions lua/acf/shared/rounds/roundchaff.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function Round.create( Gun, BulletData )
ent:SetPos( BulletData.Pos )
ent:SetAngles( BulletData.Flight:Angle() )
ent.Life = (BulletData.FillerMass or 1) / (0.4 * ACFM.FlareBurnMultiplier) * 1
ent.IsChaff = true
ent:Spawn()
ent:SetOwner( Gun )
ent:CPPISetOwner( Gun:CPPIGetOwner())
Expand Down
10 changes: 10 additions & 0 deletions lua/entities/ace_flare/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ AddCSLuaFile("shared.lua")

include("shared.lua")

ACE.CMTable = ACE.CMTable or {} -- Keep track of all countermeasures for radars

function ENT:Initialize()

self:SetModel( "models/Items/AR2_Grenade.mdl" )
Expand Down Expand Up @@ -37,6 +39,14 @@ function ENT:Initialize()

self:SetRenderMode( RENDERMODE_TRANSCOLOR )

if self.IsChaff then
ACE.CMTable[self] = true

self:CallOnRemove( "ACEFlareRemove", function(ent)
ACE.CMTable[ent] = nil
end )
end

table.insert( ACE.contraptionEnts, self )
end

Expand Down
1 change: 0 additions & 1 deletion lua/entities/ace_trackingradar/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ function ENT:ScanForContraptions()
GCTraceData.mins = Vector(-ConeClutterSize, -ConeClutterSize, -ConeClutterSize)
GCTraceData.maxs = Vector(ConeClutterSize, ConeClutterSize, ConeClutterSize)


local BTFactor = 1 / (1 + ((self.Cone - 1) / (self.ICone - 1)) * 2)

for Contraption in pairs(CFW.Contraptions) do
Expand Down

0 comments on commit 8f163ba

Please sign in to comment.