@rpgjs/common 5.0.0-alpha.13 → 5.0.0-alpha.14
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/dist/Player.d.ts +1 -0
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/Player.ts +2 -1
- package/src/rooms/WorldMaps.ts +6 -5
package/dist/Player.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ export declare abstract class RpgCommonPlayer {
|
|
|
73
73
|
_throughOtherPlayer: import('@signe/reactive').WritableSignal<boolean>;
|
|
74
74
|
_throughEvent: import('@signe/reactive').WritableSignal<boolean>;
|
|
75
75
|
_frequency: import('@signe/reactive').WritableSignal<number>;
|
|
76
|
+
isConnected: import('@signe/reactive').WritableSignal<boolean>;
|
|
76
77
|
private _intendedDirection;
|
|
77
78
|
/**
|
|
78
79
|
* Change the player's facing direction
|
package/dist/index.js
CHANGED
|
@@ -2320,6 +2320,7 @@ class RpgCommonPlayer {
|
|
|
2320
2320
|
this._throughOtherPlayer = signal(true);
|
|
2321
2321
|
this._throughEvent = signal(false);
|
|
2322
2322
|
this._frequency = signal(0);
|
|
2323
|
+
this.isConnected = signal(false);
|
|
2323
2324
|
// Store intended movement direction (not synced, only used locally)
|
|
2324
2325
|
this._intendedDirection = null;
|
|
2325
2326
|
}
|
|
@@ -2608,6 +2609,9 @@ __decorateClass([
|
|
|
2608
2609
|
__decorateClass([
|
|
2609
2610
|
sync()
|
|
2610
2611
|
], RpgCommonPlayer.prototype, "_frequency");
|
|
2612
|
+
__decorateClass([
|
|
2613
|
+
connected()
|
|
2614
|
+
], RpgCommonPlayer.prototype, "isConnected");
|
|
2611
2615
|
|
|
2612
2616
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2613
2617
|
|
|
@@ -16723,19 +16727,18 @@ class WorldMapsManager {
|
|
|
16723
16727
|
getAdjacentMaps(map, search) {
|
|
16724
16728
|
const maps = Array.from(this.maps.values());
|
|
16725
16729
|
if (typeof search === "number") {
|
|
16726
|
-
const Direction = require("../Player").Direction;
|
|
16727
16730
|
const src = map;
|
|
16728
16731
|
return maps.filter((m) => {
|
|
16729
16732
|
const horizontallyOverlaps = Math.max(src.worldX, m.worldX) < Math.min(src.worldX + src.width, m.worldX + m.width);
|
|
16730
16733
|
const verticallyOverlaps = Math.max(src.worldY, m.worldY) < Math.min(src.worldY + src.height, m.worldY + m.height);
|
|
16731
16734
|
switch (search) {
|
|
16732
|
-
case
|
|
16735
|
+
case 0:
|
|
16733
16736
|
return verticallyOverlaps && m.worldY + m.height === src.worldY;
|
|
16734
|
-
case
|
|
16737
|
+
case 1:
|
|
16735
16738
|
return verticallyOverlaps && m.worldY === src.worldY + src.height;
|
|
16736
|
-
case
|
|
16739
|
+
case 2:
|
|
16737
16740
|
return horizontallyOverlaps && m.worldX + m.width === src.worldX;
|
|
16738
|
-
case
|
|
16741
|
+
case 3:
|
|
16739
16742
|
return horizontallyOverlaps && m.worldX === src.worldX + src.width;
|
|
16740
16743
|
default:
|
|
16741
16744
|
return false;
|