mirror of
https://github.com/metrostroi-repo/MetrostroiAddon.git
synced 2026-05-02 00:42:29 +00:00
@@ -419,29 +419,29 @@ function ENT:CheckContact(pos,dir,id,cpos)
|
|||||||
return result.Hit
|
return result.Hit
|
||||||
end
|
end
|
||||||
|
|
||||||
local C_Reqiure3rdRail = GetConVar("metrostroi_train_requirethirdrail")
|
local C_Require3rdRail = GetConVar("metrostroi_train_requirethirdrail")
|
||||||
|
|
||||||
function ENT:CheckVoltage(dT)
|
function ENT:CheckVoltage(dT)
|
||||||
-- Check contact states
|
-- Check contact states
|
||||||
if (CurTime() - self.CheckTimeout) <= 0.25 then return end
|
if (CurTime() - self.CheckTimeout) <= 0.25 then return end
|
||||||
self.CheckTimeout = CurTime()
|
self.CheckTimeout = CurTime()
|
||||||
local supported = C_Reqiure3rdRail:GetInt() > 0 and Metrostroi.MapHasFullSupport()
|
local supported = C_Require3rdRail:GetInt() > 0 and Metrostroi.MapHasFullSupport()
|
||||||
local feeder = self.Feeder and Metrostroi.Voltages[self.Feeder]
|
local feeder = self.Feeder and Metrostroi.Voltages[self.Feeder]
|
||||||
local volt = feeder or Metrostroi.Voltage or 750
|
local contacts = not self.DisableContacts and not self.DisableContactsManual
|
||||||
|
local volt = contacts and (feeder or Metrostroi.Voltage or 750) or 0
|
||||||
|
|
||||||
-- Non-metrostroi maps
|
-- Non-metrostroi maps
|
||||||
if not supported then
|
if not supported then
|
||||||
self.Voltage = volt
|
self.Voltage = volt
|
||||||
self.NextStates[1] = true
|
self.NextStates[1] = contacts
|
||||||
self.NextStates[2] = true
|
self.NextStates[2] = contacts
|
||||||
|
self.ContactStates = self.NextStates
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
self.VoltageDropByTouch = 0
|
self.VoltageDropByTouch = 0
|
||||||
self.NextStates[1] = not self.DisableContacts and not self.DisableContactsManual
|
self.NextStates[1] = contacts and self:CheckContact(self.PantLPos,Vector(0,-1,0),1,self.PantLCPos)
|
||||||
and self:CheckContact(self.PantLPos,Vector(0,-1,0),1,self.PantLCPos)
|
self.NextStates[2] = contacts and self:CheckContact(self.PantRPos,Vector(0, 1,0),2,self.PantRCPos)
|
||||||
self.NextStates[2] = not self.DisableContacts and not self.DisableContactsManual
|
|
||||||
and self:CheckContact(self.PantRPos,Vector(0, 1,0),2,self.PantRCPos)
|
|
||||||
|
|
||||||
-- Detect changes in contact states
|
-- Detect changes in contact states
|
||||||
for i=1,2 do
|
for i=1,2 do
|
||||||
|
|||||||
Reference in New Issue
Block a user