From 96972b6e1af980d86fc306172fab01a6f43a47ae Mon Sep 17 00:00:00 2001 From: dvdvideo1234 Date: Sun, 5 Nov 2023 16:30:55 +0200 Subject: [PATCH] Fixed: Use the new wire vararg to avoid deprecation --- .../core/custom/cl_primitive.lua | 2 ++ .../gmod_wire_expression2/core/custom/primitive.lua | 11 +---------- 2 files changed, 3 insertions(+), 10 deletions(-) create mode 100644 lua/entities/gmod_wire_expression2/core/custom/cl_primitive.lua diff --git a/lua/entities/gmod_wire_expression2/core/custom/cl_primitive.lua b/lua/entities/gmod_wire_expression2/core/custom/cl_primitive.lua new file mode 100644 index 0000000..e803b1d --- /dev/null +++ b/lua/entities/gmod_wire_expression2/core/custom/cl_primitive.lua @@ -0,0 +1,2 @@ +E2Helper.Descriptions["primitiveGetVars(e)"] = "Reads primitive shape variables" +E2Helper.Descriptions["primitiveEdit(es...)"] = "Edits a primitive shape entity" diff --git a/lua/entities/gmod_wire_expression2/core/custom/primitive.lua b/lua/entities/gmod_wire_expression2/core/custom/primitive.lua index 46cb9c4..5ad5880 100644 --- a/lua/entities/gmod_wire_expression2/core/custom/primitive.lua +++ b/lua/entities/gmod_wire_expression2/core/custom/primitive.lua @@ -3,8 +3,6 @@ E2Lib.RegisterExtension( "primitive", false, "Allows the manipulation of primiti local ANTISPAM_UPDATE_DELAY = 0.5 - --- local function isValidPrimitive( self, ent ) if not IsValid( ent ) or not scripted_ents.IsBasedOn( ent:GetClass(), "primitive_base" ) then return false @@ -13,7 +11,6 @@ local function isValidPrimitive( self, ent ) return true end - local function antispam( ent, key ) if not ent.E2PrimitiveAntispam then ent.E2PrimitiveAntispam = {} @@ -36,7 +33,6 @@ local function antispam( ent, key ) return true end - local e2type = {} e2type.Vector = function( val ) local a = val[1] @@ -73,19 +69,14 @@ local function editVariable( ply, ent, key, val ) hook.Run( "VariableEdited", ent, ply, key, tostring( val ), editor ) end - --- __e2setcost( 15 ) -e2function void primitiveEdit( entity ent, string key, ... ) +e2function void primitiveEdit( entity ent, string key, ...args ) if not isValidPrimitive( self, ent ) then return end - local args = { ... } editVariable( self.player, ent, key, args[1] ) end - --- __e2setcost( 30 ) local e2table = { string = "s", number = "n", boolean = "n" }