0ad/binaries/data/mods/public/gui/session/placement.js
vts 490182ddd0 Wall placement. Closes #786.
This was SVN commit r11760.
2012-05-05 19:22:22 +00:00

31 lines
1.1 KiB
JavaScript

function PlacementSupport()
{
this.Reset();
}
PlacementSupport.DEFAULT_ANGLE = Math.PI*3/4;
/**
* Resets the building placement support state. Use this to cancel construction of an entity.
*/
PlacementSupport.prototype.Reset = function()
{
this.mode = null;
this.position = null;
this.template = null;
this.wallSet = null; // maps types of wall pieces ("tower", "long", "short", ...) to template names
this.wallSnapEntities = null; // list of candidate entities to snap the starting and (!) ending positions to when building walls
this.wallEndPosition = null;
this.wallSnapEntitiesIncludeOffscreen = false; // should the next update of the snap candidate list include offscreen towers?
this.wallDragTooltip = null; // tooltip text while the user is draggin the wall. Used to indicate the current cost to build the wall.
this.SetDefaultAngle();
Engine.GuiInterfaceCall("SetBuildingPlacementPreview", {"template": ""});
Engine.GuiInterfaceCall("SetWallPlacementPreview", {"wallSet": null});
};
PlacementSupport.prototype.SetDefaultAngle = function()
{
this.angle = PlacementSupport.DEFAULT_ANGLE;
};