Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYNC] Generic schemes update #17

Merged
merged 11 commits into from
Aug 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/bin
Submodule bin updated 74 files
+ engines/gold/bin/BugTrap.dll
+ engines/gold/bin/LuaJIT.dll
+ engines/gold/bin/OpenAL32.dll
+1 −1 engines/gold/bin/bin.json
+ engines/gold/bin/luabind.dll
+ engines/gold/bin/xrAICore.dll
+ engines/gold/bin/xrAPI.dll
+ engines/gold/bin/xrCDB.dll
+ engines/gold/bin/xrCore.dll
+ engines/gold/bin/xrD3D9-Null.dll
+ engines/gold/bin/xrEngine.dll
+ engines/gold/bin/xrEngine.exe
+ engines/gold/bin/xrGame.dll
+ engines/gold/bin/xrNetServer.dll
+ engines/gold/bin/xrParticles.dll
+ engines/gold/bin/xrRender_GL.dll
+ engines/gold/bin/xrRender_R1.dll
+ engines/gold/bin/xrRender_R2.dll
+ engines/gold/bin/xrRender_R4.dll
+ engines/gold/bin/xrScriptEngine.dll
+ engines/gold/bin/xrSound.dll
+ engines/gold/bin/xrUICore.dll
+ engines/mixed/bin/BugTrap.dll
+ engines/mixed/bin/LuaJIT.dll
+ engines/mixed/bin/ODE.dll
+ engines/mixed/bin/OPCODE.dll
+ engines/mixed/bin/OpenAL32.dll
+1 −1 engines/mixed/bin/bin.json
+ engines/mixed/bin/luabind.dll
+ engines/mixed/bin/xrAICore.dll
+ engines/mixed/bin/xrAPI.dll
+ engines/mixed/bin/xrCDB.dll
+ engines/mixed/bin/xrCore.dll
+ engines/mixed/bin/xrD3D9-Null.dll
+ engines/mixed/bin/xrEngine.dll
+ engines/mixed/bin/xrEngine.exe
+ engines/mixed/bin/xrGame.dll
+ engines/mixed/bin/xrGameSpy.dll
+ engines/mixed/bin/xrNetServer.dll
+ engines/mixed/bin/xrParticles.dll
+ engines/mixed/bin/xrPhysics.dll
+ engines/mixed/bin/xrRender_GL.dll
+ engines/mixed/bin/xrRender_R1.dll
+ engines/mixed/bin/xrRender_R2.dll
+ engines/mixed/bin/xrRender_R4.dll
+ engines/mixed/bin/xrScriptEngine.dll
+ engines/mixed/bin/xrSound.dll
+ engines/mixed/bin/xrUICore.dll
+ engines/release/bin/BugTrap.dll
+ engines/release/bin/LuaJIT.dll
+ engines/release/bin/ODE.dll
+ engines/release/bin/OPCODE.dll
+ engines/release/bin/OpenAL32.dll
+1 −1 engines/release/bin/bin.json
+ engines/release/bin/luabind.dll
+ engines/release/bin/xrAICore.dll
+ engines/release/bin/xrAPI.dll
+ engines/release/bin/xrCDB.dll
+ engines/release/bin/xrCore.dll
+ engines/release/bin/xrD3D9-Null.dll
+ engines/release/bin/xrEngine.dll
+ engines/release/bin/xrEngine.exe
+ engines/release/bin/xrGame.dll
+ engines/release/bin/xrGameSpy.dll
+ engines/release/bin/xrNetServer.dll
+ engines/release/bin/xrParticles.dll
+ engines/release/bin/xrPhysics.dll
+ engines/release/bin/xrRender_GL.dll
+ engines/release/bin/xrRender_R1.dll
+ engines/release/bin/xrRender_R2.dll
+ engines/release/bin/xrRender_R4.dll
+ engines/release/bin/xrScriptEngine.dll
+ engines/release/bin/xrSound.dll
+ engines/release/bin/xrUICore.dll
2 changes: 1 addition & 1 deletion cli/pack/pack_game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function copyGameEngine(engine: string): void {
/**
* Copy gamedata assets needed for the game build.
*
* @param isFiltered - whether gamedata should be copied with applied filtering based on compressed DBs
* @param isFiltered - whether gamedata should be copied with applied filtering based on compressed DBs content
*/
function copyGamedataAssets(isFiltered: boolean = true): void {
const destinationPath: string = path.resolve(TARGET_GAME_PACKAGE_DIR, "gamedata");
Expand Down
6 changes: 3 additions & 3 deletions doc/BUILDING_CUSTOM_GAME_PACKAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ After cloning suggested repositories or providing custom assets, you should list

### 🏗️ Running build

If assets are downloaded and configured correctly, the only needed thing is:
If assets are downloaded and configured correctly, the only needed thing is one of following:

```
npm run cli pack game -- --clean --optimize
Expand All @@ -30,10 +30,10 @@ npm run pack:game

As result, new package will be created in `target` folder.

If you want to 'just build' package for testing from existing assets without full build cycle, you can use alternative:
If you want to 'just build' package for testing from existing assets without full build/compress cycle, you can use alternative:

```
npm run cli pack game -- --engine release --build
npm run cli pack game -- --engine release --no-build
```

### 🏗️ Assets links
Expand Down
34 changes: 33 additions & 1 deletion src/engine/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
# [XRF](../../) / SRC / ENGINE

todo
This directory contains engine implementation source code.

## configs

Ltx configs of game logics and settings. <br/>
Includes both '*.ltx' and '*.ts' variants.

## core

Lua game core implementation. <br/>
Logics of objects, services, schemes, utils and game UI.

## extensions

Codebase of extensions used to provide modular game changing logic/assets. <br/>

## forms

Codebase of UI forms both in '*.xml' and '*.tsx' variants.

## lib

Sharable types and constants module that defines global project scope.

## scripts

Lua scripts used for C++ and lua sources links. <br/>
Also includes globals definitions to access from logics configs.

## translations

Source code related to translations of strings. <br/>
Both '*.xml' and '*.json' variants can be used.
4 changes: 4 additions & 0 deletions src/engine/configs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ With `typescript` variant you can generate different variations on build time, c
With `ini` variant it is less verbose and standard across modding community.

But ltx variant generally is easier to write/read and accepted by community.

## TODO

- Add readme files with LTX sections / fields documentation and explanation
4 changes: 2 additions & 2 deletions src/engine/configs/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- `combat_ignore_keep_when_attacked` - ???
- `meet` - ???
- `invulnerable` - ???
- `gather_items_enabled` - ???
- `help_wounded_enabled` - ???
- `gather_items_enabled` - whether stalker can loot items from corpses nearby if any detected, true by default
- `help_wounded_enabled` - whether stalker can help wounded if injured nearby are detected, true by default
- `corpse_detection_enabled` - ???
- `use_camp` - [boolean] whether object can use camp logic (stories, guitar, harmonica), true by default
4 changes: 2 additions & 2 deletions src/engine/configs/scripts/zaton/zat_b38_stalker_cop.ltx
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ combat_ignore_cond = {-zat_b38_fight_started} true
on_signal = zat_b38_scary_sound | {-zat_b38_scary_sound} remark@illusion %+zat_b38_scary_sound +zat_b38_illusion%
on_signal2 = zat_b38_monster_1 | {-zat_b38_monster_1} %+zat_b38_monster_1%
on_info2 = {+zat_b38_monster_1 -zat_b38_stalker_cop_see_bloodsucker_done -zat_b38_bloodscuker_1_death} remark@monster_1 %=play_sound(zat_b38_stalker_cop_see_bloodsucker) +zat_b38_stalker_cop_see_bloodsucker_done%
on_info3 = {+zat_b38_bloodscuker_1_death -zat_b38_bloodscuker_2_death -zat_b38_stalker_cop_kill_1_done +zat_b38_we_fight_monster_1} %=play_sound(zat_b38_stalker_cop_kill_1) +zat_b38_stalker_cop_kill_1_done =clearAbuse%
on_info3 = {+zat_b38_bloodscuker_1_death -zat_b38_bloodscuker_2_death -zat_b38_stalker_cop_kill_1_done +zat_b38_we_fight_monster_1} %=play_sound(zat_b38_stalker_cop_kill_1) +zat_b38_stalker_cop_kill_1_done =clear_abuse%
on_signal3 = zat_b38_monster_2 | {-zat_b38_monster_2} %+zat_b38_monster_2%
on_info4 = {+zat_b38_monster_2 +zat_b38_bloodscuker_2_death =dist_to_actor_le(5)} animpoint@break_lift %+zat_b38_break_lift =play_sound(zat_b38_stalker_cop_come_here_1)%, {+zat_b38_monster_2 +zat_b38_bloodscuker_2_death} remark@wait_bf_lift
on_info5 = {+zat_b38_monster_2 -zat_b38_bloodscuker_2_death} remark@monster_2 %+zat_b38_stalker_cop_see_bloodsucker_2 =play_sound(zat_b38_stalker_cop_another_one)%
on_info6 = {+zat_b38_bloodscuker_2_death -zat_b38_stalker_cop_kill_2_done +zat_b38_we_fight_monster_2} %=play_sound(zat_b38_stalker_cop_kill_2) +zat_b38_stalker_cop_kill_2_done =clearAbuse%
on_info6 = {+zat_b38_bloodscuker_2_death -zat_b38_stalker_cop_kill_2_done +zat_b38_we_fight_monster_2} %=play_sound(zat_b38_stalker_cop_kill_2) +zat_b38_stalker_cop_kill_2_done =clear_abuse%

[remark@illusion]:remark
anim = threat
Expand Down
33 changes: 32 additions & 1 deletion src/engine/core/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
# [XRF](../../../) / SRC / ENGINE / CORE

Engine logics of the game core.
Engine logics of the game core written with lua (tstl).

## database

In-game registry. <br/>
Stores all the objects links handled by lua part or game caches. <br/>
Usually objects are added on register and removed on unregister.

## managers

Source code of managers objects. <br/>
Managers are modular handlers of some specific to them functionality (weather, loot, corpses removal etc).

## objects

Source code related to objects logic. <br/>
Handles server/client side logics of objects, animation and states of objects.

## schemes

Source code related to logics schemes definition and implementation. <br/>
Schemes are describing scenarios used by objects and are configured from ltx files.

## ui

Source code related to game UI implementation. <br/>
Describes how xml forms should be used by the game.

## utils

Source code related to game utility functions. <br/>
In most cases utils are pure functions that may reference game state/registry and are easy to test.
4 changes: 0 additions & 4 deletions src/engine/core/database/README.md

This file was deleted.

7 changes: 5 additions & 2 deletions src/engine/core/database/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,12 @@ export interface IRegistryObjectState extends Record<EScheme, Optional<IBaseSche
*/
mute: Optional<boolean>;
/**
* todo;
* ID of object currently looting object.
* Used to prevent looting of same object by multiple objects at once.
*
* todo: Move to loot scheme state, not store it in global. Probaly pstore is correct place.
*/
corpse_already_selected: Optional<TNumberId>;
lootedByObject: Optional<TNumberId>;
/**
* todo;
*/
Expand Down
12 changes: 7 additions & 5 deletions src/engine/core/managers/world/ReleaseBodyManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { abort } from "@/engine/core/utils/assertion";
import { readIniString } from "@/engine/core/utils/ini";
import { LuaLogger } from "@/engine/core/utils/logging";
import { isMonster, isStalker } from "@/engine/core/utils/object";
import { resetTable } from "@/engine/core/utils/table";
import { roots } from "@/engine/lib/constants/roots";
import {
ClientObject,
Expand Down Expand Up @@ -57,8 +58,8 @@ export class ReleaseBodyManager extends AbstractCoreManager {
public static readonly IDLE_AFTER_DEATH: number = 40_000; // time to ignore clean up
public static readonly MAX_BODY_COUNT: number = 15;

public releaseObjectRegistry: LuaArray<IReleaseDescriptor> = new LuaTable();
public keepItemsRegistry: LuaArray<TStringId> = new LuaTable();
public readonly releaseObjectRegistry: LuaArray<IReleaseDescriptor> = new LuaTable();
public readonly keepItemsRegistry: LuaArray<TStringId> = new LuaTable();

/**
* todo: Description.
Expand Down Expand Up @@ -240,7 +241,7 @@ export class ReleaseBodyManager extends AbstractCoreManager {

const count: TCount = reader.r_u16();

this.releaseObjectRegistry = new LuaTable();
resetTable(this.releaseObjectRegistry);

for (const it of $range(1, count)) {
const vid = reader.r_u16();
Expand All @@ -251,8 +252,9 @@ export class ReleaseBodyManager extends AbstractCoreManager {

const levelId: TNumberId = reader.r_u16();

if (levelId !== game_graph().vertex(alife().object(0)!.m_game_vertex_id).level_id()) {
this.releaseObjectRegistry = new LuaTable();
// Is not same level, reset corpses list.
if (levelId !== game_graph().vertex(alife().actor().m_game_vertex_id).level_id()) {
resetTable(this.releaseObjectRegistry);
}

closeLoadMarker(reader, ReleaseBodyManager.name);
Expand Down
12 changes: 6 additions & 6 deletions src/engine/core/objects/animation/animations/base.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IAnimationDescriptor } from "@/engine/core/objects/animation/animation_types";
import { EStalkerState } from "@/engine/core/objects/animation/state_types";
import { SchemeCorpseDetection } from "@/engine/core/schemes/corpse_detection";
import { SchemeHelpWounded } from "@/engine/core/schemes/help_wounded";
import { finishCorpseLooting } from "@/engine/core/schemes/corpse_detection/utils";
import { finishHelpWounded } from "@/engine/core/schemes/help_wounded/utils";
import { createSequence } from "@/engine/core/utils/animation";
import { getExtern } from "@/engine/core/utils/binding";
import { startPlayingGuitar, startPlayingHarmonica } from "@/engine/core/utils/camp";
Expand Down Expand Up @@ -997,9 +997,8 @@ export const baseAnimations: LuaTable<TName, IAnimationDescriptor> = $fromObject
into: createSequence([
"dinamit_1",
{
f: (object: ClientObject) => {
SchemeCorpseDetection.getAllFromCorpse(object);
},
// When animation ends, loot everything from an object.
f: (object: ClientObject) => finishCorpseLooting(object),
},
]),
out: null,
Expand All @@ -1016,8 +1015,9 @@ export const baseAnimations: LuaTable<TName, IAnimationDescriptor> = $fromObject
into: createSequence([
"dinamit_1",
{
// When animation ends, finish help wounded and heal up.
f: (object: ClientObject) => {
SchemeHelpWounded.helpWounded(object);
finishHelpWounded(object);
},
},
]),
Expand Down
10 changes: 10 additions & 0 deletions src/engine/core/objects/animation/state_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,16 @@ export enum EStateActionId {
SMARTCOVER_EXIT = 81,
}

/**
* todo;
*/
export enum ESmartCoverState {
FIRE_TARGET = "fire_target",
FIRE_NO_LOOKOUT_TARGET = "fire_no_lookout_target",
IDLE_TARGET = "idle_target",
LOOKOUT_TARGET = "lookout_target",
}

/**
* todo;
*/
Expand Down
Loading