mirror of
https://github.com/metrostroi-repo/MetrostroiAddon.git
synced 2026-05-02 00:42:29 +00:00
* Global change. Замена всех устаревших функции на аналогичные * Global change. Добавил локальные переменные там, где это было рентабельно.
This commit is contained in:
@@ -1047,7 +1047,7 @@ function ENT:Think()
|
||||
end
|
||||
end
|
||||
|
||||
if (GetConVarNumber("metrostroi_disablecamaccel") == 0) then
|
||||
if (GetConVar("metrostroi_disablecamaccel"):GetInt() == 0) then
|
||||
self.HeadAcceleration = (self:Animate("accel",((self:GetNW2Float("Accel",0)+1)/2),0,1, 4, 1)*30-15)
|
||||
else
|
||||
self.HeadAcceleration = 0
|
||||
@@ -2262,8 +2262,8 @@ hook.Add("Think","metrostroi-cabin-panel",function()
|
||||
end
|
||||
|
||||
-- Tooltips
|
||||
local ttdelay = GetConVarNumber("metrostroi_tooltip_delay")
|
||||
if GetConVarNumber("metrostroi_disablehovertext") == 0 and ttdelay and ttdelay >= 0 then
|
||||
local ttdelay = GetConVar("metrostroi_tooltip_delay"):GetFloat()
|
||||
if GetConVar("metrostroi_disablehovertext"):GetInt() == 0 and ttdelay and ttdelay >= 0 then
|
||||
local button = findAimButton(ply,train)
|
||||
--print(train.ClientProps[button.ID].button)
|
||||
if button and
|
||||
@@ -2291,7 +2291,7 @@ hook.Add("Think","metrostroi-cabin-panel",function()
|
||||
toolTipText = toolTipText..newTT
|
||||
toolTipPosition = Metrostroi.GetPhrase(newTTpos)
|
||||
end]]
|
||||
if GetConVarNumber("metrostroi_disablehovertextpos") == 0 and button.tooltipState and button.tooltip then
|
||||
if GetConVar("metrostroi_disablehovertextpos"):GetInt() == 0 and button.tooltipState and button.tooltip then
|
||||
toolTipText = toolTipText..button.tooltipState(train)
|
||||
end
|
||||
end
|
||||
@@ -2525,7 +2525,7 @@ local ppMat = Material("pp/blurx")
|
||||
hook.Add( "HUDPaint", "metrostroi-draw-crosshair-tooltip", function()
|
||||
--if not drawCrosshair then return end
|
||||
if IsValid(LocalPlayer()) then
|
||||
local scrX,scrY = surface.ScreenWidth(),surface.ScreenHeight()
|
||||
local scrX,scrY = ScrW(),ScrH()
|
||||
|
||||
if canDrawCrosshair then
|
||||
surface.DrawCircle(scrX/2,scrY/2,4.1,drawCrosshair and Color(255,0,0) or Color(255,255,150))
|
||||
|
||||
@@ -86,6 +86,10 @@ function ENT:PostEntityPaste(ply,ent,createdEntities)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
local C_MaxWagons = GetConVar("metrostroi_maxwagons")
|
||||
local C_MaxTrains = GetConVar("metrostroi_maxtrains")
|
||||
local C_MaxTrainsOnPly = GetConVar("metrostroi_maxtrains_onplayer")
|
||||
|
||||
function ENT:Initialize()
|
||||
self.Joints = {}
|
||||
self.JointPositions = {}
|
||||
@@ -128,7 +132,7 @@ function ENT:Initialize()
|
||||
-- Initialize highspeed interface
|
||||
self:InitializeHighspeedLayout()
|
||||
-- Add telemetry recording module if required
|
||||
if GetConVarNumber("metrostroi_write_telemetry") == 1 then
|
||||
if GetConVar("metrostroi_write_telemetry"):GetInt() == 1 then
|
||||
self:LoadSystem("Telemetry")
|
||||
end
|
||||
self:LoadSystem("FailSim")
|
||||
@@ -2001,15 +2005,15 @@ end
|
||||
function ENT:SpawnFunction(ply, tr,className,rotate,func)
|
||||
--MaxTrains limit
|
||||
if self.ClassName ~= "gmod_subway_base" and not self.NoTrain then
|
||||
local Limit1 = math.min(2,GetConVarNumber("metrostroi_maxwagons"))*GetConVarNumber("metrostroi_maxtrains_onplayer")-1
|
||||
local Limit2 = math.max(0,GetConVarNumber("metrostroi_maxwagons")-2)*GetConVarNumber("metrostroi_maxtrains_onplayer")-1
|
||||
local Limit1 = math.min(2,C_MaxWagons:GetInt())*C_MaxTrainsOnPly:GetInt()-1
|
||||
local Limit2 = math.max(0,C_MaxWagons:GetInt()-2)*C_MaxTrainsOnPly:GetInt()-1
|
||||
|
||||
if Metrostroi.TrainCount() > GetConVarNumber("metrostroi_maxtrains")*GetConVarNumber("metrostroi_maxwagons")-1 then
|
||||
if Metrostroi.TrainCount() > C_MaxTrains:GetInt()*C_MaxWagons:GetInt()-1 then
|
||||
ply:LimitHit("train_limit")
|
||||
--Metrostroi.LimitMessage(ply)
|
||||
return
|
||||
end
|
||||
if Metrostroi.TrainCountOnPlayer(ply) > GetConVarNumber("metrostroi_maxwagons")*GetConVarNumber("metrostroi_maxtrains_onplayer")-1 then
|
||||
if Metrostroi.TrainCountOnPlayer(ply) > C_MaxWagons:GetInt()*C_MaxTrainsOnPly:GetInt()-1 then
|
||||
ply:LimitHit("train_limit")
|
||||
--Metrostroi.LimitMessage(ply)
|
||||
return
|
||||
|
||||
@@ -229,7 +229,7 @@ function ENT:CreateBASSSound(name,callback,noblock,onerr)
|
||||
if err ~= 41 then
|
||||
MsgC(Color(255,0,0),Format("Sound:%s\n\tErrCode:%s, ErrName:%s\n",name,err,errName))
|
||||
if onerr then callback(false) end
|
||||
elseif GetConVarNumber("metrostroi_drawdebug") ~= 0 then
|
||||
elseif GetConVar("metrostroi_drawdebug"):GetInt() ~= 0 then
|
||||
MsgC(Color(255,255,0),Format("Sound:%s\n\tBASS_ERROR_UNKNOWN (it's normal),ErrCode:%s, ErrName:%s\n",name,err,errName))
|
||||
self:CreateBASSSound(name,callback)
|
||||
end
|
||||
@@ -461,7 +461,7 @@ else
|
||||
if err == 4 or err == 37 then self.StopSounds = true end
|
||||
if err ~= 41 then
|
||||
MsgC(Color(255,0,0),Format("Sound:%s\n\tErrCode:%s, ErrName:%s\n",name,err,errName))
|
||||
elseif GetConVarNumber("metrostroi_drawdebug") ~= 0 then
|
||||
elseif GetConVar("metrostroi_drawdebug"):GetInt() ~= 0 then
|
||||
MsgC(Color(255,255,0),Format("Sound:%s\n\tBASS_ERROR_UNKNOWN (it's normal),ErrCode:%s, ErrName:%s\n",name,err,errName))
|
||||
--self:PlayOnce(soundid,location,range,pitch,randoff)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user