Skip to content

Commit

Permalink
Merge branch 'dev' into Ammo-File-Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
LengthenedGradient authored Apr 25, 2024
2 parents ae2815c + 8286be6 commit 72d2a90
Show file tree
Hide file tree
Showing 100 changed files with 5,729 additions and 629 deletions.
1 change: 1 addition & 0 deletions .github/workflows/gluatest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: GLuaTest Runner

on:
workflow_dispatch:
pull_request:
push:
branches:
Expand Down
19 changes: 18 additions & 1 deletion lua/acf/ballistics/ballistics_sv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,18 @@ function Ballistics.OnImpact(Bullet, Trace, Ammo, Type)
end
end

function Ballistics.TestFilter(Entity, Bullet)
if not IsValid(Entity) then return true end

if GlobalFilter[Entity:GetClass()] then return false end

if HookRun("ACF_OnFilterBullet", Entity, Bullet) == false then return false end

if Entity._IsSpherical then return false end -- TODO: Remove when damage changes make props unable to be destroyed, as physical props can have friction reduced (good for wheels)

return true
end

function Ballistics.DoBulletsFlight(Bullet)
if HookRun("ACF Bullet Flight", Bullet) == false then return end

Expand Down Expand Up @@ -260,7 +272,12 @@ function Ballistics.DoBulletsFlight(Bullet)
else
local Entity = traceRes.Entity

if GlobalFilter[Entity:GetClass()] then return end
if Ballistics.TestFilter(Entity, Bullet) == false then
table.insert(Bullet.Filter, Entity)
Ballistics.DoBulletsFlight(Bullet) -- Retries the same trace after adding the entity to the filter, important incase something is embedded in something that shouldn't be hit

return
end

local Type = Ballistics.GetImpactType(traceRes, Entity)

Expand Down
Loading

0 comments on commit 72d2a90

Please sign in to comment.