@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpgjs/common",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.14",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"publishConfig": {
|
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"description": "",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@dimforge/rapier2d": "^0.18.
|
|
15
|
-
"@signe/di": "^2.4.
|
|
16
|
-
"@signe/reactive": "^2.4.
|
|
17
|
-
"@signe/sync": "^2.4.
|
|
14
|
+
"@dimforge/rapier2d": "^0.18.1",
|
|
15
|
+
"@signe/di": "^2.4.6",
|
|
16
|
+
"@signe/reactive": "^2.4.6",
|
|
17
|
+
"@signe/sync": "^2.4.6",
|
|
18
18
|
"matter-js": "^0.20.0",
|
|
19
19
|
"rxjs": "^7.8.2"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"vite": "^7.1.
|
|
22
|
+
"vite": "^7.1.2",
|
|
23
23
|
"vite-plugin-dts": "^4.5.4",
|
|
24
24
|
"vitest": "^3.2.4"
|
|
25
25
|
},
|
package/src/Player.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { signal } from "@signe/reactive";
|
|
2
|
-
import { id, sync, users } from "@signe/sync";
|
|
2
|
+
import { connected, id, sync, users } from "@signe/sync";
|
|
3
3
|
import * as Matter from "matter-js";
|
|
4
4
|
import { MovementManager } from "./movement";
|
|
5
5
|
import { Item } from "./database";
|
|
@@ -85,6 +85,7 @@ export abstract class RpgCommonPlayer {
|
|
|
85
85
|
@sync() _throughOtherPlayer = signal(true);
|
|
86
86
|
@sync() _throughEvent = signal(false);
|
|
87
87
|
@sync() _frequency = signal(0);
|
|
88
|
+
@connected() isConnected = signal(false)
|
|
88
89
|
|
|
89
90
|
// Store intended movement direction (not synced, only used locally)
|
|
90
91
|
private _intendedDirection: Direction | null = null;
|
package/src/rooms/WorldMaps.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Direction } from "../Player";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Interface for world map information
|
|
3
5
|
*/
|
|
@@ -134,7 +136,6 @@ export class WorldMapsManager {
|
|
|
134
136
|
|
|
135
137
|
// Direction lookup (number) --------------------------------------------
|
|
136
138
|
if (typeof search === 'number') {
|
|
137
|
-
const Direction = require('../Player').Direction as any;
|
|
138
139
|
const src = map;
|
|
139
140
|
return maps.filter(m => {
|
|
140
141
|
const horizontallyOverlaps =
|
|
@@ -143,13 +144,13 @@ export class WorldMapsManager {
|
|
|
143
144
|
Math.max(src.worldY, m.worldY) < Math.min(src.worldY + src.height, m.worldY + m.height);
|
|
144
145
|
|
|
145
146
|
switch (search) {
|
|
146
|
-
case
|
|
147
|
+
case 0:
|
|
147
148
|
return verticallyOverlaps && m.worldY + m.height === src.worldY;
|
|
148
|
-
case
|
|
149
|
+
case 1:
|
|
149
150
|
return verticallyOverlaps && m.worldY === src.worldY + src.height;
|
|
150
|
-
case
|
|
151
|
+
case 2:
|
|
151
152
|
return horizontallyOverlaps && m.worldX + m.width === src.worldX;
|
|
152
|
-
case
|
|
153
|
+
case 3:
|
|
153
154
|
return horizontallyOverlaps && m.worldX === src.worldX + src.width;
|
|
154
155
|
default:
|
|
155
156
|
return false;
|