@rpgjs/common 3.0.1 → 3.2.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.
Files changed (56) hide show
  1. package/LICENSE +19 -0
  2. package/lib/AbstractObject.d.ts +318 -0
  3. package/lib/AbstractObject.js +828 -0
  4. package/lib/AbstractObject.js.map +1 -0
  5. package/lib/Game.d.ts +6 -2
  6. package/lib/Game.js +42 -13
  7. package/lib/Game.js.map +1 -1
  8. package/lib/Hit.d.ts +4 -28
  9. package/lib/Hit.js +12 -15
  10. package/lib/Hit.js.map +1 -1
  11. package/lib/Hitbox.d.ts +6 -0
  12. package/lib/Hitbox.js +10 -0
  13. package/lib/Hitbox.js.map +1 -0
  14. package/lib/HitboxEffect.d.ts +6 -0
  15. package/lib/HitboxEffect.js +10 -0
  16. package/lib/HitboxEffect.js.map +1 -0
  17. package/lib/Map.d.ts +12 -0
  18. package/lib/Map.js +77 -4
  19. package/lib/Map.js.map +1 -1
  20. package/lib/Player.d.ts +9 -296
  21. package/lib/Player.js +7 -639
  22. package/lib/Player.js.map +1 -1
  23. package/lib/Scheduler.d.ts +16 -38
  24. package/lib/Scheduler.js +69 -76
  25. package/lib/Scheduler.js.map +1 -1
  26. package/lib/Shape.d.ts +8 -7
  27. package/lib/Shape.js +11 -15
  28. package/lib/Shape.js.map +1 -1
  29. package/lib/SocketEvents.d.ts +8 -0
  30. package/lib/SocketEvents.js +14 -0
  31. package/lib/SocketEvents.js.map +1 -0
  32. package/lib/Utils.d.ts +12 -11
  33. package/lib/Utils.js.map +1 -1
  34. package/lib/Vector2d.d.ts +19 -0
  35. package/lib/Vector2d.js +63 -0
  36. package/lib/Vector2d.js.map +1 -0
  37. package/lib/VirtualGrid.d.ts +2 -3
  38. package/lib/VirtualGrid.js.map +1 -1
  39. package/lib/WorldMaps.d.ts +1 -1
  40. package/lib/WorldMaps.js +5 -5
  41. package/lib/WorldMaps.js.map +1 -1
  42. package/lib/index.d.ts +21 -19
  43. package/lib/index.js +27 -30
  44. package/lib/index.js.map +1 -1
  45. package/lib/types/Hitbox.d.ts +24 -0
  46. package/lib/types/Hitbox.js +3 -0
  47. package/lib/types/Hitbox.js.map +1 -0
  48. package/lib/types/Player.d.ts +8 -0
  49. package/lib/types/Player.js +3 -0
  50. package/lib/types/Player.js.map +1 -0
  51. package/lib/types/index.d.ts +3 -0
  52. package/lib/types/index.js +3 -0
  53. package/lib/types/index.js.map +1 -0
  54. package/lib/workers/move.js +1 -1
  55. package/lib/workers/move.js.map +1 -1
  56. package/package.json +5 -3
package/lib/Player.js CHANGED
@@ -1,654 +1,22 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
2
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.RpgCommonPlayer = exports.PlayerType = exports.LiteralDirection = exports.Direction = void 0;
16
- const Utils_1 = require("./Utils");
17
- const Hit_1 = require("./Hit");
18
- const Shape_1 = require("./Shape");
19
- const sat_1 = __importDefault(require("sat"));
20
- const Map_1 = require("./Map");
21
- const Plugin_1 = require("./Plugin");
22
- const Game_1 = require("./Game");
23
- const ACTIONS = { IDLE: 0, RUN: 1, ACTION: 2 };
24
- var Direction;
25
- (function (Direction) {
26
- Direction[Direction["Up"] = 1] = "Up";
27
- Direction[Direction["Down"] = 3] = "Down";
28
- Direction[Direction["Left"] = 4] = "Left";
29
- Direction[Direction["Right"] = 2] = "Right";
30
- Direction[Direction["UpRight"] = 1.5] = "UpRight";
31
- Direction[Direction["DownRight"] = 2.5] = "DownRight";
32
- Direction[Direction["DownLeft"] = 3.5] = "DownLeft";
33
- Direction[Direction["UpLeft"] = 2.5] = "UpLeft";
34
- })(Direction = exports.Direction || (exports.Direction = {}));
3
+ exports.RpgCommonPlayer = exports.LiteralDirection = void 0;
4
+ const AbstractObject_1 = require("./AbstractObject");
35
5
  exports.LiteralDirection = {
36
6
  1: 'up',
37
7
  2: 'right',
38
8
  3: 'down',
39
9
  4: 'left'
40
10
  };
41
- var PlayerType;
42
- (function (PlayerType) {
43
- PlayerType["Player"] = "player";
44
- PlayerType["Event"] = "event";
45
- PlayerType["Shape"] = "shape";
46
- })(PlayerType = exports.PlayerType || (exports.PlayerType = {}));
47
- class RpgCommonPlayer {
48
- constructor(gameEngine, playerId) {
49
- this.gameEngine = gameEngine;
50
- this.playerId = playerId;
51
- this.map = '';
11
+ class RpgCommonPlayer extends AbstractObject_1.AbstractObject {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.events = [];
52
15
  this.layerName = '';
53
16
  this.components = [];
54
- this.height = 0;
55
- this.width = 0;
56
- this.events = [];
57
- this.direction = 3;
58
- this.collisionWith = [];
59
- this._collisionWithTiles = [];
60
- /** @internal */
61
17
  this.data = {};
62
18
  this.pendingMove = [];
63
- this.inShapes = {};
64
- this.shapes = [];
65
- this._hitboxPos = new sat_1.default.Vector(0, 0);
66
- this.setHitbox(this.width, this.height);
67
- this.position = { x: 0, y: 0, z: 0 };
68
- }
69
- static get ACTIONS() {
70
- return ACTIONS;
71
- }
72
- get id() {
73
- return this.playerId;
74
- }
75
- set id(str) {
76
- this.playerId = str;
77
- }
78
- updateInVirtualGrid() {
79
- const map = this.mapInstance;
80
- if (map /*&& this.gameEngine.isWorker TODO */) {
81
- map.grid.insertInCells(this.id, this.getSizeMaxShape());
82
- }
83
- }
84
- /**
85
- * Get/Set position x, y and z of player
86
- *
87
- * z is the depth layer. By default, its value is 0. Collisions and overlays will be performed with other objects on the same z-position.
88
- *
89
- * @title Get/Set position
90
- * @prop { { x: number, y: number, z: number } } position
91
- * @memberof Player
92
- */
93
- set position(val) {
94
- const { x, y, z } = val;
95
- this._hitboxPos.x = x;
96
- this._hitboxPos.y = y;
97
- this._hitboxPos.z = z;
98
- this._position = val;
99
- this.updateInVirtualGrid();
100
- this._position = new Proxy(val, {
101
- get: (target, prop) => target[prop],
102
- set: (target, prop, value) => {
103
- this._hitboxPos[prop] = value;
104
- target[prop] = value;
105
- return true;
106
- }
107
- });
108
- }
109
- get position() {
110
- return this._position;
111
- }
112
- get worldPositionX() {
113
- let x = this.position.x;
114
- if (this.mapInstance) {
115
- x += this.mapInstance.worldX;
116
- }
117
- return x;
118
- }
119
- get worldPositionY() {
120
- let y = this.position.y;
121
- if (this.mapInstance) {
122
- y += this.mapInstance.worldY;
123
- }
124
- return y;
125
- }
126
- set posX(val) {
127
- this.position.x = val;
128
- }
129
- set posY(val) {
130
- this.position.y = val;
131
- }
132
- set posZ(val) {
133
- this.position.z = val;
134
- }
135
- /** @internal */
136
- get mapInstance() {
137
- if (this.gameEngine.side == Game_1.GameSide.Client) {
138
- return Map_1.RpgCommonMap.bufferClient.get(this.map);
139
- }
140
- return Map_1.RpgCommonMap.buffer.get(this.map);
141
- }
142
- /**
143
- *
144
- * Recovers all the colliding tiles of the current player
145
- *
146
- * @title Get Collision of tiles
147
- * @since 3.0.0-beta.4
148
- * @readonly
149
- * @prop { TileInfo[] } tiles
150
- * @memberof Player
151
- * @memberof RpgSpriteLogic
152
- */
153
- get tilesCollision() {
154
- return this._collisionWithTiles;
155
- }
156
- /**
157
- *
158
- * Recovers all other players and events colliding with the current player's hitbox
159
- *
160
- * @title Get Collision of other players/events
161
- * @since 3.0.0-beta.4
162
- * @readonly
163
- * @prop { (RpgPlayer | RpgEvent)[] } otherPlayersCollision
164
- * @memberof Player
165
- * @memberof RpgSpriteLogic
166
- */
167
- get otherPlayersCollision() {
168
- return this.collisionWith;
169
- }
170
- /**
171
- * Define the size of the player. You can set the hitbox for collisions
172
- *
173
- * ```ts
174
- * player.setSizes({
175
- * width: 32,
176
- * height: 32
177
- * })
178
- * ```
179
- *
180
- * and with hitbox:
181
- *
182
- * ```ts
183
- * player.setSizes({
184
- * width: 32,
185
- * height: 32,
186
- * hitbox: {
187
- * width: 20,
188
- * height: 20
189
- * }
190
- * })
191
- * ```
192
- *
193
- * @title Set Sizes
194
- * @method player.setSizes(key,value)
195
- * @param { { width: number, height: number, hitbox?: { width: number, height: number } } } obj
196
- * @deprecated
197
- * @returns {void}
198
- * @memberof Player
199
- */
200
- setSizes(obj) {
201
- this.width = obj.width;
202
- this.height = obj.height;
203
- if (obj.hitbox) {
204
- this.hitbox = new sat_1.default.Box(this._hitboxPos, obj.hitbox.width, obj.hitbox.height);
205
- }
206
- }
207
- /**
208
- * Define the hitbox of the player.
209
- *
210
- * ```ts
211
- * player.setHitbox(20, 20)
212
- * ```
213
- *
214
- * @title Set Hitbox
215
- * @method player.setHitbox(width,height)
216
- * @param {number} width
217
- * @param {number} height
218
- * @returns {void}
219
- * @memberof Player
220
- */
221
- setHitbox(width, height) {
222
- const map = this.mapInstance;
223
- if (map) {
224
- this.width = map.tileWidth;
225
- this.height = map.tileHeight;
226
- }
227
- this.hitbox = new sat_1.default.Box(this._hitboxPos, width, height);
228
- this.wHitbox = width;
229
- this.hHitbox = height;
230
- }
231
- set wHitbox(val) {
232
- this.hitbox.w = val;
233
- }
234
- set hHitbox(val) {
235
- this.hitbox.h = val;
236
- }
237
- get wHitbox() {
238
- return this.hitbox.w;
239
- }
240
- get hHitbox() {
241
- return this.hitbox.h;
242
- }
243
- directionToAngle(direction) {
244
- const angle = (direction < 2 ? +direction + 2 : direction - 2) * 90;
245
- return Utils_1.toRadians(angle);
246
- }
247
- /** @internal */
248
- defineNextPosition(direction, deltaTimeInt) {
249
- const angle = this.directionToAngle(direction);
250
- const computePosition = (prop) => {
251
- return this.position[prop] + this.speed * deltaTimeInt
252
- * (Math.round(Math[prop == 'x' ? 'cos' : 'sin'](angle) * 100) / 100);
253
- };
254
- return {
255
- x: ~~computePosition('x'),
256
- y: ~~computePosition('y'),
257
- z: ~~this.position.z
258
- };
259
- }
260
- /** @internal */
261
- setPosition({ x, y, tileX, tileY }, move = true) {
262
- const { tileWidth, tileHeight } = this.mapInstance;
263
- if (x !== undefined)
264
- this.posX = x;
265
- if (y !== undefined)
266
- this.posY = y;
267
- if (tileX !== undefined)
268
- this.posX = tileX * tileWidth;
269
- if (tileY !== undefined)
270
- this.posY = tileY * tileHeight;
271
- }
272
- /** @internal */
273
- triggerCollisionWith(type) {
274
- for (let collisionWith of this.collisionWith) {
275
- const { properties } = collisionWith;
276
- if (type == RpgCommonPlayer.ACTIONS.ACTION) {
277
- if (collisionWith.onAction)
278
- collisionWith.execMethod('onAction', [this]);
279
- }
280
- else if (collisionWith.onPlayerTouch)
281
- collisionWith.execMethod('onPlayerTouch', [this]);
282
- else if (properties) {
283
- if (properties['go-map'] && this['changeMap'])
284
- this['changeMap'](properties['go-map']);
285
- }
286
- }
287
- }
288
- /** @internal */
289
- zCollision(other) {
290
- const z = this.position.z;
291
- const otherZ = other.position.z;
292
- return Utils_1.intersection([z, z + this.height], [otherZ, otherZ + other.height]);
293
- }
294
- /** @internal */
295
- moveByDirection(direction, deltaTimeInt) {
296
- const nextPosition = this.defineNextPosition(direction, deltaTimeInt);
297
- return this.move(nextPosition);
298
- }
299
- /**
300
- * Retrieves a tile and checks if the player has a collision
301
- *
302
- * ```ts
303
- * const tileInfo = player.getTile(20, 30)
304
- * console.log(tileInfo)
305
- * ```
306
- *
307
- * Example of returns:
308
- *
309
- ```ts
310
- {
311
- tiles: [
312
- {
313
- id: 0,
314
- terrain: [],
315
- probability: null,
316
- properties: [Object],
317
- animations: [],
318
- objectGroups: [],
319
- image: null,
320
- gid: 1
321
- }
322
- ],
323
- hasCollision: false,
324
- isOverlay: undefined,
325
- objectGroups: [],
326
- isClimbable: undefined,
327
- tileIndex: 93
328
- }
329
- ```
330
- *
331
- * @title Get Tile
332
- * @since 3.0.0-beta.4
333
- * @method player.getTile(x,y,z?)
334
- * @param {number} x
335
- * @param {number} y
336
- * @param {number} [z]
337
- * @returns {object}
338
- * @memberof Player
339
- * @memberof RpgSpriteLogic
340
- */
341
- getTile(x, y, z = 0, hitbox) {
342
- const map = this.mapInstance;
343
- return map.getTile(hitbox || this.hitbox, x, y, [z, this.height]);
344
- }
345
- isCollided(nextPosition) {
346
- return __awaiter(this, void 0, void 0, function* () {
347
- this.collisionWith = [];
348
- this._collisionWithTiles = [];
349
- const map = this.mapInstance;
350
- const prevMapId = this.map;
351
- const hitbox = Hit_1.Hit.createObjectHitbox(nextPosition.x, nextPosition.y, 0, this.hitbox.w, this.hitbox.h);
352
- if (!map) {
353
- return true;
354
- }
355
- if (nextPosition.x < 0) {
356
- this.posX = 0;
357
- return true;
358
- }
359
- if (nextPosition.y < 0) {
360
- this.posY = 0;
361
- return true;
362
- }
363
- if (nextPosition.x > map.widthPx - this.hitbox.w) {
364
- this.posX = map.widthPx - this.hitbox.w;
365
- return true;
366
- }
367
- if (nextPosition.y > map.heightPx - this.hitbox.h) {
368
- this.posY = map.heightPx - this.hitbox.h;
369
- return true;
370
- }
371
- const tileCollision = (x, y) => {
372
- const tile = this.getTile(x, y, nextPosition.z, hitbox);
373
- if (tile.hasCollision) {
374
- this._collisionWithTiles.push(tile);
375
- return true;
376
- }
377
- return false;
378
- };
379
- if (tileCollision(nextPosition.x, nextPosition.y) ||
380
- tileCollision(nextPosition.x + this.hitbox.w, nextPosition.y) ||
381
- tileCollision(nextPosition.x, nextPosition.y + this.hitbox.h) ||
382
- tileCollision(nextPosition.x + this.hitbox.w, nextPosition.y + this.hitbox.h)) {
383
- return true;
384
- }
385
- if (this.autoChangeMap) {
386
- const changeMap = yield this.autoChangeMap(nextPosition);
387
- if (changeMap) {
388
- return true;
389
- }
390
- }
391
- const playerSizeBox = this.getSizeMaxShape(nextPosition.x, nextPosition.y);
392
- const events = this.gameEngine.world.getObjectsOfGroup(this.map, this);
393
- const objects = map.grid.getObjectsByBox(playerSizeBox);
394
- for (let objectId of objects) {
395
- // client side: read "object" propertie
396
- if (!events[objectId])
397
- continue;
398
- const event = events[objectId]['object'] || events[objectId];
399
- if (event.id == this.id)
400
- continue;
401
- if (!this.zCollision(event))
402
- continue;
403
- const collided = Hit_1.Hit.testPolyCollision(Hit_1.HitType.Box, hitbox, event.hitbox);
404
- for (let shape of this.shapes) {
405
- yield this.collisionWithShape(shape, event);
406
- }
407
- for (let shape of event.shapes) {
408
- yield event.collisionWithShape(shape, this);
409
- }
410
- if (collided) {
411
- this.collisionWith.push(event);
412
- this.triggerCollisionWith();
413
- let throughOtherPlayer = false;
414
- if (event.type == PlayerType.Player && this.type == PlayerType.Player) {
415
- if (!(event.throughOtherPlayer || this.throughOtherPlayer)) {
416
- return true;
417
- }
418
- else {
419
- throughOtherPlayer = true;
420
- }
421
- }
422
- if (!throughOtherPlayer && (!(event.through || this.through)))
423
- return true;
424
- }
425
- }
426
- const shapes = this.gameEngine.world.getShapesOfGroup(this.map);
427
- const shapesInGrid = this.gameEngine.side == Game_1.GameSide.Client
428
- ? new Set(Object.keys(shapes))
429
- : map.gridShapes.getObjectsByBox(playerSizeBox);
430
- for (let shapeId of shapesInGrid) {
431
- const shape = shapes[shapeId]['object'] || shapes[shapeId];
432
- const bool = yield this.collisionWithShape(shape, this, nextPosition);
433
- if (bool)
434
- return true;
435
- }
436
- // if there is a change of map after a move, the moves are not changed
437
- if (prevMapId != this.map) {
438
- return true;
439
- }
440
- return false;
441
- });
442
- }
443
- /**
444
- * Attach a shape to the player (and allow interaction with it)
445
- *
446
- * ```ts
447
- * import { ShapePositioning } from '@rpgjs/server'
448
- *
449
- * player.attachShape({
450
- * width: 100,
451
- * height: 100,
452
- * positioning: ShapePositioning.Center
453
- * })
454
- * ```
455
- *
456
- * @title Attach Shape
457
- * @method player.attachShape(parameters)
458
- * @param { { width: number, height: number, positioning?, name?, properties?: object } } obj
459
- * - positioning: Indicate where the shape is placed.
460
- * - properties: An object in order to retrieve information when interacting with the shape
461
- * - name: The name of the shape
462
- * @since 3.0.0-beta.3
463
- * @returns {RpgShape}
464
- * @memberof Player
465
- */
466
- attachShape(obj) {
467
- obj.name = (obj.name || Utils_1.generateUID());
468
- const shape = new Shape_1.RpgShape(Object.assign(Object.assign({}, obj), { fixEvent: this }));
469
- this.shapes.push(shape);
470
- return shape;
471
- }
472
- /**
473
- * Returns all shapes assigned to this player
474
- *
475
- * @title Get Shapes
476
- * @method player.getShapes()
477
- * @returns {RpgShape[]}
478
- * @since 3.0.0-beta.3
479
- * @memberof Player
480
- * @memberof RpgSpriteLogic
481
- */
482
- getShapes() {
483
- return this.shapes;
484
- }
485
- /** @internal */
486
- collisionWithShape(shape, player, nextPosition) {
487
- return __awaiter(this, void 0, void 0, function* () {
488
- const { collision, z } = shape.properties;
489
- if (shape.isShapePosition())
490
- return false;
491
- if (z !== undefined && !this.zCollision({
492
- position: { z },
493
- height: this.mapInstance.zTileHeight
494
- })) {
495
- return false;
496
- }
497
- let { position, hitbox } = player;
498
- if (nextPosition)
499
- position = nextPosition;
500
- const hitboxObj = Hit_1.Hit.createObjectHitbox(position.x, position.y, position.z, hitbox.w, hitbox.h);
501
- let collided = Hit_1.Hit.testPolyCollision(shape.type, hitboxObj, shape.hitbox);
502
- if (collided) {
503
- this.collisionWith.push(shape);
504
- // TODO: in shape after map load
505
- if (!collision)
506
- yield shape.in(this);
507
- this.triggerCollisionWith();
508
- if (collision)
509
- return true;
510
- }
511
- else {
512
- yield shape.out(this);
513
- }
514
- return false;
515
- });
516
- }
517
- /** @internal */
518
- move(nextPosition, testCollision = true) {
519
- return __awaiter(this, void 0, void 0, function* () {
520
- {
521
- const { x, y } = this.position;
522
- const { x: nx, y: ny } = nextPosition;
523
- const diff = Math.abs(x - nx) > Math.abs(y - ny);
524
- if (diff) {
525
- if (nx > x) {
526
- this.changeDirection(Direction.Right);
527
- }
528
- else {
529
- this.changeDirection(Direction.Left);
530
- }
531
- }
532
- else {
533
- if (ny > y) {
534
- this.changeDirection(Direction.Down);
535
- }
536
- else {
537
- this.changeDirection(Direction.Up);
538
- }
539
- }
540
- }
541
- const collided = testCollision && !(yield this.isCollided(nextPosition));
542
- if (collided) {
543
- this.position = nextPosition;
544
- yield Plugin_1.RpgPlugin.emit(Plugin_1.HookServer.PlayerMove, this);
545
- }
546
- return true;
547
- });
548
- }
549
- /**
550
- * Retrieves all shapes where the player is located
551
- *
552
- * @title Get In-Shapes
553
- * @method player.getInShapes()
554
- * @returns {RpgShape[]}
555
- * @since 3.0.0-beta.3
556
- * @memberof Player
557
- */
558
- getInShapes() {
559
- return Object.values(this.inShapes);
560
- }
561
- /**
562
- * Get the current direction.
563
- *
564
- * ```ts
565
- * player.getDirection()
566
- * ```
567
- *
568
- * @title Get Direction
569
- * @method player.getDirection()
570
- * @returns {Direction | number} direction
571
- * @memberof Player
572
- */
573
- getDirection(direction) {
574
- return direction || this.direction;
575
- }
576
- /**
577
- * Changes the player's direction
578
- *
579
- * ```ts
580
- * import { Direction } from '@rpgjs/server'
581
- *
582
- * player.changeDirection(Direction.Left)
583
- * ```
584
- *
585
- * @title Change direction
586
- * @method player.changeDirection(direction)
587
- * @param {Direction} direction
588
- * @enum {string}
589
- *
590
- * Direction.Left | left
591
- * Direction.Right | right
592
- * Direction.Up | up
593
- * Direction.Down | down
594
- * @returns {boolean} the direction has changed
595
- * @memberof Player
596
- */
597
- changeDirection(direction) {
598
- const dir = +this.getDirection(direction);
599
- if (dir === undefined)
600
- return false;
601
- this.direction = dir;
602
- return true;
603
- }
604
- /**
605
- * Gets the necessary number of pixels to allow the player to cross a tile.
606
- * This is the ratio between the height or width of the tile and the speed of the player.
607
- */
608
- get nbPixelInTile() {
609
- const direction = this.getDirection();
610
- switch (direction) {
611
- case Direction.Down:
612
- case Direction.Up:
613
- return Math.floor(this.mapInstance.tileHeight / this.speed);
614
- case Direction.Left:
615
- case Direction.Right:
616
- return Math.floor(this.mapInstance.tileWidth / this.speed);
617
- default:
618
- return NaN;
619
- }
620
- }
621
- /** @internal */
622
- getSizeMaxShape(x, y) {
623
- const _x = x || this.position.x;
624
- const _y = y || this.position.y;
625
- let minX = _x;
626
- let minY = _y;
627
- let maxX = _x + this.wHitbox;
628
- let maxY = _y + this.hHitbox;
629
- const shapes = this.getShapes();
630
- for (let shape of shapes) {
631
- if (shape.x < minX)
632
- minX = shape.x;
633
- if (shape.y < minY)
634
- minY = shape.y;
635
- const shapeMaxX = shape.x + shape.width;
636
- const shapeMaxY = shape.y + shape.height;
637
- if (shapeMaxX > maxX)
638
- maxX = shapeMaxX;
639
- if (shapeMaxY > maxY)
640
- maxY = shapeMaxY;
641
- }
642
- return {
643
- minX,
644
- minY,
645
- maxX,
646
- maxY
647
- };
648
- }
649
- /** @internal */
650
- execMethod(methodName, methodData, instance) {
651
- return __awaiter(this, void 0, void 0, function* () { });
19
+ this.inputsTimestamp = {};
652
20
  }
653
21
  }
654
22
  exports.RpgCommonPlayer = RpgCommonPlayer;
package/lib/Player.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Player.js","sourceRoot":"","sources":["../src/Player.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mCAA8D;AAC9D,+BAAoC;AACpC,mCAAkC;AAClC,8CAAqB;AACrB,+BAA8C;AAC9C,qCAAgD;AAChD,iCAAgD;AAGhD,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAA;AAI9C,IAAY,SASX;AATD,WAAY,SAAS;IACjB,qCAAM,CAAA;IACN,yCAAQ,CAAA;IACR,yCAAQ,CAAA;IACR,2CAAS,CAAA;IACT,iDAAa,CAAA;IACb,qDAAe,CAAA;IACf,mDAAc,CAAA;IACd,+CAAa,CAAA;AACjB,CAAC,EATW,SAAS,GAAT,iB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