MiniQuake2

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.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.
registrydynamic—registry value consumed by this operation.
stepdynamic—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.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.
contextdynamic—Context that carries state for the operation.
itemdynamic—item value consumed by this operation.
worldEntityNumberdynamic—worldEntityNumber value consumed by this operation.

View source

dropItem

function dropItem(player, context, pickupName, worldEntityNumber)

Drop item.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.
contextdynamic—Context that carries state for the operation.
pickupNamedynamic—pickupName value consumed by this operation.
worldEntityNumberdynamic—worldEntityNumber value consumed by this operation.

View source

dropSelectedItem

function dropSelectedItem(player, context, worldEntityNumber)

Drop selected item.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.
contextdynamic—Context that carries state for the operation.
worldEntityNumberdynamic—worldEntityNumber value consumed by this operation.

View source

killPlayer

function killPlayer(player, context)

Kill player.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.
contextdynamic—Context that carries state for the operation.

View source

ownedWeapon

function ownedWeapon(player, item)

Return the owned weapon value.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.
itemdynamic—item value consumed by this operation.

View source

putAway

function putAway(player)

Write away.

ParameterTypeDefaultDescription
playerdynamic—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.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.
registrydynamic—registry value consumed by this operation.
stepdynamic—step value consumed by this operation.
itemFlagsdynamic—itemFlags value consumed by this operation.

View source

selectNextItem

function selectNextItem(player, registry, itemFlags)

Select next item.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.
registrydynamic—registry value consumed by this operation.
itemFlagsdynamic—itemFlags value consumed by this operation.

View source

selectPreviousItem

function selectPreviousItem(player, registry, itemFlags)

Select previous item.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.
registrydynamic—registry value consumed by this operation.
itemFlagsdynamic—itemFlags value consumed by this operation.

View source

toggleHelp

function toggleHelp(player, context)

Toggle help.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.
contextdynamic—Context that carries state for the operation.

View source

toggleInventory

function toggleInventory(player)

Toggle inventory.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.

View source

toggleScore

function toggleScore(player, context)

Toggle score.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.
contextdynamic—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.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.
contextdynamic—Context that carries state for the operation.
pickupNamedynamic—pickupName value consumed by this operation.

View source

useSelectedItem

function useSelectedItem(player, context)

Use selected item.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.
contextdynamic—Context that carries state for the operation.

View source

useWeapon

function useWeapon(player, registry, pickupName)

Use weapon.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.
registrydynamic—registry value consumed by this operation.
pickupNamedynamic—pickupName value consumed by this operation.

View source

validateSelectedItem

function validateSelectedItem(player, registry)

Validate selected item.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.
registrydynamic—registry value consumed by this operation.

View source

wave

function wave(player, choice)

Return the wave value.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.
choicedynamic—choice value consumed by this operation.

View source

weaponLast

function weaponLast(player, registry)

Return the weapon last value.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.
registrydynamic—registry value consumed by this operation.

View source

weaponNext

function weaponNext(player, registry)

Return the weapon next value.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.
registrydynamic—registry value consumed by this operation.

View source

weaponPrevious

function weaponPrevious(player, registry)

Return the weapon previous value.

ParameterTypeDefaultDescription
playerdynamic—player value consumed by this operation.
registrydynamic—registry value consumed by this operation.

View source