1
0
mirror of https://github.com/metrostroi-repo/MetrostroiAddon.git synced 2026-05-02 00:42:29 +00:00

Фикс сцепки при спавне

This commit is contained in:
ZONT_
2026-04-30 01:41:28 +03:00
parent 6d5336d891
commit 38688cc83a

View File

@@ -313,7 +313,18 @@ function ENT:OnDecouple()
end
end
local vector_zero = Vector(0, 0, 0)
function ENT:Think()
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