Skip to content

Commit

Permalink
better radio fuze
Browse files Browse the repository at this point in the history
- added better compensation among the ticks for the radio detection. This should allow to handle speedy missiles better
  • Loading branch information
MartyX5555 committed Aug 31, 2023
1 parent 333b49f commit c681420
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
16 changes: 9 additions & 7 deletions lua/acf/shared/fuses/d_radio.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,18 @@ do

if not self:IsArmed() then return false end

local MissilePos = missile:GetPos()
local MissilePos = missile.CurPos
local Dist = self.Distance

local trace = {}
trace.start = MissilePos
trace.endpos = MissilePos + missile.LastVel * 0.5 --small compensation for incoming impacts.
trace.filter = FilterFunction
trace.mins = Vector(-Dist, -Dist, -Dist)
trace.maxs = -trace.mins
trace.ignoreworld = true
trace.start = missile.DPos or MissilePos print(MissilePos)
trace.endpos = MissilePos --small compensation for incoming impacts.
trace.filter = FilterFunction
trace.mins = Vector(-Dist, -Dist, -Dist)
trace.maxs = -trace.mins
trace.ignoreworld = true

missile.DPos = MissilePos

local tr = util.TraceHull(trace)

Expand Down
4 changes: 2 additions & 2 deletions lua/entities/acf_missile/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ function ENT:CalcFlight()
self.FlightTime = Flight

--Missile trajectory debugging
debugoverlay.Line(Pos, EndPos, 10, Color(0, 255, 0))
debugoverlay.Line(EndPos, EndPos + Dir:GetNormalized() * 50, 10, Color(0, 0, 255))
--.Line(Pos, EndPos, 10, Color(0, 255, 0))
--debugoverlay.Line(EndPos, EndPos + Dir:GetNormalized() * 50, 10, Color(0, 0, 255))

self:DoFlight()
end
Expand Down

0 comments on commit c681420

Please sign in to comment.