Skip to content

Commit

Permalink
Fix issue with null check introduced in previous commits for mob comb…
Browse files Browse the repository at this point in the history
…at. Add no_meet section constant. Extend meet scheme readme.
  • Loading branch information
Neloreck committed Aug 20, 2023
1 parent a11576e commit 27073d2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
19 changes: 19 additions & 0 deletions src/engine/core/schemes/meet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,23 @@ description
## ini parameters

```
close_distance - ?
close_anim - ?
close_snd_distance - ?
close_snd_hello - ?
close_snd_bye - ?
close_victim - ?
far_distance - ?
far_anim - ?
far_snd_distance - ?
far_snd - ?
far_victim - ?
snd_on_use - ?
use - ?
meet_dialog - ?
abuse - ?
trade_enable - ?
allow_break - ?
meet_on_talking - ?
use_text - ?
```
9 changes: 6 additions & 3 deletions src/engine/core/schemes/mob_combat/SchemeMobCombat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ISchemeMobCombatState } from "@/engine/core/schemes/mob_combat/ISchemeM
import { MobCombatManager } from "@/engine/core/schemes/mob_combat/MobCombatManager";
import { getConfigSwitchConditions } from "@/engine/core/utils/ini/ini_config";
import { LuaLogger } from "@/engine/core/utils/logging";
import { ClientObject, EScheme, ESchemeType, IniFile, TSection } from "@/engine/lib/types";
import { ClientObject, EScheme, ESchemeType, IniFile, Optional, TSection } from "@/engine/lib/types";

const logger: LuaLogger = new LuaLogger($filename);

Expand Down Expand Up @@ -37,8 +37,11 @@ export class SchemeMobCombat extends AbstractScheme {
}

public static override disable(object: ClientObject, scheme: EScheme): void {
const state: ISchemeMobCombatState = registry.objects.get(object.id())[scheme] as ISchemeMobCombatState;
const state: Optional<ISchemeMobCombatState> = registry.objects.get(object.id())[scheme] as ISchemeMobCombatState;

state.enabled = false;
// No guarantee that it was activated before so should be checked additionally.
if (state !== null) {
state.enabled = false;
}
}
}
5 changes: 5 additions & 0 deletions src/engine/lib/constants/sections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ export const SMART_TERRAIN_SECTION: TName = "smart_terrain";
* Section representing stalkers that are used only for cutscenes / scenarios (todo: confirm).
*/
export const ACTOR_VISUAL_STALKER: TName = "actor_visual_stalker";

/**
* Section to disable meet scheme.
*/
export const NO_MEET_SECTION: TName = "no_meet";

0 comments on commit 27073d2

Please sign in to comment.