diff --git a/jest.config.js b/jest.config.js index 281b08c..76fac49 100644 --- a/jest.config.js +++ b/jest.config.js @@ -19,6 +19,7 @@ export default { '^@middlewares$': '/src/middlewares/index.ts', '^@plugins$': '/src/plugins/index.ts', '^@decorators$': '/src/decorators/index.ts', + '^@core$': '/src/core/index.ts', }, transform: { '^.+\\.(t|j)s$': [ diff --git a/src/game.ts b/src/core/game.ts similarity index 99% rename from src/game.ts rename to src/core/game.ts index 623e933..c46f3be 100644 --- a/src/game.ts +++ b/src/core/game.ts @@ -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, diff --git a/src/core/index.ts b/src/core/index.ts new file mode 100644 index 0000000..c50bd59 --- /dev/null +++ b/src/core/index.ts @@ -0,0 +1,3 @@ +export * from "./game.js" +export * from "./manager.js" +export * from "./undo-manager.js" \ No newline at end of file diff --git a/src/manager.ts b/src/core/manager.ts similarity index 99% rename from src/manager.ts rename to src/core/manager.ts index 8e79908..2a49c6f 100644 --- a/src/manager.ts +++ b/src/core/manager.ts @@ -1,4 +1,4 @@ -import { Game } from "@"; +import { Game } from "@core"; import type { ITarget, IEntityManager as Manager, diff --git a/src/undo-manager.ts b/src/core/undo-manager.ts similarity index 100% rename from src/undo-manager.ts rename to src/core/undo-manager.ts diff --git a/src/factories/blueprints-factory.ts b/src/factories/blueprints-factory.ts index 0635c75..e062d19 100644 --- a/src/factories/blueprints-factory.ts +++ b/src/factories/blueprints-factory.ts @@ -1,8 +1,7 @@ import type { IBluePrint, IBluePrintsFactory, - IBluePrintsFactoryOptions, - ITarget, + IBluePrintsFactoryOptions } from "@interfaces"; import type { BlueprintContent, Position } from "@types"; import { blueprintIsTarget, createId } from "@utils"; diff --git a/src/index.ts b/src/index.ts index 0330bf9..1a501bb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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" diff --git a/src/interfaces/core/engine/classes-engine.interfaces.ts b/src/interfaces/core/engine/classes-engine.interfaces.ts index f9e7f29..23c934f 100644 --- a/src/interfaces/core/engine/classes-engine.interfaces.ts +++ b/src/interfaces/core/engine/classes-engine.interfaces.ts @@ -1,4 +1,4 @@ -import type { Game } from "@"; +import type { Game } from "@core"; import type { GameEvent } from "@enums"; import type { IEventInfo, diff --git a/src/interfaces/core/engine/engine-options.intefaces.ts b/src/interfaces/core/engine/engine-options.intefaces.ts index e843eb7..e834b12 100644 --- a/src/interfaces/core/engine/engine-options.intefaces.ts +++ b/src/interfaces/core/engine/engine-options.intefaces.ts @@ -1,4 +1,4 @@ -import type { UndoManager } from "@"; +import type { UndoManager } from "@core"; import type { IEntityManager, IGameMap } from "@interfaces"; import type { GlobalStore } from "@store"; diff --git a/src/interfaces/core/support/support.interfaces.ts b/src/interfaces/core/support/support.interfaces.ts index 123337f..c3a1cac 100644 --- a/src/interfaces/core/support/support.interfaces.ts +++ b/src/interfaces/core/support/support.interfaces.ts @@ -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"; diff --git a/src/interfaces/event-datas/actions/attack.action.ts b/src/interfaces/event-datas/actions/attack.action.ts index 9210317..b181fad 100644 --- a/src/interfaces/event-datas/actions/attack.action.ts +++ b/src/interfaces/event-datas/actions/attack.action.ts @@ -1,5 +1,5 @@ import type { Entity, GameObject } from "@world"; -import type { EntityManager } from "@" +import type { EntityManager } from "@core" export interface IAttackResult { /** diff --git a/src/interfaces/event-datas/iteractions-datas/iteractions-datas.interfaces.ts b/src/interfaces/event-datas/iteractions-datas/iteractions-datas.interfaces.ts index 100775a..e64de46 100644 --- a/src/interfaces/event-datas/iteractions-datas/iteractions-datas.interfaces.ts +++ b/src/interfaces/event-datas/iteractions-datas/iteractions-datas.interfaces.ts @@ -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"; diff --git a/src/interfaces/factories/base-factories-options.ts b/src/interfaces/factories/base-factories-options.ts index e654961..7809590 100644 --- a/src/interfaces/factories/base-factories-options.ts +++ b/src/interfaces/factories/base-factories-options.ts @@ -1,4 +1,4 @@ -import type { Game } from "@"; +import type { Game } from "@core"; export interface IBaseFactoriesOptions { /** diff --git a/src/interfaces/factories/iteractions-factory.ts b/src/interfaces/factories/iteractions-factory.ts index a06c7c1..5a0cbb3 100644 --- a/src/interfaces/factories/iteractions-factory.ts +++ b/src/interfaces/factories/iteractions-factory.ts @@ -1,4 +1,4 @@ -import type { Game } from "@"; +import type { Game } from "@core"; import type { IBaseFactoriesOptions } from "@interfaces"; import type { Entity, GameObject } from "@world"; diff --git a/src/interfaces/store/global-store.ts b/src/interfaces/store/global-store.ts index a0486f2..71a8232 100644 --- a/src/interfaces/store/global-store.ts +++ b/src/interfaces/store/global-store.ts @@ -1,4 +1,4 @@ -import type { Game } from "@"; +import type { Game } from "@core"; import type { CommandContext } from "@types"; export interface IGlobalStore { diff --git a/src/middlewares/entity/drop-item-guard.middleware.ts b/src/middlewares/entity/drop-item-guard.middleware.ts index 758edd7..173a33c 100644 --- a/src/middlewares/entity/drop-item-guard.middleware.ts +++ b/src/middlewares/entity/drop-item-guard.middleware.ts @@ -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"; diff --git a/src/middlewares/entity/open-chest-guard.middleare.ts b/src/middlewares/entity/open-chest-guard.middleare.ts index c2c170f..6c4bbab 100644 --- a/src/middlewares/entity/open-chest-guard.middleare.ts +++ b/src/middlewares/entity/open-chest-guard.middleare.ts @@ -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"; diff --git a/src/middlewares/entity/pickup-guard.middleare.ts b/src/middlewares/entity/pickup-guard.middleare.ts index 1e98cea..ac907e8 100644 --- a/src/middlewares/entity/pickup-guard.middleare.ts +++ b/src/middlewares/entity/pickup-guard.middleare.ts @@ -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"; diff --git a/src/plugins/async.plugin.ts b/src/plugins/async.plugin.ts index ba67699..9104ce5 100644 --- a/src/plugins/async.plugin.ts +++ b/src/plugins/async.plugin.ts @@ -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"; diff --git a/src/plugins/canvas.plugin.ts b/src/plugins/canvas.plugin.ts index d6a5fbe..ee0953e 100644 --- a/src/plugins/canvas.plugin.ts +++ b/src/plugins/canvas.plugin.ts @@ -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"; diff --git a/src/plugins/conflict-resolver.plugin.ts b/src/plugins/conflict-resolver.plugin.ts index 2115537..d4dd8b3 100644 --- a/src/plugins/conflict-resolver.plugin.ts +++ b/src/plugins/conflict-resolver.plugin.ts @@ -1,4 +1,4 @@ -import { Game } from "@"; +import { Game } from "@core"; import type { IPlugin } from "@interfaces"; import { CanvasPlugin, ConsolePlugin, GraphicPlugin } from "@plugins"; diff --git a/src/plugins/console.plugin.ts b/src/plugins/console.plugin.ts index f129315..4fcf328 100644 --- a/src/plugins/console.plugin.ts +++ b/src/plugins/console.plugin.ts @@ -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"; diff --git a/src/plugins/graphic.plugin.ts b/src/plugins/graphic.plugin.ts index 68e6758..d2b3374 100644 --- a/src/plugins/graphic.plugin.ts +++ b/src/plugins/graphic.plugin.ts @@ -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"; diff --git a/src/plugins/network.plgugin.ts b/src/plugins/network.plgugin.ts index 60aa7c2..4d56b12 100644 --- a/src/plugins/network.plgugin.ts +++ b/src/plugins/network.plgugin.ts @@ -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"; diff --git a/src/plugins/regenration.plugin.ts b/src/plugins/regenration.plugin.ts index 6eea0d9..55ef598 100644 --- a/src/plugins/regenration.plugin.ts +++ b/src/plugins/regenration.plugin.ts @@ -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"; diff --git a/src/types/callbacks/lifecycle-callbacks.types.ts b/src/types/callbacks/lifecycle-callbacks.types.ts index 859e999..ed82054 100644 --- a/src/types/callbacks/lifecycle-callbacks.types.ts +++ b/src/types/callbacks/lifecycle-callbacks.types.ts @@ -1,4 +1,4 @@ -import type { Game } from "@"; +import type { Game } from "@core"; import type { ICommand } from "@interfaces"; import type { CommandContext } from "@types"; diff --git a/src/types/callbacks/middleware-callback.type.ts b/src/types/callbacks/middleware-callback.type.ts index 1e51222..79a3466 100644 --- a/src/types/callbacks/middleware-callback.type.ts +++ b/src/types/callbacks/middleware-callback.type.ts @@ -1,4 +1,4 @@ -import type { Game } from "@"; +import type { Game } from "@core"; import type { ICommand } from "@interfaces"; import type { CommandContext } from "@types"; diff --git a/src/types/callbacks/plgunis-callbacks.types.ts b/src/types/callbacks/plgunis-callbacks.types.ts index f7c5643..662d895 100644 --- a/src/types/callbacks/plgunis-callbacks.types.ts +++ b/src/types/callbacks/plgunis-callbacks.types.ts @@ -1,4 +1,4 @@ -import type { IClient, ICommand } from "@interfaces"; +import type { IClient } from "@interfaces"; import type { Default } from "@types"; export type NetworkCallback = (event: string, data: Default) => void diff --git a/src/types/decorators/common-decorators.types.ts b/src/types/decorators/common-decorators.types.ts index 42f2ffe..c52b469 100644 --- a/src/types/decorators/common-decorators.types.ts +++ b/src/types/decorators/common-decorators.types.ts @@ -1,4 +1,4 @@ -import type { Game } from "@"; +import type { Game } from "@core"; import type { BaseMethodDecorator } from "@types"; /** diff --git a/src/utils/hooks/use-attack.hook.ts b/src/utils/hooks/use-attack.hook.ts index e483f84..ed5e86e 100644 --- a/src/utils/hooks/use-attack.hook.ts +++ b/src/utils/hooks/use-attack.hook.ts @@ -1,4 +1,4 @@ -import type { Game } from "@"; +import type { Game } from "@core"; import type { Entity, GameObject } from "@world"; import type { IDeadData } from "@interfaces"; diff --git a/src/utils/hooks/use-validation.hook.ts b/src/utils/hooks/use-validation.hook.ts index 49a20a0..00b1445 100644 --- a/src/utils/hooks/use-validation.hook.ts +++ b/src/utils/hooks/use-validation.hook.ts @@ -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"; diff --git a/src/utils/hooks/use-visibility.hook.ts b/src/utils/hooks/use-visibility.hook.ts index 96511bd..9ded2be 100644 --- a/src/utils/hooks/use-visibility.hook.ts +++ b/src/utils/hooks/use-visibility.hook.ts @@ -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"; diff --git a/src/utils/logic/extractors/middleware-extractors.ts b/src/utils/logic/extractors/middleware-extractors.ts index 7348e78..5374742 100644 --- a/src/utils/logic/extractors/middleware-extractors.ts +++ b/src/utils/logic/extractors/middleware-extractors.ts @@ -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"; diff --git a/src/world/entities/entity.ts b/src/world/entities/entity.ts index 329f5f4..247ccb3 100644 --- a/src/world/entities/entity.ts +++ b/src/world/entities/entity.ts @@ -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, diff --git a/src/world/entities/object.ts b/src/world/entities/object.ts index 842c416..b9685c8 100644 --- a/src/world/entities/object.ts +++ b/src/world/entities/object.ts @@ -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" diff --git a/src/world/map.ts b/src/world/map.ts index 14c5a09..b54a78b 100644 --- a/src/world/map.ts +++ b/src/world/map.ts @@ -1,4 +1,4 @@ -import { Game } from "@"; +import { Game, EntityManager } from "@core"; import { GameObjectEnum } from "@enums"; import type { IMovedData, @@ -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, diff --git a/test/collision.test.ts b/test/collision.test.ts index e75c3db..8e1ce5e 100644 --- a/test/collision.test.ts +++ b/test/collision.test.ts @@ -1,4 +1,4 @@ -import type { Game } from "@" +import type { Game } from "@core" import { createGame } from "@" import { CommandType, GameObjectEnum } from "@enums" import type { diff --git a/test/event.test.ts b/test/event.test.ts index 47eae60..b0387a5 100644 --- a/test/event.test.ts +++ b/test/event.test.ts @@ -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" diff --git a/test/iteraction.test.ts b/test/iteraction.test.ts index cb29d3d..8622321 100644 --- a/test/iteraction.test.ts +++ b/test/iteraction.test.ts @@ -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"; diff --git a/test/map.test.ts b/test/map.test.ts index 20bdb1c..ae3ce36 100644 --- a/test/map.test.ts +++ b/test/map.test.ts @@ -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" diff --git a/test/utils/wait-60-fps.ts b/test/utils/wait-60-fps.ts index 6e05fd4..97eb275 100644 --- a/test/utils/wait-60-fps.ts +++ b/test/utils/wait-60-fps.ts @@ -1,4 +1,4 @@ -import type { Game } from "@"; +import type { Game } from "@core"; /** * Util func for wait game in 60 fps diff --git a/tsconfig.json b/tsconfig.json index a08d6f2..68c95da 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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"],