mirror of
https://github.com/metrostroi-repo/MetrostroiAddon.git
synced 2026-05-02 00:42:29 +00:00
@@ -313,7 +313,17 @@ function ENT:OnDecouple()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local vector_zero = Vector(0, 0, 0)
|
||||||
function ENT:Think()
|
function ENT:Think()
|
||||||
|
if self.TrainSpawnerCoupleFix 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)
|
self:NextThink(CurTime() + 1)
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -327,6 +327,12 @@ function TOOL:SpawnWagon(trace)
|
|||||||
ent:UpdateTextures()
|
ent:UpdateTextures()
|
||||||
ent.FrontAutoCouple = i > 1 and i < self.Settings.WagNum
|
ent.FrontAutoCouple = i > 1 and i < self.Settings.WagNum
|
||||||
ent.RearAutoCouple = self.Settings.WagNum > 1
|
ent.RearAutoCouple = self.Settings.WagNum > 1
|
||||||
|
if IsValid(ent.FrontCouple) then
|
||||||
|
ent.FrontCouple.TrainSpawnerCoupleFix = ent.FrontAutoCouple
|
||||||
|
end
|
||||||
|
if IsValid(ent.RearCouple) then
|
||||||
|
ent.RearCouple.TrainSpawnerCoupleFix = ent.RearAutoCouple
|
||||||
|
end
|
||||||
LastEnt = ent
|
LastEnt = ent
|
||||||
end
|
end
|
||||||
undo.SetPlayer(ply)
|
undo.SetPlayer(ply)
|
||||||
@@ -342,6 +348,8 @@ function TOOL:SpawnWagon(trace)
|
|||||||
train.RearBogey.BrakeCylinderPressure = 3
|
train.RearBogey.BrakeCylinderPressure = 3
|
||||||
train.FrontBogey.MotorPower = 0
|
train.FrontBogey.MotorPower = 0
|
||||||
train.RearBogey.MotorPower = 0
|
train.RearBogey.MotorPower = 0
|
||||||
|
train.FrontCouple.TrainSpawnerCoupleFix = nil
|
||||||
|
train.RearCouple.TrainSpawnerCoupleFix = nil
|
||||||
train.OnCoupled = nil
|
train.OnCoupled = nil
|
||||||
end
|
end
|
||||||
timer.Simple(1,function() for i,train in ipairs(trains) do train.IgnoreEngine = false end end)
|
timer.Simple(1,function() for i,train in ipairs(trains) do train.IgnoreEngine = false end end)
|
||||||
|
|||||||
Reference in New Issue
Block a user