fixing not operators

This commit is contained in:
Bleck 2020-03-31 12:34:50 -05:00
parent 5cdd8a7d71
commit fc63a5c56d
6 changed files with 164 additions and 164 deletions

View File

@ -277,18 +277,18 @@ local function Queue_Process()
local ent_table = table.remove( stack_queue, 1 )
-- Stop processing the stack queue
if !ent_table then
if not ent_table then
last_ent = nil
processing = false
return false
end
local ply = ent_table.ply
if !IsValid( ply ) then return false end
if not IsValid( ply ) then return false end
-- Stack entity
local ent = duplicator.CreateEntityFromTable( ply, ent_table.data )
if !IsValid( ent ) then return false end
if not IsValid( ent ) then return false end
local stackID = ent_table.stackID
@ -306,7 +306,7 @@ local function Queue_Process()
end
-- Nocollide selected ent with final stacked ent
if !stack_queue[1] or stackID ~= stack_queue[1].stackID then
if not stack_queue[1] or stackID ~= stack_queue[1].stackID then
constraint.NoCollide( ent, ent_table.data.Entity )
last_ent = nil
else
@ -396,7 +396,7 @@ local function Queue_Add( ply, ent, stackID )
table.insert( stack_queue, ent_table )
-- Start processing the stack queue
if !processing then
if not processing then
processing = true
local Delay = GetConVarNumber( PA_ .. "stack_delay", 0.1 )
@ -415,10 +415,10 @@ end
-- 4 = Stack number
-- 5 = Repeat flag
function precision_align_move_func( ply, cmd, args )
if !ply.PA_activeent then return false end
if not ply.PA_activeent then return false end
local ent = ply.PA_activeent
if !IsValid(ent) then return false end
if !util.IsValidPhysicsObject(ent, 0) or IsValid(ent:GetParent()) then return false end
if not IsValid(ent) then return false end
if not util.IsValidPhysicsObject(ent, 0) or IsValid(ent:GetParent()) then return false end
local v = Vector(args[1], args[2], args[3])
if v == Vector(0,0,0) then return false end
@ -454,7 +454,7 @@ function precision_align_move_func( ply, cmd, args )
undo.Finish()
-- Record action
if !args[5] then
if not args[5] then
action_table[ply] = args
action_table[ply][5] = true
action_table[ply].cmd = precision_align_move_func
@ -473,13 +473,13 @@ concommand.Add( PA_.. "move", precision_align_move_func )
-- Rotate by world axes
local function rotate_world( ang, rotang )
if rotang.p != 0 then
if rotang.p ~= 0 then
ang:RotateAroundAxis( Vector(0,1,0), rotang.p )
end
if rotang.y != 0 then
if rotang.y ~= 0 then
ang:RotateAroundAxis( Vector(0,0,1), rotang.y )
end
if rotang.r != 0 then
if rotang.r ~= 0 then
ang:RotateAroundAxis( Vector(1,0,0), rotang.r )
end
@ -488,7 +488,7 @@ end
-- Convert from euler to axis-angle by quaternion method
local function euler_to_axisangle( ang )
if !ang then return false end
if not ang then return false end
ang = Angle( math.rad( ang.p ), math.rad( ang.y ), math.rad( ang.r ) ) * 0.5
@ -526,12 +526,12 @@ end
-- 8 = Stack number
-- 9 = Repeat flag
function precision_align_rotate_func( ply, cmd, args )
if !ply.PA_activeent then return false end
if not ply.PA_activeent then return false end
local ent = ply.PA_activeent
if !IsValid(ent) then return false end
if !util.IsValidPhysicsObject(ent, 0) or IsValid(ent:GetParent()) then return false end
if not IsValid(ent) then return false end
if not util.IsValidPhysicsObject(ent, 0) or IsValid(ent:GetParent()) then return false end
if !tonumber(args[1]) or !tonumber(args[2]) or !tonumber(args[3]) then
if not tonumber(args[1]) or not tonumber(args[2]) or not tonumber(args[3]) then
return false
end
@ -564,7 +564,7 @@ function precision_align_rotate_func( ply, cmd, args )
-- Get pivot point
local v
if !tonumber(args[4]) or !tonumber(args[5]) or !tonumber(args[6]) then
if not tonumber(args[4]) or not tonumber(args[5]) or not tonumber(args[6]) then
v = startpos
else
v = Vector( tonumber(args[4]), tonumber(args[5]), tonumber(args[6]) )
@ -623,7 +623,7 @@ function precision_align_rotate_func( ply, cmd, args )
undo.Finish()
-- Record action
if !args[9] then
if not args[9] then
action_table[ply] = args
action_table[ply][9] = true
action_table[ply].cmd = precision_align_rotate_func
@ -649,10 +649,10 @@ concommand.Add( PA_.. "rotate", precision_align_rotate_func )
-- 7 = Stack number
-- 8 = Repeat flag
function precision_align_mirror_func( ply, cmd, args )
if !ply.PA_activeent then return false end
if not ply.PA_activeent then return false end
local ent = ply.PA_activeent
if !IsValid(ent) then return false end
if !util.IsValidPhysicsObject(ent, 0) or IsValid(ent:GetParent()) then return false end
if not IsValid(ent) then return false end
if not util.IsValidPhysicsObject(ent, 0) or IsValid(ent:GetParent()) then return false end
local origin = Vector(args[1], args[2], args[3])
local normal = Vector(args[4], args[5], args[6])
@ -686,7 +686,7 @@ function precision_align_mirror_func( ply, cmd, args )
exceptionang = PA_mirror_exceptions_specific[model]
-- Match left part of string
if !exceptionang then
if not exceptionang then
local PA_mirror_exceptions = list.Get( "PA_mirror_exceptions" )
for k, v in pairs( PA_mirror_exceptions ) do
if string.match( model, "^" .. k ) then
@ -721,7 +721,7 @@ function precision_align_mirror_func( ply, cmd, args )
ent:GetPhysicsObject():EnableMotion( false )
-- Record action
if !args[8] then
if not args[8] then
action_table[ply] = args
action_table[ply][8] = true
action_table[ply].cmd = precision_align_mirror_func
@ -751,22 +751,22 @@ function precision_align_constraint_func( len, ply )
if CPPI then
if Ent1:IsWorld() then
if !util.IsValidPhysicsObject(Ent2, 0) or !Ent2:CPPICanTool( ply, PA ) then
if not util.IsValidPhysicsObject(Ent2, 0) or not Ent2:CPPICanTool( ply, PA ) then
return false
end
elseif Ent2:IsWorld() then
if !util.IsValidPhysicsObject(Ent1, 0) or !Ent1:CPPICanTool( ply, PA ) then
if not util.IsValidPhysicsObject(Ent1, 0) or not Ent1:CPPICanTool( ply, PA ) then
return false
end
elseif !util.IsValidPhysicsObject(Ent1, 0) or !util.IsValidPhysicsObject(Ent2, 0) then
elseif not util.IsValidPhysicsObject(Ent1, 0) or not util.IsValidPhysicsObject(Ent2, 0) then
return false
elseif !Ent1:CPPICanTool( ply, PA ) or !Ent2:CPPICanTool( ply, PA ) then
elseif not Ent1:CPPICanTool( ply, PA ) or not Ent2:CPPICanTool( ply, PA ) then
return false
end
else
if Ent1:IsWorld() and !util.IsValidPhysicsObject(Ent2, 0) then
if Ent1:IsWorld() and not util.IsValidPhysicsObject(Ent2, 0) then
return false
elseif Ent2:IsWorld() and !util.IsValidPhysicsObject(Ent1, 0) then
elseif Ent2:IsWorld() and not util.IsValidPhysicsObject(Ent1, 0) then
return false
end
end
@ -827,7 +827,7 @@ function precision_align_constraint_func( len, ply )
local forcelimit = ply:GetInfoNum( PA_.. "rope_forcelimit", 0 )
local width = ply:GetInfoNum( PA_.. "rope_width", 1 )
local material = ply:GetInfo( PA_.. "rope_material", "cable/rope" )
local rigid = ply:GetInfoNum( PA_.. "rope_rigid", 0 ) != 0
local rigid = ply:GetInfoNum( PA_.. "rope_rigid", 0 ) ~= 0
local length = ply:GetInfoNum( PA_.. "rope_setlength", 0 )
local addlength = 0
@ -845,7 +845,7 @@ function precision_align_constraint_func( len, ply )
elseif constraint_type == "Wire Hydraulic" then
local controller = Entity( vars )
if !IsValid( controller ) then return false end
if not IsValid( controller ) then return false end
if controller:GetClass() ~= "gmod_wire_hydraulic" then
print( "PA Error: Tried to create wire hydraulic with invalid controller ent" )
return false
@ -917,13 +917,13 @@ net.Receive( PA_.. "constraint", precision_align_constraint_func )
-- Keep a record of each player's last PA action
function precision_align_lastaction_func( ply, cmd, args )
if !ply.PA_activeent then return false end
if not ply.PA_activeent then return false end
local ent = ply.PA_activeent
if !IsValid(ent) then return false end
if !util.IsValidPhysicsObject(ent, 0) or IsValid(ent:GetParent()) then return false end
if not IsValid(ent) then return false end
if not util.IsValidPhysicsObject(ent, 0) or IsValid(ent:GetParent()) then return false end
local lastaction = action_table[ply]
if !lastaction then return false end
if not lastaction then return false end
return lastaction.cmd( ply, nil, lastaction )
end

View File

@ -259,7 +259,7 @@ function TOOL:GetClickPosition( trace )
local tooltype = self:GetClientNumber( "tooltype" )
if ( !Phys or !Ent or Ent:IsWorld() ) then
if ( not Phys or not Ent or Ent:IsWorld() ) then
Pos = trace.HitPos
-- Coordinate Centre
@ -324,15 +324,15 @@ function TOOL:GetClickPosition( trace )
Centre_Dist = CentrePosL - HitPosL
-- NewPosL is already equal to CentrePosL, so only need to set cases where EdgePosL is smaller
if ( math.abs( Edge_Dist.x ) < math.abs( Centre_Dist.x ) and Snapped_Edges.x ) or !Snapped_Centres.x then
if ( math.abs( Edge_Dist.x ) < math.abs( Centre_Dist.x ) and Snapped_Edges.x ) or not Snapped_Centres.x then
NewPosL.x = EdgePosL.x
end
if ( math.abs( Edge_Dist.y ) < math.abs( Centre_Dist.y ) and Snapped_Edges.y ) or !Snapped_Centres.y then
if ( math.abs( Edge_Dist.y ) < math.abs( Centre_Dist.y ) and Snapped_Edges.y ) or not Snapped_Centres.y then
NewPosL.y = EdgePosL.y
end
if ( math.abs( Edge_Dist.z ) < math.abs( Centre_Dist.z ) and Snapped_Edges.z ) or !Snapped_Centres.z then
if ( math.abs( Edge_Dist.z ) < math.abs( Centre_Dist.z ) and Snapped_Edges.z ) or not Snapped_Centres.z then
NewPosL.z = EdgePosL.z
end
end
@ -347,14 +347,14 @@ end
-- Place Constructs
function TOOL:LeftClick( trace )
if !trace.HitPos then return false end
if not trace.HitPos then return false end
if CLIENT then return true end
local point = self:GetClickPosition( trace )
local normal = trace.HitNormal
local ent = trace.Entity
if !IsValid(ent) then
if not IsValid(ent) then
ent = nil
end
@ -371,9 +371,9 @@ function TOOL:RightClick( trace )
return true
end
if !IsValid(trace.Entity) then
if not IsValid(trace.Entity) then
return false
elseif !util.IsValidPhysicsObject( trace.Entity, trace.PhysicsBone ) then
elseif not util.IsValidPhysicsObject( trace.Entity, trace.PhysicsBone ) then
return false
elseif trace.Entity:IsPlayer() then
return false

View File

@ -417,12 +417,12 @@ function POINTS_TAB:Init()
local function update_primary_listview()
local selection = self.list_primarypoint:GetSelectedLine()
if !selection then return false end
if not selection then return false end
local point_temp = PA_funcs.point_global( selection )
local vec
if !point_temp then
if not point_temp then
vec = Vector(0,0,0)
else
vec = point_temp.origin
@ -454,7 +454,7 @@ function POINTS_TAB:Init()
self.checkbox_relative1:SetText( "Relative to\nEntity" )
self.checkbox_relative1:SetSize(100,30)
self.checkbox_relative1.OnChange = function()
if !update_primary_listview() and self.checkbox_relative1:GetChecked() then
if not update_primary_listview() and self.checkbox_relative1:GetChecked() then
self.checkbox_relative1:SetValue(false)
end
end
@ -515,12 +515,12 @@ function POINTS_TAB:Init()
local function update_secondary_listview()
local selection = self.list_secondarypoint:GetSelectedLine()
if !selection then return false end
if not selection then return false end
local point_temp = PA_funcs.point_global( selection )
local vec
if !point_temp then
if not point_temp then
vec = Vector(0,0,0)
else
vec = point_temp.origin
@ -553,7 +553,7 @@ function POINTS_TAB:Init()
self.checkbox_relative2:SetSize(100,30)
self.checkbox_relative2:SetText( "Relative to\nEntity" )
self.checkbox_relative2.OnChange = function()
if !update_secondary_listview() and self.checkbox_relative2:GetChecked() then
if not update_secondary_listview() and self.checkbox_relative2:GetChecked() then
self.checkbox_relative2:SetValue(false)
end
end
@ -702,7 +702,7 @@ function POINTS_TAB:Init()
local selected_point1 = self.list_primarypoint:GetSelectedLine()
local selected_point2 = self.list_secondarypoint:GetSelectedLine()
if !selected_point1 or !selected_point2 then
if not selected_point1 or not selected_point2 then
Warning("Select both a primary and secondary point")
return false
end
@ -715,12 +715,12 @@ function POINTS_TAB:Init()
local point1 = PA_funcs.point_global(selected_point1)
local point2 = PA_funcs.point_global(selected_point2)
if !point1 or !point2 then
if not point1 or not point2 then
Warning("Points not correctly defined")
return false
end
if !PA_funcs.move_entity(point1.origin, point2.origin, PA_activeent) then return false end
if not PA_funcs.move_entity(point1.origin, point2.origin, PA_activeent) then return false end
end )
end
@ -762,12 +762,12 @@ function LINES_TAB:Init()
local function update_primary_listview()
local selection = self.list_primary:GetSelectedLine()
if !selection then return false end
if not selection then return false end
local line_temp = PA_funcs.line_global( selection )
local startpoint, endpoint, direction, length, angle
if !line_temp then
if not line_temp then
startpoint = Vector(0,0,0)
endpoint = Vector(0,0,0)
direction = Vector(0,0,0)
@ -863,7 +863,7 @@ function LINES_TAB:Init()
self.checkbox_relative:SetText( "Relative to\nEntity" )
self.checkbox_relative:SetSize(100,30)
self.checkbox_relative.OnChange = function()
if !update_primary_listview() and self.checkbox_relative:GetChecked() then
if not update_primary_listview() and self.checkbox_relative:GetChecked() then
self.checkbox_relative:SetValue(false)
end
end
@ -1042,7 +1042,7 @@ function LINES_TAB:Init()
self.functions_button_default_length:SetToolTip( "Sets the default length to the current length slider value" )
self.functions_button_default_length:SetFunction( function()
local length = self.slider_length:GetValue()
if !(length > 0) then
if not (length > 0) then
Warning("Length must be greater than 0")
return false
end
@ -1058,7 +1058,7 @@ function LINES_TAB:Init()
self.functions_button_copy_start:SetToolTip( "Copy start point from the selected line" )
self.functions_button_copy_start:SetFunction( function()
local line = single_line_selection()
if !line then
if not line then
return false
end
self.sliders_startpoint:SetValues(line.startpoint)
@ -1071,7 +1071,7 @@ function LINES_TAB:Init()
self.functions_button_copy_end:SetToolTip( "Copy end point from the selected line" )
self.functions_button_copy_end:SetFunction( function()
local line = single_line_selection()
if !line then
if not line then
return false
end
self.sliders_endpoint:SetValues(line.endpoint)
@ -1084,7 +1084,7 @@ function LINES_TAB:Init()
self.functions_button_copy_dir:SetToolTip( "Copy direction from the selected line" )
self.functions_button_copy_dir:SetFunction( function()
local line = single_line_selection()
if !line then
if not line then
return false
end
local dir = (line.endpoint - line.startpoint):GetNormal()
@ -1098,7 +1098,7 @@ function LINES_TAB:Init()
self.functions_button_copy_length:SetToolTip( "Copy length from the selected line" )
self.functions_button_copy_length:SetFunction( function()
local line = single_line_selection()
if !line then
if not line then
return false
end
local length = (line.endpoint - line.startpoint):Length()
@ -1131,7 +1131,7 @@ function LINES_TAB:Init()
self.functions_button_addlines:SetToolTip( "Add the selected lines as vectors to the current endpoint" )
self.functions_button_addlines:SetFunction( function()
local selection = self.functions_list_functionlines:GetSelected()
if !selection then
if not selection then
Warning("Select at least 1 line")
return false
end
@ -1159,18 +1159,18 @@ function LINES_TAB:Init()
self.button_moveentity:SetToolTip( "Move entity by line" )
self.button_moveentity:SetFunction( function()
local selection = self.list_primary:GetSelectedLine()
if !selection then
if not selection then
Warning("Select a line")
return false
end
if !PA_funcs.construct_exists( "Line", selection ) then
if not PA_funcs.construct_exists( "Line", selection ) then
Warning("Line not correctly defined")
return false
end
local line = PA_funcs.line_global(selection)
if !PA_funcs.move_entity(line.startpoint, line.endpoint, PA_activeent) then return false end
if not PA_funcs.move_entity(line.startpoint, line.endpoint, PA_activeent) then return false end
end )
end
@ -1204,7 +1204,7 @@ function PLANES_TAB:Init()
if normal then self.sliders_normal:SetValues(normal) end
if angle then
if !normal or normal == Vector(0,0,0) then angle = Angle(0,0,0) end
if not normal or normal == Vector(0,0,0) then angle = Angle(0,0,0) end
if math.abs(angle.p) > 89.999 then angle.y = 0 end
self.slider_ang_p:SetValue(angle.p)
@ -1215,12 +1215,12 @@ function PLANES_TAB:Init()
local function update_primary_listview()
local selection = self.list_primary:GetSelectedLine()
if !selection then return false end
if not selection then return false end
local plane_temp = PA_funcs.plane_global( selection )
local origin, normal, angle
if !plane_temp then
if not plane_temp then
origin = Vector(0,0,0)
normal = Vector(0,0,0)
angle = Angle(0,0,0)
@ -1307,7 +1307,7 @@ function PLANES_TAB:Init()
self.checkbox_relative:SetText( "Relative to\nEntity" )
self.checkbox_relative:SetSize(100,30)
self.checkbox_relative.OnChange = function()
if !update_primary_listview() and self.checkbox_relative:GetChecked() then
if not update_primary_listview() and self.checkbox_relative:GetChecked() then
self.checkbox_relative:SetValue(false)
end
end
@ -1410,7 +1410,7 @@ function PLANES_TAB:Init()
self.functions_button_copy_origin:SetToolTip( "Copy origin from the selected plane" )
self.functions_button_copy_origin:SetFunction( function()
local plane = single_plane_selection()
if !plane then
if not plane then
return false
end
self.sliders_origin:SetValues(plane.origin)
@ -1423,7 +1423,7 @@ function PLANES_TAB:Init()
self.functions_button_copy_normal:SetToolTip( "Copy normal from the selected plane" )
self.functions_button_copy_normal:SetFunction( function()
local plane = single_plane_selection()
if !plane then
if not plane then
return false
end
self.sliders_normal:SetValues(plane.normal)
@ -1562,12 +1562,12 @@ function MOVE_TAB:Init()
self.button_axisrotate_angle:SetFunction( function()
local selected_line = self.list_line_axis:GetSelectedLine()
if !selected_line then
if not selected_line then
Warning("Select an axis line")
return false
end
if !PA_funcs.construct_exists( "Line", selected_line ) then
if not PA_funcs.construct_exists( "Line", selected_line ) then
Warning("Line not correctly defined")
return false
end
@ -1575,7 +1575,7 @@ function MOVE_TAB:Init()
-- Check construct selections
local selection_constructs = self.panel_multiselect:GetSelection()
if !selection_constructs then
if not selection_constructs then
Warning( "No valid constructs selected for move" )
return false
end
@ -1647,7 +1647,7 @@ function MOVE_TAB:Init()
self.button_move_constructs:SetText( "Set" )
self.button_move_constructs:SetToolTip( "Move the selected constructs" )
self.button_move_constructs:SetFunction( function()
if !self.activebutton then
if not self.activebutton then
Warning("No function selected")
return false
end
@ -1658,29 +1658,29 @@ function MOVE_TAB:Init()
-- Check primary selection
if selection_type == "Point" then
local point1, point2 = self.list_point_1:GetSelectedLine(), self.list_point_2:GetSelectedLine()
if !point1 then
if not point1 then
Warning( "Select Point 1" ) return false
elseif !point2 then
elseif not point2 then
Warning( "Select Point 2" ) return false
elseif !PA_funcs.construct_exists( "Point", point1 ) then
elseif not PA_funcs.construct_exists( "Point", point1 ) then
Warning( "Point " .. tostring(point1) .. " not defined" ) return false
elseif !PA_funcs.construct_exists( "Point", point2 ) then
elseif not PA_funcs.construct_exists( "Point", point2 ) then
Warning( "Point " .. tostring(point2) .. " not defined" ) return false
end
selection_primary = { point1, point2 }
elseif selection_type == "Line" then
local line = self.list_line_1:GetSelectedLine()
if !line then
if not line then
Warning( "Select Line 1" ) return false
elseif !PA_funcs.construct_exists( "Line", line ) then
elseif not PA_funcs.construct_exists( "Line", line ) then
Warning( "Line " .. tostring(line) .. " not defined" ) return false
end
selection_primary = { line }
elseif selection_type == "Plane" then
local plane = self.list_plane_1:GetSelectedLine()
if !plane then
if not plane then
Warning( "Select Plane 1" ) return false
elseif !PA_funcs.construct_exists( "Plane", plane ) then
elseif not PA_funcs.construct_exists( "Plane", plane ) then
Warning( "Plane " .. tostring(plane) .. " not defined" ) return false
end
selection_primary = { plane }
@ -1692,7 +1692,7 @@ function MOVE_TAB:Init()
-- Check construct selections
local selection_constructs = self.panel_multiselect:GetSelection()
if !selection_constructs then
if not selection_constructs then
Warning( "No valid constructs selected for move" )
return false
end
@ -1823,7 +1823,7 @@ function MOVE_TAB:Init()
-- Check construct selections
local selection_constructs = self.panel_multiselect:GetSelection()
if !selection_constructs then
if not selection_constructs then
Warning( "No valid constructs selected for move" )
return false
end
@ -1961,7 +1961,7 @@ function FUNCTIONS_TAB:Init()
self.button_set:SetText( "Set" )
self.button_set:SetToolTip( "Execute the selected function" )
self.button_set:SetFunction( function()
if !self.activebutton then
if not self.activebutton then
Warning("No function selected")
return false
end
@ -1979,7 +1979,7 @@ function FUNCTIONS_TAB:Init()
selection_primary = self.list_plane_primary:GetSelectedLine()
end
if !selection_primary then
if not selection_primary then
Warning( "Select a primary " .. string.lower(selection_type[1]) )
return false
end
@ -2003,7 +2003,7 @@ function FUNCTIONS_TAB:Init()
-- Check the selections point to valid constructs
for l, w in pairs (selection) do
local ID = w:GetID()
if !PA_funcs.construct_exists( string_table[k], ID ) then
if not PA_funcs.construct_exists( string_table[k], ID ) then
Warning( string_table[k] .. " " .. tostring(ID) .. " has not been defined" )
return false
end
@ -2268,7 +2268,7 @@ function FUNCTIONS_TAB:Init()
self.button_plane_2lines.selections = { "Plane", 0, 2, 0 }
self.button_plane_2lines.func = function( selection_primary, selection_secondary )
local direction = PA_funcs.line_function_perpendicular( selection_secondary[1], selection_secondary[2] )
if !direction then return false end
if not direction then return false end
local origin = ( PA_funcs.line_global(selection_secondary[1]).startpoint + PA_funcs.line_global(selection_secondary[2]).startpoint ) * 0.5
return PA_funcs.set_plane( selection_primary, origin, direction )
end
@ -2337,7 +2337,7 @@ function ROTATION_TAB:Init()
self.checkbox_relative1:SetSize(100,30)
self.checkbox_relative1.OnChange = function()
local ent, ang
if !PA_activeent and self.checkbox_relative1:GetChecked() then
if not PA_activeent and self.checkbox_relative1:GetChecked() then
self.checkbox_relative1:SetValue(false)
elseif self.checkbox_relative1:GetChecked() then
self.checkbox_relative1.lastentity = PA_activeent
@ -2345,7 +2345,7 @@ function ROTATION_TAB:Init()
ang = PA_activeent:WorldToLocalAngles( ToAngle(ang) )
self.sliders_angle1:SetValues( ToVector(ang) )
else
if !PA_activeent then
if not PA_activeent then
if self.checkbox_relative1.lastentity then
ent = self.checkbox_relative1.lastentity
self.checkbox_relative1.lastentity = nil
@ -2383,7 +2383,7 @@ function ROTATION_TAB:Init()
relative = 1
--ang = PA_activeent:LocalToWorldAngles( ang )
end
if !PA_funcs.rotate_entity(ang, vec, relative, PA_activeent) then return false end
if not PA_funcs.rotate_entity(ang, vec, relative, PA_activeent) then return false end
end )
self.button_get1 = vgui.Create( "PA_Move_Button", self )
@ -2517,7 +2517,7 @@ function ROTATION_TAB:Init()
self.checkbox_relative2:SetSize(100,30)
self.checkbox_relative2.OnChange = function()
local ent, ang
if !PA_activeent and self.checkbox_relative2:GetChecked() then
if not PA_activeent and self.checkbox_relative2:GetChecked() then
self.checkbox_relative2:SetValue(false)
elseif self.checkbox_relative2:GetChecked() then
self.checkbox_relative2.lastentity = PA_activeent
@ -2525,7 +2525,7 @@ function ROTATION_TAB:Init()
ang = PA_activeent:WorldToLocalAngles( ToAngle(ang) )
self.sliders_angle2:SetValues( ToVector(ang) )
else
if !PA_activeent then
if not PA_activeent then
if self.checkbox_relative2.lastentity then
ent = self.checkbox_relative2.lastentity
self.checkbox_relative2.lastentity = nil
@ -2608,12 +2608,12 @@ function ROTATION_TAB:Init()
self.button_axisrotate_angle:SetFunction( function()
local selected_line = self.list_line_axis:GetSelectedLine()
if !selected_line then
if not selected_line then
Warning("Select an axis line")
return false
end
if !PA_funcs.construct_exists( "Line", selected_line ) then
if not PA_funcs.construct_exists( "Line", selected_line ) then
Warning("Line not correctly defined")
return false
end
@ -2639,14 +2639,14 @@ function ROTATION_TAB:Init()
self.button_axisrotate_entity:SetFunction( function()
local selected_line = self.list_line_axis:GetSelectedLine()
if !selected_line then
if not selected_line then
Warning("Select a line")
return false
end
local line = PA_funcs.line_global(selected_line)
if !line then
if not line then
Warning("Line not correctly defined")
return false
end
@ -2669,7 +2669,7 @@ function ROTATION_TAB:Init()
local relative = 3
if !PA_funcs.rotate_entity(ang, vec, relative, PA_activeent) then return false end
if not PA_funcs.rotate_entity(ang, vec, relative, PA_activeent) then return false end
end )
@ -2727,7 +2727,7 @@ function ROTATION_TAB:Init()
local relative = 2
if !PA_funcs.rotate_entity(ang, vec, relative, PA_activeent) then return false end
if not PA_funcs.rotate_entity(ang, vec, relative, PA_activeent) then return false end
end )
end
@ -2830,7 +2830,7 @@ function ROTATION_FUNCTIONS_TAB:Init()
self.button_set:SetText( "Rotate Entity" )
self.button_set:SetToolTip( "Execute the selected function" )
self.button_set:SetFunction( function()
if !self.activebutton then
if not self.activebutton then
Warning("No function selected")
return false
end
@ -2843,13 +2843,13 @@ function ROTATION_FUNCTIONS_TAB:Init()
for k, v in pairs (selection_lists) do
if v:IsVisible() then
local selection = v:GetSelectedLine()
if !selection then
if not selection then
local str = "Selections not correct - " .. string_table[k] .. " must be selected"
Warning( str )
return false
end
if !PA_funcs.construct_exists( string_table2[k], selection ) then
if not PA_funcs.construct_exists( string_table2[k], selection ) then
Warning( string_table2[k] .. " " .. tostring(selection) .. " has not been defined" )
return false
end
@ -2860,7 +2860,7 @@ function ROTATION_FUNCTIONS_TAB:Init()
-- Filter out non-existant pivot / axis selections before passing to functions
local pivot = self.list_pivotpoint:GetSelectedLine()
if pivot then
if !PA_funcs.construct_exists( "Point", pivot ) then
if not PA_funcs.construct_exists( "Point", pivot ) then
pivot = nil
else
pivot = PA_funcs.point_global( pivot ).origin
@ -2869,14 +2869,14 @@ function ROTATION_FUNCTIONS_TAB:Init()
local axis = self.list_line_axis:GetSelectedLine()
if axis then
if !PA_funcs.construct_exists( "Line", axis ) then
if not PA_funcs.construct_exists( "Line", axis ) then
axis = nil
else
axis = PA_funcs.line_global( axis )
end
end
if !self.activebutton.func( pivot, axis, selections ) then
if not self.activebutton.func( pivot, axis, selections ) then
return false
end
end )
@ -2974,7 +2974,7 @@ function ROTATION_FUNCTIONS_TAB:Init()
if PA_funcs.rotate_2lines_parallel( pivot, selections[1], selections[2], PA_activeent ) then
local vec1 = PA_funcs.line_global( selections[1] ).startpoint
local vec2 = PA_funcs.line_global( selections[2] ).startpoint
if !vec1 or !vec2 then
if not vec1 or not vec2 then
return false
end
@ -3092,12 +3092,12 @@ function CONSTRAINTS_TAB:Init()
local selection1 = self.list_point_LPos1:GetSelectedLine()
local selection2 = self.list_point_LPos2:GetSelectedLine()
if !selection1 then
if not selection1 then
Warning("Select a point for Pos 1")
return false
end
if !PA_funcs.construct_exists( "Point", selection1 ) then
if not PA_funcs.construct_exists( "Point", selection1 ) then
Warning("Point 1 has not been defined")
return false
end
@ -3106,12 +3106,12 @@ function CONSTRAINTS_TAB:Init()
local constraint_type = activepanel.Constraint
if constraint_type ~= "Axis" and constraint_type ~= "Ballsocket" and constraint_type ~= "Ballsocket Advanced" then
if !selection2 then
if not selection2 then
Warning("Select a point for Pos 2")
return false
end
if !PA_funcs.construct_exists( "Point", selection2 ) then
if not PA_funcs.construct_exists( "Point", selection2 ) then
Warning("Point 2 has not been defined")
return false
end
@ -3121,7 +3121,7 @@ function CONSTRAINTS_TAB:Init()
local point1 = precision_align_points[ selection1 ]
local point2
if !PA_funcs.construct_exists( "Point", selection2 ) then
if not PA_funcs.construct_exists( "Point", selection2 ) then
point2 = { ["origin"] = PA_funcs.point_global(selection1).origin + Vector(0,0,1) } -- Set so default axis dir is (0,0,1)
else
point2 = precision_align_points[ selection2 ]
@ -3130,7 +3130,7 @@ function CONSTRAINTS_TAB:Init()
local Ent1 = point1.entity
local Ent2 = point2.entity
if !Ent1 and !Ent2 then
if not Ent1 and not Ent2 then
Warning("At least one point must be attached to an entity")
return false
end
@ -3699,7 +3699,7 @@ function CONSTRAINTS_WIRE_HYDRAULIC_TAB:Init()
self.matselect:SetConVar( PA_ .. "wire_hydraulic_material" )
self.Constraint_Func = function()
if !IsValid( PA_activeent ) then
if not IsValid( PA_activeent ) then
Warning( "Select a wire hydraulic controller" )
return false
end

View File

@ -27,7 +27,7 @@ end
-- Set view in direction of world position vector v
PA_funcs.set_playerview = function( v )
if !v then return false end
if not v then return false end
local ply = LocalPlayer()
local pos = ply:GetShootPos()
local Ang = (v - pos):Angle()
@ -37,12 +37,12 @@ end
-- Sends data to server to move entity - ent1/ent2 are the entities the points are attached to
PA_funcs.move_entity = function( vec1, vec2, activeent )
if !IsValid(activeent) then
if not IsValid(activeent) then
Warning("No valid entity selected")
return false
end
if !vec1 or !vec2 then
if not vec1 or not vec2 then
Warning("Incomplete move data")
return false
end
@ -73,12 +73,12 @@ end
-- Sends data to server to rotate entity - vector is pivot point
PA_funcs.rotate_entity = function( ang, vec, relative, activeent )
if !IsValid(activeent) then
if not IsValid(activeent) then
Warning("No valid entity selected")
return false
end
if !ang then
if not ang then
Warning("Incomplete rotation data")
return false
end
@ -131,7 +131,7 @@ PA_funcs.rotate_entity = function( ang, vec, relative, activeent )
end
PA_funcs.construct_exists = function( construct_type, ID )
if !construct_type or !ID then return false end
if not construct_type or not ID then return false end
if construct_type == "Point" then
if precision_align_points[ID].origin then
@ -159,7 +159,7 @@ end
PA_funcs.point_global = function( point )
local point_temp = table.Copy( precision_align_points[point] )
if !point_temp.origin then
if not point_temp.origin then
return false
end
@ -179,7 +179,7 @@ end
PA_funcs.point_local = function( point )
local point_temp = table.Copy( precision_align_points[point] )
if !point_temp.origin then
if not point_temp.origin then
return false
end
@ -197,7 +197,7 @@ PA_funcs.point_local = function( point )
end
PA_funcs.set_point = function( point, origin )
if !origin then
if not origin then
Warning("Incomplete point data")
return false
end
@ -229,14 +229,14 @@ PA_funcs.delete_points = function()
end
PA_funcs.attach_point = function( point, ent )
if !precision_align_points[point].origin then
if not precision_align_points[point].origin then
Warning("Point must be defined before attaching")
return false
end
local attached_ent = precision_align_points[point].entity
if !IsValid(ent) then
if not IsValid(ent) then
if attached_ent then
precision_align_points[point].origin = attached_ent:LocalToWorld(precision_align_points[point].origin)
precision_align_points[point].entity = nil
@ -292,7 +292,7 @@ end
PA_funcs.line_global = function( line )
local line_temp = table.Copy( precision_align_lines[line] )
if !line_temp.startpoint or !line_temp.endpoint then
if not line_temp.startpoint or not line_temp.endpoint then
return false
end
@ -313,7 +313,7 @@ end
PA_funcs.line_local = function( line )
local line_temp = table.Copy( precision_align_lines[line] )
if !line_temp.startpoint or !line_temp.endpoint then
if not line_temp.startpoint or not line_temp.endpoint then
return false
end
@ -333,7 +333,7 @@ end
PA_funcs.set_line = function( line, startpoint, endpoint, direction, length )
local ent = precision_align_lines[line].entity
if !IsValid(ent) then
if not IsValid(ent) then
ent = nil
end
@ -345,7 +345,7 @@ PA_funcs.set_line = function( line, startpoint, endpoint, direction, length )
precision_align_lines[line].startpoint = startpoint
end
if !endpoint and !direction then
if not endpoint and not direction then
Message("Line [" .. tostring(line) .. "] startpoint set at " .. tostring(startpoint))
return true
end
@ -366,14 +366,14 @@ PA_funcs.set_line = function( line, startpoint, endpoint, direction, length )
return true
end
if !precision_align_lines[line].startpoint then
if not precision_align_lines[line].startpoint then
Warning("Line not defined")
return false
end
if direction then
local len
if !length then
if not length then
--Check to see whether line already exists, if so use that length
if PA_funcs.construct_exists( "Line", line ) then
len = startpoint_old:Distance( precision_align_lines[line].endpoint )
@ -419,14 +419,14 @@ PA_funcs.delete_lines = function()
end
PA_funcs.attach_line = function( line, ent )
if !precision_align_lines[line].startpoint or !precision_align_lines[line].endpoint then
if not precision_align_lines[line].startpoint or not precision_align_lines[line].endpoint then
Warning("Line must be defined before attaching")
return false
end
local attached_ent = precision_align_lines[line].entity
if !IsValid(ent) then
if not IsValid(ent) then
if attached_ent then
precision_align_lines[line].startpoint = attached_ent:LocalToWorld(precision_align_lines[line].startpoint)
precision_align_lines[line].endpoint = attached_ent:LocalToWorld(precision_align_lines[line].endpoint)
@ -483,7 +483,7 @@ end
PA_funcs.plane_global = function( plane )
local plane_temp = table.Copy(precision_align_planes[plane])
if !plane_temp.origin or !plane_temp.normal then
if not plane_temp.origin or not plane_temp.normal then
return false
end
@ -504,7 +504,7 @@ end
PA_funcs.plane_local = function( plane )
local plane_temp = table.Copy(precision_align_planes[plane])
if !plane_temp.origin or !plane_temp.normal then
if not plane_temp.origin or not plane_temp.normal then
return false
end
@ -533,7 +533,7 @@ PA_funcs.set_plane = function( plane, origin, normal )
end
end
if !precision_align_planes[plane].origin then
if not precision_align_planes[plane].origin then
Warning("Plane not defined")
return false
end
@ -572,14 +572,14 @@ PA_funcs.delete_planes = function()
end
PA_funcs.attach_plane = function( plane, ent )
if !precision_align_planes[plane].origin or !precision_align_planes[plane].normal then
if not precision_align_planes[plane].origin or not precision_align_planes[plane].normal then
Warning("Plane must be defined before attaching")
return false
end
local attached_ent = precision_align_planes[plane].entity
if !IsValid(ent) then
if not IsValid(ent) then
if attached_ent then
precision_align_planes[plane].origin = attached_ent:LocalToWorld(precision_align_planes[plane].origin)
precision_align_planes[plane].normal = ( attached_ent:LocalToWorld(precision_align_planes[plane].normal) - attached_ent:GetPos() ):GetNormal()
@ -667,7 +667,7 @@ local function solve_point_2line_intersection( line1, line2 )
-- solve simultaneous
local length1, length2 = solve_simultaneous_2( a1, b1, c1, a2, b2, c2 )
if !length1 or !length2 then return false end
if not length1 or not length2 then return false end
local dir1, dir2 = A:GetNormal(), B:GetNormal()
@ -745,7 +745,7 @@ PA_funcs.point_3plane_intersection = function( planeID1, planeID2, planeID3 )
end
local line = PA_funcs.line_2plane_intersection( planeID1, planeID2 )
if !line then return false end
if not line then return false end
-- Calculate line/plane intercept
local length = plane3.normal:Dot(plane3.origin - line.startpoint) / plane3.normal:Dot(line.direction)
@ -867,13 +867,13 @@ end
-- Rotate angle by world angles
PA_funcs.rotate_world = function( ang, rotang )
if rotang.p != 0 then
if rotang.p ~= 0 then
ang:RotateAroundAxis( Vector(0,1,0), rotang.p )
end
if rotang.y != 0 then
if rotang.y ~= 0 then
ang:RotateAroundAxis( Vector(0,0,1), rotang.y )
end
if rotang.r != 0 then
if rotang.r ~= 0 then
ang:RotateAroundAxis( Vector(1,0,0), rotang.r )
end
@ -885,7 +885,7 @@ PA_funcs.rotate_2lines_parallel = function( pivot, lineID1, lineID2, activeent )
local line1 = PA_funcs.line_global( lineID1 )
local line2 = PA_funcs.line_global( lineID2 )
if !pivot then
if not pivot then
pivot = line1.startpoint
end
@ -910,7 +910,7 @@ PA_funcs.rotate_2planes_parallel = function( pivot, planeID1, planeID2, activeen
local plane1 = PA_funcs.plane_global( planeID1 )
local plane2 = PA_funcs.plane_global( planeID2 )
if !pivot then
if not pivot then
pivot = plane1.origin
end
@ -1047,7 +1047,7 @@ PA_funcs.rotate_line_plane_parallel = function( pivot, axis, lineID, planeID, ac
ang:RotateAroundAxis( axisdir, Ang )
-- Use axis as pivot by default
if !pivot and axis then
if not pivot and axis then
pivot = axis.startpoint
end
@ -1096,7 +1096,7 @@ end
-- -- Use axis as pivot by default
-- if !pivot and axis then
-- if not pivot and axis then
-- pivot = axis.startpoint
-- end

View File

@ -44,7 +44,7 @@ local ColourLookup = {
local function construct_exists( construct_type, ID )
if !construct_type or !ID then return false end
if not construct_type or not ID then return false end
if construct_type == "Point" then
if precision_align_points[ID].origin then
@ -194,7 +194,7 @@ function PA_DrawToolScreen( w, h )
end )
if !r then
if not r then
ErrorNoHalt( e, "\n" )
end
end

View File

@ -407,7 +407,7 @@ end
-- Override mouse functions (make it into a toggle button)
function FUNCTION_BUTTON_2:OnMousePressed( mousecode )
if !self.Depressed then
if not self.Depressed then
-- pop up any previously depressed buttons
for k, v in pairs (function_buttons_2_list) do
if v.Depressed then
@ -469,7 +469,7 @@ end
-- Override mouse functions (make it into a toggle button)
function FUNCTION_BUTTON_3:OnMousePressed( mousecode )
if !self.Depressed then
if not self.Depressed then
-- pop up any previously depressed buttons
for k, v in pairs (function_buttons_3_list) do
if v.Depressed then
@ -554,7 +554,7 @@ end
-- Override mouse functions (make it into a toggle button)
function FUNCTION_BUTTON_ROTATION:OnMousePressed( mousecode )
if !self.Depressed then
if not self.Depressed then
-- pop up any previously depressed buttons
for k, v in pairs (rotation_function_buttons_list) do
if v.Depressed then
@ -716,7 +716,7 @@ end
function MOVE_BUTTON:Think()
if IsValid(PA_activeent) and self:GetDisabled() then
self:SetDisabled(false)
elseif !IsValid(PA_activeent) and !self:GetDisabled() then
elseif not IsValid(PA_activeent) and not self:GetDisabled() then
self:SetDisabled(true)
end
end
@ -779,7 +779,7 @@ function CONSTRAINTS_SHEET:AddComboBox( data )
ctrl:SetPreset( data.folder )
if ( data.options ) then
for k, v in pairs( data.options ) do
if ( k != "id" ) then -- Some txt file configs still have an `ID'. But these are redundant now.
if ( k ~= "id" ) then -- Some txt file configs still have an `ID'. But these are redundant now.
ctrl:AddOption( k, v )
end
end
@ -1252,7 +1252,7 @@ end
-- Open a particular tab in the manipulation panel
local function Open_Manipulation_Tab( Tab )
PA_manipulation_panel.panel:SetActiveTab( Tab )
if !PA_manipulation_panel:IsVisible() then
if not PA_manipulation_panel:IsVisible() then
PA_manipulation_panel:SetVisible(true)
end
end
@ -1308,7 +1308,7 @@ function TOOL_POINT_PANEL:Init()
create_buttons_standard( self, "point" )
self.button_view:SetFunction( function()
if !PA_funcs.construct_exists( "Point", PA_selected_point ) then return false end
if not PA_funcs.construct_exists( "Point", PA_selected_point ) then return false end
local point = PA_funcs.point_global( PA_selected_point )
return PA_funcs.set_playerview( point.origin )
end )
@ -1342,12 +1342,12 @@ function TOOL_POINT_PANEL:Init()
local point1 = PA_funcs.point_global( PA_selected_point )
local point2 = PA_funcs.point_global( PA_selected_point2 )
if !point1 or !point2 then
if not point1 or not point2 then
Warning("Points not correctly defined")
return false
end
if !PA_funcs.move_entity(point1.origin, point2.origin, PA_activeent) then return false end
if not PA_funcs.move_entity(point1.origin, point2.origin, PA_activeent) then return false end
end )
end
@ -1388,7 +1388,7 @@ function TOOL_LINE_PANEL:Init()
create_buttons_standard( self, "line" )
self.button_view:SetFunction( function()
if !PA_funcs.construct_exists( "Line", PA_selected_line ) then return false end
if not PA_funcs.construct_exists( "Line", PA_selected_line ) then return false end
local line = PA_funcs.line_global( PA_selected_line )
return PA_funcs.set_playerview( line.startpoint )
end )
@ -1413,14 +1413,14 @@ function TOOL_LINE_PANEL:Init()
self.button_moveentity:SetToolTip( "Move entity by line" )
self.button_moveentity:SetFunction( function()
local line = PA_funcs.line_global(PA_selected_line)
if !line then
if not line then
Warning("Line not correctly defined")
return false
end
local point1 = line.startpoint
local point2 = line.endpoint
if !PA_funcs.move_entity(point1, point2, PA_activeent) then return false end
if not PA_funcs.move_entity(point1, point2, PA_activeent) then return false end
end )
end
@ -1461,7 +1461,7 @@ function TOOL_PLANE_PANEL:Init()
create_buttons_standard( self, "plane" )
self.button_view:SetFunction( function()
if !PA_funcs.construct_exists( "Plane", PA_selected_plane ) then return false end
if not PA_funcs.construct_exists( "Plane", PA_selected_plane ) then return false end
local plane = PA_funcs.plane_global( PA_selected_plane )
return PA_funcs.set_playerview( plane.origin )
end )
@ -2044,7 +2044,7 @@ hook.Add("HUDPaint", "draw_precision_align", precision_align_draw)
local function precision_align_displayhud_func( ply, cmd, args )
local enabled = tobool( args[1] )
if !enabled then
if not enabled then
hook.Remove( "HUDPaint", "draw_precision_align" )
else
hook.Add("HUDPaint", "draw_precision_align", precision_align_draw)
@ -2057,7 +2057,7 @@ PA_manipulation_panel = vgui.Create( "PA_Manipulation_Frame" )
PA_manipulation_panel:SetVisible(false)
local function precision_align_open_panel_func( ply, cmd, args )
if !PA_manipulation_panel then
if not PA_manipulation_panel then
local PA_manipulation_panel = vgui.Create( "PA_Manipulation_Frame" )
else
if PA_manipulation_panel:IsVisible() then