diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index 16e6f01..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "resources/3rd/SpriteGL"]
- path = resources/3rd/SpriteGL
- url = https://github.com/RemoveIt/SpriteGL.git
diff --git a/Interchange/DataStructures.ts b/Interchange/DataStructures.ts
index f19cba7..99b3745 100644
--- a/Interchange/DataStructures.ts
+++ b/Interchange/DataStructures.ts
@@ -1,10 +1,10 @@
-const enum Rotation { Down, Top, Right, Left };
+export const enum Rotation { Down, Top, Right, Left };
-interface Vector2D { x: number; y: number; }
+export interface Vector2D { x: number; y: number; }
-interface MoveData { Rot: Rotation; Pos: Vector2D }
+export interface MoveData { Rot: Rotation; Pos: Vector2D }
-interface NewCharacterData {
+export interface NewCharacterData {
Position: Vector2D;
Race: string;
ID: string;
@@ -15,7 +15,7 @@ interface NewCharacterData {
Level: number;
}
-interface Config {
+export interface Config {
TileSize: number;
MapWidth: number;
MapHeight: number;
@@ -39,12 +39,12 @@ interface Config {
Collision: number[];
};
-interface SpawnData {
+export interface SpawnData {
Position: Vector2D;
Count: number
}
-interface MobData {
+export interface MobData {
AliveSprites: number[];
DeadSprites: number[];
Experience: number;
diff --git a/README.md b/README.md
index e2ff0c1..284279e 100644
--- a/README.md
+++ b/README.md
@@ -3,16 +3,9 @@
### Requirements
* Node 8+
-
### How to run
* `git clone https://github.com/RemoveIt/TibiaJS.git`
* `cd TibiaJS`
-* `git submodule init`
-* `git submodule update`
* `npm install`
* `npm run build`
-* `npm run run` or `cd Out` & `node Server.js`
-
-### How to update cloned repo
-* `git pull origin master`
-* `git submodule foreach git pull origin master`
+* `npm run run` or `cd out/` & `node Server.js`
diff --git a/client/BasicComponents.ts b/client/BasicComponents.ts
index d864ed9..d596c79 100644
--- a/client/BasicComponents.ts
+++ b/client/BasicComponents.ts
@@ -1,6 +1,7 @@
import {IComponent} from "./Game";
import {config} from "./Init";
import {GameObj} from "./GameObj";
+import {Vector2D, Rotation} from "../Interchange/DataStructures";
export const enum Componenets {
Position = 1, Movement = 2, Sprite = 4, CharacterAnimation = 8,
diff --git a/client/Init.ts b/client/Init.ts
index 4aa19e5..991c85e 100644
--- a/client/Init.ts
+++ b/client/Init.ts
@@ -1,7 +1,6 @@
-///
-///
-
+///
+import {Config} from "../Interchange/DataStructures";
import {RenderingSystem} from "./Systems/RenderingSystem";
import {AnimationSystem} from "./Systems/AnimationSystem";
import {NetworkSystem} from "./Systems/NetworkSystem";
@@ -13,6 +12,7 @@ import {GameObj} from "./GameObj";
import {PositionComponent, RenderMapComponent} from "./BasicComponents";
import {World} from "./World";
import {GetFPS, loadImage} from "./Misc";
+import SpritesURL from "../resources/sprites.png";
export var config: Config;
@@ -28,12 +28,12 @@ window.onload = function () {
var world = new World();
- const configPromise = fetch("data.json").then(response => response.json());
- const spritePromise = loadImage("sprites.png");
+ const configPromise = import("../resources/data.json");
+ const spritePromise = loadImage(SpritesURL);
Promise.all([configPromise, spritePromise])
.then(([configData, sprites]) => {
- config = configData;
+ config = configData.default as Config;
const canvas = document.getElementById("GameCanvas");
renderingSystem = new RenderingSystem(canvas, sprites);
diff --git a/client/Misc.ts b/client/Misc.ts
index 08e5751..f4d54e2 100644
--- a/client/Misc.ts
+++ b/client/Misc.ts
@@ -1,4 +1,6 @@
-export function GET(path: string, fn: (err, res) => void) {
+import {Vector2D} from "../Interchange/DataStructures";
+
+export function GET(path: string, fn: (err, res) => void) {
var req = new XMLHttpRequest();
req.open("GET", path, true);
req.send();
diff --git a/client/SpriteDrawer.ts b/client/SpriteDrawer.ts
index 9a496d0..30c40e7 100644
--- a/client/SpriteDrawer.ts
+++ b/client/SpriteDrawer.ts
@@ -1,8 +1,9 @@
import {config} from "./Init";
+import {SpriteRenderer} from "SpriteGL";
class SpriteDrawer {
- renderer: SpriteGL.SpriteRenderer;
- constructor(renderer: SpriteGL.SpriteRenderer) {
+ renderer: SpriteRenderer;
+ constructor(renderer: SpriteRenderer) {
this.renderer = renderer;
}
diff --git a/client/Systems/AnimationSystem.ts b/client/Systems/AnimationSystem.ts
index ad34ced..9ba6581 100644
--- a/client/Systems/AnimationSystem.ts
+++ b/client/Systems/AnimationSystem.ts
@@ -8,6 +8,7 @@ import {
} from "../BasicComponents";
import {GameObj} from "../GameObj";
import {World} from "../World";
+import {Rotation} from "../../Interchange/DataStructures";
export class AnimationSystem implements ISystem {
private tick = 1;
diff --git a/client/Systems/CameraSystem.ts b/client/Systems/CameraSystem.ts
index 63a710b..77d6e8b 100644
--- a/client/Systems/CameraSystem.ts
+++ b/client/Systems/CameraSystem.ts
@@ -1,6 +1,7 @@
import {ISystem} from "../Game";
import {Componenets, PositionComponent} from "../BasicComponents";
import {World} from "../World";
+import {Vector2D} from "../../Interchange/DataStructures";
export class CameraSystem implements ISystem {
private cameraPosList = new Array();
diff --git a/client/Systems/InputSystem.ts b/client/Systems/InputSystem.ts
index c7595eb..2f1a449 100644
--- a/client/Systems/InputSystem.ts
+++ b/client/Systems/InputSystem.ts
@@ -3,6 +3,7 @@ import {Componenets, HealthComponent, InputComponent, MovementComponent, Positio
import {GameObj} from "../GameObj";
import {config} from "../Init";
import {Events, World} from "../World";
+import {Rotation, Vector2D} from "../../Interchange/DataStructures";
export class InputSystem implements ISystem {
private keys = new Array(200);
diff --git a/client/Systems/NetworkSystem.ts b/client/Systems/NetworkSystem.ts
index c9abd07..66ca96c 100644
--- a/client/Systems/NetworkSystem.ts
+++ b/client/Systems/NetworkSystem.ts
@@ -11,6 +11,7 @@
import {config} from "../Init";
import {GameObj} from "../GameObj";
import {Events, World} from "../World";
+import {NewCharacterData, Rotation, MoveData} from "../../Interchange/DataStructures";
export class NetworkSystem {
private socket: SocketIOClient.Socket;
diff --git a/client/Systems/RenderingSystem.ts b/client/Systems/RenderingSystem.ts
index 1ba621c..10ddd05 100644
--- a/client/Systems/RenderingSystem.ts
+++ b/client/Systems/RenderingSystem.ts
@@ -1,4 +1,5 @@
-import {
+import SpriteGL, {SpriteRenderer} from "SpriteGL";
+import {
CharacterMessageComponent,
Componenets,
HealthComponent,
@@ -8,9 +9,10 @@
import {config} from "../Init";
import {ISystem} from "../Game";
import {Events, World} from "../World";
+import {Vector2D} from "../../Interchange/DataStructures";
export class RenderingSystem implements ISystem {
- private renderer: SpriteGL.SpriteRenderer;
+ private renderer: SpriteRenderer;
private mapsToRender = new Array<{ position: PositionComponent; map: RenderMapComponent; }>();
private dmgTxtList = new Array<{ txtObj; position: Vector2D, lifeTime: number }>();
constructor(canvas: HTMLCanvasElement, textureAtlas: HTMLImageElement) {
diff --git a/client/index.html b/client/index.html
index 13ea196..cb553b5 100644
--- a/client/index.html
+++ b/client/index.html
@@ -64,8 +64,7 @@
-
-
-
+
+