Module WeaponUnit
Displays information about the weapon's state.
Element class: Weapon Extends: Element Weapons have a Descriptions of fields with a (?) are uncertain and need more testing.
This method is deprecated: getOperationalState should be used instead
Possible status:
Note: This is documentation on an event handler, not a callable method.
Note: This is documentation on an event handler, not a callable method.
Note: This is documentation on an event handler, not a callable method.
Note: This is documentation on an event handler, not a callable method.
Note: This is documentation on an event handler, not a callable method.
Note: This is documentation on an event handler, not a callable method.
Functions
getWidgetData ()
Get element data as JSON.
getAmmo ()
Returns the item ID of the currently equipped ammo.
getAmmoCount ()
Returns the current amount of remaining ammunition.
getMaxAmmo ()
Returns the maximum amount of ammunition the weapon can carry.
isOutOfAmmo ()
Checks if the weapon is out of ammo.
isOperational ()
Deprecated: Returns 1 if the wapon is not broken and compatible with the construct size.
getOperationalState ()
Returns 1 if the wapon is not broken and compatible with the construct size.
getStatus ()
Returns the current weapon status.
getContainerId ()
Returns the local ID of the container linked to the weapon.
getHitProbability ()
Returns the current hit probability of the weapon for the current target.
getBaseDamage ()
Returns the base weapon damage.
getOptimalAimingCone ()
Returns the optimal aim cone.
getOptimalDistance ()
Returns the optimal distance to target.
getMaxDistance ()
Returns the maximum distance to target.
getOptimalTracking ()
Returns the optimal tracking rate.
getMagazineVolume ()
Returns the magazine volume.
getCycleTime ()
Returns the weapon cycle time.
getReloadTime ()
Returns the weapon reload time.
getUnloadTime ()
Returns the weapon unload time.
getTargetId ()
Returns the ID of the current target construct of the weapon.
EVENT_onReload (ammoId)
Event: Emitted when the weapon starts reloading.
EVENT_onReloaded (ammoId)
Event: Emitted when the weapon has reloaded.
EVENT_onMissed (targetId)
Event: Emitted when the weapon has missed its target.
EVENT_onDestroyed (targetId)
Event: Emitted when the weapon target has been destroyed.
EVENT_onElementDestroyed (targetId, itemId)
Event: Emitted when an element on the weapon target has been destroyed.
EVENT_onHit (targetId, damage)
Event: Emitted when the weapon has hit.
Functions
weapon
widget, which contains the following fields (bold fields are visible when making
custom use of the widget):
weapon
weapon
Returns:
string
Data as JSON.
Returns:
int
The item ID of the ammunition in the weapon.
Returns:
int
The remaining ammunition count (0 when reloading).
Returns:
int
The maximum amount of ammunition.
Returns:
0/1
1 if the weapon is out of ammo.
Returns:
0/1
1 if the weapon is operational, otherwise 0.
See also:
Returns:
int
1 if the weapon is operational, otherwise 0 = broken, -1 = incompatible size.
Returns:
int
The current status of the weapon.
Returns:
int
The local ID of the container.
Returns:
float
The hit probability of the weapon.
Returns:
float
The base weapon damage in hitpoints.
Returns:
float
The optimal aim cone in degrees.
Returns:
float
The optimal distance in meters.
Returns:
float
The optimal distance in meters.
Returns:
float
The optimal tracking rate in degrees per second.
Returns:
float
The magazine volume in liters.
Returns:
float
The weapon cycle time in seconds.
Returns:
float
The weapon reload time in seconds.
Returns:
float
The weapon unload time in seconds.
Returns:
int
The target construct ID.
Parameters:
Parameters:
Parameters:
Parameters:
Parameters:
Parameters: