Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | function TestFormationExiting(mode) | ||||
AddMock(SYSTEM_ENTITY, IID_PlayerManager, { | AddMock(SYSTEM_ENTITY, IID_PlayerManager, { | ||||
GetPlayerByID: function(id) { return playerEntity; }, | GetPlayerByID: function(id) { return playerEntity; }, | ||||
GetNumPlayers: function() { return 2; }, | GetNumPlayers: function() { return 2; }, | ||||
}); | }); | ||||
AddMock(playerEntity, IID_Player, { | AddMock(playerEntity, IID_Player, { | ||||
IsAlly: function() { return false; }, | IsAlly: function() { return false; }, | ||||
IsEnemy: function() { return true; }, | IsEnemy: function() { return true; }, | ||||
GetEnemies: function() { return []; }, | GetEnemies: function() { return [2]; }, | ||||
}); | }); | ||||
AddMock(SYSTEM_ENTITY, IID_ObstructionManager, { | AddMock(SYSTEM_ENTITY, IID_ObstructionManager, { | ||||
"IsInTargetRange": (ent, target, min, max, opposite) => true | "IsInTargetRange": (ent, target, min, max, opposite) => true | ||||
}); | }); | ||||
var unitAI = ConstructComponent(unit, "UnitAI", { "FormationController": "false", "DefaultStance": "aggressive" }); | var unitAI = ConstructComponent(unit, "UnitAI", { "FormationController": "false", "DefaultStance": "aggressive" }); | ||||
▲ Show 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | function TestMoveIntoFormationWhileAttacking() | ||||
AddMock(SYSTEM_ENTITY, IID_ObstructionManager, { | AddMock(SYSTEM_ENTITY, IID_ObstructionManager, { | ||||
"IsInTargetRange": (ent, target, min, max) => true | "IsInTargetRange": (ent, target, min, max) => true | ||||
}); | }); | ||||
AddMock(playerEntity, IID_Player, { | AddMock(playerEntity, IID_Player, { | ||||
IsAlly: function() { return false; }, | IsAlly: function() { return false; }, | ||||
IsEnemy: function() { return true; }, | IsEnemy: function() { return true; }, | ||||
GetEnemies: function() { return []; }, | GetEnemies: function() { return [2]; }, | ||||
}); | }); | ||||
// create units | // create units | ||||
for (var i = 0; i < unitCount; i++) { | for (var i = 0; i < unitCount; i++) { | ||||
units.push(unit + i); | units.push(unit + i); | ||||
var unitAI = ConstructComponent(unit + i, "UnitAI", { "FormationController": "false", "DefaultStance": "aggressive" }); | var unitAI = ConstructComponent(unit + i, "UnitAI", { "FormationController": "false", "DefaultStance": "aggressive" }); | ||||
▲ Show 20 Lines • Show All 103 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator