mirror of
https://github.com/metrostroi-repo/MetrostroiAddon.git
synced 2026-05-02 00:42:29 +00:00
Оптимизация. Заменен ents.FindByClass на Metrostroi.SpawnedTrains в gmod_track_platform
This commit is contained in:
@@ -236,7 +236,7 @@ end
|
|||||||
|
|
||||||
ENT.TESTTEST = false
|
ENT.TESTTEST = false
|
||||||
local dT = 0.25
|
local dT = 0.25
|
||||||
local trains = {}
|
local trains = Metrostroi.SpawnedTrains
|
||||||
function ENT:Think()
|
function ENT:Think()
|
||||||
if not Metrostroi.Stations[self.StationIndex] then return end
|
if not Metrostroi.Stations[self.StationIndex] then return end
|
||||||
-- Send update to client
|
-- Send update to client
|
||||||
@@ -266,9 +266,8 @@ function ENT:Think()
|
|||||||
local boarding = false
|
local boarding = false
|
||||||
|
|
||||||
local BoardTime = 8+7*self.HorliftStation
|
local BoardTime = 8+7*self.HorliftStation
|
||||||
for k,v in pairs(ents.FindByClass("gmod_subway_*")) do
|
for v in pairs(trains) do
|
||||||
if v.Base ~= "gmod_subway_base" and v:GetClass() ~= "gmod_subway_base" then continue end
|
if v:GetPos():DistToSqr(self:GetPos()) > self.PlatformStart:DistToSqr(self.PlatformEnd) then continue end
|
||||||
if not IsValid(v) or v:GetPos():DistToSqr(self:GetPos()) > self.PlatformStart:DistToSqr(self.PlatformEnd) then continue end
|
|
||||||
|
|
||||||
local platform_distance = ((self.PlatformStart-v:GetPos()) - ((self.PlatformStart-v:GetPos()):Dot(self.PlatformNorm))*self.PlatformNorm):Length()
|
local platform_distance = ((self.PlatformStart-v:GetPos()) - ((self.PlatformStart-v:GetPos()):Dot(self.PlatformNorm))*self.PlatformNorm):Length()
|
||||||
local vertical_distance = math.abs(v:GetPos().z - self.PlatformStart.z)
|
local vertical_distance = math.abs(v:GetPos().z - self.PlatformStart.z)
|
||||||
|
|||||||
Reference in New Issue
Block a user