Weapon#
Weapon represents an in-flight munition: a shell, rocket, missile, or bomb. It
extends CoalitionObject (and, transitively,
Object). Weapon objects are typically obtained through
event handlers (e.g. the initiator/weapon fields on shot/hit events), rather
than a static lookup function.
- class Weapon#
Inherits all member functions of
CoalitionObjectandObject.- getLauncher()#
Returns the
Unitthat launched/fired this weapon.- Returns:
The launching unit.
- Return type:
- getTarget()#
Returns the object this weapon is currently guiding toward, if applicable.
- Returns:
The weapon’s target, or
nil.- Return type:
- getCategoryEx()#
Returns the weapon’s more specific category (see Weapon.Category). Equivalent to
weapon:getDesc().category.- Returns:
Weapon category.
- Return type:
number
Enumerators#
Weapon.Category identifies the specific weapon category (via
weapon:getDesc().category – not weapon:getCategory(), which always
returns Object.Category.WEAPON):
Value |
Meaning |
|---|---|
|
Gun shell ( |
|
Missile ( |
|
Unguided rocket ( |
|
Bomb ( |
Weapon.GuidanceType identifies a missile/bomb’s guidance method:
Value |
Meaning |
|---|---|
|
Inertial navigation ( |
|
Infra-red ( |
|
Active radar ( |
|
Semi-active radar ( |
|
Passive radar ( |
|
TV ( |
|
Laser ( |
|
Television/data-link ( |
Weapon.MissileCategory further classifies guided missiles:
Value |
Meaning |
|---|---|
|
Air-to-air missile ( |
|
Surface-to-air missile ( |
|
Ballistic missile ( |
|
Anti-ship missile ( |
|
Cruise missile ( |
|
Other ( |
Weapon.WarheadType identifies the warhead type:
Value |
Meaning |
|---|---|
|
Armor-piercing ( |
|
High-explosive ( |
|
Shaped-charge explosive ( |
Footnotes#
Weaponobjects are commonly obtained via theweaponfield ofS_EVENT_SHOT/S_EVENT_HITevents registered throughworld.addEventHandler().