Skip to content

Commit

Permalink
Color( ... ) to color where possible and similar things
Browse files Browse the repository at this point in the history
Hopefully nothing broke in the process
  • Loading branch information
robotboy655 committed Aug 20, 2020
1 parent ce61402 commit b9839ed
Show file tree
Hide file tree
Showing 54 changed files with 109 additions and 110 deletions.
2 changes: 1 addition & 1 deletion garrysmod/gamemodes/base/entities/effects/dof_node.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ function EFFECT:Render()
local SpriteSize = ( self.spacing + self.offset ) * 8

render.SetMaterial( self.Mat )
render.DrawSprite( self:GetPos(), SpriteSize, SpriteSize, Color( 255, 255, 255 ) )
render.DrawSprite( self:GetPos(), SpriteSize, SpriteSize, color_white )

end
2 changes: 1 addition & 1 deletion garrysmod/gamemodes/base/entities/effects/tooltracer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function EFFECT:Render()
8, -- Width
texcoord, -- Start tex coord
texcoord + self.Length / 128, -- End tex coord
Color( 255, 255, 255 ) ) -- Color (optional)
color_white ) -- Color (optional)
end

render.DrawBeam( self.StartPos,
Expand Down
4 changes: 2 additions & 2 deletions garrysmod/gamemodes/base/entities/entities/gmod_hands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function ENT:AttachToViewmodel( vm )
self:SetParent( vm )
self:SetMoveType( MOVETYPE_NONE )

self:SetPos( Vector( 0, 0, 0 ) )
self:SetAngles( Angle( 0, 0, 0 ) )
self:SetPos( vector_origin )
self:SetAngles( angle_zero )

end
2 changes: 1 addition & 1 deletion garrysmod/gamemodes/base/entities/entities/prop_effect.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function ENT:PhysicsUpdate( physobj )
-- Don't do anything if the player isn't holding us
if ( !self:IsPlayerHolding() && !self:IsConstrained() ) then

physobj:SetVelocity( Vector( 0, 0, 0 ) )
physobj:SetVelocity( vector_origin )
physobj:Sleep()

end
Expand Down
4 changes: 2 additions & 2 deletions garrysmod/gamemodes/base/entities/entities/ragdoll_motion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function ENT:PhysicsUpdate( physobj )
if ( self:IsPlayerHolding() ) then return end
if ( self:IsConstrained() ) then return end

physobj:SetVelocity( Vector( 0, 0, 0 ) )
physobj:SetVelocity( vector_origin )
physobj:Sleep()

end
Expand Down Expand Up @@ -131,7 +131,7 @@ function ENT:DrawDebug( ragdoll, controller, pos, ang, rotation, scale, center,

center = center

local col_bone = Color( 255, 255, 255, 255 )
local col_bone = color_white
local col_point = Color( 255, 0, 0, 255 )
local col_tran_bn = Color( 0, 255, 0, 255 )

Expand Down
4 changes: 2 additions & 2 deletions garrysmod/gamemodes/base/gamemode/cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function GM:OnPlayerChat( player, strText, bTeamOnly, bPlayerIsDead )
--
-- I've made this all look more complicated than it is. Here's the easy version
--
-- chat.AddText( player, Color( 255, 255, 255 ), ": ", strText )
-- chat.AddText( player, color_white, ": ", strText )
--

local tab = {}
Expand All @@ -162,7 +162,7 @@ function GM:OnPlayerChat( player, strText, bTeamOnly, bPlayerIsDead )
table.insert( tab, "Console" )
end

table.insert( tab, Color( 255, 255, 255 ) )
table.insert( tab, color_white )
table.insert( tab, ": " .. strText )

chat.AddText( unpack(tab) )
Expand Down
4 changes: 2 additions & 2 deletions garrysmod/gamemodes/base/gamemode/cl_scoreboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,15 @@ local SCORE_BOARD = {

self.Name = self.Header:Add( "DLabel" )
self.Name:SetFont( "ScoreboardDefaultTitle" )
self.Name:SetTextColor( Color( 255, 255, 255, 255 ) )
self.Name:SetTextColor( color_white )
self.Name:Dock( TOP )
self.Name:SetHeight( 40 )
self.Name:SetContentAlignment( 5 )
self.Name:SetExpensiveShadow( 2, Color( 0, 0, 0, 200 ) )

--self.NumPlayers = self.Header:Add( "DLabel" )
--self.NumPlayers:SetFont( "ScoreboardDefault" )
--self.NumPlayers:SetTextColor( Color( 255, 255, 255, 255 ) )
--self.NumPlayers:SetTextColor( color_white )
--self.NumPlayers:SetPos( 0, 100 - 30 )
--self.NumPlayers:SetSize( 300, 30 )
--self.NumPlayers:SetContentAlignment( 4 )
Expand Down
2 changes: 1 addition & 1 deletion garrysmod/gamemodes/base/gamemode/cl_voice.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function PANEL:Init()
self.LabelName:SetFont( "GModNotify" )
self.LabelName:Dock( FILL )
self.LabelName:DockMargin( 8, 0, 0, 0 )
self.LabelName:SetTextColor( Color( 255, 255, 255, 255 ) )
self.LabelName:SetTextColor( color_white )

self.Avatar = vgui.Create( "AvatarImage", self )
self.Avatar:Dock( LEFT )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function TauntCamera()

local WasOn = false

local CustomAngles = Angle( 0, 0, 0 )
local CustomAngles = angle_zero
local PlayerLockAngles = nil

local InLerp = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ end
function ENT:PhysicsSimulate( phys, deltatime )

local vLinear = Vector( 0, 0, self:GetForce() * 5000 ) * deltatime
local vAngular = Vector( 0, 0, 0 )
local vAngular = vector_origin

return vAngular, vLinear, SIM_GLOBAL_FORCE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ function ENT:PhysicsSimulate( phys, deltatime )

Exponent = math.Clamp( Exponent, -5000, 5000 )

local Linear = Vector( 0, 0, 0 )
local Angular = Vector( 0, 0, 0 )
local Linear = vector_origin
local Angular = vector_origin

Linear.z = Exponent

Expand Down
4 changes: 2 additions & 2 deletions garrysmod/gamemodes/sandbox/entities/entities/gmod_lamp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ function ENT:OnSwitch( bOn )
self.flashlight:SetParent( self )

-- The local positions are the offsets from parent..
self.flashlight:SetLocalPos( Vector( 0, 0, 0 ) )
self.flashlight:SetLocalAngles( Angle( 0, 0, 0 ) )
self.flashlight:SetLocalPos( vector_origin )
self.flashlight:SetLocalAngles( angle_zero )

self.flashlight:SetKeyValue( "enableshadows", 1 )
self.flashlight:SetKeyValue( "nearz", 12 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ list.Set( "ThrusterEffects", "#thrustereffect.flames", {
render.SetMaterial( matHeatWave )
render.StartBeam( 3 )
render.AddBeam( vOffset, size * Scale, scroll, Color( 0, 0, 255, 128 ) )
render.AddBeam( vOffset + vNormal * 32 * Scale, 32 * Scale, scroll + 2, Color( 255, 255, 255, 255 ) )
render.AddBeam( vOffset + vNormal * 32 * Scale, 32 * Scale, scroll + 2, color_white )
render.AddBeam( vOffset + vNormal * 128 * Scale, 48 * Scale, scroll + 5, Color( 0, 0, 0, 0 ) )
render.EndBeam()

Expand Down Expand Up @@ -441,23 +441,23 @@ list.Set( "ThrusterEffects", "#thrustereffect.plasma", {

render.StartBeam( 3 )
render.AddBeam( vOffset, size, scroll, Color( 0, 255, 255, 255 ) )
render.AddBeam( vOffset + vNormal * 8, size, scroll + 0.01, Color( 255, 255, 255, 255 ) )
render.AddBeam( vOffset + vNormal * 8, size, scroll + 0.01, color_white )
render.AddBeam( vOffset + vNormal * 64, size, scroll + 0.02, Color( 0, 255, 255, 0 ) )
render.EndBeam()

scroll = scroll * 0.9

render.StartBeam( 3 )
render.AddBeam( vOffset, size, scroll, Color( 0, 255, 255, 255 ) )
render.AddBeam( vOffset + vNormal * 8, size, scroll + 0.01, Color( 255, 255, 255, 255 ) )
render.AddBeam( vOffset + vNormal * 8, size, scroll + 0.01, color_white )
render.AddBeam( vOffset + vNormal * 64, size, scroll + 0.02, Color( 0, 255, 255, 0 ) )
render.EndBeam()

scroll = scroll * 0.9

render.StartBeam( 3 )
render.AddBeam( vOffset, size, scroll, Color( 0, 255, 255, 255 ) )
render.AddBeam( vOffset + vNormal * 8, size, scroll + 0.01, Color( 255, 255, 255, 255 ) )
render.AddBeam( vOffset + vNormal * 8, size, scroll + 0.01, color_white )
render.AddBeam( vOffset + vNormal * 64, size, scroll + 0.02, Color( 0, 255, 255, 0 ) )
render.EndBeam()
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ function TOOL:LeftClick( trace, attach )
if ( attach ) then

-- The real model should have an attachment!
local attachpoint = Pos + Vector( 0, 0, 0 )

local LPos1 = balloon:WorldToLocal( attachpoint )
local LPos1 = balloon:WorldToLocal( Pos )
local LPos2 = trace.Entity:WorldToLocal( trace.HitPos )

if ( IsValid( trace.Entity ) ) then
Expand Down Expand Up @@ -189,7 +187,7 @@ function TOOL:UpdateGhostBalloon( ent, ply )
if ( modeltable.skin ) then ent:SetSkin( modeltable.skin ) end

ent:SetPos( pos )
ent:SetAngles( Angle( 0, 0, 0 ) )
ent:SetAngles( angle_zero )

ent:SetNoDraw( false )

Expand All @@ -202,7 +200,7 @@ function TOOL:Think()
local modeltable = list.Get( "BalloonModels" )[ self:GetClientInfo( "model" ) ]
if ( !modeltable ) then self:ReleaseGhostEntity() return end

self:MakeGhostEntity( modeltable.model, Vector( 0, 0, 0 ), Angle( 0, 0, 0 ) )
self:MakeGhostEntity( modeltable.model, vector_origin, angle_zero )
if ( IsValid( self.GhostEntity ) ) then self.GhostEntity.model = self:GetClientInfo( "model" ) end

end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function TOOL:Think()
if ( !IsValidButtonModel( mdl ) ) then self:ReleaseGhostEntity() return end

if ( !IsValid( self.GhostEntity ) || self.GhostEntity:GetModel() != mdl ) then
self:MakeGhostEntity( mdl, Vector( 0, 0, 0 ), Angle( 0, 0, 0 ) )
self:MakeGhostEntity( mdl, vector_origin, angle_zero )
end

self:UpdateGhostButton( self.GhostEntity, self:GetOwner() )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function TOOL:Reload( trace )
if ( !IsValid( ent ) ) then return false end -- The entity is valid and isn't worldspawn
if ( CLIENT ) then return true end

SetColour( self:GetOwner(), ent, { Color = Color( 255, 255, 255, 255 ), RenderMode = 0, RenderFX = 0 } )
SetColour( self:GetOwner(), ent, { Color = color_white, RenderMode = 0, RenderFX = 0 } )
return true

end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ function TOOL:LeftClick( trace )

DisablePropCreateEffect = nil

duplicator.SetLocalPos( Vector( 0, 0, 0 ) )
duplicator.SetLocalAng( Angle( 0, 0, 0 ) )
duplicator.SetLocalPos( vector_origin )
duplicator.SetLocalAng( angle_zero )

--
-- Create one undo for the whole creation
Expand Down Expand Up @@ -104,8 +104,8 @@ function TOOL:RightClick( trace )

local Dupe = duplicator.Copy( trace.Entity )

duplicator.SetLocalPos( Vector( 0, 0, 0 ) )
duplicator.SetLocalAng( Angle( 0, 0, 0 ) )
duplicator.SetLocalPos( vector_origin )
duplicator.SetLocalAng( angle_zero )

if ( !Dupe ) then return false end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function TOOL:LeftClick( trace )
if ( !util.IsValidModel( model ) || !util.IsValidProp( model ) || !IsValidDynamiteModel( model ) ) then return false end
if ( !self:GetSWEP():CheckLimit( "dynamite" ) ) then return false end

local dynamite = MakeDynamite( ply, trace.HitPos, Angle( 0, 0, 0 ), group, damage, model, remove, delay )
local dynamite = MakeDynamite( ply, trace.HitPos, angle_zero, group, damage, model, remove, delay )

local CurPos = dynamite:GetPos()
local Offset = CurPos - dynamite:NearestPoint( CurPos - ( trace.HitNormal * 512 ) )
Expand Down Expand Up @@ -132,7 +132,7 @@ function TOOL:UpdateGhostDynamite( ent, ply )
return
end

ent:SetAngles( Angle( 0, 0, 0 ) )
ent:SetAngles( angle_zero )

local CurPos = ent:GetPos()
local Offset = CurPos - ent:NearestPoint( CurPos - ( trace.HitNormal * 512 ) )
Expand All @@ -149,7 +149,7 @@ function TOOL:Think()
if ( !IsValidDynamiteModel( mdl ) ) then self:ReleaseGhostEntity() return end

if ( !IsValid( self.GhostEntity ) || self.GhostEntity:GetModel() != mdl ) then
self:MakeGhostEntity( mdl, Vector( 0, 0, 0 ), Angle( 0, 0, 0 ) )
self:MakeGhostEntity( mdl, vector_origin, angle_zero )
end

self:UpdateGhostDynamite( self.GhostEntity, self:GetOwner() )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ end
function TOOL:Think()

if ( !IsValid( self.GhostEntity ) || self.GhostEntity:GetModel() != "models/props_lab/tpplug.mdl" ) then
self:MakeGhostEntity( "models/props_lab/tpplug.mdl", Vector( 0, 0, 0 ), Angle( 0, 0, 0 ) )
self:MakeGhostEntity( "models/props_lab/tpplug.mdl", vector_origin, angle_zero )
end

self:UpdateGhostEmitter( self.GhostEntity, self:GetOwner() )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function TOOL:Think()
if ( !IsValidHoverballModel( mdl ) ) then self:ReleaseGhostEntity() return end

if ( !IsValid( self.GhostEntity ) || self.GhostEntity:GetModel() != mdl ) then
self:MakeGhostEntity( mdl, Vector( 0, 0, 0 ), Angle( 0, 0, 0 ) )
self:MakeGhostEntity( mdl, vector_origin, angle_zero )
end

self:UpdateGhostHoverball( self.GhostEntity, self:GetOwner() )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function TOOL:LeftClick( trace )
if ( !util.IsValidModel( mdl ) || !util.IsValidProp( mdl ) || !IsValidLampModel( mdl ) ) then return false end
if ( !self:GetSWEP():CheckLimit( "lamps" ) ) then return false end

local lamp = MakeLamp( ply, r, g, b, key, toggle, texture, mdl, fov, distance, bright, !toggle, { Pos = pos, Angle = Angle( 0, 0, 0 ) } )
local lamp = MakeLamp( ply, r, g, b, key, toggle, texture, mdl, fov, distance, bright, !toggle, { Pos = pos, Angle = angle_zero } )

local CurPos = lamp:GetPos()
local NearestPoint = lamp:NearestPoint( CurPos - ( trace.HitNormal * 512 ) )
Expand Down Expand Up @@ -226,7 +226,7 @@ function TOOL:Think()
if ( !IsValidLampModel( mdl ) ) then self:ReleaseGhostEntity() return end

if ( !IsValid( self.GhostEntity ) || self.GhostEntity:GetModel() != mdl ) then
self:MakeGhostEntity( mdl, Vector( 0, 0, 0 ), Angle( 0, 0, 0 ) )
self:MakeGhostEntity( mdl, vector_origin, angle_zero )
end

self:UpdateGhostLamp( self.GhostEntity, self:GetOwner() )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ end
function TOOL:Think()

if ( !IsValid( self.GhostEntity ) || self.GhostEntity:GetModel() != "models/maxofs2d/light_tubular.mdl" ) then
self:MakeGhostEntity( "models/maxofs2d/light_tubular.mdl", Vector( 0, 0, 0 ), Angle( 0, 0, 0 ) )
self:MakeGhostEntity( "models/maxofs2d/light_tubular.mdl", vector_origin, angle_zero )
end

self:UpdateGhostLight( self.GhostEntity, self:GetOwner() )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function TOOL:Think()
if ( !IsValidThrusterModel( mdl ) ) then self:ReleaseGhostEntity() return end

if ( !IsValid( self.GhostEntity ) || self.GhostEntity:GetModel() != mdl ) then
self:MakeGhostEntity( mdl, Vector( 0, 0, 0 ), Angle( 0, 0, 0 ) )
self:MakeGhostEntity( mdl, vector_origin, angle_zero )
end

self:UpdateGhostThruster( self.GhostEntity, self:GetOwner() )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ function TOOL:Think()

if ( !IsValid( self.GhostEntity ) || self.GhostEntity:GetModel() != mdl ) then
self.wheelAngle = Angle( math.NormalizeAngle( self:GetClientNumber( "rx" ) ), math.NormalizeAngle( self:GetClientNumber( "ry" ) ), math.NormalizeAngle( self:GetClientNumber( "rz" ) ) )
self:MakeGhostEntity( mdl, Vector( 0, 0, 0 ), Angle( 0, 0, 0 ) )
self:MakeGhostEntity( mdl, vector_origin, angle_zero )
end

self:UpdateGhostWheel( self.GhostEntity, self:GetOwner() )
Expand Down
8 changes: 4 additions & 4 deletions garrysmod/gamemodes/sandbox/gamemode/gui/iconeditor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ function PANEL:Init()
local mat_wireframe = Material( "models/wireframe" )
function self.ModelPanel.PostDrawModel( mdlpnl, ent )
if ( self.ShowOrigin ) then
render.DrawLine( Vector( 0, 0, 0 ), Vector( 0, 0, 100 ), Color( 0, 0, 255 ) )
render.DrawLine( Vector( 0, 0, 0 ), Vector( 0, 100, 0 ), Color( 0, 255, 0 ) )
render.DrawLine( Vector( 0, 0, 0 ), Vector( 100, 0, 0 ), Color( 255, 0, 0 ) )
render.DrawLine( vector_origin, Vector( 0, 0, 100 ), Color( 0, 0, 255 ) )
render.DrawLine( vector_origin, Vector( 0, 100, 0 ), Color( 0, 255, 0 ) )
render.DrawLine( vector_origin, Vector( 100, 0, 0 ), Color( 255, 0, 0 ) )
end

if ( self.ShowBBox ) then
Expand Down Expand Up @@ -333,7 +333,7 @@ function PANEL:OriginLayout()

local ent = self.ModelPanel:GetEntity()
local pos = ent:GetPos()
local campos = pos + Vector( 0, 0, 0 )
local campos = pos + vector_origin

self.ModelPanel:SetCamPos( campos )
self.ModelPanel:SetFOV( 45 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ function CreateContextMenu()
label:Dock( BOTTOM )
label:SetText( v.title )
label:SetContentAlignment( 5 )
label:SetTextColor( Color( 255, 255, 255, 255 ) )
label:SetTextColor( color_white )
label:SetExpensiveShadow( 1, Color( 0, 0, 0, 200 ) )

icon.DoClick = function()
Expand Down
Loading

0 comments on commit b9839ed

Please sign in to comment.