mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-30 09:32:28 +00:00
Enable strictPropertyInitialization (#1909)
## Description: Enable the tsconfig option `strictPropertyInitialization`. Fixes #1907 ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced
This commit is contained in:
@@ -5,11 +5,11 @@ import { TileRef } from "../game/GameMap";
|
||||
|
||||
export class ShellExecution implements Execution {
|
||||
private active = true;
|
||||
private pathFinder: AirPathFinder;
|
||||
private pathFinder: AirPathFinder | undefined;
|
||||
private shell: Unit | undefined;
|
||||
private mg: Game;
|
||||
private mg: Game | undefined;
|
||||
private destroyAtTick = -1;
|
||||
private random: PseudoRandom;
|
||||
private random: PseudoRandom | undefined;
|
||||
|
||||
constructor(
|
||||
private readonly spawn: TileRef,
|
||||
@@ -25,6 +25,8 @@ export class ShellExecution implements Execution {
|
||||
}
|
||||
|
||||
tick(ticks: number): void {
|
||||
if (this.mg === undefined) throw new Error("Not initialized");
|
||||
if (this.pathFinder === undefined) throw new Error("Not initialized");
|
||||
this.shell ??= this._owner.buildUnit(UnitType.Shell, this.spawn, {});
|
||||
if (!this.shell.isActive()) {
|
||||
this.active = false;
|
||||
@@ -62,6 +64,8 @@ export class ShellExecution implements Execution {
|
||||
}
|
||||
|
||||
private effectOnTarget(): number {
|
||||
if (this.mg === undefined) throw new Error("Not initialized");
|
||||
if (this.random === undefined) throw new Error("Not initialized");
|
||||
const { damage } = this.mg.config().unitInfo(UnitType.Shell);
|
||||
const baseDamage = damage ?? 250;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user