From db347bc3b2a57499fda370040d39daebb2f8fe8e Mon Sep 17 00:00:00 2001 From: StrawWagen <64710817+StrawWagen@users.noreply.github.com> Date: Tue, 26 Sep 2023 21:11:16 -0700 Subject: [PATCH 1/2] Freeze on Initialize Fixes primitives sometimes getting woken up too early, and simulating with helicopter bomb collisions. --- lua/primitive/entities/base.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/primitive/entities/base.lua b/lua/primitive/entities/base.lua index a940584..ae851eb 100644 --- a/lua/primitive/entities/base.lua +++ b/lua/primitive/entities/base.lua @@ -397,6 +397,11 @@ function class:Initialize() self:PhysicsInit( SOLID_VPHYSICS ) self:SetMoveType( MOVETYPE_VPHYSICS ) self:SetSolid( SOLID_VPHYSICS ) + + local physobj = self:GetPhysicsObject() + if physobj:IsValid() then + physobj:EnableMotion( false ) + end end end From 54b27d6d35d1394d0d368c45d37aeab17f7fa483 Mon Sep 17 00:00:00 2001 From: StrawWagen <64710817+StrawWagen@users.noreply.github.com> Date: Thu, 28 Sep 2023 10:50:59 -0700 Subject: [PATCH 2/2] Handle potential error --- lua/primitive/entities/base.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/primitive/entities/base.lua b/lua/primitive/entities/base.lua index ae851eb..a49990c 100644 --- a/lua/primitive/entities/base.lua +++ b/lua/primitive/entities/base.lua @@ -399,7 +399,7 @@ function class:Initialize() self:SetSolid( SOLID_VPHYSICS ) local physobj = self:GetPhysicsObject() - if physobj:IsValid() then + if physobj and physobj:IsValid() then physobj:EnableMotion( false ) end end