@rpgjs/common 3.0.0-beta.8 → 3.0.0
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.d.ts +3 -0
- package/lib/Game.js +7 -0
- package/lib/Game.js.map +1 -1
- package/lib/Hit.d.ts +0 -3
- package/lib/Hit.js +9 -4
- package/lib/Hit.js.map +1 -1
- package/lib/Map.d.ts +9 -162
- package/lib/Map.js +11 -234
- package/lib/Map.js.map +1 -1
- package/lib/Module.d.ts +3 -1
- package/lib/Module.js +89 -63
- package/lib/Module.js.map +1 -1
- package/lib/Player.d.ts +4 -2
- package/lib/Player.js +13 -9
- package/lib/Player.js.map +1 -1
- package/lib/Plugin.d.ts +3 -1
- package/lib/Plugin.js +2 -0
- package/lib/Plugin.js.map +1 -1
- package/lib/Shape.d.ts +12 -6
- package/lib/Shape.js +49 -19
- package/lib/Shape.js.map +1 -1
- package/lib/Utils.d.ts +2 -0
- package/lib/Utils.js +8 -3
- package/lib/Utils.js.map +1 -1
- package/lib/transports/io.d.ts +4 -2
- package/lib/transports/io.js +12 -5
- package/lib/transports/io.js.map +1 -1
- package/package.json +3 -3
package/lib/Game.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { EventEmitter } from './EventEmitter';
|
|
2
2
|
import { RpgCommonPlayer } from './Player';
|
|
3
3
|
import { GameWorker } from './Worker';
|
|
4
|
+
import { HitObject } from './Hit';
|
|
5
|
+
import { RpgShape } from './Shape';
|
|
4
6
|
export declare enum GameSide {
|
|
5
7
|
Server = "server",
|
|
6
8
|
Client = "client",
|
|
@@ -17,5 +19,6 @@ export declare class RpgCommonGame extends EventEmitter {
|
|
|
17
19
|
addObject(_class: any, playerId?: string): any;
|
|
18
20
|
addPlayer(playerClass: any, playerId?: string): any;
|
|
19
21
|
addEvent(eventClass: any, eventId?: string): any;
|
|
22
|
+
addShape(obj: HitObject): RpgShape;
|
|
20
23
|
processInput<RpgPlayer extends RpgCommonPlayer>(playerId: string): Promise<RpgPlayer>;
|
|
21
24
|
}
|
package/lib/Game.js
CHANGED
|
@@ -16,6 +16,7 @@ const Player_1 = require("./Player");
|
|
|
16
16
|
const Input_1 = require("./Input");
|
|
17
17
|
const Plugin_1 = require("./Plugin");
|
|
18
18
|
const Worker_1 = require("./Worker");
|
|
19
|
+
const Shape_1 = require("./Shape");
|
|
19
20
|
var GameSide;
|
|
20
21
|
(function (GameSide) {
|
|
21
22
|
GameSide["Server"] = "server";
|
|
@@ -57,6 +58,12 @@ class RpgCommonGame extends EventEmitter_1.EventEmitter {
|
|
|
57
58
|
const event = this.addObject(eventClass, eventId);
|
|
58
59
|
return event;
|
|
59
60
|
}
|
|
61
|
+
addShape(obj) {
|
|
62
|
+
const id = obj.name = (obj.name || Utils_1.generateUID());
|
|
63
|
+
const shape = new Shape_1.RpgShape(obj);
|
|
64
|
+
shape.name = id;
|
|
65
|
+
return shape;
|
|
66
|
+
}
|
|
60
67
|
processInput(playerId) {
|
|
61
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
69
|
const player = this.world.getObject(playerId);
|
package/lib/Game.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Game.js","sourceRoot":"","sources":["../src/Game.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAA8C;AAC9C,iDAA6C;AAC7C,qCAAqD;AACrD,mCAAiC;AACjC,qCAAoC;AACpC,qCAAqC;AAErC,IAAY,QAIX;AAJD,WAAY,QAAQ;IAChB,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;AACrB,CAAC,EAJW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAInB;AAED,MAAa,aAAc,SAAQ,2BAAY;IAK3C,YAAmB,IAAc;QAC7B,KAAK,EAAE,CAAA;QADQ,SAAI,GAAJ,IAAI,CAAU;QAE7B,IAAI,CAAC,MAAM,GAAG,EAAE,CAAA,CAAC,+BAA+B;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AAE,IAAI,CAAC,CAAA;aAEZ;YACD,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;CACJ;AA1FD,sCA0FC"}
|
package/lib/Hit.d.ts
CHANGED
package/lib/Hit.js
CHANGED
|
@@ -40,7 +40,6 @@ class HitClass {
|
|
|
40
40
|
type = obj.type;
|
|
41
41
|
}
|
|
42
42
|
return {
|
|
43
|
-
properties: obj.properties,
|
|
44
43
|
hitbox,
|
|
45
44
|
type,
|
|
46
45
|
name: obj.name
|
|
@@ -48,14 +47,20 @@ class HitClass {
|
|
|
48
47
|
}
|
|
49
48
|
testPolyCollision(type, hit1, hit2) {
|
|
50
49
|
let collided = false;
|
|
50
|
+
if (type == HitType.Box) {
|
|
51
|
+
if (hit1.pos.x <= hit2.pos.x + hit2.w &&
|
|
52
|
+
hit1.pos.x + hit1.w >= hit2.pos.x &&
|
|
53
|
+
hit1.pos.y <= hit2.pos.y + hit2.h &&
|
|
54
|
+
hit1.h + hit1.pos.y >= hit2.pos.y) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
51
59
|
if (Utils_1.isInstanceOf(hit1, sat_1.default.Box))
|
|
52
60
|
hit1 = hit1.toPolygon();
|
|
53
61
|
if (Utils_1.isInstanceOf(hit2, sat_1.default.Box))
|
|
54
62
|
hit2 = hit2.toPolygon();
|
|
55
63
|
switch (type) {
|
|
56
|
-
case HitType.Box:
|
|
57
|
-
collided = sat_1.default.testPolygonPolygon(hit1, hit2);
|
|
58
|
-
break;
|
|
59
64
|
case HitType.Circle:
|
|
60
65
|
collided = sat_1.default.testPolygonCircle(hit1, hit2);
|
|
61
66
|
break;
|
package/lib/Hit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hit.js","sourceRoot":"","sources":["../src/Hit.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"Hit.js","sourceRoot":"","sources":["../src/Hit.ts"],"names":[],"mappings":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,CAAC,GAAG,CAAC,CAAC,EAAE;gBACnC,OAAO,IAAI,CAAA;aACb;YACF,OAAO,KAAK,CAAA;SACf;QACD,IAAI,oBAAY,CAAC,IAAI,EAAE,aAAG,CAAC,GAAG,CAAC;YAAE,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,CAAA;QACxD,IAAI,oBAAY,CAAC,IAAI,EAAE,aAAG,CAAC,GAAG,CAAC;YAAE,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,CAAA;QACxD,QAAQ,IAAI,EAAE;YACV,KAAK,OAAO,CAAC,MAAM;gBACf,QAAQ,GAAG,aAAG,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;gBAChD,MAAK;YACL,KAAK,OAAO,CAAC,OAAO;gBAChB,QAAQ,GAAG,aAAG,CAAC,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;gBACjD,MAAK;SACR;QACD,OAAO,QAAQ,CAAA;IACnB,CAAC;CACJ;AAEY,QAAA,GAAG,GAAG,IAAI,QAAQ,EAAE,CAAA"}
|
package/lib/Map.d.ts
CHANGED
|
@@ -2,22 +2,13 @@ import { HitObject } from './Hit';
|
|
|
2
2
|
import { RpgShape } from './Shape';
|
|
3
3
|
import { VirtualGrid } from './VirtualGrid';
|
|
4
4
|
import { RpgCommonWorldMaps } from './WorldMaps';
|
|
5
|
-
|
|
6
|
-
id: number;
|
|
7
|
-
terrain: any[];
|
|
8
|
-
probability: any;
|
|
9
|
-
properties: any;
|
|
10
|
-
animations: any[];
|
|
11
|
-
objectGroups: any[];
|
|
12
|
-
image: any;
|
|
13
|
-
gid: number;
|
|
14
|
-
}
|
|
5
|
+
import { TiledMap, Tile, TiledObjectClass, MapClass } from '@rpgjs/tiled';
|
|
15
6
|
export interface TileInfo {
|
|
16
7
|
tiles: Tile[];
|
|
17
|
-
hasCollision: boolean;
|
|
18
|
-
isClimbable?: boolean;
|
|
19
|
-
isOverlay: boolean;
|
|
20
|
-
objectGroups:
|
|
8
|
+
hasCollision: boolean | undefined;
|
|
9
|
+
isClimbable?: boolean | undefined;
|
|
10
|
+
isOverlay: boolean | undefined;
|
|
11
|
+
objectGroups: TiledObjectClass[];
|
|
21
12
|
tileIndex: number;
|
|
22
13
|
}
|
|
23
14
|
export interface LayerInfo {
|
|
@@ -29,7 +20,7 @@ export interface LayerInfo {
|
|
|
29
20
|
objects: HitObject[];
|
|
30
21
|
tiles: Tile[];
|
|
31
22
|
}
|
|
32
|
-
export declare class RpgCommonMap {
|
|
23
|
+
export declare class RpgCommonMap extends MapClass {
|
|
33
24
|
/**
|
|
34
25
|
* @title map id
|
|
35
26
|
* @readonly
|
|
@@ -39,40 +30,8 @@ export declare class RpgCommonMap {
|
|
|
39
30
|
readonly id: string;
|
|
40
31
|
grid: VirtualGrid;
|
|
41
32
|
gridShapes: VirtualGrid;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* @prop {object} [data]
|
|
45
|
-
* @readonly
|
|
46
|
-
* @memberof Map
|
|
47
|
-
* @memberof RpgSceneMap
|
|
48
|
-
* */
|
|
49
|
-
data: any;
|
|
50
|
-
width: number;
|
|
51
|
-
height: number;
|
|
52
|
-
/**
|
|
53
|
-
* @title Width of a tile
|
|
54
|
-
* @prop {number} [tileWidth]
|
|
55
|
-
* @readonly
|
|
56
|
-
* @memberof Map
|
|
57
|
-
* @memberof RpgSceneMap
|
|
58
|
-
* */
|
|
59
|
-
tileWidth: number;
|
|
60
|
-
/**
|
|
61
|
-
* @title Height of a tile
|
|
62
|
-
* @prop {number} [tileHeight]
|
|
63
|
-
* @readonly
|
|
64
|
-
* @memberof Map
|
|
65
|
-
* @memberof RpgSceneMap
|
|
66
|
-
* */
|
|
67
|
-
tileHeight: number;
|
|
68
|
-
/**
|
|
69
|
-
* @title Layers of map
|
|
70
|
-
* @prop {object[]} [layers]
|
|
71
|
-
* @readonly
|
|
72
|
-
* @memberof Map
|
|
73
|
-
* @memberof RpgSceneMap
|
|
74
|
-
* */
|
|
75
|
-
layers: LayerInfo[];
|
|
33
|
+
get tileWidth(): number;
|
|
34
|
+
get tileHeight(): number;
|
|
76
35
|
private worldMapParent;
|
|
77
36
|
/**
|
|
78
37
|
* Retrieves the X position of the map in the world (0 if no world assigned)
|
|
@@ -102,47 +61,7 @@ export declare class RpgCommonMap {
|
|
|
102
61
|
* In RPG mode, to avoid confusion with buffer, we have a new variable to memorize the maps
|
|
103
62
|
*/
|
|
104
63
|
static get bufferClient(): Map<any, any>;
|
|
105
|
-
load(data:
|
|
106
|
-
/**
|
|
107
|
-
* @title Width of the map in pixels
|
|
108
|
-
* @prop {number} [widthPx]
|
|
109
|
-
* @readonly
|
|
110
|
-
* @memberof Map
|
|
111
|
-
* @memberof RpgSceneMap
|
|
112
|
-
* */
|
|
113
|
-
get widthPx(): number;
|
|
114
|
-
/**
|
|
115
|
-
* @title Height of the map in pixels
|
|
116
|
-
* @prop {number} [heightPx]
|
|
117
|
-
* @readonly
|
|
118
|
-
* @memberof Map
|
|
119
|
-
* @memberof RpgSceneMap
|
|
120
|
-
* */
|
|
121
|
-
get heightPx(): number;
|
|
122
|
-
/**
|
|
123
|
-
* @title The depth of the map in pixels (this is the height of a tile ;))
|
|
124
|
-
* @prop {number} map.zTileHeight
|
|
125
|
-
* @readonly
|
|
126
|
-
* @memberof Map
|
|
127
|
-
* @memberof RpgSceneMap
|
|
128
|
-
* */
|
|
129
|
-
get zTileHeight(): number;
|
|
130
|
-
_extractShapes(): void;
|
|
131
|
-
/**
|
|
132
|
-
* Find a layer by name. Returns `undefined` is the layer is not found
|
|
133
|
-
|
|
134
|
-
* @title Get Layer by name
|
|
135
|
-
* @method map.getLayerByName(name)
|
|
136
|
-
* @param {string} name layer name
|
|
137
|
-
* @returns {LayerInfo | undefined}
|
|
138
|
-
* @example
|
|
139
|
-
* ```ts
|
|
140
|
-
* const tiles = map.getLayerByName(0, 0)
|
|
141
|
-
* ```
|
|
142
|
-
* @memberof Map
|
|
143
|
-
* @memberof RpgSceneMap
|
|
144
|
-
*/
|
|
145
|
-
getLayerByName(name: string): LayerInfo | undefined;
|
|
64
|
+
load(data: TiledMap): void;
|
|
146
65
|
/**
|
|
147
66
|
* Create a shape dynamically on the map
|
|
148
67
|
*
|
|
@@ -201,78 +120,6 @@ export declare class RpgCommonMap {
|
|
|
201
120
|
y: number;
|
|
202
121
|
z: number;
|
|
203
122
|
} | null;
|
|
204
|
-
setTile(x: number, y: number, layerFilter: string | ((layer: any) => boolean), tileInfo: any): {
|
|
205
|
-
x: number;
|
|
206
|
-
y: number;
|
|
207
|
-
tiles: {
|
|
208
|
-
[tileIndex: number]: object;
|
|
209
|
-
};
|
|
210
|
-
};
|
|
211
|
-
/**
|
|
212
|
-
* Get the tile index on the tileset
|
|
213
|
-
*
|
|
214
|
-
* @title Get index of tile
|
|
215
|
-
* @method map.getTileIndex(x,y)
|
|
216
|
-
* @param {number} x Position X
|
|
217
|
-
* @param {number} x Position Y
|
|
218
|
-
* @returns {number}
|
|
219
|
-
* @memberof Map
|
|
220
|
-
* @memberof RpgSceneMap
|
|
221
|
-
*/
|
|
222
|
-
getTileIndex(x: number, y: number, [z]?: [number]): number;
|
|
223
|
-
/**
|
|
224
|
-
* Retrieves tiles according to its index
|
|
225
|
-
|
|
226
|
-
* @title Get tile by index
|
|
227
|
-
* @method map.getTileByIndex(tileIndex)
|
|
228
|
-
* @param {number} tileIndex tile index
|
|
229
|
-
* @returns {TileInfo}
|
|
230
|
-
* @example
|
|
231
|
-
* ```ts
|
|
232
|
-
* const index = map.getTileIndex(0, 0)
|
|
233
|
-
* const tiles = map.getTileByIndex(index)
|
|
234
|
-
* ```
|
|
235
|
-
* @memberof Map
|
|
236
|
-
* @memberof RpgSceneMap
|
|
237
|
-
*/
|
|
238
|
-
getTileByIndex(tileIndex: number, zPlayer?: [number, number]): TileInfo;
|
|
239
|
-
/**
|
|
240
|
-
* Find the point of origin (top left) of a tile. Of course, its position depends on the size of the tile
|
|
241
|
-
|
|
242
|
-
* @title Get origin position of tile
|
|
243
|
-
* @method map.getTileOriginPosition(x,y)
|
|
244
|
-
* @param {number} x Position X
|
|
245
|
-
* @param {number} x Position Y
|
|
246
|
-
* @returns { {x: number, y: number }}
|
|
247
|
-
* @example
|
|
248
|
-
* ```ts
|
|
249
|
-
* // If the size of a tile is 32x32px
|
|
250
|
-
* const position = map.getTileOriginPosition(35, 12)
|
|
251
|
-
* console.log(position) // { x: 32, y: 0 }
|
|
252
|
-
* ```
|
|
253
|
-
* @memberof Map
|
|
254
|
-
* @memberof RpgSceneMap
|
|
255
|
-
*/
|
|
256
|
-
getTileOriginPosition(x: number, y: number): {
|
|
257
|
-
x: number;
|
|
258
|
-
y: number;
|
|
259
|
-
};
|
|
260
|
-
/**
|
|
261
|
-
* Recover tiles according to a position
|
|
262
|
-
|
|
263
|
-
* @title Get tile by position
|
|
264
|
-
* @method map.getTileByPosition(x,y)
|
|
265
|
-
* @param {number} x Position X
|
|
266
|
-
* @param {number} x Position Y
|
|
267
|
-
* @returns {TileInfo}
|
|
268
|
-
* @example
|
|
269
|
-
* ```ts
|
|
270
|
-
* const tiles = map.getTileByPosition(0, 0)
|
|
271
|
-
* ```
|
|
272
|
-
* @memberof Map
|
|
273
|
-
* @memberof RpgSceneMap
|
|
274
|
-
*/
|
|
275
|
-
getTileByPosition(x: number, y: number, z?: [number, number]): TileInfo;
|
|
276
123
|
/**
|
|
277
124
|
* Get tile and verify collision with hitbox
|
|
278
125
|
* @param hitbox
|
package/lib/Map.js
CHANGED
|
@@ -5,28 +5,12 @@ const Utils_1 = require("./Utils");
|
|
|
5
5
|
const Shape_1 = require("./Shape");
|
|
6
6
|
const Hit_1 = require("./Hit");
|
|
7
7
|
const VirtualGrid_1 = require("./VirtualGrid");
|
|
8
|
+
const tiled_1 = require("@rpgjs/tiled");
|
|
8
9
|
const buffer = new Map();
|
|
9
10
|
const bufferClient = new Map();
|
|
10
|
-
class RpgCommonMap {
|
|
11
|
+
class RpgCommonMap extends tiled_1.MapClass {
|
|
11
12
|
constructor() {
|
|
12
|
-
|
|
13
|
-
this.height = 0;
|
|
14
|
-
/**
|
|
15
|
-
* @title Width of a tile
|
|
16
|
-
* @prop {number} [tileWidth]
|
|
17
|
-
* @readonly
|
|
18
|
-
* @memberof Map
|
|
19
|
-
* @memberof RpgSceneMap
|
|
20
|
-
* */
|
|
21
|
-
this.tileWidth = 0;
|
|
22
|
-
/**
|
|
23
|
-
* @title Height of a tile
|
|
24
|
-
* @prop {number} [tileHeight]
|
|
25
|
-
* @readonly
|
|
26
|
-
* @memberof Map
|
|
27
|
-
* @memberof RpgSceneMap
|
|
28
|
-
* */
|
|
29
|
-
this.tileHeight = 0;
|
|
13
|
+
super(...arguments);
|
|
30
14
|
/**
|
|
31
15
|
* @title Layers of map
|
|
32
16
|
* @prop {object[]} [layers]
|
|
@@ -34,10 +18,15 @@ class RpgCommonMap {
|
|
|
34
18
|
* @memberof Map
|
|
35
19
|
* @memberof RpgSceneMap
|
|
36
20
|
* */
|
|
37
|
-
this.layers = [];
|
|
38
21
|
/** @internal */
|
|
39
22
|
this.shapes = {};
|
|
40
23
|
}
|
|
24
|
+
get tileWidth() {
|
|
25
|
+
return this.tilewidth;
|
|
26
|
+
}
|
|
27
|
+
get tileHeight() {
|
|
28
|
+
return this.tileheight;
|
|
29
|
+
}
|
|
41
30
|
/**
|
|
42
31
|
* Retrieves the X position of the map in the world (0 if no world assigned)
|
|
43
32
|
*
|
|
@@ -77,71 +66,9 @@ class RpgCommonMap {
|
|
|
77
66
|
return bufferClient;
|
|
78
67
|
}
|
|
79
68
|
load(data) {
|
|
80
|
-
|
|
81
|
-
this.width = data.width;
|
|
82
|
-
this.tileWidth = data.tileWidth;
|
|
83
|
-
this.tileHeight = data.tileHeight;
|
|
84
|
-
this.height = data.height;
|
|
85
|
-
this.layers = data.layers;
|
|
69
|
+
super.load(data);
|
|
86
70
|
this.grid = new VirtualGrid_1.VirtualGrid(this.width, this.tileWidth, this.tileHeight).zoom(10);
|
|
87
71
|
this.gridShapes = new VirtualGrid_1.VirtualGrid(this.width, this.tileWidth, this.tileHeight).zoom(20);
|
|
88
|
-
this._extractShapes();
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* @title Width of the map in pixels
|
|
92
|
-
* @prop {number} [widthPx]
|
|
93
|
-
* @readonly
|
|
94
|
-
* @memberof Map
|
|
95
|
-
* @memberof RpgSceneMap
|
|
96
|
-
* */
|
|
97
|
-
get widthPx() {
|
|
98
|
-
return this.width * this.tileWidth;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* @title Height of the map in pixels
|
|
102
|
-
* @prop {number} [heightPx]
|
|
103
|
-
* @readonly
|
|
104
|
-
* @memberof Map
|
|
105
|
-
* @memberof RpgSceneMap
|
|
106
|
-
* */
|
|
107
|
-
get heightPx() {
|
|
108
|
-
return this.height * this.tileHeight;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* @title The depth of the map in pixels (this is the height of a tile ;))
|
|
112
|
-
* @prop {number} map.zTileHeight
|
|
113
|
-
* @readonly
|
|
114
|
-
* @memberof Map
|
|
115
|
-
* @memberof RpgSceneMap
|
|
116
|
-
* */
|
|
117
|
-
get zTileHeight() {
|
|
118
|
-
return this.tileHeight;
|
|
119
|
-
}
|
|
120
|
-
_extractShapes() {
|
|
121
|
-
for (let layer of this.layers) {
|
|
122
|
-
if (layer.type != 'object')
|
|
123
|
-
continue;
|
|
124
|
-
for (let obj of layer.objects) {
|
|
125
|
-
this.createShape(obj);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Find a layer by name. Returns `undefined` is the layer is not found
|
|
131
|
-
|
|
132
|
-
* @title Get Layer by name
|
|
133
|
-
* @method map.getLayerByName(name)
|
|
134
|
-
* @param {string} name layer name
|
|
135
|
-
* @returns {LayerInfo | undefined}
|
|
136
|
-
* @example
|
|
137
|
-
* ```ts
|
|
138
|
-
* const tiles = map.getLayerByName(0, 0)
|
|
139
|
-
* ```
|
|
140
|
-
* @memberof Map
|
|
141
|
-
* @memberof RpgSceneMap
|
|
142
|
-
*/
|
|
143
|
-
getLayerByName(name) {
|
|
144
|
-
return this.layers.find(layer => layer.name == name);
|
|
145
72
|
}
|
|
146
73
|
/**
|
|
147
74
|
* Create a shape dynamically on the map
|
|
@@ -166,7 +93,6 @@ class RpgCommonMap {
|
|
|
166
93
|
*/
|
|
167
94
|
createShape(obj) {
|
|
168
95
|
const id = obj.name = (obj.name || Utils_1.generateUID());
|
|
169
|
-
obj.properties = obj.properties || {};
|
|
170
96
|
const shape = new Shape_1.RpgShape(obj);
|
|
171
97
|
this.shapes[id] = shape;
|
|
172
98
|
if (!shape.isShapePosition()) {
|
|
@@ -222,155 +148,6 @@ class RpgCommonMap {
|
|
|
222
148
|
}
|
|
223
149
|
return null;
|
|
224
150
|
}
|
|
225
|
-
setTile(x, y, layerFilter, tileInfo) {
|
|
226
|
-
const tileIndex = this.getTileIndex(x, y);
|
|
227
|
-
let fnFilter;
|
|
228
|
-
let tilesEdited = {};
|
|
229
|
-
if (Utils_1.isString(layerFilter)) {
|
|
230
|
-
fnFilter = (layer) => layer.name == layerFilter;
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
fnFilter = layerFilter;
|
|
234
|
-
}
|
|
235
|
-
for (let layer of this.layers) {
|
|
236
|
-
if (!fnFilter(layer))
|
|
237
|
-
continue;
|
|
238
|
-
tilesEdited[layer.name] = tileInfo;
|
|
239
|
-
layer.tiles[tileIndex] = tilesEdited[layer.name];
|
|
240
|
-
}
|
|
241
|
-
return {
|
|
242
|
-
x,
|
|
243
|
-
y,
|
|
244
|
-
tiles: tilesEdited
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Get the tile index on the tileset
|
|
249
|
-
*
|
|
250
|
-
* @title Get index of tile
|
|
251
|
-
* @method map.getTileIndex(x,y)
|
|
252
|
-
* @param {number} x Position X
|
|
253
|
-
* @param {number} x Position Y
|
|
254
|
-
* @returns {number}
|
|
255
|
-
* @memberof Map
|
|
256
|
-
* @memberof RpgSceneMap
|
|
257
|
-
*/
|
|
258
|
-
getTileIndex(x, y, [z] = [0]) {
|
|
259
|
-
return this.width * Math.floor((y - z) / this.tileHeight) + Math.floor(x / this.tileWidth);
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Retrieves tiles according to its index
|
|
263
|
-
|
|
264
|
-
* @title Get tile by index
|
|
265
|
-
* @method map.getTileByIndex(tileIndex)
|
|
266
|
-
* @param {number} tileIndex tile index
|
|
267
|
-
* @returns {TileInfo}
|
|
268
|
-
* @example
|
|
269
|
-
* ```ts
|
|
270
|
-
* const index = map.getTileIndex(0, 0)
|
|
271
|
-
* const tiles = map.getTileByIndex(index)
|
|
272
|
-
* ```
|
|
273
|
-
* @memberof Map
|
|
274
|
-
* @memberof RpgSceneMap
|
|
275
|
-
*/
|
|
276
|
-
getTileByIndex(tileIndex, zPlayer = [0, 0]) {
|
|
277
|
-
const tiles = [];
|
|
278
|
-
for (let layer of this.layers) {
|
|
279
|
-
if (layer.type != 'tile') {
|
|
280
|
-
continue;
|
|
281
|
-
}
|
|
282
|
-
const _tiles = layer.tiles[tileIndex];
|
|
283
|
-
if (!_tiles) {
|
|
284
|
-
continue;
|
|
285
|
-
}
|
|
286
|
-
if (!_tiles.properties)
|
|
287
|
-
_tiles.properties = {};
|
|
288
|
-
const zLayer = layer.properties ? layer.properties.z : 0;
|
|
289
|
-
const zTile = _tiles.properties.z;
|
|
290
|
-
let z, zIntersection;
|
|
291
|
-
if (zLayer !== undefined) {
|
|
292
|
-
z = zLayer + (zTile !== undefined ? zTile : 0);
|
|
293
|
-
}
|
|
294
|
-
else if (zTile !== undefined) {
|
|
295
|
-
z = zTile;
|
|
296
|
-
}
|
|
297
|
-
if (z !== undefined) {
|
|
298
|
-
const realZ = z * this.tileHeight;
|
|
299
|
-
zIntersection = Utils_1.intersection(zPlayer, [realZ, realZ + this.tileHeight]);
|
|
300
|
-
}
|
|
301
|
-
if (zIntersection !== undefined) {
|
|
302
|
-
if (zIntersection)
|
|
303
|
-
tiles.push(_tiles);
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
tiles.push(_tiles);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
const getLastTile = tiles[tiles.length - 1];
|
|
310
|
-
if (!getLastTile) {
|
|
311
|
-
return {
|
|
312
|
-
tiles,
|
|
313
|
-
hasCollision: true,
|
|
314
|
-
isOverlay: false,
|
|
315
|
-
objectGroups: [],
|
|
316
|
-
tileIndex
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
const hasCollision = getLastTile.properties.collision;
|
|
320
|
-
const isOverlay = getLastTile.properties.overlay;
|
|
321
|
-
const isClimbable = getLastTile.properties.climb;
|
|
322
|
-
const objectGroups = getLastTile.objectGroups;
|
|
323
|
-
return {
|
|
324
|
-
tiles,
|
|
325
|
-
hasCollision,
|
|
326
|
-
isOverlay,
|
|
327
|
-
objectGroups,
|
|
328
|
-
isClimbable,
|
|
329
|
-
tileIndex
|
|
330
|
-
};
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Find the point of origin (top left) of a tile. Of course, its position depends on the size of the tile
|
|
334
|
-
|
|
335
|
-
* @title Get origin position of tile
|
|
336
|
-
* @method map.getTileOriginPosition(x,y)
|
|
337
|
-
* @param {number} x Position X
|
|
338
|
-
* @param {number} x Position Y
|
|
339
|
-
* @returns { {x: number, y: number }}
|
|
340
|
-
* @example
|
|
341
|
-
* ```ts
|
|
342
|
-
* // If the size of a tile is 32x32px
|
|
343
|
-
* const position = map.getTileOriginPosition(35, 12)
|
|
344
|
-
* console.log(position) // { x: 32, y: 0 }
|
|
345
|
-
* ```
|
|
346
|
-
* @memberof Map
|
|
347
|
-
* @memberof RpgSceneMap
|
|
348
|
-
*/
|
|
349
|
-
getTileOriginPosition(x, y) {
|
|
350
|
-
return {
|
|
351
|
-
x: Math.floor(x / this.tileWidth) * this.tileWidth,
|
|
352
|
-
y: Math.floor(y / this.tileHeight) * this.tileHeight
|
|
353
|
-
};
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Recover tiles according to a position
|
|
357
|
-
|
|
358
|
-
* @title Get tile by position
|
|
359
|
-
* @method map.getTileByPosition(x,y)
|
|
360
|
-
* @param {number} x Position X
|
|
361
|
-
* @param {number} x Position Y
|
|
362
|
-
* @returns {TileInfo}
|
|
363
|
-
* @example
|
|
364
|
-
* ```ts
|
|
365
|
-
* const tiles = map.getTileByPosition(0, 0)
|
|
366
|
-
* ```
|
|
367
|
-
* @memberof Map
|
|
368
|
-
* @memberof RpgSceneMap
|
|
369
|
-
*/
|
|
370
|
-
getTileByPosition(x, y, z = [0, 0]) {
|
|
371
|
-
const tileIndex = this.getTileIndex(x, y, [z[0]]);
|
|
372
|
-
return this.getTileByIndex(tileIndex, z);
|
|
373
|
-
}
|
|
374
151
|
/**
|
|
375
152
|
* Get tile and verify collision with hitbox
|
|
376
153
|
* @param hitbox
|
|
@@ -380,7 +157,7 @@ class RpgCommonMap {
|
|
|
380
157
|
* @returns TileInfo
|
|
381
158
|
*/
|
|
382
159
|
getTile(hitbox, x, y, z = [0, 0]) {
|
|
383
|
-
const tile = this.getTileByPosition(x, y, z);
|
|
160
|
+
const tile = Object.assign({}, this.getTileByPosition(x, y, z));
|
|
384
161
|
const tilePos = this.getTileOriginPosition(x, y);
|
|
385
162
|
if (tile.objectGroups) {
|
|
386
163
|
for (let object of tile.objectGroups) {
|
package/lib/Map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Map.js","sourceRoot":"","sources":["../src/Map.ts"],"names":[],"mappings":";;;AACA,mCAAqE;AACrE,mCAAkC;AAClC,+BAA2B;AAC3B,+CAA2C;
|
|
1
|
+
{"version":3,"file":"Map.js","sourceRoot":"","sources":["../src/Map.ts"],"names":[],"mappings":";;;AACA,mCAAqE;AACrE,mCAAkC;AAClC,+B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AAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAClD,CAAC;IAEA;;;;;;;;MAQE;IACH,cAAc;QACV,OAAO,IAAI,CAAC,cAAc,CAAA;IAC9B,CAAC;CACJ;AAnOD,oCAmOC"}
|
package/lib/Module.d.ts
CHANGED
|
@@ -10,5 +10,7 @@ export declare type ModuleType = ModuleSide | [
|
|
|
10
10
|
}
|
|
11
11
|
];
|
|
12
12
|
export declare function RpgModule<T>(options: T): (target: any) => void;
|
|
13
|
-
export declare function loadModules(modules: any, obj: any):
|
|
13
|
+
export declare function loadModules(modules: any, obj: any, middleware?: Function): Promise<{
|
|
14
|
+
playerProps: any;
|
|
15
|
+
}>;
|
|
14
16
|
export {};
|