mirror of
https://github.com/HaodongMo/ARC-9.git
synced 2025-03-04 03:02:58 -05:00
flir range test
obviously inherently more expensive but by how much? idk we already have atttbl cached and we're using square root for distance calc anyway so the only thing happening is division which we could replace with a multiplication of 39.37 if needed for a good enough precision accuracy requesting darsu to test the function by adding FLIRRange to a scope and seeing if the ranges match up
This commit is contained in:
parent
f73ecf53ae
commit
8de4b1af59
@ -18,6 +18,7 @@ local monochrometable = {
|
||||
}
|
||||
|
||||
local ref = 32
|
||||
local r_def = 160
|
||||
|
||||
function SWEP:DoFLIR(atttbl)
|
||||
|
||||
@ -29,6 +30,7 @@ function SWEP:DoFLIR(atttbl)
|
||||
-- local targets = ents.FindInCone(EyePos(), EyeAngles():Forward(), atttbl.RTScopeFLIRRange or 30000, math.cos(fov + 5))
|
||||
local targets = lastents
|
||||
local entcount = ents.GetCount()
|
||||
local range = (atttbl.FLIRRange or r_def)/ARC9.HUToM
|
||||
|
||||
if lastentcount != entcount then
|
||||
targets = ents.GetAll()
|
||||
@ -56,7 +58,7 @@ function SWEP:DoFLIR(atttbl)
|
||||
|
||||
for _, ent in ipairs(targets) do
|
||||
if ent == self:GetOwner() then continue end
|
||||
local hot = self:GetEntityHot(ent)
|
||||
local hot = self:GetEntityHot(ent, range)
|
||||
if atttbl.FLIRHotFunc then
|
||||
hot = atttbl.FLIRHotFunc(self, ent)
|
||||
end
|
||||
@ -111,12 +113,12 @@ function SWEP:DoFLIR(atttbl)
|
||||
render.SetStencilEnable(false)
|
||||
end
|
||||
|
||||
local maxrange = (160/ARC9.HUToM)^2 -- 160 m
|
||||
-- local maxrange = (160/ARC9.HUToM)^2 -- 160 m
|
||||
|
||||
function SWEP:GetEntityHot(ent)
|
||||
function SWEP:GetEntityHot(ent, range)
|
||||
if !ent:IsValid() or ent:IsWorld() then return false end
|
||||
|
||||
if self:GetPos():DistToSqr(ent:GetPos()) > maxrange then return end
|
||||
if self:GetPos():DistToSqr(ent:GetPos()) > range^2 then return end
|
||||
|
||||
if ent:IsPlayer() then
|
||||
if ent.ArcticMedShots_ActiveEffects and ent.ArcticMedShots_ActiveEffects["coldblooded"] or ent:Health() <= 0 then return false end -- arc stims
|
||||
@ -137,4 +139,4 @@ function SWEP:GetEntityHot(ent)
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user