Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

This constant is no longer available, but this article provides some guidance on dealing with structure demolition...

 

Why demolish buildings?

There are three main reasons for demolishing structures:

  1. To get a partial refund of their construction cost (if you are low on power)
  2. To replace them with a better building (particularly with defences)
  3. To make room for something else (particularly near your start position)

What happens when a building is demolished?

When a structure is being demolished, it's status will be set to BEING_BUILT – which is somewhat confusing!

It will remain operational until it's completely removed from the map. For example, sensors will still "see" stuff on the map until they are completely removed.

Of particular note is the LASSAT structure – it can still fire the laser even if it's part demolished. Ideally your script should check that it's status is BUILT before using it (see structureIdle() for details).

Once the building is demolished, you get some of it's construction cost refunded and can obviously build something new in its place.

What do I do now?

It turns out that this constant was never actually used by Warzone, so it was removed in 3.1 Beta 7 to avoid ongoing confusion and bugs.

This means there is no way to differentiate between a building that's being built and one that's being demolished. If your script sends additional trucks to help build structures with a .status of BEING_BUILT they could end up building a structure that other trucks are trying to demolish!

As such, for the time being, you need to keep a record of structures construction state, for example:

Code Block
themeRDark
languagejavascript
titleKeep a log of construction state
linenumberstrue
var beingBuilt = {};
 
// when you start demolishing a building:
// true  = being built
// false = being demolished
// maybe use null = fully built
beingBuilt[structure.id] = false;
 
// want trucks to help with construction?
// check the building isn't being demolished first!
if (structure.id in beingBuilt && beingBuilt[structure.id]) {
  // send trucks to help build it
} else {
  // send trucks to demolish it
}

Better still, keep a record of which trucks are doing the demolition – then on eventDroidIdle() for one of those trucks you can determine that the structure has been fully demolished and remove it from the list.

Note: Structure IDs are always unique within a game, so removing them from the list is optional (just saves some RAM).

Div
classbox
Availability
Status
colourRed
titleRemoved

This constant was removed in Warzone 3.1 Beta 7.

For more details, see:

Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5

Div
classbox

See also

Related articles:

  • BEING_BUILT – indicates structure is being built or demolished
  • BUILT – indicates structure is fully built