Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:GetSiegeWeaponControlData

From RoR Wiki

UI Lua API · RvR functions
Version: WAR 1.4.8

Returns the definition of the siege weapon the client currently has as its active siege weapon.

controlData = GetSiegeWeaponControlData()

Arguments

None.

Returns

controlData
table – A table with one field, weaponDef (table), the weapon definition described below.

Siege weapon table

The same table format is used for each entry of GetSiegePadBuildData.

Key Type Meaning
id number Siege weapon id. BuildSiegeWeapon takes this value.
name wstring Weapon name.
level number Weapon level.
hitPoints number Hit points.
maxBuilders number Maximum number of players building it. The stock UI uses it as the user limit while the weapon is being built.
maxUsers number Maximum number of players using it.
buildTime number Filled from the same stored value as maxUsers, see Details.
repairTime number Filled from the same stored value as maxUsers, see Details.
decayTime number –
decayPerFire number –
fireMode number –
fireAbility table The weapon's fire ability, in the format of GetAbilityData. Only present when there is a player object.
requiredItems table Array of item tables, indexed from 1, in the format of GetInventoryItemData. Empty if no items are needed.

Details

  • Client bug: maxUsers, buildTime and repairTime are all filled from the same stored byte, so buildTime and repairTime always equal maxUsers. Do not rely on them.
  • The function always returns a table; it does not check whether the player is using a siege weapon. The stock UI treats weaponDef.name == L"" as "no weapon" and hides its window.
  • A new table is built on every call.

Errors

None.

Example

From default/ea_siegeweaponwindow/source/siegeweaponcontrolwindow.lua:

SiegeWeaponControlWindow.controlData = GetSiegeWeaponControlData()

local weaponName = SiegeWeaponControlWindow.controlData.weaponDef.name
...
local showWindow = SiegeWeaponControlWindow.controlData.weaponDef.name ~= L""

Picking the user limit, from the same file:

maxUsers = SiegeWeaponControlWindow.controlData.weaponDef.maxBuilders
...
maxUsers = SiegeWeaponControlWindow.controlData.weaponDef.maxUsers

See also