Feature object

(info) Other great resources: Official JS API docs, Scripting Forum

Feature object

Feature objects describe inanimate game objects such as oil barrels and resources, artefacts, log cabins and skyscrapers, trees, etc.

 

Properties

Inherits all the properties of a Game objects (id, x, y, z, player, selected, name, health, armour, thermal, etc.) then adds/overrides the properties listed below.

Property

Type

Description

Game version

Property

Type

Description

Game version

type

Constant

FEATURE

3.1 Beta 1

player

Number

Most features on the map are owned by player 99.

Oil resources, oil barrels and artefacts are owned by player 12.

3.1 Beta 1

damageable

Boolean

Can this feature be destroyed?

  • true – yes, you can destroy it

  • false – it's indestructible

group

Number

The group the feature is in, or null if no group.

3.2

stattype

Constant

<not defined>

A .stattype property is added for certain special features:

  • ARTIFACT – an artefact that can be picked up

  • OIL_DRUM – an oil barrel that can be picked up

  • OIL_RESOURCE – an oil resource that you can build a derrick on

All other features don't have the stattype property.

3.2

Notes

When an oil derrick is built on an oil resource, the oil resource feature is removed from the map. If the derrick is later destroyed, a new oil resource feature will be added to the map. Positions of oil resources can be found in the derrickPositions[] array.

When artefacts and oil drums are picked up, their associated feature object is removed from the map. It's not currently possible for non-human players to pick up such items.

Most features can be destroyed (see "damageable" property). The only features that cannot be destroyed (by attacking them) are: Boulders, oil resources, artefacts, oil barrels – the last 3 can be removed from the map by building a derrick (on an oil resource) or collecting them (in case of artefacts and barrels). Oil resources will automatically re-appear, and burn for a short while, if the derrick is destroyed.

When collectible features are picked up, eventDestroyed() is often called.