Differential D4605 Diff 20250 ps/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
Show First 20 Lines • Show All 241 Lines • ▼ Show 20 Lines | AddMock(controller, IID_Position, { | ||||
"MoveOutOfWorld": () => {} | "MoveOutOfWorld": () => {} | ||||
}); | }); | ||||
AddMock(controller, IID_UnitMotion, { | AddMock(controller, IID_UnitMotion, { | ||||
"GetWalkSpeed": () => 1, | "GetWalkSpeed": () => 1, | ||||
"StopMoving": () => {}, | "StopMoving": () => {}, | ||||
"SetSpeedMultiplier": () => {}, | "SetSpeedMultiplier": () => {}, | ||||
"SetAcceleration": (accel) => {}, | "SetAcceleration": (accel) => {}, | ||||
"SetPassabilityClassName": (name) => {}, | |||||
"MoveToPointRange": () => true, | "MoveToPointRange": () => true, | ||||
"SetFacePointAfterMove": () => {}, | "SetFacePointAfterMove": () => {}, | ||||
"GetFacePointAfterMove": () => true, | "GetFacePointAfterMove": () => true, | ||||
"GetPassabilityClassName": () => "default" | "GetPassabilityClassName": () => "default" | ||||
}); | }); | ||||
AddMock(SYSTEM_ENTITY, IID_Pathfinder, { | |||||
"GetClearance": () => 1, | |||||
"GetPassabilityClass": () => 16 | |||||
}); | |||||
controllerAI.OnCreate(); | controllerAI.OnCreate(); | ||||
TS_ASSERT_EQUALS(controllerAI.fsmStateName, "FORMATIONCONTROLLER.IDLE"); | TS_ASSERT_EQUALS(controllerAI.fsmStateName, "FORMATIONCONTROLLER.IDLE"); | ||||
TS_ASSERT_EQUALS(unitAI.fsmStateName, "INDIVIDUAL.IDLE"); | TS_ASSERT_EQUALS(unitAI.fsmStateName, "INDIVIDUAL.IDLE"); | ||||
controllerFormation.SetMembers([unit]); | controllerFormation.SetMembers([unit]); | ||||
controllerAI.Walk(100, 100, false); | controllerAI.Walk(100, 100, false); | ||||
▲ Show 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | AddMock(controller, IID_Position, { | ||||
"IsInWorld": () => true, | "IsInWorld": () => true, | ||||
"MoveOutOfWorld": () => {}, | "MoveOutOfWorld": () => {}, | ||||
}); | }); | ||||
AddMock(controller, IID_UnitMotion, { | AddMock(controller, IID_UnitMotion, { | ||||
"GetWalkSpeed": () => 1, | "GetWalkSpeed": () => 1, | ||||
"SetSpeedMultiplier": (speed) => {}, | "SetSpeedMultiplier": (speed) => {}, | ||||
"SetAcceleration": (accel) => {}, | "SetAcceleration": (accel) => {}, | ||||
"SetPassabilityClassName": (name) => {}, | |||||
"MoveToPointRange": (x, z, minRange, maxRange) => {}, | "MoveToPointRange": (x, z, minRange, maxRange) => {}, | ||||
"StopMoving": () => {}, | "StopMoving": () => {}, | ||||
"SetFacePointAfterMove": () => {}, | "SetFacePointAfterMove": () => {}, | ||||
"GetFacePointAfterMove": () => true, | "GetFacePointAfterMove": () => true, | ||||
"GetPassabilityClassName": () => "default" | "GetPassabilityClassName": () => "default" | ||||
}); | }); | ||||
AddMock(SYSTEM_ENTITY, IID_Pathfinder, { | |||||
"GetClearance": () => 1, | |||||
"GetPassabilityClass": () => 16 | |||||
}); | |||||
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; }, | ||||
}); | }); | ||||
controllerAI.OnCreate(); | controllerAI.OnCreate(); | ||||
controllerFormation.SetMembers(units); | controllerFormation.SetMembers(units); | ||||
▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator