Skip to content
Liam S edited this page Jul 19, 2015 · 9 revisions

The API is broken down into a few major components, each with there own unique properties:

  • BuildingHelper functions
  • Building Objects
  • Builder Objects
  • Callback Functions

Each function has its own API with more details and sample code/usage.

BuildingHelper Functions

Use these functions to create buildings. Global accessor variable: BuildingHelper

Method Description
AddBuilding( keys ) Must be cast from a unit. This will run through a standard building process.
PlaceBuilding(player, name, location, snapToGrid, blockGridNav, size) This will place a building at a location, skipping the steps in AddBuilding where the player selects the location.

Building Objects

These can be called on any building created with BuildingHelper

Method Description
RemoveBuilding(bForcedKill) Removes a building and clears the gridnav blockers.
Properties Description
state either "building" while under construction or "complete" when done

Builder Objects

These are added to any unit that makes a building automatically. There are other functions in addition to these but they are used internally only.

Method Description
ClearQueue() Clears a builders work queue, including particles

Library Functions

These are all fairly self documenting. See the build function in abilities.lua for an idea as to how to use them.

Method Description
OnConstructionStarted( callback ) Callback function is called when construction starts
OnConstructionCompleted( callback ) Callback function is called when construction completes
OnConstructionFailed( callback ) Callback function is called if there is a mechanical issue with the building (cant be placed)
OnConstructionCancelled( callback ) Called when player right clicks to cancel a queue
EnableFireEffect( sFireEffect ) Particle effect added to buildings when they fall below 50% HP, ignore this to have no effect
OnBelowHalfHealth( callback ) Called once when a building drops below 50% HP
OnAboveHalfHealth( callback ) Called once on a building being healed above 50% HP
OnBuildingPosChosen( callback ) Called every time you either queue up, or place a ghost for a building to be built.