Skip to content

Commit

Permalink
[SCHEME] sr_crow_spawner scheme update, generic updates of flows (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
Neloreck authored Sep 18, 2023
2 parents 5a95879 + 577e148 commit 2776e54
Show file tree
Hide file tree
Showing 67 changed files with 366 additions and 151 deletions.
48 changes: 48 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
cli:
- .github/**
- cli/**

binaries:
- cli/bin/**

test:
- src/**/*.test.ts
- src/fixtures/**

engine:
- src/engine/**

configs:
- src/engine/forms/**

managers:
- src/engine/core/managers/**

schemes:
- src/engine/core/schemes/**

ai:
- src/engine/core/objects/ai/**

extensions:
- src/engine/forms/**

ui:
- src/engine/forms/**
- src/engine/core/ui/**

scripts:
- src/engine/scripts/**

translations:
- src/engine/translations/**

resources:
- src/resources/**

typedefs:
- src/typedefs/**

dependencies:
- package.json
- package-lock.json
3 changes: 1 addition & 2 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- dev
pull_request:
workflow_dispatch:

Expand Down Expand Up @@ -134,7 +133,7 @@ jobs:
retention-days: 1

upload-nightly:
if: ${{ github.ref_name == 'dev' && github.event_name != 'pull_request' }}
if: ${{ github.ref_name == 'main' && github.event_name != 'pull_request' }}
needs: [test, check, build]
runs-on: ubuntu-latest

Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: pull-request-labeler
on:
- pull_request_target

jobs:
triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
2 changes: 1 addition & 1 deletion cli/test/jest_after_env.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { extendJest } from "@/fixtures/jest/extendJest";
import { extendJest } from "@/fixtures/jest/extend_jest";

extendJest();
2 changes: 1 addition & 1 deletion src/engine/core/database/logic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { registerObject, resetObject } from "@/engine/core/database/objects";
import { getPortableStoreValue, setPortableStoreValue } from "@/engine/core/database/portable_store";
import { IBaseSchemeState, IRegistryObjectState } from "@/engine/core/database/types";
import { ClientObject, EScheme } from "@/engine/lib/types";
import { replaceFunctionMock } from "@/fixtures/utils/function_mock";
import { replaceFunctionMock } from "@/fixtures/jest";
import { EPacketDataType, mockClientGameObject, mockNetPacket, MockNetProcessor } from "@/fixtures/xray";
import { MockCTime } from "@/fixtures/xray/mocks/CTime.mock";

Expand Down
2 changes: 1 addition & 1 deletion src/engine/core/database/monster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { clsid } from "xray16";
import { getMonsterState, setMonsterState } from "@/engine/core/database/monster";
import { EMonsterState } from "@/engine/lib/constants/monsters";
import { ClientObject } from "@/engine/lib/types";
import { resetFunctionMock } from "@/fixtures/utils/function_mock";
import { resetFunctionMock } from "@/fixtures/jest";
import { mockClientGameObject, mockIniFile } from "@/fixtures/xray";

describe("'monster' database module", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/engine/core/managers/actor/ActorInputManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { beforeEach, describe, expect, it } from "@jest/globals";
import { disposeManager, getManagerInstance, registerActor, registry } from "@/engine/core/database";
import { ActorInputManager } from "@/engine/core/managers/actor/ActorInputManager";
import { EventsManager } from "@/engine/core/managers/events";
import { replaceFunctionMock } from "@/fixtures/utils/function_mock";
import { replaceFunctionMock } from "@/fixtures/jest";
import { mockClientGameObject } from "@/fixtures/xray";
import { EPacketDataType, mockNetPacket, mockNetProcessor, MockNetProcessor } from "@/fixtures/xray/mocks/save";

Expand Down
2 changes: 1 addition & 1 deletion src/engine/core/managers/map/MapDisplayManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { registry } from "@/engine/core/database";
import { MapDisplayManager } from "@/engine/core/managers/map/MapDisplayManager";
import { ETreasureType, ITreasureDescriptor } from "@/engine/core/managers/treasures";
import { mapMarks } from "@/engine/lib/constants/map_marks";
import { resetFunctionMock } from "@/fixtures/utils";
import { resetFunctionMock } from "@/fixtures/jest";

describe("MapDisplayManager class", () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { AbstractPlayableSound } from "@/engine/core/objects/sounds/playable_sou
import { ActorSound } from "@/engine/core/objects/sounds/playable_sounds/ActorSound";
import { ISchemeWoundedState } from "@/engine/core/schemes/stalker/wounded";
import { GameTask } from "@/engine/lib/types";
import { resetFunctionMock } from "@/fixtures/utils/function_mock";
import { resetFunctionMock } from "@/fixtures/jest";
import { mockClientGameObject } from "@/fixtures/xray";
import { mockServerAlifeCreatureActor } from "@/fixtures/xray/mocks/objects";
import { MockAlifeSimulator } from "@/fixtures/xray/mocks/objects/AlifeSimulator.mock";
Expand Down
2 changes: 1 addition & 1 deletion src/engine/core/managers/save/SaveManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import { TaskManager } from "@/engine/core/managers/tasks";
import { TreasureManager } from "@/engine/core/managers/treasures";
import { WeatherManager } from "@/engine/core/managers/weather/WeatherManager";
import { AnyObject } from "@/engine/lib/types";
import { resetFunctionMock } from "@/fixtures/jest";
import { MockIoFile } from "@/fixtures/lua";
import { resetFunctionMock } from "@/fixtures/utils";
import { mockClientGameObject, mockNetPacket } from "@/fixtures/xray";

describe("SaveManager class", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { level } from "xray16";
import { disposeManager, getManagerInstance, registry } from "@/engine/core/database";
import { GameSettingsManager } from "@/engine/core/managers/settings/GameSettingsManager";
import { EGameDifficulty, gameDifficulties } from "@/engine/lib/constants/game_difficulties";
import { replaceFunctionMock } from "@/fixtures/utils/function_mock";
import { replaceFunctionMock } from "@/fixtures/jest";
import { gameConsole } from "@/fixtures/xray/mocks/console.mock";
import { EPacketDataType, mockNetPacket, mockNetProcessor, MockNetProcessor } from "@/fixtures/xray/mocks/save";

Expand Down
9 changes: 2 additions & 7 deletions src/engine/core/managers/sleep/SleepManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,15 @@ const logger: LuaLogger = new LuaLogger($filename);
* Manage sleep process of the actor.
*/
export class SleepManager extends AbstractManager {
/**
* Sleep dialog UI component.
*/
private sleepDialog: Optional<SleepDialog> = null;

/**
* Duration of next sleep.
*/
private nextSleepDuration: TDuration = 0;

/**
* Show sleep dialog.
*/
public showSleepDialog(): void {
logger.info("Show sleep dialog");

if (this.sleepDialog === null) {
this.sleepDialog = new SleepDialog(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { EGameEvent, EventsManager } from "@/engine/core/managers/events";
import { StatisticsManager } from "@/engine/core/managers/statistics";
import { weapons } from "@/engine/lib/constants/items/weapons";
import { ClientObject, TClassId, TName } from "@/engine/lib/types";
import { replaceFunctionMock } from "@/fixtures/jest";
import { MockLuaTable } from "@/fixtures/lua";
import { replaceFunctionMock } from "@/fixtures/utils";
import {
EPacketDataType,
mockActorClientGameObject,
Expand Down
2 changes: 1 addition & 1 deletion src/engine/core/managers/trade/TradeManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { registry } from "@/engine/core/database/registry";
import { TradeManager } from "@/engine/core/managers/trade";
import { parseConditionsList } from "@/engine/core/utils/ini";
import { ClientObject, IniFile } from "@/engine/lib/types";
import { replaceFunctionMock } from "@/fixtures/utils";
import { replaceFunctionMock } from "@/fixtures/jest";
import { EPacketDataType, mockClientGameObject, MockNetProcessor } from "@/fixtures/xray";

describe("TradeManager class implementation", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/engine/core/managers/weather/WeatherManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { EGameEvent, EventsManager } from "@/engine/core/managers/events";
import { IWeatherState } from "@/engine/core/managers/weather/weather_types";
import { WeatherManager } from "@/engine/core/managers/weather/WeatherManager";
import { NIL } from "@/engine/lib/constants/words";
import { getFunctionMock } from "@/fixtures/jest";
import { mockLuaTable, MockLuaTable } from "@/fixtures/lua/mocks/LuaTable.mock";
import { getFunctionMock } from "@/fixtures/utils";
import { EPacketDataType, mockNetPacket, mockNetProcessor, MockNetProcessor } from "@/fixtures/xray/mocks/save";

describe("WeatherManager class", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { registerStalker, unregisterStalker } from "@/engine/core/database/stalk
import { EvaluatorBodyStateCrouchNow } from "@/engine/core/objects/ai/state/body_state/EvaluatorBodyStateCrouchNow";
import { StalkerStateManager } from "@/engine/core/objects/ai/state/StalkerStateManager";
import { StalkerBinder } from "@/engine/core/objects/binders/creature/StalkerBinder";
import { replaceFunctionMock } from "@/fixtures/utils/function_mock";
import { replaceFunctionMock } from "@/fixtures/jest";
import { mockClientGameObject } from "@/fixtures/xray";

describe("EvaluatorBodyStateCrouchNow class", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { EvaluatorBodyStateSet } from "@/engine/core/objects/ai/state/body_state
import { StalkerStateManager } from "@/engine/core/objects/ai/state/StalkerStateManager";
import { EStalkerState } from "@/engine/core/objects/animation/types";
import { StalkerBinder } from "@/engine/core/objects/binders/creature/StalkerBinder";
import { replaceFunctionMock } from "@/fixtures/utils/function_mock";
import { replaceFunctionMock } from "@/fixtures/jest";
import { mockClientGameObject } from "@/fixtures/xray";

describe("EvaluatorBodyStateSet class", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { registerStalker, unregisterStalker } from "@/engine/core/database/stalk
import { EvaluatorBodyStateStandingNow } from "@/engine/core/objects/ai/state/body_state/EvaluatorBodyStateStandingNow";
import { StalkerStateManager } from "@/engine/core/objects/ai/state/StalkerStateManager";
import { StalkerBinder } from "@/engine/core/objects/binders/creature/StalkerBinder";
import { replaceFunctionMock } from "@/fixtures/utils/function_mock";
import { replaceFunctionMock } from "@/fixtures/jest";
import { mockClientGameObject } from "@/fixtures/xray";

describe("EvaluatorBodyStateStandingNow class", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ActionDirectionSearch } from "@/engine/core/objects/ai/state/direction/
import { StalkerStateManager } from "@/engine/core/objects/ai/state/StalkerStateManager";
import { EStalkerState } from "@/engine/core/objects/animation/types";
import { StalkerBinder } from "@/engine/core/objects/binders/creature/StalkerBinder";
import { resetFunctionMock } from "@/fixtures/utils/function_mock";
import { resetFunctionMock } from "@/fixtures/jest";
import { mockClientGameObject } from "@/fixtures/xray";

describe("ActionDirectionSearch class", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { EStalkerState } from "@/engine/core/objects/animation/types";
import { StalkerBinder } from "@/engine/core/objects/binders/creature/StalkerBinder";
import { createEmptyVector, createVector } from "@/engine/core/utils/vector";
import { ClientObject } from "@/engine/lib/types";
import { resetFunctionMock } from "@/fixtures/utils/function_mock";
import { resetFunctionMock } from "@/fixtures/jest";
import { mockClientGameObject } from "@/fixtures/xray";

describe("ActionDirectionTurn class", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { EvaluatorDirectionSet } from "@/engine/core/objects/ai/state/direction/
import { StalkerStateManager } from "@/engine/core/objects/ai/state/StalkerStateManager";
import { EStalkerState } from "@/engine/core/objects/animation/types";
import { StalkerBinder } from "@/engine/core/objects/binders/creature/StalkerBinder";
import { replaceFunctionMock } from "@/fixtures/utils/function_mock";
import { replaceFunctionMock } from "@/fixtures/jest";
import { mockClientGameObject, MockSightParameters } from "@/fixtures/xray";
import { MockCSightParams } from "@/fixtures/xray/mocks/CSightParams.mock";

Expand Down
9 changes: 4 additions & 5 deletions src/engine/core/objects/binders/creature/CrowBinder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ const logger: LuaLogger = new LuaLogger($filename);
export class CrowBinder extends object_binder {
public diedAt: TTimestamp = 0;

public override net_save_relevant(): boolean {
return true;
}
public override reinit(): void {
super.reinit();

Expand Down Expand Up @@ -72,16 +75,12 @@ export class CrowBinder extends object_binder {
super.net_destroy();
}

public override net_save_relevant(): boolean {
return true;
}

public override update(delta: TDuration): void {
super.update(delta);

if (
!this.object.alive() &&
this.diedAt !== 0 &&
!this.object.alive() &&
time_global() - logicsConfig.CROW_CORPSE_RELEASE_TIMEOUT >= this.diedAt
) {
const simulator: AlifeSimulator = alife();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { createObjectJobDescriptor, IObjectJobDescriptor } from "@/engine/core/u
import { TRUE } from "@/engine/lib/constants/words";
import { ServerHumanObject } from "@/engine/lib/types";
import { mockSmartTerrain, mockSmartTerrainWithConfiguration } from "@/fixtures/engine";
import { replaceFunctionMock } from "@/fixtures/utils";
import { replaceFunctionMock } from "@/fixtures/jest";
import {
EPacketDataType,
MockCALifeSmartTerrainTask,
Expand Down
2 changes: 1 addition & 1 deletion src/engine/core/objects/sounds/StereoSound.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { sound_object, time_global } from "xray16";

import { registerActor } from "@/engine/core/database";
import { StereoSound } from "@/engine/core/objects/sounds/StereoSound";
import { replaceFunctionMock } from "@/fixtures/utils/function_mock";
import { replaceFunctionMock } from "@/fixtures/jest";
import { mockClientGameObject } from "@/fixtures/xray";

describe("StereoSound class", () => {
Expand Down
Loading

0 comments on commit 2776e54

Please sign in to comment.