transfer the entities angles to the AIs

This was SVN commit r18231.
This commit is contained in:
mimo 2016-05-25 19:03:41 +00:00
parent 07007f1963
commit 9c67cd6743
2 changed files with 10 additions and 1 deletions

View File

@ -614,6 +614,7 @@ m.Entity = m.Class({
},
position: function() { return this._entity.position; },
angle: function() { return this._entity.angle; },
isIdle: function() {
if (typeof this._entity.idle === "undefined")

View File

@ -88,9 +88,15 @@ AIProxy.prototype.OnPositionChanged = function(msg)
return;
if (msg.inWorld)
{
this.changes.position = [msg.x, msg.z];
this.changes.angle = msg.a;
}
else
{
this.changes.position = undefined;
this.changes.angle = undefined;
}
};
AIProxy.prototype.OnHealthChanged = function(msg)
@ -215,12 +221,14 @@ AIProxy.prototype.GetFullRepresentation = function()
if (cmpPosition.IsInWorld())
{
var pos = cmpPosition.GetPosition2D();
let pos = cmpPosition.GetPosition2D();
ret.position = [pos.x, pos.y];
ret.angle = cmpPosition.GetRotation().y;
}
else
{
ret.position = undefined;
ret.angle = undefined;
}
}