Adds event data to BaseAI (so that AIs can handle being attacked, defeated, etc) based on patch from quantumstate. Fixes 972.

This was SVN commit r10306.
This commit is contained in:
historic_bruno 2011-09-23 22:02:04 +00:00
parent 7828544946
commit c3bb3ec57e

View File

@ -78,12 +78,13 @@ BaseAI.prototype.HandleMessage = function(state)
Engine.ProfileStart("HandleMessage setup"); Engine.ProfileStart("HandleMessage setup");
this.entities = new EntityCollection(this, this._rawEntities); this.entities = new EntityCollection(this, this._rawEntities);
this.events = state.events;
this.map = state.map;
this.passabilityClasses = state.passabilityClasses;
this.player = this._player; this.player = this._player;
this.playerData = state.players[this._player]; this.playerData = state.players[this._player];
this.templates = this._templates; this.templates = this._templates;
this.timeElapsed = state.timeElapsed; this.timeElapsed = state.timeElapsed;
this.map = state.map;
this.passabilityClasses = state.passabilityClasses;
Engine.ProfileStop(); Engine.ProfileStop();
@ -91,12 +92,13 @@ BaseAI.prototype.HandleMessage = function(state)
// Clean up temporary properties, so they don't disturb the serializer // Clean up temporary properties, so they don't disturb the serializer
delete this.entities; delete this.entities;
delete this.events;
delete this.map;
delete this.passabilityClasses;
delete this.player; delete this.player;
delete this.playerData; delete this.playerData;
delete this.templates; delete this.templates;
delete this.timeElapsed; delete this.timeElapsed;
delete this.map;
delete this.passabilityClasses;
}; };
BaseAI.prototype.ApplyEntitiesDelta = function(state) BaseAI.prototype.ApplyEntitiesDelta = function(state)
@ -150,7 +152,7 @@ BaseAI.prototype.ApplyEntitiesDelta = function(state)
}; };
BaseAI.prototype.OnUpdate = function() BaseAI.prototype.OnUpdate = function()
{ { // AIs override this function
}; };
BaseAI.prototype.chat = function(message) BaseAI.prototype.chat = function(message)