mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
9b9410c923
This patch corrects occurrences of “building” into “structure”. Whilst “constructing a building” is proper English, it is important to refer to one and the same thing with a single term, to avoid potential misunderstandings (see https://trac.wildfiregames.com/wiki/EnglishStyleGuide ), thence “building a structure”, because the unit action is “build” and the entity is a “structure” (see `simulation/templates/`). Patch By: Nescio Reviewed By: Gallaecio Differential Revision: https://code.wildfiregames.com/D2429 This was SVN commit r23366.
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
function PlacementSupport()
|
|
{
|
|
this.Reset();
|
|
}
|
|
|
|
PlacementSupport.DEFAULT_ANGLE = Math.PI * 3 / 4;
|
|
|
|
/**
|
|
* Reset the structure 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.tooltipMessage = ""; // tooltip text to show while the user is placing a structure
|
|
this.tooltipError = false;
|
|
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.SetDefaultAngle();
|
|
this.RandomizeActorSeed();
|
|
|
|
this.attack = null;
|
|
|
|
Engine.GuiInterfaceCall("SetBuildingPlacementPreview", { "template": "" });
|
|
Engine.GuiInterfaceCall("SetWallPlacementPreview", { "wallSet": null });
|
|
};
|
|
|
|
PlacementSupport.prototype.SetDefaultAngle = function()
|
|
{
|
|
this.angle = PlacementSupport.DEFAULT_ANGLE;
|
|
};
|
|
|
|
PlacementSupport.prototype.RandomizeActorSeed = function()
|
|
{
|
|
this.actorSeed = randIntExclusive(0, Math.pow(2, 16));
|
|
};
|
|
|
|
var placementSupport = new PlacementSupport();
|