Skip to content
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
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default {
'^@middlewares$': '<rootDir>/src/middlewares/index.ts',
'^@plugins$': '<rootDir>/src/plugins/index.ts',
'^@decorators$': '<rootDir>/src/decorators/index.ts',
'^@core$': '<rootDir>/src/core/index.ts',
},
transform: {
'^.+\\.(t|j)s$': [
Expand Down
2 changes: 1 addition & 1 deletion src/game.ts → src/core/game.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CommandType, FactoryKeys, GameEvent } from "@enums";
import type { IGame, IGameOptions, IEventInfo, ISnapshot, ICommand, IInitGameOptions, IPlugin, IGlobalStateChangedData, IObjectDeletedOrCreatedData, IEntityTagsChangedData, ICommandBlocked } from "@interfaces";
import { EntityManager, UndoManager} from "@";
import { EntityManager, UndoManager } from "@core";
import type {
EventCallback,
CustomEventCallback,
Expand Down
3 changes: 3 additions & 0 deletions src/core/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "./game.js"
export * from "./manager.js"
export * from "./undo-manager.js"
2 changes: 1 addition & 1 deletion src/manager.ts → src/core/manager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Game } from "@";
import { Game } from "@core";
import type {
ITarget,
IEntityManager as Manager,
Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions src/factories/blueprints-factory.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type {
IBluePrint,
IBluePrintsFactory,
IBluePrintsFactoryOptions,
ITarget,
IBluePrintsFactoryOptions
} from "@interfaces";
import type { BlueprintContent, Position } from "@types";
import { blueprintIsTarget, createId } from "@utils";
Expand Down
6 changes: 2 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { Game } from "@";
import { Game } from "@core";
import type {
IEntityManager,
IGameMap,
IInitGameOptions,
} from "@interfaces";

export * from "./game.js"
export * from "./manager.js"
export * from "./undo-manager.js"
export * from "./const/index.js"
export * from "./core/index.js"
export * from "./enums/index.js"
export * from "./interfaces/index.js"
export * from "./types/index.js"
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/core/engine/classes-engine.interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@";
import type { Game } from "@core";
import type { GameEvent } from "@enums";
import type {
IEventInfo,
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/core/engine/engine-options.intefaces.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { UndoManager } from "@";
import type { UndoManager } from "@core";
import type { IEntityManager, IGameMap } from "@interfaces";
import type { GlobalStore } from "@store";

Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/core/support/support.interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@";
import type { Game } from "@core";
import type { CommandType } from "@enums";
import type { IGameObject, ITarget } from "@interfaces";
import type { CommandContext, LifecycleCallback } from "@types";
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/event-datas/actions/attack.action.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Entity, GameObject } from "@world";
import type { EntityManager } from "@"
import type { EntityManager } from "@core"

export interface IAttackResult {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { EntityManager } from "@";
import type { EntityManager } from "@core";
import type { IGameSound } from "@interfaces";
import type { AnyPosition, Position } from "@types";
import type { Entity, GameObject } from "@world";
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/factories/base-factories-options.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@";
import type { Game } from "@core";

export interface IBaseFactoriesOptions {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/factories/iteractions-factory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@";
import type { Game } from "@core";
import type { IBaseFactoriesOptions } from "@interfaces";
import type { Entity, GameObject } from "@world";

Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/store/global-store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@";
import type { Game } from "@core";
import type { CommandContext } from "@types";

export interface IGlobalStore {
Expand Down
2 changes: 1 addition & 1 deletion src/middlewares/entity/drop-item-guard.middleware.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IItemDroppedErrorData } from "@";
import type { IItemDroppedErrorData } from "@interfaces";
import { ITERACTION_ERRORS } from "@const";
import { CommandType } from "@enums";
import type { MiddlewareFn } from "@types";
Expand Down
2 changes: 1 addition & 1 deletion src/middlewares/entity/open-chest-guard.middleare.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IChestOpenErrorData } from "@";
import type { IChestOpenErrorData } from "@interfaces";
import { ITERACTION_ERRORS } from "@const";
import { CommandType } from "@enums";
import type { MiddlewareFn } from "@types";
Expand Down
2 changes: 1 addition & 1 deletion src/middlewares/entity/pickup-guard.middleare.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IItemPickedUpErrorData } from "@";
import type { IItemPickedUpErrorData } from "@interfaces";
import { ITERACTION_ERRORS } from "@const";
import { CommandType } from "@enums";
import type { MiddlewareFn } from "@types";
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/async.plugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@";
import type { Game } from "@core";
import type { IPlugin, ICommand, IAsyncMapValues, ICommandBlocked } from "@interfaces";
import { createId } from "@utils";
import { InjectCore } from "@decorators";
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/canvas.plugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@";
import type { Game } from "@core";
import type { IPlugin, ICanvasPluginOptions } from "@interfaces";
import type { Entity, GameObject } from "@world";
import type { Position } from "@types";
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/conflict-resolver.plugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Game } from "@";
import { Game } from "@core";
import type { IPlugin } from "@interfaces";
import { CanvasPlugin, ConsolePlugin, GraphicPlugin } from "@plugins";

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/console.plugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@";
import type { Game } from "@core";
import { CONSOLE_BASE_HEIGHT, CONSOLE_BASE_WIDTH } from "@const";
import { InjectCore, OnTick } from "@decorators";
import type { IPlugin, ICanvasPluginOptions } from "@interfaces";
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/graphic.plugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@";
import type { Game } from "@core";
import { GRAPHIC_GRID_X, GRAPHIC_GRID_Y, GRAPHIC_HEIGHT, GRAPHIC_WIDTH, isServer } from "@const";
import type { IGraphicPluginOptions, IPlugin } from "@interfaces";
import { InjectCore, OnTick } from "@decorators";
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/network.plgugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@";
import type { Game } from "@core";
import type { IPlugin, IServer } from "@interfaces";
import type { NetworkCallback } from "@types";
import type { CommandType } from "@enums";
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/regenration.plugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@";
import type { Game } from "@core";
import { InjectCore, InjectLiveQuery, InjectLiveQueryObject, InjectStoreValue, OnCustomEvent, OnEvent, OnTick, When, OnTagAdded, OnTagDeleted, Chance, OnUIEvent } from "@decorators";
import type { IPlugin, IEventInfo } from "@interfaces";
import { anyWorldObjectIsGameObject } from "@utils";
Expand Down
2 changes: 1 addition & 1 deletion src/types/callbacks/lifecycle-callbacks.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@";
import type { Game } from "@core";
import type { ICommand } from "@interfaces";
import type { CommandContext } from "@types";

Expand Down
2 changes: 1 addition & 1 deletion src/types/callbacks/middleware-callback.type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@";
import type { Game } from "@core";
import type { ICommand } from "@interfaces";
import type { CommandContext } from "@types";

Expand Down
2 changes: 1 addition & 1 deletion src/types/callbacks/plgunis-callbacks.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IClient, ICommand } from "@interfaces";
import type { IClient } from "@interfaces";
import type { Default } from "@types";

export type NetworkCallback = <T = any>(event: string, data: Default<T>) => void
Expand Down
2 changes: 1 addition & 1 deletion src/types/decorators/common-decorators.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@";
import type { Game } from "@core";
import type { BaseMethodDecorator } from "@types";

/**
Expand Down
2 changes: 1 addition & 1 deletion src/utils/hooks/use-attack.hook.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@";
import type { Game } from "@core";
import type { Entity, GameObject } from "@world";
import type { IDeadData } from "@interfaces";

Expand Down
2 changes: 1 addition & 1 deletion src/utils/hooks/use-validation.hook.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@";
import type { Game } from "@core";
import type { Entity, GameObject } from "@world";
import type { CommandType } from "@enums";
import type { IUseValidationResult } from "@interfaces";
Expand Down
2 changes: 1 addition & 1 deletion src/utils/hooks/use-visibility.hook.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@";
import type { Game } from "@core";
import type { Entity, GameObject } from "@world";
import { canSee } from "@utils";
import type { IUseVisibiltyResult, IUseVisibilityContext } from "@interfaces";
Expand Down
2 changes: 1 addition & 1 deletion src/utils/logic/extractors/middleware-extractors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@"
import type { Game } from "@core"
import type { ICommand } from "@interfaces"
import type { Entity, GameObject } from "@world"
import type { CommandContext } from "@types";
Expand Down
2 changes: 1 addition & 1 deletion src/world/entities/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type {
IEntityTagsChangedData,
IGameEffect,
} from "@interfaces";
import type { EntityManager } from "@";
import type { EntityManager } from "@core";
import type { CreateUsableItemMetadata, Position } from "@types";
import {
convertGameObjectToInventoryItem,
Expand Down
2 changes: 1 addition & 1 deletion src/world/entities/object.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Entity, GameMap } from "@world";
import { FactoryKeys, GameObjectEnum } from "@enums";
import type { IGameObject, ITriggerActivatedData, ITowerShootedData } from "@interfaces";
import type { EntityManager } from "@";
import type { EntityManager } from "@core";
import type { Position } from "@types";
import { canSee, createId, createQuadFromPosition, useAttack } from "@utils";
import { IteractionsFactory } from "@factories"
Expand Down
6 changes: 3 additions & 3 deletions src/world/map.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Game } from "@";
import { Game, EntityManager } from "@core";
import { GameObjectEnum } from "@enums";
import type {
IMovedData,
Expand All @@ -7,9 +7,9 @@ import type {
IGameMap as Map,
ITriggerActivatedData,
IWorldObjectHearedNoiseData,
IObjectDeletedOrCreatedData
IObjectDeletedOrCreatedData,
IGameEffect
} from "@interfaces";
import type { EntityManager, IGameEffect } from "@";
import type {
Position,
Quad,
Expand Down
2 changes: 1 addition & 1 deletion test/collision.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@"
import type { Game } from "@core"
import { createGame } from "@"
import { CommandType, GameObjectEnum } from "@enums"
import type {
Expand Down
3 changes: 2 additions & 1 deletion test/event.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createGame, type Game } from "@"
import { createGame } from "@";
import type { Game } from "@core"
import type { IEntityManager, IGameMap } from "@interfaces"
import type { Entity } from "@world"
import { CommandType } from "@enums"
Expand Down
3 changes: 2 additions & 1 deletion test/iteraction.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import createGame, { Game } from "@";
import { Game } from "@core";
import { createGame } from "@";
import { CommandType, GameObjectEnum } from "@enums";
import type { CreateChestMetadata, CreateItemMetadata, CreateTowerMetadata, CreateTriggerMetadata, CreateUsableItemMetadata } from "@types";
import type { IEntityManager, IGameMap, IDeadData, ITowerShootedData } from "@interfaces";
Expand Down
3 changes: 2 additions & 1 deletion test/map.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import createGame, { Game } from "@"
import { Game } from "@core"
import createGame from "@"
import type { CreateItemMetadata, Quad } from "@types"
import { CommandType, FactoryKeys, GameObjectEnum } from "@enums"
import { Entity, GameObject } from "@world"
Expand Down
2 changes: 1 addition & 1 deletion test/utils/wait-60-fps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Game } from "@";
import type { Game } from "@core";

/**
* Util func for wait game in 60 fps
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"paths": {
"@enums": ["./src/enums/index.ts"],
"@const": ["./src/const/index.ts"],
"@core": ["./src/core/index.ts"],
"@factories": ["./src/factories/index.ts"],
"@store": ["./src/store/index.ts"],
"@middlewares": ["./src/middlewares/index.ts"],
Expand Down
Loading