mirror of
https://github.com/metrostroi-repo/MetrostroiAddon.git
synced 2026-05-04 00:52:33 +00:00
Бортовые номера.
Установка моделей цифр бортовых номеров в modelcallback из-за бага, когда моделька улетает в центр вагона.
This commit is contained in:
@@ -816,23 +816,32 @@ for i=1,8 do
|
||||
hide = 1.1,
|
||||
}
|
||||
end
|
||||
|
||||
for i=0,3 do
|
||||
ENT.ClientProps["TrainNumberL"..i] = {
|
||||
model = "models/metrostroi_train/81-714_mmz/bortnumber_0.mdl",
|
||||
pos = Vector(57+i*6.6-5*6.6/2,67.64,-17.8),
|
||||
pos = Vector(0,0,0),
|
||||
ang = Angle(0,90,0),
|
||||
hide = 1.5,
|
||||
callback = function(ent)
|
||||
ent.WagonNumber = false
|
||||
callback = function(ent,cent)
|
||||
Metrostroi.BortNumberMMZCallback(ent,cent,"TrainNumberL",i,Vector(70, 67.64,-17.8),TEXT_ALIGN_LEFT)
|
||||
end,
|
||||
modelcallback = function(ent)
|
||||
local wagNum = ent.WagonNumber or 0
|
||||
return Metrostroi.BortNumberMMZCallbackModel(ent,"TrainNumberL",i,(wagNum < 250 and 3 or 4),false)
|
||||
end,
|
||||
}
|
||||
ENT.ClientProps["TrainNumberR"..i] = {
|
||||
model = "models/metrostroi_train/81-714_mmz/bortnumber_0.mdl",
|
||||
pos = Vector(80-i*6.6-5*6.6/2,-67.64,-17.8),
|
||||
pos = Vector(0,0,0),
|
||||
ang = Angle(0,-90,0),
|
||||
hide = 1.5,
|
||||
callback = function(ent)
|
||||
ent.WagonNumber = false
|
||||
callback = function(ent,cent)
|
||||
Metrostroi.BortNumberMMZCallback(ent,cent,"TrainNumberR",i,Vector(70,-67.64,-17.8),TEXT_ALIGN_RIGHT)
|
||||
end,
|
||||
modelcallback = function(ent)
|
||||
local wagNum = ent.WagonNumber or 0
|
||||
return Metrostroi.BortNumberMMZCallbackModel(ent,"TrainNumberR",i,(wagNum < 250 and 3 or 4),true)
|
||||
end,
|
||||
}
|
||||
end
|
||||
@@ -879,22 +888,18 @@ function ENT:Initialize()
|
||||
end
|
||||
end
|
||||
function ENT:UpdateWagonNumber()
|
||||
for i=0,3 do
|
||||
local count = self.WagonNumber < 250 and 3 or 4
|
||||
self:ShowHide("TrainNumberL"..i,i<count)
|
||||
self:ShowHide("TrainNumberR"..i,i<count)
|
||||
if i< count and self.WagonNumber then
|
||||
local leftNum,rightNum = self.ClientEnts["TrainNumberL"..i],self.ClientEnts["TrainNumberR"..i]
|
||||
local num = math.floor(self.WagonNumber%(10^(i+1))/10^i)
|
||||
if IsValid(leftNum) then
|
||||
leftNum:SetPos(self:LocalToWorld(Vector(57+i*6.6-count*6.6/2,67.64,-17.8)))
|
||||
leftNum:SetModel("models/metrostroi_train/81-714_mmz/bortnumber_"..num..".mdl")
|
||||
end
|
||||
if IsValid(rightNum) then
|
||||
rightNum:SetPos(self:LocalToWorld(Vector(80-i*6.6-count*6.6/2,-67.64,-17.8)))
|
||||
rightNum:SetModel("models/metrostroi_train/81-714_mmz/bortnumber_"..num..".mdl")
|
||||
end
|
||||
end
|
||||
local count = self.WagonNumber < 250 and 3 or 4
|
||||
|
||||
self.TrainNumberR = false
|
||||
self.TrainNumberL = false
|
||||
for i=0,4 do
|
||||
self:ShowHide("TrainNumberR"..i, i<count)
|
||||
local cent = self.ClientEnts["TrainNumberR"..i]
|
||||
if IsValid(cent) then cent:Remove() end
|
||||
|
||||
self:ShowHide("TrainNumberL"..i, i<count)
|
||||
cent = self.ClientEnts["TrainNumberL"..i]
|
||||
if IsValid(cent) then cent:Remove() end
|
||||
end
|
||||
end
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user