From e6d084a09dc9a25bda0a6f5a32bcda3c4dc52041 Mon Sep 17 00:00:00 2001 From: thecraftianman <64441307+thecraftianman@users.noreply.github.com> Date: Fri, 5 Jan 2024 22:55:28 -0500 Subject: [PATCH] Update ballistics impact tests Now accounts for the fact that all NPCs are counted as props regardless of owner --- .../ballistics_sv/get_impact_type.lua | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lua/tests/acf/ballistics/ballistics_sv/get_impact_type.lua b/lua/tests/acf/ballistics/ballistics_sv/get_impact_type.lua index fcb872d61..bf0edae85 100644 --- a/lua/tests/acf/ballistics/ballistics_sv/get_impact_type.lua +++ b/lua/tests/acf/ballistics/ballistics_sv/get_impact_type.lua @@ -16,7 +16,24 @@ return { name = "Returns Prop if impacting a Player Entity", func = function() local Trace = {} - local Entity = { IsPlayer = stub().returns( true ) } + local Entity = { + IsPlayer = stub().returns( true ), + IsNPC = stub().returns( false ) + } + + local Type = ACF.Ballistics.GetImpactType( Trace, Entity ) + expect( Type ).to.equal( "Prop" ) + end + }, + + { + name = "Returns Prop if impacting an NPC Entity", + func = function() + local Trace = {} + local Entity = { + IsPlayer = stub().returns( false ), + IsNPC = stub().returns( true ) + } local Type = ACF.Ballistics.GetImpactType( Trace, Entity ) expect( Type ).to.equal( "Prop" ) @@ -29,6 +46,7 @@ return { local Trace = {} local Entity = { IsPlayer = stub().returns( false ), + IsNPC = stub().returns( false ), CPPIGetOwner = function() return { IsValid = stub().returns( true ) } end @@ -45,6 +63,7 @@ return { local Trace = {} local Entity = { IsPlayer = stub().returns( false ), + IsNPC = stub().returns( false ), CPPIGetOwner = function() return { IsValid = stub().returns( false ) } end