From 308b0087ce390d91f08a8a0292bc641f90de8a85 Mon Sep 17 00:00:00 2001 From: march <106459595+marchc1@users.noreply.github.com> Date: Fri, 28 Feb 2025 22:38:10 -0800 Subject: [PATCH] Add Ballistics.CreateBullet required properties This should help us catch these issues easier --- lua/acf/ballistics/ballistics_sv.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/acf/ballistics/ballistics_sv.lua b/lua/acf/ballistics/ballistics_sv.lua index d7690698..d4f6019a 100644 --- a/lua/acf/ballistics/ballistics_sv.lua +++ b/lua/acf/ballistics/ballistics_sv.lua @@ -112,7 +112,16 @@ function Ballistics.IterateBullets() end end +local RequiredBulletDataProperties = {"Pos", "Flight"} function Ballistics.CreateBullet(BulletData) + -- Validate BulletData, so we can catch these problems easier + + for _, RequiredProp in ipairs(RequiredBulletDataProperties) do + if not BulletData[RequiredProp] then + error(("Ballistics.CreateBullet: Expected '%s' to be present in BulletData, got nil!"):format(RequiredProp)) + end + end + local Index = Ballistics.GetBulletIndex() if not Index then return end -- Too many bullets in the air