Skip to content

Commit c8f18e2

Browse files
authored
Add FCVAR_REPLICATED (#3479)
* Add FCVAR_REPLICATED * Move convar creation to shared.lua
1 parent aa54e88 commit c8f18e2

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

lua/entities/gmod_wire_customprop/init.lua

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,11 @@ util.AddNetworkString(shared.classname)
77
local ENT_META = FindMetaTable("Entity")
88
local Ent_GetTable = ENT_META.GetTable
99

10-
-- Reason why there are more max convexes but less max vertices by default is that client's ENT:BuildPhysics is the main bottleneck.
11-
-- It seems to require more time exponentially to the vertices amount.
12-
-- The same amount of vertices in total, but broken into different convexes greatly reduces the performance hit.
13-
local wire_customprops_hullsize_max = CreateConVar("wire_customprops_hullsize_max", 2048, FCVAR_ARCHIVE, "The max hull size of a custom prop")
14-
local wire_customprops_minvertexdistance = CreateConVar("wire_customprops_minvertexdistance", 0.2, FCVAR_ARCHIVE, "The min distance between two vertices in a custom prop.")
15-
local wire_customprops_vertices_max = CreateConVar("wire_customprops_vertices_max", 64, FCVAR_ARCHIVE, "How many vertices custom props can have.", 4)
16-
local wire_customprops_convexes_max = CreateConVar("wire_customprops_convexes_max", 12, FCVAR_ARCHIVE, "How many convexes custom props can have.", 1)
17-
local wire_customprops_max = CreateConVar("wire_customprops_max", 16, FCVAR_ARCHIVE, "The maximum number of custom props a player can spawn. (0 to disable)", 0)
10+
local wire_customprops_hullsize_max = GetConVar("wire_customprops_hullsize_max")
11+
local wire_customprops_minvertexdistance = GetConVar("wire_customprops_minvertexdistance")
12+
local wire_customprops_vertices_max = GetConVar("wire_customprops_vertices_max")
13+
local wire_customprops_convexes_max = GetConVar("wire_customprops_convexes_max")
14+
local wire_customprops_max = GetConVar("wire_customprops_max")
1815

1916
WireLib = WireLib or {}
2017
WireLib.CustomProp = WireLib.CustomProp or {}

lua/entities/gmod_wire_customprop/shared.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ ENT.Author = "Sparky & DeltaMolfar"
77
ENT.Spawnable = false
88
ENT.AdminSpawnable = false
99

10+
-- Reason why there are more max convexes but less max vertices by default is that client's ENT:BuildPhysics is the main bottleneck.
11+
-- It seems to require more time exponentially to the vertices amount.
12+
-- The same amount of vertices in total, but broken into different convexes greatly reduces the performance hit.
13+
CreateConVar("wire_customprops_hullsize_max", 2048, {FCVAR_ARCHIVE, FCVAR_REPLICATED}, "The max hull size of a custom prop")
14+
CreateConVar("wire_customprops_minvertexdistance", 0.2, {FCVAR_ARCHIVE, FCVAR_REPLICATED}, "The min distance between two vertices in a custom prop.")
15+
CreateConVar("wire_customprops_vertices_max", 64, {FCVAR_ARCHIVE, FCVAR_REPLICATED}, "How many vertices custom props can have.", 4)
16+
CreateConVar("wire_customprops_convexes_max", 12, {FCVAR_ARCHIVE, FCVAR_REPLICATED}, "How many convexes custom props can have.", 1)
17+
CreateConVar("wire_customprops_max", 16, {FCVAR_ARCHIVE, FCVAR_REPLICATED}, "The maximum number of custom props a player can spawn. (0 to disable)", 0)
18+
1019
function ENT:SetupDataTables()
1120
self:NetworkVar("String", 0, "PhysMaterial")
1221

0 commit comments

Comments
 (0)