@rpgjs/common 4.0.0-beta.1 → 4.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AbstractObject.js +7 -7
- package/lib/Event.js +1 -1
- package/lib/EventEmitter.js +1 -1
- package/lib/Game.js +6 -6
- package/lib/Hit.js +1 -1
- package/lib/Map.js +5 -5
- package/lib/Module.js +3 -3
- package/lib/Player.js +1 -1
- package/lib/Plugin.js +2 -2
- package/lib/Scheduler.js +2 -2
- package/lib/Shape.js +2 -2
- package/lib/index.js +21 -21
- package/lib/workers/move.js +3 -3
- package/package.json +6 -8
- package/src/AbstractObject.ts +915 -0
- package/src/Color.ts +29 -0
- package/src/DefaultInput.ts +26 -0
- package/src/Event.ts +3 -0
- package/src/EventEmitter.ts +52 -0
- package/src/Game.ts +150 -0
- package/src/Hit.ts +70 -0
- package/src/Logger.ts +7 -0
- package/src/Map.ts +335 -0
- package/src/Module.ts +108 -0
- package/src/Player.ts +28 -0
- package/src/Plugin.ts +91 -0
- package/src/Scheduler.ts +88 -0
- package/src/Shape.ts +300 -0
- package/src/Utils.ts +168 -0
- package/src/Vector2d.ts +70 -0
- package/src/VirtualGrid.ts +78 -0
- package/src/Worker.ts +17 -0
- package/src/WorldMaps.ts +204 -0
- package/src/gui/PrebuiltGui.ts +27 -0
- package/src/index.ts +23 -0
- package/src/transports/io.ts +91 -0
- package/src/workers/move.ts +61 -0
- package/tsconfig.json +25 -0
package/lib/AbstractObject.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { intersection, generateUID, toRadians, isInstanceOf } from './Utils';
|
|
2
|
-
import { Hit, HitType } from './Hit';
|
|
3
|
-
import { RpgShape } from './Shape';
|
|
1
|
+
import { intersection, generateUID, toRadians, isInstanceOf } from './Utils.js';
|
|
2
|
+
import { Hit, HitType } from './Hit.js';
|
|
3
|
+
import { RpgShape } from './Shape.js';
|
|
4
4
|
import SAT from 'sat';
|
|
5
|
-
import { RpgCommonMap } from './Map';
|
|
6
|
-
import { RpgPlugin, HookServer } from './Plugin';
|
|
7
|
-
import { GameSide } from './Game';
|
|
8
|
-
import { Vector2d, Vector2dZero } from './Vector2d';
|
|
5
|
+
import { RpgCommonMap } from './Map.js';
|
|
6
|
+
import { RpgPlugin, HookServer } from './Plugin.js';
|
|
7
|
+
import { GameSide } from './Game.js';
|
|
8
|
+
import { Vector2d, Vector2dZero } from './Vector2d.js';
|
|
9
9
|
import { Behavior, Direction, MoveClientMode, PlayerType } from '@rpgjs/types';
|
|
10
10
|
import { from, map, mergeMap, Subject, tap, takeUntil } from 'rxjs';
|
|
11
11
|
const ACTIONS = { IDLE: 0, RUN: 1, ACTION: 2 };
|
package/lib/Event.js
CHANGED
package/lib/EventEmitter.js
CHANGED
package/lib/Game.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { generateUID, isClass } from './Utils';
|
|
2
|
-
import { EventEmitter } from './EventEmitter';
|
|
3
|
-
import { RpgCommonPlayer } from './Player';
|
|
1
|
+
import { generateUID, isClass } from './Utils.js';
|
|
2
|
+
import { EventEmitter } from './EventEmitter.js';
|
|
3
|
+
import { RpgCommonPlayer } from './Player.js';
|
|
4
4
|
import { Control, Direction } from '@rpgjs/types';
|
|
5
|
-
import { RpgPlugin } from './Plugin';
|
|
6
|
-
import { GameWorker } from './Worker';
|
|
7
|
-
import { RpgShape } from './Shape';
|
|
5
|
+
import { RpgPlugin } from './Plugin.js';
|
|
6
|
+
import { GameWorker } from './Worker.js';
|
|
7
|
+
import { RpgShape } from './Shape.js';
|
|
8
8
|
export var GameSide;
|
|
9
9
|
(function (GameSide) {
|
|
10
10
|
GameSide["Server"] = "server";
|
package/lib/Hit.js
CHANGED
package/lib/Map.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import Utils, { random, generateUID } from './Utils';
|
|
2
|
-
import { RpgShape } from './Shape';
|
|
3
|
-
import { Hit } from './Hit';
|
|
4
|
-
import { VirtualGrid } from './VirtualGrid';
|
|
1
|
+
import Utils, { random, generateUID } from './Utils.js';
|
|
2
|
+
import { RpgShape } from './Shape.js';
|
|
3
|
+
import { Hit } from './Hit.js';
|
|
4
|
+
import { VirtualGrid } from './VirtualGrid.js';
|
|
5
5
|
import { MapClass } from '@rpgjs/tiled';
|
|
6
|
-
import { AbstractObject } from './AbstractObject';
|
|
6
|
+
import { AbstractObject } from './AbstractObject.js';
|
|
7
7
|
import { map, Subject, takeUntil, mergeMap, from, filter } from 'rxjs';
|
|
8
8
|
const buffer = new Map();
|
|
9
9
|
const bufferClient = new Map();
|
package/lib/Module.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RpgPlugin, HookServer, HookClient } from './Plugin';
|
|
2
|
-
import { isArray, isClass, isFunction, isPromise } from './Utils';
|
|
3
|
-
import { warning } from './Logger';
|
|
1
|
+
import { RpgPlugin, HookServer, HookClient } from './Plugin.js';
|
|
2
|
+
import { isArray, isClass, isFunction, isPromise } from './Utils.js';
|
|
3
|
+
import { warning } from './Logger.js';
|
|
4
4
|
var Side;
|
|
5
5
|
(function (Side) {
|
|
6
6
|
Side["Server"] = "server";
|
package/lib/Player.js
CHANGED
package/lib/Plugin.js
CHANGED
package/lib/Scheduler.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BehaviorSubject } from 'rxjs';
|
|
2
|
-
import { EventEmitter } from './EventEmitter';
|
|
3
|
-
import Utils from './Utils';
|
|
2
|
+
import { EventEmitter } from './EventEmitter.js';
|
|
3
|
+
import Utils from './Utils.js';
|
|
4
4
|
export class Scheduler extends EventEmitter {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
package/lib/Shape.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Hit, HitType } from './Hit';
|
|
1
|
+
import { Hit, HitType } from './Hit.js';
|
|
2
2
|
import { TiledObjectClass } from '@rpgjs/tiled';
|
|
3
3
|
import { PlayerType } from '@rpgjs/types';
|
|
4
|
-
import { Vector2d } from './Vector2d';
|
|
4
|
+
import { Vector2d } from './Vector2d.js';
|
|
5
5
|
export var ShapePositioning;
|
|
6
6
|
(function (ShapePositioning) {
|
|
7
7
|
ShapePositioning["Default"] = "default";
|
package/lib/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
export { LiteralDirection, RpgCommonPlayer } from './Player';
|
|
2
|
-
export { AbstractObject } from './AbstractObject';
|
|
3
|
-
export { RpgCommonEvent } from './Event';
|
|
4
|
-
export { RpgCommonMap } from './Map';
|
|
5
|
-
export { RpgCommonGame, GameSide } from './Game';
|
|
6
|
-
export { EventEmitter } from './EventEmitter';
|
|
7
|
-
export { PrebuiltGui } from './gui/PrebuiltGui';
|
|
8
|
-
export * as Utils from './Utils';
|
|
9
|
-
export { RpgPlugin, HookServer, HookClient } from './Plugin';
|
|
10
|
-
export * as TransportIo from './transports/io';
|
|
1
|
+
export { LiteralDirection, RpgCommonPlayer } from './Player.js';
|
|
2
|
+
export { AbstractObject } from './AbstractObject.js';
|
|
3
|
+
export { RpgCommonEvent } from './Event.js';
|
|
4
|
+
export { RpgCommonMap } from './Map.js';
|
|
5
|
+
export { RpgCommonGame, GameSide } from './Game.js';
|
|
6
|
+
export { EventEmitter } from './EventEmitter.js';
|
|
7
|
+
export { PrebuiltGui } from './gui/PrebuiltGui.js';
|
|
8
|
+
export * as Utils from './Utils.js';
|
|
9
|
+
export { RpgPlugin, HookServer, HookClient } from './Plugin.js';
|
|
10
|
+
export * as TransportIo from './transports/io.js';
|
|
11
11
|
export { Input, Control } from '@rpgjs/types';
|
|
12
|
-
export { Hit } from './Hit';
|
|
13
|
-
export { Scheduler } from './Scheduler';
|
|
14
|
-
export { RpgModule, loadModules } from './Module';
|
|
15
|
-
export * as MockIo from './transports/io';
|
|
16
|
-
export * as Logger from './Logger';
|
|
17
|
-
export { RpgShape, ShapePositioning } from './Shape';
|
|
18
|
-
export { VirtualGrid } from './VirtualGrid';
|
|
19
|
-
export { RpgCommonWorldMaps } from './WorldMaps';
|
|
20
|
-
export { Vector2d } from './Vector2d';
|
|
12
|
+
export { Hit } from './Hit.js';
|
|
13
|
+
export { Scheduler } from './Scheduler.js';
|
|
14
|
+
export { RpgModule, loadModules } from './Module.js';
|
|
15
|
+
export * as MockIo from './transports/io.js';
|
|
16
|
+
export * as Logger from './Logger.js';
|
|
17
|
+
export { RpgShape, ShapePositioning } from './Shape.js';
|
|
18
|
+
export { VirtualGrid } from './VirtualGrid.js';
|
|
19
|
+
export { RpgCommonWorldMaps } from './WorldMaps.js';
|
|
20
|
+
export { Vector2d } from './Vector2d.js';
|
|
21
21
|
export { Direction } from '@rpgjs/types';
|
|
22
|
-
export { transitionColor } from './Color';
|
|
23
|
-
export { DefaultInput } from './DefaultInput';
|
|
22
|
+
export { transitionColor } from './Color.js';
|
|
23
|
+
export { DefaultInput } from './DefaultInput.js';
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
package/lib/workers/move.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import workerpool from 'workerpool';
|
|
2
|
-
import { RpgCommonMap } from '../Map';
|
|
3
|
-
import { RpgCommonGame, GameSide } from '../Game';
|
|
4
|
-
import { RpgCommonPlayer } from '../Player';
|
|
2
|
+
import { RpgCommonMap } from '../Map.js';
|
|
3
|
+
import { RpgCommonGame, GameSide } from '../Game.js';
|
|
4
|
+
import { RpgCommonPlayer } from '../Player.js';
|
|
5
5
|
const objects = {};
|
|
6
6
|
let objectsByMap = {};
|
|
7
7
|
const gameEngine = new RpgCommonGame(GameSide.Worker);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpgjs/common",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -11,22 +11,20 @@
|
|
|
11
11
|
"build": "tsc",
|
|
12
12
|
"watch": "tsc -w"
|
|
13
13
|
},
|
|
14
|
-
"files": [
|
|
15
|
-
"lib"
|
|
16
|
-
],
|
|
17
14
|
"keywords": [],
|
|
18
15
|
"author": "Samuel Ronce",
|
|
19
16
|
"license": "MIT",
|
|
20
17
|
"dependencies": {
|
|
21
|
-
"@rpgjs/tiled": "^4.0.0-beta.
|
|
22
|
-
"@rpgjs/types": "^4.0.0-beta.
|
|
18
|
+
"@rpgjs/tiled": "^4.0.0-beta.4",
|
|
19
|
+
"@rpgjs/types": "^4.0.0-beta.4",
|
|
23
20
|
"rbush": "^3.0.1",
|
|
24
21
|
"rxjs": "^7.8.0",
|
|
25
22
|
"sat": "^0.9.0",
|
|
26
23
|
"workerpool": "^6.4.0"
|
|
27
24
|
},
|
|
28
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "20c8697cc462bf2a1811bc0ff288dc421f8234f3",
|
|
29
26
|
"devDependencies": {
|
|
30
27
|
"typescript": "^5.0.4"
|
|
31
|
-
}
|
|
28
|
+
},
|
|
29
|
+
"type": "module"
|
|
32
30
|
}
|