Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | AddMock(unit, IID_Position, { | ||||
GetTurretParent: function() { return INVALID_ENTITY; }, | GetTurretParent: function() { return INVALID_ENTITY; }, | ||||
GetPosition: function() { return new Vector3D(); }, | GetPosition: function() { return new Vector3D(); }, | ||||
GetPosition2D: function() { return new Vector2D(); }, | GetPosition2D: function() { return new Vector2D(); }, | ||||
GetRotation: function() { return { "y": 0 }; }, | GetRotation: function() { return { "y": 0 }; }, | ||||
IsInWorld: function() { return true; }, | IsInWorld: function() { return true; }, | ||||
}); | }); | ||||
AddMock(unit, IID_UnitMotion, { | AddMock(unit, IID_UnitMotion, { | ||||
GetWalkSpeed: function() { return 1; }, | GetWalkSpeed: function() { return 1; }, | ||||
bb: -`()` | |||||
MoveToFormationOffset: function(target, x, z) { }, | MoveToFormationOffset: function(target, x, z) { }, | ||||
IsInTargetRange: function(target, min, max) { return true; }, | IsInTargetRange: function(target, min, max) { return true; }, | ||||
MoveToTargetRange: function(target, min, max) { }, | MoveToTargetRange: function(target, min, max) { }, | ||||
StopMoving: function() { }, | StopMoving: function() { }, | ||||
GetPassabilityClassName: function() { return "default"; }, | GetPassabilityClassName: function() { return "default"; }, | ||||
}); | }); | ||||
AddMock(unit, IID_Vision, { | AddMock(unit, IID_Vision, { | ||||
Show All 37 Lines | AddMock(controller, IID_Position, { | ||||
GetTurretParent: function() { return INVALID_ENTITY; }, | GetTurretParent: function() { return INVALID_ENTITY; }, | ||||
GetPosition: function() { return new Vector3D(this.x, 0, this.z); }, | GetPosition: function() { return new Vector3D(this.x, 0, this.z); }, | ||||
GetPosition2D: function() { return new Vector2D(this.x, this.z); }, | GetPosition2D: function() { return new Vector2D(this.x, this.z); }, | ||||
GetRotation: function() { return { "y": 0 }; }, | GetRotation: function() { return { "y": 0 }; }, | ||||
IsInWorld: function() { return true; }, | IsInWorld: function() { return true; }, | ||||
}); | }); | ||||
AddMock(controller, IID_UnitMotion, { | AddMock(controller, IID_UnitMotion, { | ||||
SetSpeed: function(speed) { }, | GetWalkSpeed: function() { return 1; }, | ||||
SetSpeedRatio: function(speed) { }, | |||||
Not Done Inline Actions^ bb: ^ | |||||
MoveToPointRange: function(x, z, minRange, maxRange) { }, | MoveToPointRange: function(x, z, minRange, maxRange) { }, | ||||
GetPassabilityClassName: function() { return "default"; }, | GetPassabilityClassName: function() { return "default"; }, | ||||
}); | }); | ||||
controllerAI.OnCreate(); | controllerAI.OnCreate(); | ||||
TS_ASSERT_EQUALS(controllerAI.fsmStateName, "FORMATIONCONTROLLER.IDLE"); | TS_ASSERT_EQUALS(controllerAI.fsmStateName, "FORMATIONCONTROLLER.IDLE"); | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | AddMock(unit + i, IID_Position, { | ||||
GetTurretParent: function() { return INVALID_ENTITY; }, | GetTurretParent: function() { return INVALID_ENTITY; }, | ||||
GetPosition: function() { return new Vector3D(); }, | GetPosition: function() { return new Vector3D(); }, | ||||
GetPosition2D: function() { return new Vector2D(); }, | GetPosition2D: function() { return new Vector2D(); }, | ||||
GetRotation: function() { return { "y": 0 }; }, | GetRotation: function() { return { "y": 0 }; }, | ||||
IsInWorld: function() { return true; }, | IsInWorld: function() { return true; }, | ||||
}); | }); | ||||
AddMock(unit + i, IID_UnitMotion, { | AddMock(unit + i, IID_UnitMotion, { | ||||
GetWalkSpeed: function() { return 1; }, | GetWalkSpeed: function() { return 1; }, | ||||
Not Done Inline Actions^^ bb: ^^ | |||||
MoveToFormationOffset: function(target, x, z) { }, | MoveToFormationOffset: function(target, x, z) { }, | ||||
IsInTargetRange: function(target, min, max) { return true; }, | IsInTargetRange: function(target, min, max) { return true; }, | ||||
MoveToTargetRange: function(target, min, max) { }, | MoveToTargetRange: function(target, min, max) { }, | ||||
StopMoving: function() { }, | StopMoving: function() { }, | ||||
GetPassabilityClassName: function() { return "default"; }, | GetPassabilityClassName: function() { return "default"; }, | ||||
}); | }); | ||||
AddMock(unit + i, IID_Vision, { | AddMock(unit + i, IID_Vision, { | ||||
Show All 29 Lines | AddMock(controller, IID_Position, { | ||||
JumpTo: function(x, z) { this.x = x; this.z = z; }, | JumpTo: function(x, z) { this.x = x; this.z = z; }, | ||||
GetPosition: function() { return new Vector3D(this.x, 0, this.z); }, | GetPosition: function() { return new Vector3D(this.x, 0, this.z); }, | ||||
GetPosition2D: function() { return new Vector2D(this.x, this.z); }, | GetPosition2D: function() { return new Vector2D(this.x, this.z); }, | ||||
GetRotation: function() { return { "y": 0 }; }, | GetRotation: function() { return { "y": 0 }; }, | ||||
IsInWorld: function() { return true; }, | IsInWorld: function() { return true; }, | ||||
}); | }); | ||||
AddMock(controller, IID_UnitMotion, { | AddMock(controller, IID_UnitMotion, { | ||||
SetSpeed: function(speed) { }, | GetWalkSpeed: function() { return 1; }, | ||||
SetSpeedRatio: function(speed) { }, | |||||
Not Done Inline Actions^^^ bb: ^^^ | |||||
MoveToPointRange: function(x, z, minRange, maxRange) { }, | MoveToPointRange: function(x, z, minRange, maxRange) { }, | ||||
IsInTargetRange: function(target, min, max) { return true; }, | IsInTargetRange: function(target, min, max) { return true; }, | ||||
GetPassabilityClassName: function() { return "default"; }, | GetPassabilityClassName: function() { return "default"; }, | ||||
}); | }); | ||||
AddMock(controller, IID_Attack, { | AddMock(controller, IID_Attack, { | ||||
GetRange: function() { return {"max":10, "min": 0}; }, | GetRange: function() { return {"max":10, "min": 0}; }, | ||||
CanAttackAsFormation: function() { return false; }, | CanAttackAsFormation: function() { return false; }, | ||||
Show All 28 Lines |
Wildfire Games · Phabricator
-()