diff --git a/lua/entities/gmod_train_couple/init.lua b/lua/entities/gmod_train_couple/init.lua index 84f8316..bda2a4c 100644 --- a/lua/entities/gmod_train_couple/init.lua +++ b/lua/entities/gmod_train_couple/init.lua @@ -313,7 +313,18 @@ function ENT:OnDecouple() end end +local vector_zero = Vector(0, 0, 0) function ENT:Think() - self:NextThink(CurTime()+1) + local train = self:GetNW2Entity("TrainEntity") + if IsValid(train) and train.OnCoupled and not IsValid(self.Coupled) then + -- Fixing crazy physics on spawn + local phy = self:GetPhysicsObject() + if IsValid(phy) then + phy:SetAngleVelocityInstantaneous(vector_zero) + end + self:NextThink(CurTime()) + else + self:NextThink(CurTime() + 1) + end return true end