Skip to content

Collectable wares

A Collectable wares is a floating ware pickup — dropped cargo containers from destroyed transports, asteroid shards from mining, or scattered loot from raids. The most common collectable subtype.

Inheritance: component → destructible → object → drop → collectable → collectablewares.

PropertyTypeDescription
.moneymoneyContained money (drops can carry credits too)
.unbundleboolCrate is flagged for converting its wares into ammo/units on pickup
.isdroppedcontainerboolTrue if this is a dropped container (not an asteroid shard or other natural collectable)
PropertySourceDescription
.cargocontainer (indirect)Wares inside — see container chain
.sector / .positionobjectLocation
.macrocomponentMacro variant

”Distinguish dropped containers from asteroid shards”

Section titled “”Distinguish dropped containers from asteroid shards””

Pattern from vanilla notifications.xml:335, 402:

<do_if value="event.param3.isclass.collectablewares
and event.param3.isdroppedcontainer">
<!-- dropped container — credit to source faction -->
</do_if>

Vanilla uses this to attribute ware drops to the destroyed ship’s owner; asteroid shards are ownerless.

”Find asteroid shards (mining output) in a sector”

Section titled “”Find asteroid shards (mining output) in a sector””

Pattern from vanilla scenario_advanced.xml:1565-1570:

<find_object
groupname="$asteroidshards"
class="[class.collectablewares]"
space="$ResourceSector"
multiple="true"
append="true"/>
<do_for_each name="$shard" in="$asteroidshards">
<do_if value="not $shard.isdroppedcontainer">
<!-- this is an asteroid shard, not a dropped container -->
</do_if>
</do_for_each>
<do_if value="$ItemHolder.isclass.[class.lockbox,
class.collectablewares, class.crate]">
<!-- any ware-bearing loot the player can pick up -->
</do_if>

Pattern from gm_bringitems.xml:391, 1811, 1827. Use this when your mod accepts loot from any kind of holder.

EventWhenNotes
event_object_destroyedPicked upStandard
  • .isdroppedcontainer vs not .isdroppedcontainer. The first identifies player-attributed loot (someone’s container was destroyed). The second identifies natural / unattributed (asteroid mining output). Mods that handle ownership / faction reputation need this distinction.
  • .unbundle=true triggers ware → ammo/unit conversion on pickup. Most ware-pickups stay as wares; this special flag converts contents to ammo or units automatically. Read before assuming “wares in = wares out”.
  • .money exists on this datatype. A ware collectable can carry credits directly, not just wares. Sum both for total value.
  • class.collectablewares is the loot-filter pivot. Vanilla’s “find any pickup-able ware-bearing object” idiom always includes this class.
  • Asteroid shards don’t have owners. .owner returns faction.ownerless for mining shards. Don’t expect attribution.
  • Collectable — parent.
  • Lockbox — sibling loot container (different mechanic — shootable locks).
  • Crate — sibling interior container (dock-slot based).
  • Asteroid — what mining-derived shards come from.
  • Ware — what’s inside.
  • Ship — what dropped them (for .isdroppedcontainer=true).