Files
src/miniquake2/game/player/commands.ml
Provides miniquake2 game player commands facilities for this project.
- Package
miniquake2.game.player.commands- Reachable
- Yes
Imports
Declarations
# cycleWeapon
function cycleWeapon(player, registry, step)
g_cmds.c intentionally traverses the item table in opposite directions for WeapPrev and WeapNext. Keep that externally visible order, while stopping at the first owned weapon whose ammo policy accepts the selection.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
registry | dynamic | — | registry value consumed by this operation. |
step | dynamic | — | step value consumed by this operation. |
View source
# dropDefinition
function dropDefinition(player, context, item, worldEntityNumber)
Cmd_Drop_f/Cmd_InvDrop_f share this dispatch after their command-specific diagnostics. Grenades are both IT_AMMO and IT_WEAPON, so ammo must win the arity decision exactly as its gitem_t drop pointer does in stock BaseQ2.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
context | dynamic | — | Context that carries state for the operation. |
item | dynamic | — | item value consumed by this operation. |
worldEntityNumber | dynamic | — | worldEntityNumber value consumed by this operation. |
View source
# dropItem
function dropItem(player, context, pickupName, worldEntityNumber)
Drop item.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
context | dynamic | — | Context that carries state for the operation. |
pickupName | dynamic | — | pickupName value consumed by this operation. |
worldEntityNumber | dynamic | — | worldEntityNumber value consumed by this operation. |
View source
# dropSelectedItem
function dropSelectedItem(player, context, worldEntityNumber)
Drop selected item.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
context | dynamic | — | Context that carries state for the operation. |
worldEntityNumber | dynamic | — | worldEntityNumber value consumed by this operation. |
View source
# killPlayer
function killPlayer(player, context)
Kill player.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
context | dynamic | — | Context that carries state for the operation. |
View source
# ownedWeapon
function ownedWeapon(player, item)
Return the owned weapon value.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
item | dynamic | — | item value consumed by this operation. |
View source
# putAway
function putAway(player)
Write away.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
View source
# selectItem
function selectItem(player, registry, step, itemFlags)
g_cmds.c SelectNextItem/SelectPrevItem/ValidateSelectedItem. The managed inventory and persistent selected-item fields are kept together because the HUD consumes the former while save/respawn state retains the latter.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
registry | dynamic | — | registry value consumed by this operation. |
step | dynamic | — | step value consumed by this operation. |
itemFlags | dynamic | — | itemFlags value consumed by this operation. |
View source
# selectNextItem
function selectNextItem(player, registry, itemFlags)
Select next item.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
registry | dynamic | — | registry value consumed by this operation. |
itemFlags | dynamic | — | itemFlags value consumed by this operation. |
View source
# selectPreviousItem
function selectPreviousItem(player, registry, itemFlags)
Select previous item.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
registry | dynamic | — | registry value consumed by this operation. |
itemFlags | dynamic | — | itemFlags value consumed by this operation. |
View source
# toggleHelp
function toggleHelp(player, context)
Toggle help.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
context | dynamic | — | Context that carries state for the operation. |
View source
# toggleInventory
function toggleInventory(player)
Toggle inventory.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
View source
# toggleScore
function toggleScore(player, context)
Toggle score.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
context | dynamic | — | Context that carries state for the operation. |
View source
# useItem
function useItem(player, context, pickupName)
Cmd_Use_f is not weapon-only. Power armor and carried powerups use the existing g_items.c adapters and synchronize their public PlayerData fields.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
context | dynamic | — | Context that carries state for the operation. |
pickupName | dynamic | — | pickupName value consumed by this operation. |
View source
# useSelectedItem
function useSelectedItem(player, context)
Use selected item.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
context | dynamic | — | Context that carries state for the operation. |
View source
# useWeapon
function useWeapon(player, registry, pickupName)
Use weapon.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
registry | dynamic | — | registry value consumed by this operation. |
pickupName | dynamic | — | pickupName value consumed by this operation. |
View source
# validateSelectedItem
function validateSelectedItem(player, registry)
Validate selected item.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
registry | dynamic | — | registry value consumed by this operation. |
View source
# wave
function wave(player, choice)
Return the wave value.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
choice | dynamic | — | choice value consumed by this operation. |
View source
# weaponLast
function weaponLast(player, registry)
Return the weapon last value.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
registry | dynamic | — | registry value consumed by this operation. |
View source
# weaponNext
function weaponNext(player, registry)
Return the weapon next value.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
registry | dynamic | — | registry value consumed by this operation. |
View source
# weaponPrevious
function weaponPrevious(player, registry)
Return the weapon previous value.
| Parameter | Type | Default | Description |
|---|
player | dynamic | — | player value consumed by this operation. |
registry | dynamic | — | registry value consumed by this operation. |
View source