diff --git a/lua/acf/core/globals.lua b/lua/acf/core/globals.lua index 754fa1a73..cdba82822 100644 --- a/lua/acf/core/globals.lua +++ b/lua/acf/core/globals.lua @@ -67,6 +67,7 @@ do -- ACF global vars npc_strider = true, npc_dog = true, phys_bone_follower = true, + acf_armor = not ACF.AllowProcArmor, -- Procedural armor filter } -- Ammo diff --git a/lua/acf/core/utilities/traces_sh.lua b/lua/acf/core/utilities/traces_sh.lua index e8e347220..25d70022d 100644 --- a/lua/acf/core/utilities/traces_sh.lua +++ b/lua/acf/core/utilities/traces_sh.lua @@ -56,7 +56,8 @@ do -- ACF.trace util.TraceLine(traceData) - if Output.HitNonWorld and ACF.CheckClips(Output.Entity, Output.HitPos) then + -- Check for clips or to filter this entity + if Output.HitNonWorld and (ACF.CheckClips(Output.Entity, Output.HitPos) or ACF.GlobalFilter[Output.Entity:GetClass()]) then local OldFilter = traceData.filter local Filter = { Output.Entity } diff --git a/lua/acf/core/validation_sv.lua b/lua/acf/core/validation_sv.lua index c4829afeb..6e4e67240 100644 --- a/lua/acf/core/validation_sv.lua +++ b/lua/acf/core/validation_sv.lua @@ -29,7 +29,7 @@ function ACF.IsLegal(Entity) local Phys = Entity:GetPhysicsObject() - if Entity.ACF.PhysObj ~= Phys then + if not IsValid(Entity.ACF.PhysObj) or Entity.ACF.PhysObj ~= Phys then if Phys:GetVolume() then Entity.ACF.PhysObj = Phys -- Updated PhysObj else @@ -196,7 +196,7 @@ function ACF.Check(Entity, ForceUpdate) -- IsValid but for ACF end ACF.Activate(Entity) - elseif ForceUpdate or Entity.ACF.Mass ~= PhysObj:GetMass() or Entity.ACF.PhysObj ~= PhysObj then + elseif ForceUpdate or Entity.ACF.Mass ~= PhysObj:GetMass() or (not IsValid(Entity.ACF.PhysObj) or Entity.ACF.PhysObj ~= PhysObj) then ACF.Activate(Entity, true) end diff --git a/lua/acf/damage/explosion_sv.lua b/lua/acf/damage/explosion_sv.lua index b24850f16..8153af42c 100644 --- a/lua/acf/damage/explosion_sv.lua +++ b/lua/acf/damage/explosion_sv.lua @@ -14,6 +14,7 @@ local TraceData = { filter = true, mask = MASK_SOLID, } +local GlobalFilter = ACF.GlobalFilter --- Checks whether an entity can be affected by ACF explosions. -- @param Entity The entity to be checked. @@ -22,6 +23,7 @@ function Damage.isValidTarget(Entity) local Type = ACF.Check(Entity) if not Type then return false end + if GlobalFilter[Entity:GetClass()] then return false end if Entity.Exploding then return false end if Type ~= "Squishy" then return true end