Skip to content

Commit

Permalink
Update state manager generation tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neloreck committed Aug 22, 2023
1 parent 41e7cb2 commit ab55f0f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/engine/core/objects/state/add_state_manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,14 @@ describe("add_state_manager util", () => {

checkAction(
planner.action(EActionId.STATE_TO_IDLE_COMBAT),
"CombatToIdle",
"ToIdleCombat",
[[EEvaluatorId.IS_STATE_IDLE_COMBAT, false]],
[[EEvaluatorId.IS_STATE_IDLE_COMBAT, true]]
);

checkAction(
planner.action(EActionId.STATE_TO_IDLE_ITEMS),
"ItemsToIdle",
"ToIdleItems",
[
[EEvaluatorId.IS_STATE_IDLE_ITEMS, false],
[mockStalkerIds.property_items, true],
Expand All @@ -186,17 +186,27 @@ describe("add_state_manager util", () => {

checkAction(
planner.action(EActionId.STATE_TO_IDLE_ALIFE),
"DangerToIdle",
"ToIdleAlife",
[
[mockStalkerIds.property_alive, true],
[mockStalkerIds.property_enemy, false],
[mockStalkerIds.property_danger, false],
[mockStalkerIds.property_items, false],
[EEvaluatorId.IS_STATE_LOGIC_ACTIVE, false],
[EEvaluatorId.IS_STATE_IDLE_ALIFE, false],
],
[[EEvaluatorId.IS_STATE_IDLE_ALIFE, true]]
);

checkAction(planner.action(EActionId.ALIFE), "generic", [[EEvaluatorId.IS_STATE_IDLE_ALIFE, true]], []);
checkAction(
planner.action(EActionId.ALIFE),
"generic",
[
[EEvaluatorId.IS_STATE_IDLE_ALIFE, true],
[mockStalkerIds.property_items, false],
],
[]
);
checkAction(
planner.action(mockStalkerIds.action_gather_items),
"generic",
Expand Down
1 change: 1 addition & 0 deletions src/engine/core/objects/state/add_state_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export function addStateManager(object: ClientObject): StalkerStateManager {
planner.add_action(EActionId.STATE_TO_IDLE_ALIFE, actionAlifeToIdle);

planner.action(EActionId.ALIFE).add_precondition(new world_property(EEvaluatorId.IS_STATE_IDLE_ALIFE, true));
planner.action(EActionId.ALIFE).add_precondition(new world_property(stalker_ids.property_items, false));

planner
.action(stalker_ids.action_gather_items)
Expand Down

0 comments on commit ab55f0f

Please sign in to comment.