Ticket #2180: AIFix_.patch
File AIFix_.patch, 2.5 KB (added by , 10 years ago) |
---|
-
binaries/data/mods/public/simulation/ai/common-api-v3/shared.js
214 214 // applies entity deltas, and each gamestate. 215 215 SharedScript.prototype.onUpdate = function(state) 216 216 { 217 if (this.turn !== 0) 218 this.ApplyEntitiesDelta(state); 217 this.ApplyEntitiesDelta(state); 219 218 220 219 Engine.ProfileStart("onUpdate"); 221 220 … … 297 296 for (var i in this._players) 298 297 delete this._entityMetadata[this._players[i]][evt.msg.entity]; 299 298 } 299 else if (evt.type == "EntityRenamed") 300 { 301 //combines destroy and create. 302 303 if (!state.entities[evt.msg.newentity]) 304 continue; 305 306 this._entities[evt.msg.newentity] = new Entity(this, state.entities[evt.msg.newentity]); 307 this.entities.addEnt(this._entities[evt.msg.newentity]); 308 309 // Update all the entity collections since the create operation affects static properties as well as dynamic 310 for (var entCollection in this._entityCollections) 311 this._entityCollections[entCollection].updateEnt(this._entities[evt.msg.newentity]); 312 313 if (!this._entities[evt.msg.entity]) 314 continue; 315 316 // Dunno if this is relevant on renaming. 317 if (foundationFinished[evt.msg.entity]) 318 evt.msg["SuccessfulFoundation"] = true; 319 320 // Switch the metadata 321 for (var i in this._players) 322 this._entityMetadata[this._players[i]][evt.msg.entity] = this._entityMetadata[this._players[i]][evt.msg.entity]; 323 324 for each (var entCol in this._entityCollections) 325 entCol.removeEnt(this._entities[evt.msg.entity]); 326 this.entities.removeEnt(this._entities[evt.msg.entity]); 327 } 300 328 else if (evt.type == "TrainingFinished") 301 329 { 302 330 // Apply metadata stored in training queues -
binaries/data/mods/public/simulation/components/AIProxy.js
288 288 cmpAIInterface.PushEvent("TrainingFinished", msg); 289 289 }; 290 290 291 AIProxy.prototype.OnGlobalEntityRenamed = function(msg) 292 { 293 var cmpAIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_AIInterface); 294 cmpAIInterface.PushEvent("EntityRenamed", msg); 295 }; 296 291 297 AIProxy.prototype.OnAIMetadata = function(msg) 292 298 { 293 299 var cmpAIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_AIInterface);