From 5a9914b249a3d35cd7b008198dc70098f86c3879 Mon Sep 17 00:00:00 2001 From: LengthenedGradient <109800352+LengthenedGradient@users.noreply.github.com> Date: Thu, 20 Aug 2026 04:01:15 -0400 Subject: [PATCH 1/4] Add primitive convex support New primitive tab will allow for the creation of primitive convexes, which should make creating volumetric volumes much easier. Similar to making a face from vertices but for 3D. --- .../core/utils/primitives_sv.lua | 73 ++++++++++++++ .../gmod_tool/stools/precision_align.lua | 1 + .../precision_align/manipulation_panel.lua | 8 +- .../precision_align/primitives_panel.lua | 94 +++++++++++++++++++ .../gmod_tool/stools/precision_align/ui.lua | 1 + 5 files changed, 174 insertions(+), 3 deletions(-) create mode 100644 lua/precision_align/core/utils/primitives_sv.lua create mode 100644 lua/weapons/gmod_tool/stools/precision_align/primitives_panel.lua diff --git a/lua/precision_align/core/utils/primitives_sv.lua b/lua/precision_align/core/utils/primitives_sv.lua new file mode 100644 index 0000000..daed8d5 --- /dev/null +++ b/lua/precision_align/core/utils/primitives_sv.lua @@ -0,0 +1,73 @@ +-- Serverside handler for the "Primitives" manipulation panel tab: takes a list of +-- world-space points the client picked from its PA point stack and spawns a +-- primitive_convex_hull entity (from the separate "primitive" addon) using them +-- as vertices. Soft dependency: if that addon isn't loaded, the net message +-- just gets dropped, since the primitive_convex_hull class won't exist to check for. + +local PA, PA_ = PrecisionAlign.PA, PrecisionAlign.PA_ + +util.AddNetworkString( PA_ .. "primitive" ) + +local MIN_POINTS = 4 +local MAX_POINTS = 10 + +net.Receive( PA_ .. "primitive", function( _, ply ) + local count = net.ReadUInt( 8 ) + if count < MIN_POINTS or count > MAX_POINTS then return end + + local points = {} + for i = 1, count do + points[i] = net.ReadVector() + end + + if not scripted_ents.GetStored( "primitive_convex_hull" ) then + Warning( "Precision Alignment: primitive_convex_hull entity is not registered, is the \"primitive\" addon installed?\n" ) + return + end + + if scripted_ents.GetMember( "primitive_convex_hull", "AdminOnly" ) and not ply:IsAdmin() then return end + if not gamemode.Call( "PlayerSpawnProp", ply, "models/combine_helicopter/helicopter_bomb01.mdl" ) then return end + if not ply:CheckLimit( "props" ) then return end + + -- centroid becomes the entity's own position; vertices are stored relative to it + local centroid = Vector( 0, 0, 0 ) + for i = 1, count do + centroid = centroid + points[i] + end + centroid = centroid / count + + local ent = ents.Create( "primitive_convex_hull" ) + if not IsValid( ent ) then return end + + ent:SetPos( centroid ) + ent:SetAngles( Angle( 0, 0, 0 ) ) + ent:Spawn() + ent:Activate() + + if isfunction( ent.PrimitiveSetup ) then + ent:PrimitiveSetup( true ) + end + + ent:SetPrimPOINTS( count ) + for i = 1, count do + local local_point = points[i] - centroid + + ent[ "SetPrimPX" .. i ]( ent, local_point.x ) + ent[ "SetPrimPY" .. i ]( ent, local_point.y ) + ent[ "SetPrimPZ" .. i ]( ent, local_point.z ) + end + + ent:SetVar( "Player", ply ) + ply:AddCount( "props", ent ) + ply:AddCleanup( "primitive", ent ) + + undo.Create( "primitive" ) + undo.SetPlayer( ply ) + undo.AddEntity( ent ) + undo.SetCustomUndoText( "Undone primitive ( primitive_convex_hull )" ) + undo.Finish( "primitive ( primitive_convex_hull )" ) + + DoPropSpawnedEffect( ent ) + + gamemode.Call( "PlayerSpawnedProp", ply, "models/combine_helicopter/helicopter_bomb01.mdl", ent ) +end ) diff --git a/lua/weapons/gmod_tool/stools/precision_align.lua b/lua/weapons/gmod_tool/stools/precision_align.lua index 673bac2..d8b935b 100644 --- a/lua/weapons/gmod_tool/stools/precision_align.lua +++ b/lua/weapons/gmod_tool/stools/precision_align.lua @@ -17,6 +17,7 @@ local PA_ = PA .. "_" AddCSLuaFile( PA .. "/ui.lua" ) AddCSLuaFile( PA .. "/draw_hud.lua" ) AddCSLuaFile( PA .. "/manipulation_panel.lua" ) +AddCSLuaFile( PA .. "/primitives_panel.lua" ) -- local typeCvar = GetConVar("precision_align_tooltype") diff --git a/lua/weapons/gmod_tool/stools/precision_align/manipulation_panel.lua b/lua/weapons/gmod_tool/stools/precision_align/manipulation_panel.lua index 8ad7ca5..b7974d5 100644 --- a/lua/weapons/gmod_tool/stools/precision_align/manipulation_panel.lua +++ b/lua/weapons/gmod_tool/stools/precision_align/manipulation_panel.lua @@ -54,7 +54,7 @@ local BGColor_Rotation = PrecisionAlign.TOOLMODE_BACKGROUND_COLOR_ROTATION local MANIPULATION_FRAME = {} function MANIPULATION_FRAME:Init() - self:SetSize(900, 500) + self:SetSize(980, 500) self:Center() self:SetTitle( "Precision Alignment Manipulation Panel" ) self:SetVisible( true ) @@ -83,6 +83,7 @@ function MANIPULATION_FRAME:Init() self.rotation_tab = vgui.Create( "PA_Rotation_Tab", self.body ) self.rotation_functions_tab = vgui.Create( "PA_Rotation_Functions_Tab", self.body ) self.constraints_tab = vgui.Create( "PA_Constraints_Tab", self.body ) + self.primitives_tab = vgui.Create( "PA_Primitives_Tab", self.body ) self.panel:AddSheet( "Display Options", self.displays_tab, "icon16/picture_edit.png", false, false ) self.panel:AddSheet( "Points", self.points_tab, "icon16/add.png", false, false ) @@ -96,10 +97,11 @@ function MANIPULATION_FRAME:Init() self.panel:AddSheet( "Rotation", self.rotation_tab, "icon16/arrow_refresh.png", false, false ) self.panel:AddSheet( "Rotation Functions", self.rotation_functions_tab, "icon16/arrow_refresh.png", false, false ) self.panel:AddSheet( "Constraints", self.constraints_tab, "icon16/anchor.png", false, false ) + self.panel:AddSheet( "Primitives", self.primitives_tab, "icon16/shape_square.png", false, false ) -- Help button self.button_help = vgui.Create( "PA_Function_Button", self ) - self.button_help:SetPos( 810, 30 ) + self.button_help:SetPos( 890, 30 ) self.button_help:SetSize( 60, 20 ) self.button_help:SetText( "Help" ) self.button_help:SetTooltip( "Open online help using the Steam in-game browser." ) @@ -142,7 +144,7 @@ vgui.Register("PA_Manipulation_Body", MANIPULATION_BODY, "DPanel") local MANIPULATION_PANEL = {} function MANIPULATION_PANEL:Init() self:SetPos(0, 5) - self:SetSize(900, 470) + self:SetSize(980, 470) end function MANIPULATION_PANEL:Paint() diff --git a/lua/weapons/gmod_tool/stools/precision_align/primitives_panel.lua b/lua/weapons/gmod_tool/stools/precision_align/primitives_panel.lua new file mode 100644 index 0000000..d2e381a --- /dev/null +++ b/lua/weapons/gmod_tool/stools/precision_align/primitives_panel.lua @@ -0,0 +1,94 @@ +-- Primitives Tab. Lets the user pick 4-10 PA points and spawn a +-- primitive_convex_hull entity (from the "primitive" addon) whose vertices are +-- those points. Soft dependency: if the primitive addon isn't loaded, the tab +-- still shows but the create button just warns instead of doing anything. +--******************************************************************************************************************** + +if SERVER then return end + +local PA = "precision_align" +local PA_ = PA .. "_" + +local BGColor_Point = PrecisionAlign.TOOLMODE_BACKGROUND_COLOR_POINT + +local function AddMenuText( text, x, y, parent ) + local Text = vgui.Create( "DLabel", parent ) + Text:SetFont( "Default" ) + Text:SetText( text ) + Text:SizeToContents() + Text:SetPos( x, y ) + return Text +end + +local MIN_POINTS = 4 +local MAX_POINTS = 10 + +local PRIMITIVES_TAB = {} +function PRIMITIVES_TAB:Init() + self:CopyBounds( self:GetParent() ) + + AddMenuText( "Points", 32, 9, self ) + + self.colour_panel = vgui.Create( "PA_Colour_Panel", self ) + self.colour_panel:SetPos( 5, 31 ) + self.colour_panel:SetSize( 300, 404 ) + self.colour_panel:SetColour( BGColor_Point ) + + self.list_points = vgui.Create( "PA_Construct_ListView", self.colour_panel ) + self.list_points:Text( "Points", PrecisionAlign.CONSTRUCT_POINT, self.colour_panel ) + self.list_points:SetTooltip( "Select 4-10 points to use as the convex hull's vertices" ) + self.list_points:SetPos( 20, 30 ) + self.list_points:SetMultiSelect( true ) + + AddMenuText( "Primitive: Convex Hull", 330, 9, self ) + + self.text_description = vgui.Create( "DLabel", self ) + self.text_description:SetPos( 330, 36 ) + self.text_description:SetSize( 400, 300 ) + self.text_description:SetWrap( true ) + self.text_description:SetContentAlignment( 7 ) + self.text_description:SetTextColor( self:GetSkin().Colours.Label.Dark ) + self.text_description:SetText( + "Select 4 to 10 points, then hit Create.\n\n" .. + "The physics engine builds the hull, so point order doesn't matter.\n\n" .. + "Requires the \"primitive\" addon." + ) + + self.button_create = vgui.Create( "PA_Function_Button", self ) + self.button_create:SetPos( 330, 378 ) + self.button_create:SetSize( 191, 50 ) + self.button_create:SetText( "Create Primitive" ) + self.button_create:SetTooltip( "Spawn a convex hull from the selected points" ) + self.button_create:SetFunction( function() + local selected = self.list_points:GetSelected() + + local points = {} + for _, v in pairs( selected ) do + local ID = v:GetID() + if PrecisionAlign.Functions.construct_exists( PrecisionAlign.CONSTRUCT_POINT, ID ) then + points[#points + 1] = PrecisionAlign.Functions.point_global( ID ).origin + end + end + + if #points < MIN_POINTS then + Warning( "Select at least " .. MIN_POINTS .. " defined points" ) + return false + end + + if #points > MAX_POINTS then + Warning( "Select at most " .. MAX_POINTS .. " points" ) + return false + end + + net.Start( PA_ .. "primitive" ) + net.WriteUInt( #points, 8 ) + for i = 1, #points do + net.WriteVector( points[i] ) + end + net.SendToServer() + + return true + end ) +end + +vgui.Register( "PA_Primitives_Tab", PRIMITIVES_TAB, "DPanel" ) diff --git a/lua/weapons/gmod_tool/stools/precision_align/ui.lua b/lua/weapons/gmod_tool/stools/precision_align/ui.lua index d19abaa..86bfddd 100644 --- a/lua/weapons/gmod_tool/stools/precision_align/ui.lua +++ b/lua/weapons/gmod_tool/stools/precision_align/ui.lua @@ -9,6 +9,7 @@ PrecisionAlign.SelectedPlane = 1 PrecisionAlign.ActiveEnt = nil +include("weapons/gmod_tool/stools/" .. PA .. "/primitives_panel.lua") include("weapons/gmod_tool/stools/" .. PA .. "/manipulation_panel.lua") local tooltypeCvar = GetConVar( PA_ .. "toolname" ) From 60def6dac2268d9359e19dde83db2ca06fd0d3e2 Mon Sep 17 00:00:00 2001 From: LengthenedGradient <109800352+LengthenedGradient@users.noreply.github.com> Date: Thu, 20 Aug 2026 04:21:07 -0400 Subject: [PATCH 2/4] Add PA max points constant Extracts the point limit into a single constant --- lua/precision_align/classes/base_toolmodes/line.lua | 2 +- lua/precision_align/classes/base_toolmodes/plane.lua | 2 +- lua/precision_align/classes/base_toolmodes/point.lua | 2 +- lua/precision_align/core/consts.lua | 3 +++ lua/precision_align/core/utils/utils_cl.lua | 2 +- lua/vgui/pa_construct_listview.lua | 6 +++--- lua/vgui/pa_construct_multiselect.lua | 2 +- lua/weapons/gmod_tool/stools/precision_align.lua | 4 ++-- .../gmod_tool/stools/precision_align/manipulation_panel.lua | 2 +- lua/weapons/gmod_tool/stools/precision_align/ui.lua | 2 +- 10 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lua/precision_align/classes/base_toolmodes/line.lua b/lua/precision_align/classes/base_toolmodes/line.lua index 2d92147..b747171 100644 --- a/lua/precision_align/classes/base_toolmodes/line.lua +++ b/lua/precision_align/classes/base_toolmodes/line.lua @@ -5,7 +5,7 @@ end local PA = PrecisionAlign.PA function PrecisionAlign.SelectNextLine() - if PrecisionAlign.SelectedLine < 9 and PrecisionAlign.Functions.construct_exists( PrecisionAlign.CONSTRUCT_LINE, PrecisionAlign.SelectedLine ) then + if PrecisionAlign.SelectedLine < PrecisionAlign.MAX_CONSTRUCTS and PrecisionAlign.Functions.construct_exists( PrecisionAlign.CONSTRUCT_LINE, PrecisionAlign.SelectedLine ) then PrecisionAlign.SelectedLine = PrecisionAlign.SelectedLine + 1 local dlist_lines = controlpanel.Get( PA ).line_window.list_line dlist_lines:ClearSelection() diff --git a/lua/precision_align/classes/base_toolmodes/plane.lua b/lua/precision_align/classes/base_toolmodes/plane.lua index 1e85c34..8912dfb 100644 --- a/lua/precision_align/classes/base_toolmodes/plane.lua +++ b/lua/precision_align/classes/base_toolmodes/plane.lua @@ -5,7 +5,7 @@ end local PA = PrecisionAlign.PA function PrecisionAlign.SelectNextPlane() - if PrecisionAlign.SelectedPlane < 9 and PrecisionAlign.Functions.construct_exists( PrecisionAlign.CONSTRUCT_PLANE, PrecisionAlign.SelectedPlane ) then + if PrecisionAlign.SelectedPlane < PrecisionAlign.MAX_CONSTRUCTS and PrecisionAlign.Functions.construct_exists( PrecisionAlign.CONSTRUCT_PLANE, PrecisionAlign.SelectedPlane ) then PrecisionAlign.SelectedPlane = PrecisionAlign.SelectedPlane + 1 local dlist_planes = controlpanel.Get( PA ).plane_window.list_plane dlist_planes:ClearSelection() diff --git a/lua/precision_align/classes/base_toolmodes/point.lua b/lua/precision_align/classes/base_toolmodes/point.lua index 6cced85..6da5bdb 100644 --- a/lua/precision_align/classes/base_toolmodes/point.lua +++ b/lua/precision_align/classes/base_toolmodes/point.lua @@ -5,7 +5,7 @@ end local PA = PrecisionAlign.PA function PrecisionAlign.SelectNextPoint() - if PrecisionAlign.SelectedPoint < 9 and PrecisionAlign.Functions.construct_exists( PrecisionAlign.CONSTRUCT_POINT, PrecisionAlign.SelectedPoint ) then + if PrecisionAlign.SelectedPoint < PrecisionAlign.MAX_CONSTRUCTS and PrecisionAlign.Functions.construct_exists( PrecisionAlign.CONSTRUCT_POINT, PrecisionAlign.SelectedPoint ) then PrecisionAlign.SelectedPoint = PrecisionAlign.SelectedPoint + 1 local dlist_points = controlpanel.Get( PA ).point_window.list_primarypoint dlist_points:ClearSelection() diff --git a/lua/precision_align/core/consts.lua b/lua/precision_align/core/consts.lua index 220cb30..2bf2bd6 100644 --- a/lua/precision_align/core/consts.lua +++ b/lua/precision_align/core/consts.lua @@ -2,6 +2,9 @@ PrecisionAlign.CONSTRUCT_POINT = 0 PrecisionAlign.CONSTRUCT_LINE = 1 PrecisionAlign.CONSTRUCT_PLANE = 2 +-- Number of point/line/plane slots in the construct stack. +PrecisionAlign.MAX_CONSTRUCTS = 10 + PrecisionAlign.TOOLMODE_BACKGROUND_COLOR = Color(50, 50, 50, 50) PrecisionAlign.TOOLMODE_BACKGROUND_COLOR_BACKGROUND = Color(103, 100, 110, 255) PrecisionAlign.TOOLMODE_BACKGROUND_COLOR_DISABLED = Color(160, 160, 160, 255) diff --git a/lua/precision_align/core/utils/utils_cl.lua b/lua/precision_align/core/utils/utils_cl.lua index b7d7ab2..b46221a 100644 --- a/lua/precision_align/core/utils/utils_cl.lua +++ b/lua/precision_align/core/utils/utils_cl.lua @@ -22,7 +22,7 @@ do -- Backwards compatibility for Prop Mover end -- Initialize tables, set defaults -for i = 1, 9 do +for i = 1, PrecisionAlign.MAX_CONSTRUCTS do PrecisionAlign.Points[i] = {visible = true} PrecisionAlign.Lines[i] = {visible = true} PrecisionAlign.Planes[i] = {visible = true} diff --git a/lua/vgui/pa_construct_listview.lua b/lua/vgui/pa_construct_listview.lua index c9b7646..3b9c924 100644 --- a/lua/vgui/pa_construct_listview.lua +++ b/lua/vgui/pa_construct_listview.lua @@ -6,7 +6,7 @@ end function CONSTRUCT_LISTVIEW:Text( title, construct ) self.construct_type = construct self:AddColumn( "" .. title) - for i = 1, 9 do + for i = 1, PrecisionAlign.MAX_CONSTRUCTS do local line = self:AddLine(PrecisionAlign.GetConstructName(construct) .. " " .. tostring(i)) line.indicator = vgui.Create( "PA_Indicator", line ) end @@ -18,14 +18,14 @@ function CONSTRUCT_LISTVIEW:Text( title, construct ) end function CONSTRUCT_LISTVIEW:SetIndicators() - for i = 1, 9 do + for i = 1, PrecisionAlign.MAX_CONSTRUCTS do local line = self:GetLine(i) line.indicator = vgui.Create( "PA_Indicator", line ) end end function CONSTRUCT_LISTVIEW:SetIndicatorOffset( offset ) - for i = 1, 9 do + for i = 1, PrecisionAlign.MAX_CONSTRUCTS do local indicator = self:GetLine(i).indicator indicator.offset = offset end diff --git a/lua/vgui/pa_construct_multiselect.lua b/lua/vgui/pa_construct_multiselect.lua index 8430866..20c46fd 100644 --- a/lua/vgui/pa_construct_multiselect.lua +++ b/lua/vgui/pa_construct_multiselect.lua @@ -144,7 +144,7 @@ end function CONSTRUCT_MULTISELECT:SelectAll( value ) local function SelectLines( panel, construct_table ) - for id = 1, 9 do + for id = 1, PrecisionAlign.MAX_CONSTRUCTS do local line = panel.Sorted[ id ] line:SetSelected( value ) if self.visibility then diff --git a/lua/weapons/gmod_tool/stools/precision_align.lua b/lua/weapons/gmod_tool/stools/precision_align.lua index d8b935b..195f1fe 100644 --- a/lua/weapons/gmod_tool/stools/precision_align.lua +++ b/lua/weapons/gmod_tool/stools/precision_align.lua @@ -502,7 +502,7 @@ end local function DrawIndicators( x, y, w, curToolType ) local radius = 8 local diameter = radius * 2 + 1 - local separation = (w - 4) / 9 + local separation = (w - 4) / PrecisionAlign.MAX_CONSTRUCTS -- Background draw.RoundedBox( 10, x, y, w, diameter + 15, Color(50, 50, 50, 100) ) @@ -513,7 +513,7 @@ local function DrawIndicators( x, y, w, curToolType ) -- Indicators local IndicatorColour local ConstructNum = GetConstructNum( curToolType ) - for i = 1, 9 do + for i = 1, PrecisionAlign.MAX_CONSTRUCTS do -- Draw construct selection ring if i == ConstructNum then draw.RoundedBox( radius + 4, xpos - 4, ypos - 4, diameter + 8, diameter + 8, Color(255, 255, 255, 255) ) diff --git a/lua/weapons/gmod_tool/stools/precision_align/manipulation_panel.lua b/lua/weapons/gmod_tool/stools/precision_align/manipulation_panel.lua index b7974d5..8aa6c67 100644 --- a/lua/weapons/gmod_tool/stools/precision_align/manipulation_panel.lua +++ b/lua/weapons/gmod_tool/stools/precision_align/manipulation_panel.lua @@ -170,7 +170,7 @@ function DISPLAYS_TAB:Init() keytable[ selection[k]:GetID() ] = true end - for I = 1, 9 do + for I = 1, PrecisionAlign.MAX_CONSTRUCTS do if keytable[I] then construct_table[I].visible = true else diff --git a/lua/weapons/gmod_tool/stools/precision_align/ui.lua b/lua/weapons/gmod_tool/stools/precision_align/ui.lua index 86bfddd..d282198 100644 --- a/lua/weapons/gmod_tool/stools/precision_align/ui.lua +++ b/lua/weapons/gmod_tool/stools/precision_align/ui.lua @@ -178,7 +178,7 @@ do function PA_ConstructList:Setup(Construct, Click, DbClick) self.construct_type = Construct local Name = PrecisionAlign.GetConstructName(Construct) - for I = 1, 9 do + for I = 1, PrecisionAlign.MAX_CONSTRUCTS do local Line = self:AddLine(Name .. " " .. I) Line.Indicator = Line:Add "PA_Indicator" end From ce4efb5153408a8349299809aaaa514a30dcc685 Mon Sep 17 00:00:00 2001 From: LengthenedGradient <109800352+LengthenedGradient@users.noreply.github.com> Date: Thu, 20 Aug 2026 04:57:36 -0400 Subject: [PATCH 3/4] Satisfy Linter --- lua/precision_align/core/utils/primitives_sv.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/precision_align/core/utils/primitives_sv.lua b/lua/precision_align/core/utils/primitives_sv.lua index daed8d5..27e2d5b 100644 --- a/lua/precision_align/core/utils/primitives_sv.lua +++ b/lua/precision_align/core/utils/primitives_sv.lua @@ -4,7 +4,7 @@ -- as vertices. Soft dependency: if that addon isn't loaded, the net message -- just gets dropped, since the primitive_convex_hull class won't exist to check for. -local PA, PA_ = PrecisionAlign.PA, PrecisionAlign.PA_ +local PA_ = PrecisionAlign.PA_ util.AddNetworkString( PA_ .. "primitive" ) From f1818bda690b455b4ee780b7939f235df593c699 Mon Sep 17 00:00:00 2001 From: LengthenedGradient <109800352+LengthenedGradient@users.noreply.github.com> Date: Thu, 20 Aug 2026 20:50:11 -0400 Subject: [PATCH 4/4] Rate limit primitive spawns To avoid spam creation. --- lua/precision_align/core/consts.lua | 3 +++ lua/precision_align/core/utils/primitives_sv.lua | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/lua/precision_align/core/consts.lua b/lua/precision_align/core/consts.lua index 2bf2bd6..4ab09e1 100644 --- a/lua/precision_align/core/consts.lua +++ b/lua/precision_align/core/consts.lua @@ -5,6 +5,9 @@ PrecisionAlign.CONSTRUCT_PLANE = 2 -- Number of point/line/plane slots in the construct stack. PrecisionAlign.MAX_CONSTRUCTS = 10 +-- Per-player cooldown, in seconds, between primitive_convex_hull spawns from the Primitives tab. +PrecisionAlign.PRIMITIVE_SPAWN_COOLDOWN = 0.1 + PrecisionAlign.TOOLMODE_BACKGROUND_COLOR = Color(50, 50, 50, 50) PrecisionAlign.TOOLMODE_BACKGROUND_COLOR_BACKGROUND = Color(103, 100, 110, 255) PrecisionAlign.TOOLMODE_BACKGROUND_COLOR_DISABLED = Color(160, 160, 160, 255) diff --git a/lua/precision_align/core/utils/primitives_sv.lua b/lua/precision_align/core/utils/primitives_sv.lua index 27e2d5b..2161766 100644 --- a/lua/precision_align/core/utils/primitives_sv.lua +++ b/lua/precision_align/core/utils/primitives_sv.lua @@ -11,10 +11,15 @@ util.AddNetworkString( PA_ .. "primitive" ) local MIN_POINTS = 4 local MAX_POINTS = 10 +local nextSpawn = {} + net.Receive( PA_ .. "primitive", function( _, ply ) local count = net.ReadUInt( 8 ) if count < MIN_POINTS or count > MAX_POINTS then return end + if ( nextSpawn[ply] or 0 ) > SysTime() then return end + nextSpawn[ply] = SysTime() + PrecisionAlign.PRIMITIVE_SPAWN_COOLDOWN + local points = {} for i = 1, count do points[i] = net.ReadVector()