From 221fa374f271f595fe1af162694b7fd698251142 Mon Sep 17 00:00:00 2001 From: LengthenedGradient <109800352+LengthenedGradient@users.noreply.github.com> Date: Mon, 19 Feb 2024 20:40:24 -0500 Subject: [PATCH 1/4] Fix ACF.GlobalFilter The ACF global filter table was not previously applied to non ballistic traces (HEAT jets or HE traces). This update should hopefully fix that. In addition, procedural armor was meant to be filtered as per (https://github.com/ACF-Team/ACF-3/pull/355/commits/ad913041e759476b28ca48e1a59e7d81cb07bc63) but was not filtered. It will be now. --- lua/acf/core/globals.lua | 1 + lua/acf/core/utilities/traces_sh.lua | 3 ++- lua/acf/damage/explosion_sv.lua | 2 ++ lua/acf/menu/data_callbacks.lua | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/acf/core/globals.lua b/lua/acf/core/globals.lua index 8a9e89141..f9995668d 100644 --- a/lua/acf/core/globals.lua +++ b/lua/acf/core/globals.lua @@ -66,6 +66,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/damage/explosion_sv.lua b/lua/acf/damage/explosion_sv.lua index b24850f16..6de994783 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 print(Entity) return false end if Entity.Exploding then return false end if Type ~= "Squishy" then return true end diff --git a/lua/acf/menu/data_callbacks.lua b/lua/acf/menu/data_callbacks.lua index 9435448e7..69983065a 100644 --- a/lua/acf/menu/data_callbacks.lua +++ b/lua/acf/menu/data_callbacks.lua @@ -187,6 +187,7 @@ local Settings = { ACF.AllowProcArmor = Bool GlobalFilter["acf_armor"] = not Bool + if GlobalFilter["acf_armor"] == true then print("globalfiler parmor") end if CLIENT and not IsValid(Player) then return end From dd07b0dd6c4cad8d20ef66aa0eb0d117ae32a2d5 Mon Sep 17 00:00:00 2001 From: LengthenedGradient <109800352+LengthenedGradient@users.noreply.github.com> Date: Mon, 19 Feb 2024 20:48:27 -0500 Subject: [PATCH 2/4] Fix Debug Typo --- lua/acf/menu/data_callbacks.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/acf/menu/data_callbacks.lua b/lua/acf/menu/data_callbacks.lua index 69983065a..02481b145 100644 --- a/lua/acf/menu/data_callbacks.lua +++ b/lua/acf/menu/data_callbacks.lua @@ -187,8 +187,7 @@ local Settings = { ACF.AllowProcArmor = Bool GlobalFilter["acf_armor"] = not Bool - if GlobalFilter["acf_armor"] == true then print("globalfiler parmor") end - + if CLIENT and not IsValid(Player) then return end Message("Info", "Procedural armor has been " .. (Bool and "enabled." or "disabled.")) From 4658c509e809c5573ee409d467dbfc733bc5702a Mon Sep 17 00:00:00 2001 From: LengthenedGradient <109800352+LengthenedGradient@users.noreply.github.com> Date: Mon, 19 Feb 2024 20:52:27 -0500 Subject: [PATCH 3/4] Fix Whitespace and Typo Errors --- lua/acf/damage/explosion_sv.lua | 2 +- lua/acf/menu/data_callbacks.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/acf/damage/explosion_sv.lua b/lua/acf/damage/explosion_sv.lua index 6de994783..8153af42c 100644 --- a/lua/acf/damage/explosion_sv.lua +++ b/lua/acf/damage/explosion_sv.lua @@ -23,7 +23,7 @@ function Damage.isValidTarget(Entity) local Type = ACF.Check(Entity) if not Type then return false end - if GlobalFilter[Entity:GetClass()] then print(Entity) 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 diff --git a/lua/acf/menu/data_callbacks.lua b/lua/acf/menu/data_callbacks.lua index 02481b145..9435448e7 100644 --- a/lua/acf/menu/data_callbacks.lua +++ b/lua/acf/menu/data_callbacks.lua @@ -187,7 +187,7 @@ local Settings = { ACF.AllowProcArmor = Bool GlobalFilter["acf_armor"] = not Bool - + if CLIENT and not IsValid(Player) then return end Message("Info", "Procedural armor has been " .. (Bool and "enabled." or "disabled.")) From 81164f13636d79685cd3c5adb7eaaba54802e8ea Mon Sep 17 00:00:00 2001 From: thecraftianman <64441307+thecraftianman@users.noreply.github.com> Date: Mon, 19 Feb 2024 22:25:07 -0500 Subject: [PATCH 4/4] Check PhysObj comparison edge case Should close #390 --- lua/acf/core/validation_sv.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/acf/core/validation_sv.lua b/lua/acf/core/validation_sv.lua index dd9bfa6a1..d764540f3 100644 --- a/lua/acf/core/validation_sv.lua +++ b/lua/acf/core/validation_sv.lua @@ -35,7 +35,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 @@ -204,7 +204,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