From 2545b66b0a53e6d4a9221197f008cc7c4eec7aa6 Mon Sep 17 00:00:00 2001 From: Ilya Krasnow Date: Tue, 27 Jul 2021 13:16:03 +0300 Subject: [PATCH] Fix bugs #91,#79,#38,#72 (#216) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update metrostroi.lua Исправил ошибку #91 * Фикс #79 * #38 * #72 Пока-что временное решение * Update metrostroi.lua * Перенёс SquealType на сам номер в TrainSpawnerUpdate * Update cl_init.lua --- lua/autorun/metrostroi.lua | 10 ++++++++++ lua/entities/gmod_subway_81-714_lvz/init.lua | 4 ++-- lua/entities/gmod_subway_81-717_lvz/init.lua | 4 ++-- lua/entities/gmod_subway_81-717_mvm/init.lua | 2 ++ lua/metrostroi/systems/sys_81_717_pam.lua | 2 +- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lua/autorun/metrostroi.lua b/lua/autorun/metrostroi.lua index 9eacd68..8fee089 100644 --- a/lua/autorun/metrostroi.lua +++ b/lua/autorun/metrostroi.lua @@ -132,6 +132,16 @@ function Metrostroi.AddSkin(category,name,tbl) Table.name = nil tbl = Table end + if CLIENT and tbl.textures then + local find + for k,v in pairs(tbl.textures) do + if not file.Exists("materials/"..v..".vtf","GAME") then + find = true + ErrorNoHalt(Format("Metrostroi: %s texture: %s, not found. Check folder and addons!\n",category,v)) + end + end + if find then return end + end if not Metrostroi.Skins[category] then print(Format("Metrostroi: Added a %s skin category",category)) Metrostroi.Skins[category] = {} diff --git a/lua/entities/gmod_subway_81-714_lvz/init.lua b/lua/entities/gmod_subway_81-714_lvz/init.lua index fa41cd6..c842954 100644 --- a/lua/entities/gmod_subway_81-714_lvz/init.lua +++ b/lua/entities/gmod_subway_81-714_lvz/init.lua @@ -148,9 +148,9 @@ function ENT:Initialize() self.Lamps = { broken = {}, } - local rand = math.random() > 0.8 and 1 or math.random(0.95,0.99) + local rand = math.random() > 0.95 and 1 or math.random(0.95,0.99) for i = 1,23 do - if math.random() > rand then self.Lamps.broken[i] = math.random() > 0.5 end + if math.random() > rand then self.Lamps.broken[i] = math.random() > 0.7 end end self:TrainSpawnerUpdate() diff --git a/lua/entities/gmod_subway_81-717_lvz/init.lua b/lua/entities/gmod_subway_81-717_lvz/init.lua index e7d37c6..4d6e2c5 100644 --- a/lua/entities/gmod_subway_81-717_lvz/init.lua +++ b/lua/entities/gmod_subway_81-717_lvz/init.lua @@ -247,9 +247,9 @@ function ENT:Initialize() self.Lamps = { broken = {}, } - local rand = math.random() > 0.8 and 1 or math.random(0.95,0.99) + local rand = math.random() > 0.95 and 1 or math.random(0.95,0.99) for i = 1,12 do - if math.random() > rand then self.Lamps.broken[i] = math.random() > 0.5 end + if math.random() > rand then self.Lamps.broken[i] = math.random() > 0.7 end end self:SetNW2Int("Type",self:GetNW2Int("Type",3)) diff --git a/lua/entities/gmod_subway_81-717_mvm/init.lua b/lua/entities/gmod_subway_81-717_mvm/init.lua index 0f34929..09fc955 100644 --- a/lua/entities/gmod_subway_81-717_mvm/init.lua +++ b/lua/entities/gmod_subway_81-717_mvm/init.lua @@ -535,9 +535,11 @@ function ENT:TrainSpawnerUpdate() local pneumoPow = 0.8+(math.random()^1.55)*0.4 if IsValid(self.FrontBogey) then + self.FrontBogey:SetNW2Int("SquealType",math.floor(math.random(4,7))) self.FrontBogey.PneumaticPow = pneumoPow end if IsValid(self.RearBogey) then + self.RearBogey:SetNW2Int("SquealType",math.floor(math.random(4,7))) self.RearBogey.PneumaticPow = pneumoPow end self.Pneumatic.VDLoud = math.random()<0.06 and 0.9+math.random()*0.2 diff --git a/lua/metrostroi/systems/sys_81_717_pam.lua b/lua/metrostroi/systems/sys_81_717_pam.lua index b28a18b..41c9d9f 100644 --- a/lua/metrostroi/systems/sys_81_717_pam.lua +++ b/lua/metrostroi/systems/sys_81_717_pam.lua @@ -2762,7 +2762,7 @@ function TRAIN_SYSTEM:Think(dT) dist = 3072-self.Distance opv = true else - dist = self.StationTable.dist_last_end-self.Distance + dist = (self.StationTable.dist_last_end or 3072)-self.Distance local opvDist = self.StationTable.isHorlift and 0.45 or 3 opv = self.Distance > self.StationTable.dist_last_start if not opv then