@rpgjs/server 3.0.0-beta.2 → 3.0.0-beta.5
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/Game/Map.d.ts +87 -8
- package/lib/Game/Map.js +105 -10
- package/lib/Game/Map.js.map +1 -1
- package/lib/Player/BattleManager.d.ts +1 -1
- package/lib/Player/BattleManager.js.map +1 -1
- package/lib/Player/ElementManager.d.ts +1 -1
- package/lib/Player/GuiManager.d.ts +46 -0
- package/lib/Player/GuiManager.js +57 -0
- package/lib/Player/GuiManager.js.map +1 -1
- package/lib/Player/MoveManager.d.ts +5 -5
- package/lib/Player/MoveManager.js +6 -12
- package/lib/Player/MoveManager.js.map +1 -1
- package/lib/Player/Player.d.ts +98 -38
- package/lib/Player/Player.js +127 -43
- package/lib/Player/Player.js.map +1 -1
- package/lib/Query.d.ts +3 -0
- package/lib/Query.js +4 -5
- package/lib/Query.js.map +1 -1
- package/lib/RpgServer.d.ts +59 -4
- package/lib/Scenes/Map.d.ts +31 -1
- package/lib/Scenes/Map.js +54 -13
- package/lib/Scenes/Map.js.map +1 -1
- package/lib/decorators/map.d.ts +4 -5
- package/lib/decorators/map.js +4 -0
- package/lib/decorators/map.js.map +1 -1
- package/lib/entry-point.d.ts +1 -0
- package/lib/entry-point.js +6 -2
- package/lib/entry-point.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/server.d.ts +47 -3
- package/lib/server.js +99 -14
- package/lib/server.js.map +1 -1
- package/lib/workers/move.d.ts +2 -0
- package/lib/workers/move.js +8 -0
- package/lib/workers/move.js.map +1 -0
- package/package.json +6 -5
package/lib/Scenes/Map.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
2
8
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
9
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
10
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -12,7 +18,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
18
|
exports.SceneMap = void 0;
|
|
13
19
|
const common_1 = require("@rpgjs/common");
|
|
14
20
|
const sync_server_1 = require("@rpgjs/sync-server");
|
|
15
|
-
const
|
|
21
|
+
const map_1 = require("../decorators/map");
|
|
22
|
+
const Map_1 = require("../Game/Map");
|
|
16
23
|
class SceneMap {
|
|
17
24
|
constructor(maps, server) {
|
|
18
25
|
this.maps = maps;
|
|
@@ -21,16 +28,18 @@ class SceneMap {
|
|
|
21
28
|
this.mapsById = {};
|
|
22
29
|
if (this.maps) {
|
|
23
30
|
for (let map of this.maps) {
|
|
24
|
-
this.
|
|
31
|
+
this.createDynamicMap(map);
|
|
25
32
|
}
|
|
26
33
|
}
|
|
27
34
|
}
|
|
28
35
|
getMapBydId(id) {
|
|
29
|
-
|
|
36
|
+
let mapClass = this.mapsById[id];
|
|
30
37
|
if (!mapClass) {
|
|
31
38
|
console.log(`Map ${id} not exists`);
|
|
32
39
|
return false;
|
|
33
40
|
}
|
|
41
|
+
if (!common_1.Utils.isClass(mapClass))
|
|
42
|
+
mapClass = common_1.Utils.createConstructor(mapClass);
|
|
34
43
|
return mapClass;
|
|
35
44
|
}
|
|
36
45
|
loadMap(id) {
|
|
@@ -50,16 +59,50 @@ class SceneMap {
|
|
|
50
59
|
return mapInstance;
|
|
51
60
|
});
|
|
52
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Create a dynamic map
|
|
64
|
+
*
|
|
65
|
+
* @method sceneMap.createDynamicMap(mapData)
|
|
66
|
+
* @title Create a dynamic map
|
|
67
|
+
* @param {object | RpgMap} mapData The same property as [@MapData decorator](https://docs.rpgjs.dev/classes/map.html#mapdata-decorator)
|
|
68
|
+
* @returns {void}
|
|
69
|
+
* @since 3.0.0-beta.4
|
|
70
|
+
* @memberof SceneMap
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* sceneMap.createDynamicMap({
|
|
74
|
+
* id: 'myid',
|
|
75
|
+
* file: require('./tmx/mymap.tmx')
|
|
76
|
+
* })
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* And later, on the player:
|
|
80
|
+
*
|
|
81
|
+
* ```ts
|
|
82
|
+
* player.changeMap('myid')
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
createDynamicMap(mapData) {
|
|
86
|
+
if (!common_1.Utils.isClass(mapData)) {
|
|
87
|
+
let DynamicMap = class DynamicMap extends Map_1.RpgMap {
|
|
88
|
+
};
|
|
89
|
+
DynamicMap = __decorate([
|
|
90
|
+
map_1.MapData(mapData)
|
|
91
|
+
], DynamicMap);
|
|
92
|
+
mapData = DynamicMap;
|
|
93
|
+
}
|
|
94
|
+
mapData.id = mapData.id || common_1.Utils.generateUID();
|
|
95
|
+
this.mapsById[mapData.id] = mapData;
|
|
96
|
+
}
|
|
53
97
|
changeMap(mapId, player, positions) {
|
|
54
98
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
99
|
player.prevMap = player.map;
|
|
56
|
-
player.map = mapId;
|
|
57
|
-
player.events = [];
|
|
58
100
|
if (player.prevMap) {
|
|
101
|
+
player.execMethod('onLeaveMap', [player.getCurrentMap()]);
|
|
59
102
|
sync_server_1.World.leaveRoom(player.prevMap, player.id);
|
|
60
|
-
player.execMethod('onLeave', [player], player.mapInstance);
|
|
61
|
-
player.execMethod('onLeaveMap', [player.mapInstance]);
|
|
62
103
|
}
|
|
104
|
+
player.map = mapId;
|
|
105
|
+
player.events = [];
|
|
63
106
|
const mapInstance = yield this.loadMap(mapId);
|
|
64
107
|
if (!player.height)
|
|
65
108
|
player.height = mapInstance.tileHeight;
|
|
@@ -79,12 +122,10 @@ class SceneMap {
|
|
|
79
122
|
player.loadScene('map', Object.assign({ id: mapId, sounds: mapInstance.sounds }, serializeMap));
|
|
80
123
|
sync_server_1.World.joinRoom(mapId, player.id);
|
|
81
124
|
player = sync_server_1.World.getUser(player.id);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
for (let key in player.events) {
|
|
87
|
-
player.events[key].execMethod('onInit', [player]);
|
|
125
|
+
if (player) {
|
|
126
|
+
player.teleport(positions || 'start');
|
|
127
|
+
player.createDynamicEvent(mapInstance._events, false);
|
|
128
|
+
player.execMethod('onJoinMap', [mapInstance]);
|
|
88
129
|
}
|
|
89
130
|
return mapInstance;
|
|
90
131
|
});
|
package/lib/Scenes/Map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Map.js","sourceRoot":"","sources":["../../src/Scenes/Map.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Map.js","sourceRoot":"","sources":["../../src/Scenes/Map.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,0CAAmD;AACnD,oDAA0C;AAC1C,2CAAuD;AACvD,qCAAoC;AAGpC,MAAa,QAAQ;IAMjB,YAAoB,IAAW,EAAU,MAAW;QAAhC,SAAI,GAAJ,IAAI,CAAO;QAAU,WAAM,GAAN,MAAM,CAAK;QAF5C,aAAQ,GAAW,EAAE,CAAA;QAGzB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAA;QAClB,IAAI,IAAI,CAAC,IAAI,EAAE;YACX,KAAK,IAAI,G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,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,qBAAY,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAA;YAC9E,OAAO,YAAY,CAAC,MAAM,CAAA;YAC1B,OAAO,YAAY,CAAC,MAAM,CAAA;YAC1B,OAAO,YAAY,CAAC,OAAO,CAAA;YAE3B,KAAK,IAAI,KAAK,IAAI,YAAY,CAAC,MAAM,EAAE;gBACnC,OAAO,KAAK,CAAC,GAAG,CAAA;aACnB;YAED,MAAM,CAAC,SAAS,CAAC,KAAK,kBAClB,EAAE,EAAE,KAAK,EACT,MAAM,EAAE,WAAW,CAAC,MAAM,IACvB,YAAY,EACjB,CAAA;YAEF,mBAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;YAEhC,MAAM,GAAG,mBAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAc,CAAA;YAE9C,IAAI,MAAM,EAAE;gBACR,MAAM,CAAC,QAAQ,CAAC,SAAS,IAAI,OAAO,CAAC,CAAA;gBACrC,MAAM,CAAC,kBAAkB,CAAM,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;gBAC1D,MAAM,CAAC,UAAU,CAAC,WAAW,EAAO,CAAC,WAAW,CAAC,CAAC,CAAA;aACrD;YAED,OAAO,WAAW,CAAA;QACtB,CAAC;KAAA;;AA7HL,4BA8HC;AA5HmB,WAAE,GAAW,KAAK,CAAA"}
|
package/lib/decorators/map.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
interface MapOptions {
|
|
1
|
+
export interface MapOptions {
|
|
2
2
|
/**
|
|
3
3
|
* Map identifier. Allows to go to the map (for example with player.changeMap())
|
|
4
4
|
*
|
|
5
|
-
* @prop {string} id
|
|
5
|
+
* @prop {string} [id]
|
|
6
6
|
* @memberof MapData
|
|
7
7
|
* */
|
|
8
|
-
id
|
|
8
|
+
id?: string;
|
|
9
9
|
/**
|
|
10
10
|
* the path to the .tmx file (Tiled Map Editor)
|
|
11
11
|
*
|
|
@@ -58,7 +58,7 @@ interface MapOptions {
|
|
|
58
58
|
* events: [{ event: NpcEvent, x: 10, y: 30 }]
|
|
59
59
|
* ```
|
|
60
60
|
*
|
|
61
|
-
* @prop {
|
|
61
|
+
* @prop {Class of RpgEvent[] | { event: Class RpgEvent, x: number, y: number }} [events]
|
|
62
62
|
* @memberof MapData
|
|
63
63
|
* */
|
|
64
64
|
events?: {
|
|
@@ -158,4 +158,3 @@ interface MapOptions {
|
|
|
158
158
|
syncSchema?: any;
|
|
159
159
|
}
|
|
160
160
|
export declare function MapData(options: MapOptions): (target: any) => void;
|
|
161
|
-
export {};
|
package/lib/decorators/map.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.js","sourceRoot":"","sources":["../../src/decorators/map.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAmK5C,SAAgB,OAAO,CAAC,OAAmB;IACvC,OAAO,CAAC,MAAM,EAAE,EAAE;QACd,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;QAC1B,MAAM,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,CAAA;QACtB,MAAM,CAAC,IAAI,GAAG,KAAK,CAAA;QACnB,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;QACpC,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;QACpC,MAAM,CAAC,SAAS,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,CAAA;QAChC,MAAM,CAAC,SAAS,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAExC,MAAM,CAAC,SAAS,CAAC,OAAO,GAAG,EAAE,CAAA;QAE7B,IAAI,OAAO,CAAC,UAAU,EAAE;YACpB,MAAM,CAAC,SAAS,CAAC,OAAO,GAAG,OAAO,CA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14 @@ function default_1(modules, options) {
|
|
|
13
13
|
onLeaveMap: common_1.HookServer.PlayerLeaveMap,
|
|
14
14
|
onLevelUp: common_1.HookServer.PlayerLevelUp,
|
|
15
15
|
onDead: common_1.HookServer.PlayerDead,
|
|
16
|
-
onDisconnected: common_1.HookServer.PlayerDisconnected
|
|
16
|
+
onDisconnected: common_1.HookServer.PlayerDisconnected,
|
|
17
|
+
onInShape: common_1.HookServer.PlayerInShape,
|
|
18
|
+
onOutShape: common_1.HookServer.PlayerOutShape,
|
|
19
|
+
onMove: common_1.HookServer.PlayerMove
|
|
17
20
|
};
|
|
18
21
|
const relationsEngine = {
|
|
19
|
-
onStart: common_1.HookServer.Start
|
|
22
|
+
onStart: common_1.HookServer.Start,
|
|
23
|
+
onStep: common_1.HookServer.Step
|
|
20
24
|
};
|
|
21
25
|
common_1.loadModules(modules, {
|
|
22
26
|
side: 'server',
|
package/lib/entry-point.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-point.js","sourceRoot":"","sources":["../src/entry-point.ts"],"names":[],"mappings":";;AAAA,0CAAkF;AAClF,qCAA0C;
|
|
1
|
+
{"version":3,"file":"entry-point.js","sourceRoot":"","sources":["../src/entry-point.ts"],"names":[],"mappings":";;AAAA,0CAAkF;AAClF,qCAA0C;AAmC1C,mBAAwB,OAAqB,EAAE,OAAmC;IAC9E,MAAM,UAAU,GAAG,IAAI,sBAAa,CAAC,QAAQ,CAAC,CAAA;IAE9C,IAAI,CAAC,OAAO,CAAC,YAAY;QAAE,OAAO,CAAC,YAAY,GAAG,EAAE,CAAA;IAEpD,MAAM,SAAS,GAAG;QACd,WAAW,EAAE,mBAAU,CAAC,eAAe;QACvC,OAAO,EAAE,mBAAU,CAAC,WAAW;QAC/B,SAAS,EAAE,mBAAU,CAAC,aAAa;QACnC,UAAU,EAAE,mBAAU,CAAC,cAAc;QACrC,SAAS,EAAE,mBAAU,CAAC,aAAa;QACnC,MAAM,EAAE,mBAAU,CAAC,UAAU;QAC7B,cAAc,EAAE,mBAAU,CAAC,kBAAkB;QAC7C,SAAS,EAAE,mBAAU,CAAC,aAAa;QACnC,UAAU,EAAE,mBAAU,CAAC,cAAc;QACrC,MAAM,EAAE,mBAAU,CAAC,UAAU;KAChC,CAAA;IAED,MAAM,eAAe,GAAG;QACpB,OAAO,EAAE,mBAAU,CAAC,KAAK;QACzB,MAAM,EAAE,mBAAU,CAAC,IAAI;KAC1B,CAAA;IAED,oBAAW,CAAC,OAAO,EAAE;QACjB,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE;YACP,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,eAAe;SAC1B;KACJ,CAAC,CAAA;IAEF,MAAM,YAAY,GAAG,IAAI,wBAAe,CAAC,OAAO,CAAC,EAAE,EAAE,UAAU,kBAC3D,KAAK,EAAE,EAAE,EACT,UAAU,EAAE,EAAE,EACd,QAAQ,EAAE,EAAE,EACZ,eAAe,EAAE,CAAC,EAClB,gBAAgB,EAAE,KAAK,IACpB,OAAO,EACZ,CAAA;IACF,OAAO,YAAY,CAAA;AACvB,CAAC;AAxCD,4BAwCC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import entryPoint from './entry-point';
|
|
2
|
-
import { Direction, Input, Control, RpgPlugin, HookServer, HookClient, RpgModule } from '@rpgjs/common';
|
|
2
|
+
import { Direction, Input, Control, RpgPlugin, HookServer, HookClient, RpgModule, RpgShape, ShapePositioning } from '@rpgjs/common';
|
|
3
3
|
import { RpgServer, RpgPlayerHooks, RpgServerEngineHooks } from './RpgServer';
|
|
4
4
|
import { EventData } from './decorators/event';
|
|
5
5
|
import { MapData } from './decorators/map';
|
|
@@ -12,4 +12,4 @@ import Monitor from './Monitor';
|
|
|
12
12
|
import * as Presets from './presets';
|
|
13
13
|
import { Move } from './Player/MoveManager';
|
|
14
14
|
import { RpgServerEngine } from './server';
|
|
15
|
-
export { RpgServer, RpgEvent, RpgPlayer, RpgPlugin, RpgMap, RpgEnemy, MapData, EventData, Query as RpgWorld, Query, entryPoint, Presets, Monitor, Move, EventMode, Direction, Input, Control, HookServer, HookClient, RpgModule, RpgPlayerHooks, RpgServerEngineHooks, RpgServerEngine };
|
|
15
|
+
export { RpgServer, RpgEvent, RpgPlayer, RpgPlugin, RpgMap, RpgEnemy, MapData, EventData, Query as RpgWorld, Query, entryPoint, Presets, Monitor, Move, EventMode, Direction, Input, Control, HookServer, HookClient, RpgModule, RpgPlayerHooks, RpgServerEngineHooks, RpgServerEngine, RpgShape, ShapePositioning };
|
package/lib/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.RpgServerEngine = exports.RpgModule = exports.HookClient = exports.HookServer = exports.Control = exports.Input = exports.Direction = exports.EventMode = exports.Move = exports.Monitor = exports.Presets = exports.entryPoint = exports.Query = exports.RpgWorld = exports.EventData = exports.MapData = exports.RpgEnemy = exports.RpgMap = exports.RpgPlugin = exports.RpgPlayer = exports.RpgEvent = void 0;
|
|
25
|
+
exports.ShapePositioning = exports.RpgShape = exports.RpgServerEngine = exports.RpgModule = exports.HookClient = exports.HookServer = exports.Control = exports.Input = exports.Direction = exports.EventMode = exports.Move = exports.Monitor = exports.Presets = exports.entryPoint = exports.Query = exports.RpgWorld = exports.EventData = exports.MapData = exports.RpgEnemy = exports.RpgMap = exports.RpgPlugin = exports.RpgPlayer = exports.RpgEvent = void 0;
|
|
26
26
|
const entry_point_1 = __importDefault(require("./entry-point"));
|
|
27
27
|
exports.entryPoint = entry_point_1.default;
|
|
28
28
|
const common_1 = require("@rpgjs/common");
|
|
@@ -33,6 +33,8 @@ Object.defineProperty(exports, "RpgPlugin", { enumerable: true, get: function ()
|
|
|
33
33
|
Object.defineProperty(exports, "HookServer", { enumerable: true, get: function () { return common_1.HookServer; } });
|
|
34
34
|
Object.defineProperty(exports, "HookClient", { enumerable: true, get: function () { return common_1.HookClient; } });
|
|
35
35
|
Object.defineProperty(exports, "RpgModule", { enumerable: true, get: function () { return common_1.RpgModule; } });
|
|
36
|
+
Object.defineProperty(exports, "RpgShape", { enumerable: true, get: function () { return common_1.RpgShape; } });
|
|
37
|
+
Object.defineProperty(exports, "ShapePositioning", { enumerable: true, get: function () { return common_1.ShapePositioning; } });
|
|
36
38
|
const event_1 = require("./decorators/event");
|
|
37
39
|
Object.defineProperty(exports, "EventData", { enumerable: true, get: function () { return event_1.EventData; } });
|
|
38
40
|
const map_1 = require("./decorators/map");
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAAsC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAAsC;AAoClC,qBApCG,qBAAU,CAoCH;AAnCd,0CAUsB;AA8BlB,0FAvCA,kBAAS,OAuCA;AACT,sFAvCA,cAAK,OAuCA;AACL,wFAvCA,gBAAO,OAuCA;AAdP,0FAxBA,kBAAS,OAwBA;AAeT,2FAtCA,mBAAU,OAsCA;AACV,2FAtCA,mBAAU,OAsCA;AACV,0FAtCA,kBAAS,OAsCA;AAIT,yFAzCA,iBAAQ,OAyCA;AACR,iGAzCA,yBAAgB,OAyCA;AAtCpB,8CAA8C;AAoB1C,0FApBK,iBAAS,OAoBL;AAnBb,0CAA0C;AAkBtC,wFAlBK,aAAO,OAkBL;AAjBX,oCAAmC;AAe/B,uFAfK,YAAM,OAeL;AAdV,mCAA6C;AAWzC,yFAXK,gBAAQ,OAWL;AAaR,0FAxBe,iBAAS,OAwBf;AAvBb,4CAA2C;AAWvC,0FAXK,kBAAS,OAWL;AAVb,oDAA8B;AAa1B,mBAbG,eAAQ,CAaH;AAZZ,mCAA+B;AAelB,yFAfJ,aAAK,OAeO;AACjB,sFAhBK,aAAK,OAgBL;AAfT,wDAA+B;AAkB3B,kBAlBG,iBAAO,CAkBH;AAjBX,mDAAoC;AAgBhC,0BAAO;AAfX,sDAA2C;AAiBvC,qFAjBK,kBAAI,OAiBL;AAhBR,qCAA0C;AA0BtC,gGA1BK,wBAAe,OA0BL"}
|
package/lib/server.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { WorldClass } from '@rpgjs/sync-server';
|
|
1
2
|
export declare class RpgServerEngine {
|
|
2
3
|
io: any;
|
|
3
4
|
gameEngine: any;
|
|
4
|
-
|
|
5
|
+
inputOptions: any;
|
|
5
6
|
/**
|
|
6
7
|
* Express App Instance. If you have assigned this variable before starting the game, you can get the instance of Express
|
|
7
8
|
*
|
|
@@ -35,6 +36,9 @@ export declare class RpgServerEngine {
|
|
|
35
36
|
private scenes;
|
|
36
37
|
protected totalConnected: number;
|
|
37
38
|
private scheduler;
|
|
39
|
+
private tick;
|
|
40
|
+
world: WorldClass;
|
|
41
|
+
workers: any;
|
|
38
42
|
/**
|
|
39
43
|
* Combat formulas
|
|
40
44
|
*
|
|
@@ -43,17 +47,57 @@ export declare class RpgServerEngine {
|
|
|
43
47
|
*/
|
|
44
48
|
constructor(io: any, gameEngine: any, inputOptions: any);
|
|
45
49
|
private _init;
|
|
50
|
+
/**
|
|
51
|
+
* Adds data to the server's database (in RAM) for later use
|
|
52
|
+
*
|
|
53
|
+
* @method server.addInDatabase(id,data)
|
|
54
|
+
* @title Add in database
|
|
55
|
+
* @param {number} id resource id
|
|
56
|
+
* @param {class} dataClass A class representing the data
|
|
57
|
+
* @since 3.0.0-beta.4
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* @Item({
|
|
61
|
+
* name: 'Potion',
|
|
62
|
+
* description: 'Gives 100 HP',
|
|
63
|
+
* })
|
|
64
|
+
* class MyItem() {}
|
|
65
|
+
*
|
|
66
|
+
* server.addInDatabase('dynamic_item', MyItem)
|
|
67
|
+
* ```
|
|
68
|
+
* @returns {void}
|
|
69
|
+
* @memberof RpgServerEngine
|
|
70
|
+
*/
|
|
71
|
+
addInDatabase(id: string, dataClass: any): void;
|
|
46
72
|
/**
|
|
47
73
|
* Start the RPG server
|
|
48
74
|
*
|
|
49
75
|
* @method server.start()
|
|
76
|
+
* @title Start Server
|
|
50
77
|
* @returns {void}
|
|
51
78
|
* @memberof RpgServerEngine
|
|
52
79
|
*/
|
|
53
|
-
start(inputOptions?: any): Promise<void>;
|
|
54
|
-
|
|
80
|
+
start(inputOptions?: any, scheduler?: boolean): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Sends all packages to clients. The sending is done automatically but you can decide to send yourself by calling this method (for example, for unit tests)
|
|
83
|
+
*
|
|
84
|
+
* @method server.send()
|
|
85
|
+
* @title Send All Packets
|
|
86
|
+
* @returns {void}
|
|
87
|
+
* @memberof RpgServerEngine
|
|
88
|
+
*/
|
|
89
|
+
send(): void;
|
|
90
|
+
private updatePlayersMove;
|
|
91
|
+
step(t: number, dt: number): void;
|
|
55
92
|
private loadScenes;
|
|
56
93
|
getScene(name: string): any;
|
|
94
|
+
/**
|
|
95
|
+
* Return the scene that manages the maps of the game
|
|
96
|
+
* @prop {SceneMap} [sceneMap]
|
|
97
|
+
* @since 3.0.0-beta.4
|
|
98
|
+
* @memberof RpgServerEngine
|
|
99
|
+
*/
|
|
100
|
+
get sceneMap(): any;
|
|
57
101
|
sendToPlayer(currentPlayer: any, eventName: any, data: any): void;
|
|
58
102
|
private onPlayerConnected;
|
|
59
103
|
/**
|
package/lib/server.js
CHANGED
|
@@ -16,7 +16,6 @@ const Query_1 = require("./Query");
|
|
|
16
16
|
const presets_1 = require("./presets");
|
|
17
17
|
const sync_server_1 = require("@rpgjs/sync-server");
|
|
18
18
|
const common_1 = require("@rpgjs/common");
|
|
19
|
-
let tick = 0;
|
|
20
19
|
class RpgServerEngine {
|
|
21
20
|
/**
|
|
22
21
|
* Combat formulas
|
|
@@ -52,6 +51,12 @@ class RpgServerEngine {
|
|
|
52
51
|
this.damageFormulas = {};
|
|
53
52
|
this.scenes = new Map();
|
|
54
53
|
this.totalConnected = 0;
|
|
54
|
+
this.tick = 0;
|
|
55
|
+
this.world = sync_server_1.World;
|
|
56
|
+
if (this.inputOptions.workers) {
|
|
57
|
+
console.log('workers enabled');
|
|
58
|
+
this.workers = this.gameEngine.createWorkers(this.inputOptions.workers).load();
|
|
59
|
+
}
|
|
55
60
|
}
|
|
56
61
|
_init() {
|
|
57
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -73,46 +78,116 @@ class RpgServerEngine {
|
|
|
73
78
|
}
|
|
74
79
|
for (let key in this.inputOptions.database) {
|
|
75
80
|
const data = this.inputOptions.database[key];
|
|
76
|
-
this.
|
|
81
|
+
this.addInDatabase(data.id, data);
|
|
77
82
|
}
|
|
78
83
|
this.loadScenes();
|
|
79
84
|
});
|
|
80
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Adds data to the server's database (in RAM) for later use
|
|
88
|
+
*
|
|
89
|
+
* @method server.addInDatabase(id,data)
|
|
90
|
+
* @title Add in database
|
|
91
|
+
* @param {number} id resource id
|
|
92
|
+
* @param {class} dataClass A class representing the data
|
|
93
|
+
* @since 3.0.0-beta.4
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* @Item({
|
|
97
|
+
* name: 'Potion',
|
|
98
|
+
* description: 'Gives 100 HP',
|
|
99
|
+
* })
|
|
100
|
+
* class MyItem() {}
|
|
101
|
+
*
|
|
102
|
+
* server.addInDatabase('dynamic_item', MyItem)
|
|
103
|
+
* ```
|
|
104
|
+
* @returns {void}
|
|
105
|
+
* @memberof RpgServerEngine
|
|
106
|
+
*/
|
|
107
|
+
addInDatabase(id, dataClass) {
|
|
108
|
+
this.database[id] = dataClass;
|
|
109
|
+
}
|
|
81
110
|
/**
|
|
82
111
|
* Start the RPG server
|
|
83
112
|
*
|
|
84
113
|
* @method server.start()
|
|
114
|
+
* @title Start Server
|
|
85
115
|
* @returns {void}
|
|
86
116
|
* @memberof RpgServerEngine
|
|
87
117
|
*/
|
|
88
|
-
start(inputOptions) {
|
|
118
|
+
start(inputOptions, scheduler = true) {
|
|
89
119
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
120
|
if (inputOptions)
|
|
91
121
|
this.inputOptions = inputOptions;
|
|
92
122
|
yield this._init();
|
|
93
|
-
|
|
123
|
+
this.scheduler = new common_1.Scheduler({
|
|
94
124
|
tick: this.step.bind(this),
|
|
95
125
|
period: 1000 / this.inputOptions.stepRate,
|
|
96
126
|
delay: 4
|
|
97
|
-
};
|
|
98
|
-
|
|
127
|
+
});
|
|
128
|
+
if (scheduler)
|
|
129
|
+
this.scheduler.start();
|
|
99
130
|
this.gameEngine.start({
|
|
100
131
|
getObject(id) {
|
|
101
132
|
return Query_1.Query.getPlayer(id);
|
|
102
133
|
},
|
|
103
134
|
getObjectsOfGroup(groupId, player) {
|
|
104
|
-
return Query_1.Query.
|
|
135
|
+
return Query_1.Query._getObjectsOfMap(groupId, player);
|
|
105
136
|
}
|
|
106
137
|
});
|
|
107
138
|
this.io.on('connection', this.onPlayerConnected.bind(this));
|
|
108
139
|
common_1.RpgPlugin.emit(common_1.HookServer.Start, this);
|
|
109
140
|
});
|
|
110
141
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
142
|
+
/**
|
|
143
|
+
* Sends all packages to clients. The sending is done automatically but you can decide to send yourself by calling this method (for example, for unit tests)
|
|
144
|
+
*
|
|
145
|
+
* @method server.send()
|
|
146
|
+
* @title Send All Packets
|
|
147
|
+
* @returns {void}
|
|
148
|
+
* @memberof RpgServerEngine
|
|
149
|
+
*/
|
|
150
|
+
send() {
|
|
151
|
+
this.world.send();
|
|
152
|
+
}
|
|
153
|
+
updatePlayersMove(deltaTimeInt) {
|
|
154
|
+
const players = this.world.getUsers();
|
|
155
|
+
const obj = [];
|
|
156
|
+
for (let playerId in players) {
|
|
157
|
+
const player = players[playerId];
|
|
158
|
+
if (player.pendingMove.length > 0) {
|
|
159
|
+
if (this.inputOptions.workers)
|
|
160
|
+
obj.push(player.toObject());
|
|
161
|
+
else {
|
|
162
|
+
this.gameEngine.processInput(playerId);
|
|
163
|
+
}
|
|
164
|
+
player.pendingMove = [];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (this.inputOptions.workers) {
|
|
168
|
+
this.workers.call('movePlayers', obj).then((players) => {
|
|
169
|
+
for (let playerId in players) {
|
|
170
|
+
const player = this.world.getUser(playerId);
|
|
171
|
+
const data = players[playerId];
|
|
172
|
+
if (player) {
|
|
173
|
+
player.position = data.position;
|
|
174
|
+
player.direction = data.direction;
|
|
175
|
+
}
|
|
176
|
+
common_1.RpgPlugin.emit('Server.onInput', [player, {
|
|
177
|
+
input: data.direction,
|
|
178
|
+
moving: true
|
|
179
|
+
}], true);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
step(t, dt) {
|
|
185
|
+
this.tick++;
|
|
186
|
+
this.updatePlayersMove(1);
|
|
187
|
+
if (this.tick % 4 === 0) {
|
|
188
|
+
this.send();
|
|
115
189
|
}
|
|
190
|
+
common_1.RpgPlugin.emit(common_1.HookServer.Step, this);
|
|
116
191
|
}
|
|
117
192
|
loadScenes() {
|
|
118
193
|
this.scenes.set(Map_1.SceneMap.id, new Map_1.SceneMap(this.inputOptions.maps, this));
|
|
@@ -120,6 +195,15 @@ class RpgServerEngine {
|
|
|
120
195
|
getScene(name) {
|
|
121
196
|
return this.scenes.get(name);
|
|
122
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Return the scene that manages the maps of the game
|
|
200
|
+
* @prop {SceneMap} [sceneMap]
|
|
201
|
+
* @since 3.0.0-beta.4
|
|
202
|
+
* @memberof RpgServerEngine
|
|
203
|
+
*/
|
|
204
|
+
get sceneMap() {
|
|
205
|
+
return this.getScene(Map_1.SceneMap.id);
|
|
206
|
+
}
|
|
123
207
|
sendToPlayer(currentPlayer, eventName, data) {
|
|
124
208
|
currentPlayer._socket.emit(eventName, data);
|
|
125
209
|
}
|
|
@@ -127,12 +211,13 @@ class RpgServerEngine {
|
|
|
127
211
|
const playerId = common_1.Utils.generateUID();
|
|
128
212
|
let player = new this.playerClass(this.gameEngine, playerId);
|
|
129
213
|
socket.on('move', (data) => {
|
|
130
|
-
|
|
214
|
+
player._lastFrame = data.frame;
|
|
215
|
+
player.pendingMove.push(data);
|
|
131
216
|
});
|
|
132
217
|
socket.on('disconnect', () => {
|
|
133
218
|
this.onPlayerDisconnected(socket.id, playerId);
|
|
134
219
|
});
|
|
135
|
-
|
|
220
|
+
this.world.setUser(player, socket);
|
|
136
221
|
socket.emit('playerJoined', { playerId });
|
|
137
222
|
player.server = this;
|
|
138
223
|
player._init();
|
|
@@ -146,7 +231,7 @@ class RpgServerEngine {
|
|
|
146
231
|
onPlayerDisconnected(socketId, playerId) {
|
|
147
232
|
const player = sync_server_1.World.getUser(playerId);
|
|
148
233
|
player.execMethod('onDisconnected');
|
|
149
|
-
|
|
234
|
+
this.world.disconnectUser(playerId);
|
|
150
235
|
}
|
|
151
236
|
}
|
|
152
237
|
exports.RpgServerEngine = RpgServerEngine;
|
package/lib/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAAwC;AACxC,4CAA2C;AAC3C,mCAA+B;AAC/B,uCAA8F;AAC9F,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAAwC;AACxC,4CAA2C;AAC3C,mCAA+B;AAC/B,uCAA8F;AAC9F,oDAAsD;AACtD,0CAAu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AC,UAAU,CAAC,aAAa,CAAC,CAAA;IACpC,CAAC;IAED;;;;OAIG;IACK,oBAAoB,CAAC,QAAQ,EAAE,QAAgB;QACnD,MAAM,MAAM,GAAc,mBAAK,CAAC,OAAO,CAAC,QAAQ,CAAc,CAAA;QAC9D,MAAM,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAA;QACnC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAA;IACvC,CAAC;CACJ;AA9PD,0CA8PC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"move.js","sourceRoot":"","sources":["../../src/workers/move.ts"],"names":[],"mappings":";AAAA,MAAM,EACJ,UAAU,EACV,QAAQ,EACT,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAC7B,MAAM,OAAO,GAAG,EAAE,CAAA;AAElB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;AAErB,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE;IAC/B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAClB,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpgjs/server",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -18,16 +18,17 @@
|
|
|
18
18
|
"author": "Samuel Ronce",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@rpgjs/common": "^3.0.0-beta.
|
|
22
|
-
"@rpgjs/database": "^3.0.0-beta.
|
|
23
|
-
"@rpgjs/sync-server": "^3.0.0-beta.
|
|
21
|
+
"@rpgjs/common": "^3.0.0-beta.5",
|
|
22
|
+
"@rpgjs/database": "^3.0.0-beta.5",
|
|
23
|
+
"@rpgjs/sync-server": "^3.0.0-beta.5",
|
|
24
24
|
"kompute": "^1.13.0",
|
|
25
25
|
"lodash.merge": "^4.6.2",
|
|
26
26
|
"pathfinding": "^0.4.18",
|
|
27
27
|
"sat": "^0.8.0",
|
|
28
|
+
"threads": "^1.7.0",
|
|
28
29
|
"yuka": "^0.7.5"
|
|
29
30
|
},
|
|
30
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "6c053091680a5a2112790ecffec8649376feacd5",
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"typescript": "^4.3.5"
|
|
33
34
|
}
|