Skip to content

Commit 9df52bb

Browse files
committed
Major Changes
1 parent f330b47 commit 9df52bb

File tree

175 files changed

+14839
-1867
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+14839
-1867
lines changed

documentation/docs/definitions/command.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The command name itself is the first argument to `lia.command.add` and is stored
3030
| `adminOnly` | `boolean` | `false` | Restrict to admins (registers a CAMI privilege). |
3131
| `superAdminOnly` | `boolean` | `false` | Restrict to superadmins (registers a CAMI privilege). |
3232
| `privilege` | `string` | `nil` | Custom CAMI privilege name (defaults to command name). |
33-
| `syntax` | `string` | `""` | Human-readable argument format shown in help. |
33+
| `arguments` | `table` | `{}` | Ordered argument definitions used to build help text. |
3434
| `desc` | `string` | `""` | Short description shown in command lists and menus. |
3535
| `AdminStick` | `table` | `nil` | Defines how the command appears in admin utilities. |
3636
| `onRun(client, args)` | `function(client, table)` | **required** | Function executed when the command is invoked. |
@@ -119,32 +119,34 @@ privilege = "Manage Doors"
119119

120120
---
121121

122-
### Syntax & Description
122+
### Arguments & Description
123123

124-
#### `syntax`
124+
#### `arguments`
125125

126126
**Type:**
127127

128-
`string`
128+
`table`
129129

130130
**Description:**
131131

132-
Human-readable syntax string shown in help menus. Does not affect argument parsing.
132+
Ordered list defining each command argument. Every entry may contain:
133133

134-
You can use spaces in argument names for better readability.
134+
* `name` – Argument name shown to the user.
135+
* `type` – One of `player`, `bool`, `table`, or `string`.
136+
* `optional` – Set to `true` if the argument is optional.
137+
* `description` – Optional human-readable help text.
138+
* `options` – Table or function returning options for `table` type.
139+
* `filter` – Function to filter players for `player` type.
135140

136-
The in-game prompt only appears when every argument follows the `[type Name]` format.
141+
The displayed syntax string is generated automatically from these definitions.
137142

138143
**Example Usage:**
139144

140145
```lua
141-
syntax = "[string Target Name] [number Amount]"
142-
```
143-
144-
Include the word `optional` inside the brackets to make an argument optional:
145-
146-
```lua
147-
syntax = "[string Target Name] [number Amount optional]"
146+
arguments = {
147+
{name = "target", type = "player"},
148+
{name = "reason", type = "string", optional = true}
149+
}
148150
```
149151

150152
---
@@ -239,7 +241,7 @@ lia.command.add("restockvendor", {
239241
superAdminOnly = true, -- restrict to super administrators
240242
privilege = "Manage Vendors", -- custom privilege checked before run
241243
desc = "Restock the vendor you are looking at.", -- shown in command lists
242-
syntax = "[player Target]", -- help text describing the argument
244+
arguments = {{name = "target", type = "player"}}, -- argument definition
243245
alias = {"vendorrestock"}, -- other names that trigger the command
244246
AdminStick = {
245247
Name = "Restock Vendor", -- text on the Admin Stick button
@@ -271,7 +273,7 @@ lia.command.add("restockvendor", {
271273
```lua
272274
lia.command.add("goto", {
273275
adminOnly = true, -- only admins may run this command
274-
syntax = "[player Target]", -- how the argument appears in help menus
276+
arguments = {{name = "target", type = "player"}}, -- argument definition
275277
desc = "Teleport to the specified player.", -- short description
276278
onRun = function(client, args)
277279
-- look up the target player from the first argument

documentation/docs/libraries/lia.chatbox.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Registers a new chat class and sets up its command aliases.
6767

6868
* `data` (*table*): Table of chat class properties.
6969

70-
* `syntax` (string) – Argument usage description shown in command help.
70+
* `arguments` (table) – Ordered argument definitions for the associated command.
7171

7272
* `desc` (string) – Description of the command shown in menus.
7373

@@ -109,7 +109,7 @@ Registers a new chat class and sets up its command aliases.
109109
-- Register a waving emote command
110110
lia.chat.register("wave", {
111111
desc = "Wave at those nearby",
112-
syntax = "",
112+
arguments = {{name = "text", type = "string", optional = true}},
113113
format = "* %s waves",
114114
prefix = {"/wave", "/greet"},
115115
font = "liaChatFontItalics",

documentation/docs/libraries/lia.commands.md

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ Registers a new command with its associated data. See [Command Fields](../defini
3636
-- Register a simple warn command for administrators
3737
lia.command.add("warn", {
3838
adminOnly = true,
39-
syntax = "[player Target] [string Reason]",
39+
arguments = {
40+
{name = "target", type = "player"},
41+
{name = "reason", type = "string"}
42+
},
4043
desc = "Send a warning message to the target player.",
4144
onRun = function(client, args)
4245
local target = lia.util.findPlayer(client, args[1])
@@ -124,39 +127,6 @@ local args2 = lia.command.extractArgs("/mycommand 'other arg' another")
124127

125128
---
126129

127-
### lia.command.parseSyntaxFields
128-
129-
**Purpose**
130-
131-
Parses a command syntax string into an ordered list of field tables. Each field contains a `name`, a `type`, and an `optional` flag derived from the syntax.
132-
133-
**Parameters**
134-
135-
* `syntax` (*string*): Syntax string, e.g. `[string Name] [number Time]`.
136-
137-
Include the word `optional` inside a bracket to mark that argument as optional.
138-
139-
**Realm**
140-
141-
`Shared`
142-
143-
**Returns**
144-
145-
* *table*: Ordered list of field tables.
146-
147-
* *boolean*: Whether the syntax strictly used the `[type Name]` format.
148-
149-
**Example Usage**
150-
151-
```lua
152-
local fields, valid = lia.command.parseSyntaxFields("[string Name] [number Time]")
153-
154-
-- mark optional arguments with the word "optional"
155-
local fieldsOpt = lia.command.parseSyntaxFields("[string Name] [number Time optional]")
156-
```
157-
158-
---
159-
160130
### lia.command.run
161131

162132
**Purpose**
@@ -258,15 +228,15 @@ lia.command.send("mycommand", "arg1", "arg2")
258228

259229
**Purpose**
260230

261-
Opens a window asking the player to fill in arguments for the given command. Missing fields defined as `optional` may be left blank; all others must be filled before **Submit** is enabled.
231+
Opens a window asking the player to fill in missing arguments for the given command. Arguments marked `optional` may be left blank; all others must be filled before **Submit** is enabled.
262232

263233
**Parameters**
264234

265235
* `cmdKey` (*string*): Command name.
266236

267-
* `fields` (*table | string*): Existing arguments or the server-supplied list of missing fields.
237+
* `missing` (*table*): Array of argument names that still need values.
268238

269-
* `prefix` (*table*): Legacy prefix table (optional).
239+
* `prefix` (*table*): Arguments already supplied (optional).
270240

271241
**Realm**
272242

@@ -279,7 +249,7 @@ Opens a window asking the player to fill in arguments for the given command. Mis
279249
**Example Usage**
280250

281251
```lua
282-
lia.command.openArgumentPrompt("plywhitelist")
252+
lia.command.openArgumentPrompt("ban", {"target", "duration"})
283253
```
284254

285255
---

gamemode/core/derma/f1menu/cl_classes.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,12 @@ function PANEL:addClassDetails(parent, cl)
161161
for _, v in ipairs(cl.requirements) do
162162
reqs[#reqs + 1] = L(v)
163163
end
164+
164165
req = table.concat(reqs, ", ")
165166
else
166167
req = L(tostring(cl.requirements))
167168
end
169+
168170
add(L("requirements") .. ": " .. req)
169171
end
170172
end
@@ -195,4 +197,4 @@ function PANEL:addJoinButton(parent, cl, canBe)
195197
end
196198
end
197199

198-
vgui.Register("liaClasses", PANEL, "EditablePanel")
200+
vgui.Register("liaClasses", PANEL, "EditablePanel")

gamemode/core/derma/f1menu/cl_menu.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function PANEL:Init()
99
self:SetPopupStayAtBack(true)
1010
self.noAnchor = CurTime() + 0.4
1111
self.anchorMode = true
12-
self.invKey = lia.keybind.get(L("Open Inventory"), KEY_I)
12+
self.invKey = lia.keybind.get(L("openInventory"), KEY_I)
1313
local baseBtnW, btnH, spacing = 150, 40, 20
1414
self.baseBtnW = baseBtnW
1515
local topBar = self:Add("DPanel")
@@ -71,6 +71,7 @@ function PANEL:Init()
7171
for _, btn in ipairs(btns) do
7272
totalW = totalW + (btn.calcW or baseBtnW) + spacing
7373
end
74+
7475
local overflow = totalW - w
7576
if overflow > 0 then
7677
leftArrow:SetVisible(true)
@@ -120,6 +121,7 @@ function PANEL:Init()
120121
local aName, bName = tostring(L(a)):lower(), tostring(L(b)):lower()
121122
return aName < bName
122123
end)
124+
123125
self.tabList = {}
124126
for _, key in ipairs(tabKeys) do
125127
local cb = btnDefs[key]

gamemode/core/derma/mainmenu/character.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ function PANEL:createStartButton()
230230
if clientChar then
231231
table.insert(buttonsData, {
232232
id = "return",
233-
text = L("return"),
233+
text = L("returnText"),
234234
doClick = function() self:Remove() end
235235
})
236236
end
@@ -295,7 +295,7 @@ end
295295

296296
function PANEL:createTabs()
297297
self.tabs:Clear()
298-
self:addTab(L("return"), function() self:backToMainMenu() end, true)
298+
self:addTab(L("returnText"), function() self:backToMainMenu() end, true)
299299
end
300300

301301
function PANEL:backToMainMenu()
@@ -733,4 +733,4 @@ function PANEL:Think()
733733
end
734734
end
735735

736-
vgui.Register("liaCharacter", PANEL, "EditablePanel")
736+
vgui.Register("liaCharacter", PANEL, "EditablePanel")

gamemode/core/derma/panels/attributes.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local PANEL = {}
1+
local PANEL = {}
22
function PANEL:Init()
33
self:SetTall(20)
44
self.add = self:Add("DImageButton")
@@ -252,4 +252,4 @@ function PANEL:Paint(w, h)
252252
surface.DrawRect(0, 0, w, h)
253253
end
254254

255-
vgui.Register("liaCharacterAttribsRow", PANEL, "DPanel")
255+
vgui.Register("liaCharacterAttribsRow", PANEL, "DPanel")

gamemode/core/derma/panels/chatbox.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ function PANEL:setActive(state)
122122
end
123123

124124
btn.DoClick = function()
125-
local syntax = cmdInfo.syntax or ""
125+
local syntax = L(cmdInfo.syntax or "")
126126
self.text:SetText("/" .. cmdName .. " " .. syntax)
127127
self.text:RequestFocus()
128128
self.commandList:Remove()

gamemode/core/derma/panels/extended_spawnmenu.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,7 @@ end, {
109109
action = function(p) SetClipboardText(p) end
110110
},
111111
{
112-
text = function(p)
113-
return isMaterialUsable(p) and L("useWithMaterialTool") or L("tryWithMaterialTool")
114-
end,
112+
text = function(p) return isMaterialUsable(p) and L("useWithMaterialTool") or L("tryWithMaterialTool") end,
115113
icon = "icon16/pencil.png",
116114
action = function(p)
117115
RunConsoleCommand("material_override", p)

gamemode/core/derma/panels/item.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function PANEL:setItemType(itemTypeOrID)
117117
self.itemType = itemTypeOrID
118118
end
119119

120-
assert(item, L("invalidItemTypeOrID", tostring(item)))
120+
assert(item, L("invalidItemTypeOrID", item and item.name or itemTypeOrID))
121121
self.liaToolTip = true
122122
self.itemTable = item
123123
self:SetModel(item:getModel(), item:getSkin())

0 commit comments

Comments
 (0)