Skip to content

Commit

Permalink
Corrected remaining animation states. Added more tests. Test util to …
Browse files Browse the repository at this point in the history
…check arrays intersecting.
  • Loading branch information
Neloreck committed Jul 23, 2023
1 parent e1547bf commit c88f75d
Show file tree
Hide file tree
Showing 22 changed files with 736 additions and 417 deletions.
10 changes: 4 additions & 6 deletions src/engine/core/objects/animation/animations/animpoint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { describe, expect, it } from "@jest/globals";

import { animpointAnimations } from "@/engine/core/objects/animation/animations/animpoint";
import { EStalkerState } from "@/engine/core/objects/state";
import { assertArraysIntersecting } from "@/fixtures/engine";
import { mockFromLuaTable } from "@/fixtures/lua";

describe("animpoint animations list", () => {
it("should list all needed animations", () => {
expect(animpointAnimations.length()).toBe(38);

[
assertArraysIntersecting(mockFromLuaTable(animpointAnimations).getKeysArray(), [
EStalkerState.ANIMPOINT_STAY_WALL,
EStalkerState.ANIMPOINT_STAY_TABLE,
EStalkerState.ANIMPOINT_SIT_HIGH,
Expand Down Expand Up @@ -46,10 +48,6 @@ describe("animpoint animations list", () => {
EStalkerState.ANIMPOINT_SIT_HIGH_HARMONICA,
EStalkerState.ANIMPOINT_SIT_NORMAL_HARMONICA,
EStalkerState.ANIMPOINT_SIT_LOW_HARMONICA,
].forEach((it) => {
if (!animpointAnimations.has(it)) {
throw new Error(`Expected animation '${it}' to be present in the list.`);
}
});
]);
});
});
10 changes: 4 additions & 6 deletions src/engine/core/objects/animation/animations/base.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { describe, expect, it } from "@jest/globals";

import { baseAnimations } from "@/engine/core/objects/animation/animations/base";
import { EStalkerState } from "@/engine/core/objects/state";
import { assertArraysIntersecting } from "@/fixtures/engine";
import { mockFromLuaTable } from "@/fixtures/lua";

describe("base animations list", () => {
it("should list all needed animations", () => {
expect(baseAnimations.length()).toBe(46);

[
assertArraysIntersecting(mockFromLuaTable(baseAnimations).getKeysArray(), [
EStalkerState.IDLE,
EStalkerState.IDLE_CHASOVOY,
EStalkerState.CAUTION,
Expand Down Expand Up @@ -54,10 +56,6 @@ describe("base animations list", () => {
EStalkerState.LAY_ON_BED,
EStalkerState.SEARCH_CORPSE,
EStalkerState.HELP_WOUNDED,
].forEach((it) => {
if (!baseAnimations.has(it)) {
throw new Error(`Expected animation '${it}' to be present in the list.`);
}
});
]);
});
});
10 changes: 4 additions & 6 deletions src/engine/core/objects/animation/animations/scenarios.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { describe, expect, it } from "@jest/globals";

import { scenarioAnimations } from "@/engine/core/objects/animation/animations/scenarios";
import { assertArraysIntersecting } from "@/fixtures/engine";
import { mockFromLuaTable } from "@/fixtures/lua";

describe("scenario animations list", () => {
it("should list all needed animations", () => {
expect(scenarioAnimations.length()).toBe(88);

[
assertArraysIntersecting(mockFromLuaTable(scenarioAnimations).getKeysArray(), [
"zat_b14_give_artefact_idle",
"zat_b14_give_artefact_act",
"zat_b14_stay_wall",
Expand Down Expand Up @@ -95,10 +97,6 @@ describe("scenario animations list", () => {
"jup_b217_nitro_straight",
"pri_a25_psy_medic_idle",
"pri_a25_psy_medic_out",
].forEach((it) => {
if (!scenarioAnimations.has(it)) {
throw new Error(`Expected animation '${it}' to be present in the list.`);
}
});
]);
});
});
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { describe, expect, it } from "@jest/globals";

import { scenariosPriA15Animations } from "@/engine/core/objects/animation/animations/scenariosPriA15";
import { assertArraysIntersecting } from "@/fixtures/engine";
import { mockFromLuaTable } from "@/fixtures/lua";

describe("scenario priA15 animations list", () => {
it("should list all needed animations", () => {
expect(scenariosPriA15Animations.length()).toBe(114);

[
assertArraysIntersecting(mockFromLuaTable(scenariosPriA15Animations).getKeysArray(), [
"pri_a15_idle_none",
"pri_a15_idle_unstrap",
"pri_a15_vano_all",
Expand Down Expand Up @@ -121,10 +123,6 @@ describe("scenario priA15 animations list", () => {
"pri_a15_military_4_3_zulus_alive",
"pri_a15_military_4_3_wanderer_alive",
"pri_a15_military_4_all_dead",
].forEach((it) => {
if (!scenariosPriA15Animations.has(it)) {
throw new Error(`Expected animation '${it}' to be present in the list.`);
}
});
]);
});
});
10 changes: 4 additions & 6 deletions src/engine/core/objects/animation/animstates/animstates.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { describe, expect, it } from "@jest/globals";

import { animationAnimstates } from "@/engine/core/objects/animation/animstates/animstates";
import { EStalkerState } from "@/engine/core/objects/state";
import { assertArraysIntersecting } from "@/fixtures/engine";
import { mockFromLuaTable } from "@/fixtures/lua";

describe("base animstates list", () => {
it("should list all needed animations", () => {
expect(animationAnimstates.length()).toBe(21);

[
assertArraysIntersecting(mockFromLuaTable(animationAnimstates).getKeysArray(), [
EStalkerState.ANIMPOINT_STAY_WALL,
EStalkerState.ANIMPOINT_STAY_TABLE,
EStalkerState.ANIMPOINT_SIT_HIGH,
Expand All @@ -29,10 +31,6 @@ describe("base animstates list", () => {
"pri_a21_sentry_madness_idle",
"pri_a20_colonel_radio",
"pri_a22_colonel_lean_on_table",
].forEach((it) => {
if (!animationAnimstates.has(it)) {
throw new Error(`Expected animation '${it}' to be present in the list.`);
}
});
]);
});
});
74 changes: 74 additions & 0 deletions src/engine/core/objects/animation/states/animpoint.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { describe, expect, it } from "@jest/globals";

import { animpointStates } from "@/engine/core/objects/animation/states/animpoint";
import { EStalkerState } from "@/engine/core/objects/state";
import { assertArraysIntersecting } from "@/fixtures/engine";
import { mockFromLuaTable } from "@/fixtures/lua";

describe("animpoint states list", () => {
it("should list all needed animations", () => {
expect(animpointStates.length()).toBe(59);

assertArraysIntersecting(mockFromLuaTable(animpointStates).getKeysArray(), [
EStalkerState.ANIMPOINT_STAY_WALL,
EStalkerState.ANIMPOINT_STAY_TABLE,
EStalkerState.ANIMPOINT_SIT_HIGH,
EStalkerState.ANIMPOINT_SIT_NORMAL,
EStalkerState.ANIMPOINT_SIT_LOW,
EStalkerState.ANIMPOINT_SIT_ASS,
EStalkerState.ANIMPOINT_SIT_KNEE,
EStalkerState.ANIMPOINT_STAY_WALL_EAT_BREAD,
EStalkerState.ANIMPOINT_STAY_WALL_EAT_KOLBASA,
EStalkerState.ANIMPOINT_STAY_TABLE_EAT_BREAD,
EStalkerState.ANIMPOINT_STAY_TABLE_EAT_KOLBASA,
EStalkerState.ANIMPOINT_SIT_HIGH_EAT_BREAD,
EStalkerState.ANIMPOINT_SIT_HIGH_EAT_KOLBASA,
EStalkerState.ANIMPOINT_SIT_NORMAL_EAT_BREAD,
EStalkerState.ANIMPOINT_SIT_NORMAL_EAT_KOLBASA,
EStalkerState.ANIMPOINT_SIT_LOW_EAT_BREAD,
EStalkerState.ANIMPOINT_SIT_LOW_EAT_KOLBASA,
EStalkerState.ANIMPOINT_SIT_ASS_EAT_BREAD,
EStalkerState.ANIMPOINT_SIT_ASS_EAT_KOLBASA,
EStalkerState.ANIMPOINT_SIT_KNEE_EAT_BREAD,
EStalkerState.ANIMPOINT_SIT_KNEE_EAT_KOLBASA,
EStalkerState.ANIMPOINT_STAY_WALL_DRINK_VODKA,
EStalkerState.ANIMPOINT_STAY_WALL_DRINK_ENERGY,
EStalkerState.ANIMPOINT_STAY_TABLE_DRINK_VODKA,
EStalkerState.ANIMPOINT_STAY_TABLE_DRINK_ENERGY,
EStalkerState.ANIMPOINT_SIT_HIGH_DRINK_VODKA,
EStalkerState.ANIMPOINT_SIT_HIGH_DRINK_ENERGY,
EStalkerState.ANIMPOINT_SIT_NORMAL_DRINK_VODKA,
EStalkerState.ANIMPOINT_SIT_NORMAL_DRINK_ENERGY,
EStalkerState.ANIMPOINT_SIT_LOW_DRINK_VODKA,
EStalkerState.ANIMPOINT_SIT_LOW_DRINK_ENERGY,
EStalkerState.ANIMPOINT_SIT_ASS_DRINK_VODKA,
EStalkerState.ANIMPOINT_SIT_ASS_DRINK_ENERGY,
EStalkerState.ANIMPOINT_SIT_KNEE_DRINK_VODKA,
EStalkerState.ANIMPOINT_SIT_KNEE_DRINK_ENERGY,
EStalkerState.ANIMPOINT_STAY_WALL_GUITAR,
EStalkerState.ANIMPOINT_STAY_TABLE_GUITAR,
EStalkerState.ANIMPOINT_SIT_HIGH_GUITAR,
EStalkerState.ANIMPOINT_SIT_NORMAL_GUITAR,
EStalkerState.ANIMPOINT_SIT_LOW_GUITAR,
EStalkerState.ANIMPOINT_SIT_ASS_GUITAR,
EStalkerState.ANIMPOINT_SIT_KNEE_GUITAR,
EStalkerState.ANIMPOINT_STAY_WALL_HARMONICA,
EStalkerState.ANIMPOINT_STAY_TABLE_HARMONICA,
EStalkerState.ANIMPOINT_SIT_HIGH_HARMONICA,
EStalkerState.ANIMPOINT_SIT_NORMAL_HARMONICA,
EStalkerState.ANIMPOINT_SIT_LOW_HARMONICA,
EStalkerState.ANIMPOINT_SIT_ASS_HARMONICA,
EStalkerState.ANIMPOINT_SIT_KNEE_HARMONICA,
EStalkerState.ANIMPOINT_STAY_WALL_WEAPON,
EStalkerState.ANIMPOINT_STAY_TABLE_WEAPON,
EStalkerState.ANIMPOINT_SIT_HIGH_WEAPON,
EStalkerState.ANIMPOINT_SIT_NORMAL_WEAPON,
EStalkerState.ANIMPOINT_SIT_LOW_WEAPON,
EStalkerState.ANIMPOINT_STAY_WALL_NO_RND,
EStalkerState.ANIMPOINT_STAY_TABLE_NO_RND,
EStalkerState.ANIMPOINT_SIT_HIGH_NO_RND,
EStalkerState.ANIMPOINT_SIT_NORMAL_NO_RND,
EStalkerState.ANIMPOINT_SIT_LOW_NO_RND,
]);
});
});
Loading

0 comments on commit c88f75d

Please sign in to comment.