2010-08-05 12:20:47 +02:00
|
|
|
function RallyPoint() {}
|
|
|
|
|
|
|
|
RallyPoint.prototype.Schema =
|
|
|
|
"<a:component/><empty/>";
|
|
|
|
|
|
|
|
RallyPoint.prototype.Init = function()
|
|
|
|
{
|
2012-05-24 20:25:31 +02:00
|
|
|
this.pos = [];
|
|
|
|
this.data = [];
|
2010-08-05 12:20:47 +02:00
|
|
|
};
|
|
|
|
|
2012-05-24 20:25:31 +02:00
|
|
|
RallyPoint.prototype.AddPosition = function(x, z)
|
2010-08-05 12:20:47 +02:00
|
|
|
{
|
2012-05-24 20:25:31 +02:00
|
|
|
this.pos.push({
|
2010-08-05 12:20:47 +02:00
|
|
|
"x": x,
|
|
|
|
"z": z
|
2012-05-24 20:25:31 +02:00
|
|
|
});
|
2010-08-05 12:20:47 +02:00
|
|
|
};
|
|
|
|
|
2012-05-24 20:25:31 +02:00
|
|
|
RallyPoint.prototype.GetPositions = function()
|
2010-08-05 12:20:47 +02:00
|
|
|
{
|
2011-12-16 17:08:26 +01:00
|
|
|
return this.pos;
|
2010-08-05 12:20:47 +02:00
|
|
|
};
|
|
|
|
|
2011-12-16 17:08:26 +01:00
|
|
|
// Extra data for the rally point, should have a command property and then helpful data for that command
|
|
|
|
// See getActionInfo in gui/input.js
|
2012-05-24 20:25:31 +02:00
|
|
|
RallyPoint.prototype.AddData = function(data)
|
2010-08-05 12:20:47 +02:00
|
|
|
{
|
2012-05-24 20:25:31 +02:00
|
|
|
this.data.push(data);
|
2010-08-05 12:20:47 +02:00
|
|
|
};
|
|
|
|
|
2012-05-24 20:25:31 +02:00
|
|
|
// Returns an array with the data associated with this rally point. Each element has the structure:
|
2011-12-16 17:08:26 +01:00
|
|
|
// {"type": "walk/gather/garrison/...", "target": targetEntityId, "resourceType": "tree/fruit/ore/..."} where target
|
2012-03-02 00:16:01 +01:00
|
|
|
// and resourceType (specific resource type) are optional, also target may be an invalid entity, check for existence.
|
2011-12-16 17:08:26 +01:00
|
|
|
RallyPoint.prototype.GetData = function()
|
|
|
|
{
|
|
|
|
return this.data;
|
|
|
|
};
|
|
|
|
|
|
|
|
RallyPoint.prototype.Unset = function()
|
|
|
|
{
|
2012-05-24 20:25:31 +02:00
|
|
|
this.pos = [];
|
|
|
|
this.data = [];
|
2011-12-16 17:08:26 +01:00
|
|
|
};
|
|
|
|
|
2013-09-24 22:27:18 +02:00
|
|
|
RallyPoint.prototype.Reset = function()
|
|
|
|
{
|
|
|
|
this.Unset();
|
|
|
|
var cmpRallyPointRenderer = Engine.QueryInterface(this.entity, IID_RallyPointRenderer);
|
|
|
|
if (cmpRallyPointRenderer)
|
|
|
|
cmpRallyPointRenderer.Reset();
|
|
|
|
};
|
|
|
|
|
2010-08-05 12:20:47 +02:00
|
|
|
Engine.RegisterComponentType(IID_RallyPoint, "RallyPoint", RallyPoint);
|