1
0
mirror of https://github.com/metrostroi-repo/MetrostroiAddon.git synced 2026-05-02 00:42:29 +00:00

release branch init

This commit is contained in:
g_brzhezinskiy
2021-01-02 15:32:05 +03:00
parent 1d05caf866
commit 09566ce158
398 changed files with 8389 additions and 77275 deletions

View File

@@ -1,34 +1,24 @@
include("shared.lua")
local debug = GetConVar("metrostroi_drawsignaldebug")
local function enableDebug()
if debug:GetBool() then
hook.Add("PostDrawTranslucentRenderables","MetrostroiSignDebug",function(bDrawingDepth,bDrawingSkybox)
for _,ent in pairs(ents.FindByClass("gmod_track_signs")) do
if bDrawingDepth and LocalPlayer():GetPos():Distance(sig:GetPos()) < 512 then
local pos = sig:LocalToWorld(Vector(0,0,0))
local ang = sig:LocalToWorldAngles(Angle(0,90,90))
cam.Start3D2D(pos, ang, 0.25)
surface.SetDrawColor(125, 125, 0, 255)
surface.DrawRect(-40, -20, 80, 20)
cam.End3D2D()
end
end
end)
else
hook.Remove("PostDrawTranslucentRenderables","MetrostroiSignDebug")
end
end
hook.Remove("PostDrawTranslucentRenderables","MetrostroiSignDebug")
cvars.AddChangeCallback( "metrostroi_drawsignaldebug", enableDebug)
enableDebug()
hook.Add("PostDrawOpaqueRenderables", "metrostroi_sign_debug_draw", function(isDD)
if isDD then return end
if GetConVarNumber("metrostroi_drawsignaldebug") == 0 then return end
--print(2)
for _,self in pairs(ents.FindByClass("gmod_track_signs")) do
local pos = self:LocalToWorld(Vector(0,0,0))
local ang = self:LocalToWorldAngles(Angle(0,90,90))
cam.Start3D2D(pos , ang, 0.25)
surface.SetDrawColor(125, 125, 0, 255)
surface.DrawRect(-40, -20, 80, 20)
cam.End3D2D()
end
end )
function ENT:Initialize()
--self.ModelProp = self:GetNWInt("Model")
end
function ENT:OnRemove()
print(12323)
self:RemoveModels()
--self.LightType = 0
--hook.Remove("PostDrawOpaqueRenderables")
@@ -38,7 +28,7 @@ function ENT:RemoveModels()
self.Model = nil
end
function ENT:Think()
self:SetNextClientThink(CurTime()+5)
self:NextThink(CurTime()+5)
--if self.SendReq == nil or (self.SendReq and CurTime() - self.SendReq <= 0) then return true elseif self.SendReq then self.SendReq = false end
if self:IsDormant() or Metrostroi and Metrostroi.ReloadClientside then
if IsValid(self.Model) then
@@ -61,10 +51,7 @@ function ENT:Think()
end
self:RemoveModels()
end
if not self.ModelProp then
self:SetNextClientThink(CurTime()+1)
return true
end
if not self.ModelProp then return true end
if not IsValid(self.Model) then
--ents.CreateClientProp("models/metrostroi/81-717/reverser.mdl")
--hook.Add("MetrostroiBigLag",self.Model,function(ent)
@@ -88,16 +75,7 @@ function ENT:Think()
local RAND = math.random(-10,10)
local pos = self.ModelProp.pos + self.Offset
local ang = self.ModelProp.angles
if not self.ModelProp.noauto then
pos = pos+Vector(0,0,RAND/5)
if self.ModelProp.axis == 1 then
ang = ang+Angle(RAND,0,0)
elseif self.ModelProp.axis == 2 then
ang = ang+Angle(0,RAND,0)
else
ang = ang+Angle(0,0,RAND)
end
end
if not self.ModelProp.noauto then pos = pos+Vector(0,0,RAND/5); ang = ang+Angle(0,0,RAND) end
if self.Left then pos = pos*Vector(1,-1,1) end
if self.Left and self.ModelProp.rotate then ang = ang-Angle(0,180,0) end
self.Model:SetParent(self)