Collectable ammo
A Collectable ammo is an ammo pickup — typically spawned when an enemy ship is destroyed and had unfired missiles, drones, or mines on board. Player collects by flying over; the ammo macros are added to player.ship.ammostorage.{macro}.
Inheritance: component → destructible → object → drop → collectable → collectableammo.
Properties
Section titled “Properties”Collectable-ammo-specific
Section titled “Collectable-ammo-specific”| Property | Type | Description |
|---|---|---|
.ammo.count | int | How many of this ammo are contained |
.ammo.macro | macro | Which ammo macro it is (macro.weapon_gen_mine_03_macro, macro.missile_arg_torpedo_01_macro, etc.) |
Useful inherited
Section titled “Useful inherited”| Property | Source | Description |
|---|---|---|
.sector / .position | object | Location |
.macro | component | The collectable’s own macro |
Common patterns
Section titled “Common patterns””Filter player events for ammo pickups”
Section titled “”Filter player events for ammo pickups””Vanilla tutorial_flight.xml:905:
<do_if value="event.param.{$i}.isclass.collectableammo and event.param.{$i}.ammo.macro.isclass.missile"> <!-- a missile pickup --></do_if>Used to detect “the player just picked up a missile” in tutorial flows.
”Spawn ammo loot from a defeated ship”
Section titled “”Spawn ammo loot from a defeated ship””There’s no clean <create_collectableammo> action — engine spawns these automatically on ship destruction based on the destroyed ship’s ammostorage. To manually scatter ammo, use <create_object> with the appropriate collectable_ammo_* macro.
Events
Section titled “Events”| Event | When | Notes |
|---|---|---|
event_object_destroyed | Picked up by player | Standard destruction-as-collection |
Common gotchas
Section titled “Common gotchas”- ⚠
.ammo.macrois the contained ammo macro, NOT the collectable’s macro.$collectable.macro= the floating-box macro;$collectable.ammo.macro= the missile / drone / mine inside. - ⚠ Picked-up ammo goes to ammostorage, not inventory. The collected ammo lands in
player.ship.ammostorage.{macro}, same place as deployables. - ⚠ NPC pickups are silent. NPCs don’t fire pickup events the way player does. Don’t expect symmetric handling.
- ⚠
.ammo.macro.isclass.Xchains work.$col.ammo.macro.isclass.missileand.isclass.mineand.isclass.satelliteall valid for branching.
Related
Section titled “Related”- Collectable — parent.
- Ship —
ammostorage.{macro}is the destination. - Missile — common ammo content.
- Mine — common ammo content.
- Satellite / Resource probe — deployable ammo content.
- Ware —
.ammo.macro.warebridges to the inventory item.