Skip to content

Commit

Permalink
Adding more docblocks instead of todo;.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neloreck committed Aug 14, 2023
1 parent 9c07373 commit 3fd7e6c
Show file tree
Hide file tree
Showing 96 changed files with 193 additions and 198 deletions.
2 changes: 1 addition & 1 deletion cli/preview/utils/generate_preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function generateDomClasses() {
}

/**
* todo;
* @returns random hex color string
*/
function getRandomColor(): string {
return "#" + (((1 << 24) * Math.random()) | 0).toString(16).padStart(6, "0");
Expand Down
47 changes: 33 additions & 14 deletions cli/utils/fs/get_diffs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ import * as fsp from "fs/promises";
import * as os from "os";
import * as path from "path";

interface FileStat {
interface IFileStat {
mtime: Date;
size: number;
}

type FileMap = Record<string, FileStat>;
type FileMap = Record<string, IFileStat>;

type FilePathMap = string | FileMap;

interface FileStats {
interface IFileStats {
totalSize: number;
files: FileMap;
}

interface DiffOptions {
interface IDiffOptions {
exclusions: Array<string>;
compareSizes: boolean;
}
Expand All @@ -32,14 +32,21 @@ export interface IDiffs {
}

/**
* todo;
* Get time value from date or date string.
*
* @param dateOrDateString - serialized date or date instance
* @returns timestamp parsed from date
*/
function getTime(dateOrDateStr: Date | string): number {
return typeof dateOrDateStr === "string" ? Date.parse(dateOrDateStr) : dateOrDateStr.getTime();
function getTime(dateOrDateString: Date | string): number {
return typeof dateOrDateString === "string" ? Date.parse(dateOrDateString) : dateOrDateString.getTime();
}

/**
* todo;
* Make sure directory is accessible.
* If cannot access it, generate subtree in a recursive way.
*
* @param directory - path to directory
* @returns promise for ensuring directory is accessible
*/
async function ensureDirAccess(directory: string): Promise<void> {
try {
Expand All @@ -50,7 +57,7 @@ async function ensureDirAccess(directory: string): Promise<void> {
}

/**
* todo;
* Get files from some directory with async generator.
*
* @yields - files from directory in a recursive way
*/
Expand All @@ -66,10 +73,17 @@ async function* getFiles(directory: string): AsyncGenerator<string> {
}

/**
* todo;
* Get file stats for file by path.
*
* @param file - full path to file

Check warning on line 78 in cli/utils/fs/get_diffs.ts

View workflow job for this annotation

GitHub Actions / check (19.x)

Missing @param "options.exclusions"

Check warning on line 78 in cli/utils/fs/get_diffs.ts

View workflow job for this annotation

GitHub Actions / check (19.x)

Missing @param "options.pathSeparator"

Check warning on line 78 in cli/utils/fs/get_diffs.ts

View workflow job for this annotation

GitHub Actions / check (19.x)

Missing @param "options.encodePath"

Check warning on line 78 in cli/utils/fs/get_diffs.ts

View workflow job for this annotation

GitHub Actions / check (19.x)

Missing @param "options.exclusions"

Check warning on line 78 in cli/utils/fs/get_diffs.ts

View workflow job for this annotation

GitHub Actions / check (19.x)

Missing @param "options.pathSeparator"

Check warning on line 78 in cli/utils/fs/get_diffs.ts

View workflow job for this annotation

GitHub Actions / check (19.x)

Missing @param "options.encodePath"
* @param options - configuration of stats access
* @returns promise resolving file stats
*/
async function getFileStats(directory: string, options): Promise<FileStats> {
const dir = path.resolve(directory);
async function getFileStats(
file: string,
options: { exclusions?: Array<string>; pathSeparator?: string; encodePath?: boolean }
): Promise<IFileStats> {
const dir = path.resolve(file);

await ensureDirAccess(dir);

Expand Down Expand Up @@ -100,9 +114,14 @@ async function getFileStats(directory: string, options): Promise<FileStats> {
}

/**
* todo;
* Get diff between two sets of files.
*
* @param base - base to check diffs from
* @param target - target to check diffs from base
* @param options - diff checking configuration
* @returns promise resolving diffs between two sets of files
*/
export async function getDiffs(base: FilePathMap, target: FilePathMap, options?: DiffOptions): Promise<IDiffs> {
export async function getDiffs(base: FilePathMap, target: FilePathMap, options?: IDiffOptions): Promise<IDiffs> {
const { exclusions = [], compareSizes = true } = options || {};
const statsOptions = { exclusions };
let baseFiles = base;
Expand Down
3 changes: 2 additions & 1 deletion src/engine/core/objects/state/StalkerMoveManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ const ARRIVAL_AFTER_ROTATION: number = 1;
const sync: LuaTable<string, LuaTable<number, boolean>> = new LuaTable();

/**
* todo;
* Manager handling movement of stalker objects.
* Responsible for patrolling schemes logic.
*/
export class StalkerMoveManager {
/**
Expand Down
3 changes: 2 additions & 1 deletion src/engine/core/objects/state/StalkerStateManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ export class StalkerStateManager {
}

/**
* todo;
* Look at object defined by current animation.
* Applies look type / direction / object.
*/
public lookAtObject(): void {
this.isObjectPointDirectionLook = this.getLookObjectType();
Expand Down
6 changes: 3 additions & 3 deletions src/engine/core/objects/state/add_state_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function addStateManager(object: ClientObject): StalkerStateManager {
const planner: ActionPlanner = object.motivation_action_manager();
const stateManager: StalkerStateManager = new StalkerStateManager(object);

addBasicManagerGraph(stateManager, object);
addBasicManagerGraph(stateManager);

planner.add_evaluator(EEvaluatorId.IS_STATE_IDLE_COMBAT, new EvaluatorStateIdleCombat(stateManager));
planner.add_evaluator(EEvaluatorId.IS_STATE_IDLE_ALIFE, new EvaluatorStateIdleAlife(stateManager));
Expand Down Expand Up @@ -85,9 +85,9 @@ export function addStateManager(object: ClientObject): StalkerStateManager {
}

/**
* todo;
* Add basic graphs to state manager planner evalutors / actions.
*/
function addBasicManagerGraph(stateManager: StalkerStateManager, object: ClientObject): void {
function addBasicManagerGraph(stateManager: StalkerStateManager): void {
stateManager.planner.add_evaluator(EStateEvaluatorId.END, new stateManagement.EvaluatorStateEnd(stateManager));
stateManager.planner.add_evaluator(EStateEvaluatorId.LOCKED, new stateManagement.EvaluatorStateLocked(stateManager));
stateManager.planner.add_evaluator(
Expand Down
3 changes: 2 additions & 1 deletion src/engine/core/ui/game/FreeplayDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { Optional } from "@/engine/lib/types";
const logger: LuaLogger = new LuaLogger($filename);

/**
* todo;
* Class describing dialog shown in the end of game.
* Enables freeplay choice when game ends.
*/
@LuabindClass()
export class FreeplayDialog extends CUIScriptWnd {
Expand Down
4 changes: 2 additions & 2 deletions src/engine/forms/af_params_16.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { JSXNode, JSXXML } from "jsx-xml";

/**
* todo;
* Generate artefact parameters UI forms for 16/9 screens.
*/
export function create(): JSXNode {
return <ArtefactParams />;
}

/**
* todo;
* Component describing artefact parameters in inventory UI.
*/
export function ArtefactParams(): JSXNode {
return (
Expand Down
4 changes: 2 additions & 2 deletions src/engine/forms/booster_params.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { XrTexture } from "@/engine/forms/components/base/XrTexture.component";
import { fonts } from "@/engine/lib/constants/fonts";

/**
* todo;
* Generate UI components related to game food/boosters parameters.
*/
export function create(): JSXNode {
return <BoosterParams />;
Expand Down Expand Up @@ -48,7 +48,7 @@ export function BoosterParams(): JSXNode {
}

/**
* todo;
* Inventory item booster params representing component.
*/
function BoosterParam({
name,
Expand Down
4 changes: 2 additions & 2 deletions src/engine/forms/booster_params_16.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { XrTexture } from "@/engine/forms/components/base/XrTexture.component";
import { fonts } from "@/engine/lib/constants/fonts";

/**
* todo;
* Generate UI components related to game food/boosters parameters (16/9).
*/
export function create(): JSXNode {
return <BoosterParams />;
}

/**
* todo;
* Component describing booster parameters for inventory items.
*/
export function BoosterParams(): JSXNode {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/buy_menu_item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ArtefactParams } from "@/engine/forms/af_params";
import { BoosterParams } from "@/engine/forms/booster_params";

/**
* todo;
* Generate UI forms related to menu items buying in multiplayer.
*/
export function create(): JSXNode {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/buy_menu_item_16.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ArtefactParams } from "@/engine/forms/af_params_16";
import { BoosterParams } from "@/engine/forms/booster_params_16";

/**
* todo;
* Create UI forms related to buying and selling menu items.
*/
export function create(): JSXNode {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/chat_mp.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSXNode, JSXXML } from "jsx-xml";

/**
* todo;
* Generate UI forms related to multiplayer chat components.
*/
export function create(): JSXNode {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/color_defs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { JSXNode, JSXXML } from "jsx-xml";
// todo: Use enum with defined colors.

/**
* todo;
* Generate definitions of colors and related UI forms.
*/
export function create(): JSXNode {
// <!-- For applying specified color insert "%cColorName" into the text -->
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/demo_play_control.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSXNode, JSXXML } from "jsx-xml";

/**
* todo;
* Create UI forms related to recorded demos playback in multiplayer section of menu.
*/
export function create(): JSXNode {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/game_tutorials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from "@/engine/forms/tutorials";

/**
* todo;
* Generate UI forms related to game tutorials.
*/
export function create(): JSXNode {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/grenade.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSXNode, JSXXML } from "jsx-xml";

/**
* todo;
* Creates UI forms related to grenade indicator when it is near player.
*/
export function create(): JSXNode {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/hint_item.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSXNode, JSXXML } from "jsx-xml";

/**
* todo;
* Generate UI forms related to item hints in PDA.
*/
export function create(): JSXNode {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/ingame_msglog_mp.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSXNode, JSXXML } from "jsx-xml";

/**
* todo;
* Create UI forms related to messages log in game multiplayer.
*/
export function create(): JSXNode {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/ingame_msglog_sp.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSXNode, JSXXML } from "jsx-xml";

/**
* todo;
* Create UI forms related to messages log in game singleplayer.
*/
export function create(): JSXNode {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/inventory_new.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSXNode, JSXXML } from "jsx-xml";

/**
* todo;
* Generate forms related to proposed new inventory?
*/
export function create(): JSXNode {
return <w></w>;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/inventory_new_16.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSXNode, JSXXML } from "jsx-xml";

/**
* todo;
* Generate forms related to proposed new inventory? (16/9).
*/
export function create(): JSXNode {
return <w></w>;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/inventory_upgrade.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSXNode, JSXXML } from "jsx-xml";

/**
* todo;
* Create forms related to items upgrading UI.
*/
export function create(): JSXNode {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/inventory_upgrade_16.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSXNode, JSXXML } from "jsx-xml";

/**
* todo;
* Create forms related to items upgrading UI (16/9).
*/
export function create(): JSXNode {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/inventory_upgrade_info_16.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSXNode, JSXXML } from "jsx-xml";

/**
* todo;
* Creation of inventory items upgrading possible info forms (16/9).
*/
export function create(): JSXNode {
return <w></w>;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/maingame_pda_msg.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSXNode, JSXXML } from "jsx-xml";

/**
* todo;
* Create UI forms related to PDA messages.
*/
export function create(): JSXNode {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/maingame_pda_msg_16.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSXNode, JSXXML } from "jsx-xml";

/**
* todo;
* Create UI forms related to PDA messages (16/9).
*/
export function create(): JSXNode {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/map_desc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { JSXNode, JSXXML } from "jsx-xml";
import { MapDescription } from "@/engine/forms/game/map/MapDescription.component";

/**
* todo;
* Create map descriptions UI forms.
*/
export function create(): JSXNode {
return <MapDescription />;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/map_desc_16.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { JSXNode, JSXXML } from "jsx-xml";
import { MapDescription } from "@/engine/forms/game/map/MapDescription.component.16";

/**
* todo;
* Create map descriptions UI forms for 16/9.
*/
export function create(): JSXNode {
return <MapDescription />;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/messages_window.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSXNode, JSXXML } from "jsx-xml";

/**
* todo;
* Create forms related to messages window.
*/
export function create(): JSXNode {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/engine/forms/motion_icon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSXNode, JSXXML } from "jsx-xml";

/**
* todo;
* Create UI forms related to motion icons components.
*/
export function create(): JSXNode {
return (
Expand Down
Loading

0 comments on commit 3fd7e6c

Please sign in to comment.