@rpgjs/server 5.0.0-beta.5 → 5.0.0-beta.6
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/index.js +11 -12
- package/dist/index.js.map +1 -1
- package/dist/{module-BmvXIvlE.js → module-Dy124Jyk.js} +432 -239
- package/dist/module-Dy124Jyk.js.map +1 -0
- package/dist/node/index.js +1 -1
- package/package.json +4 -4
- package/src/Player/Player.ts +1 -1
- package/src/rooms/map.ts +21 -15
- package/tests/action-interaction.spec.ts +97 -0
- package/tests/item.spec.ts +72 -1
- package/tests/move.spec.ts +65 -1
- package/tests/world-maps.spec.ts +4 -0
- package/dist/module-BmvXIvlE.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as Skill, A as isArray, B as ProjectileMovement, C as SDEF, Ct as linkedSignal, D as arrayFlat, Dt as combineLatest, E as PrebuiltGui, Et as finalize$1, F as ModulesToken, G as Knockback, H as PathFollow, I as RpgModule, J as Entity, K as IceMovement, L as WorldMapsManager, M as isInstanceOf, N as isString, O as arrayUniq, Ot as BehaviorSubject, P as random, Q as RpgCommonPlayer, R as RpgCommonMap, S as PDEF, St as isSignal, T as PerlinNoise2D, Tt as untracked, U as Oscillate, V as ProjectileType, W as LinearRepulsion, X as RpgShape, Y as Vector2, Z as Direction, _ as ATK, _t as computed, a as isMapUpdateAuthorized, at as createStatesSnapshotDeep, b as MAXHP, bt as isComputed, ct as id, d as context, dt as sync, et as Item, f as inject, ft as syncClass, g as AGI, gt as ObjectSubject, h as injector, ht as ArraySubject, it as createStatesSnapshot, j as isFunction, k as capitalize, kt as createErrorClass, l as context$1, lt as load, m as inject$1, mt as users, n as MAP_UPDATE_TOKEN_ENV, nt as __decorateMetadata, ot as generateShortUUID$1, p as setInject, pt as type, q as Dash, r as MAP_UPDATE_TOKEN_HEADER, st as getByPath, t as provideServerModules, tt as __decorate, u as clearInject, ut as persist, v as DEX, vt as effect, w as STR, wt as signal, x as MAXSP, xt as isObjectSubject, y as INT, yt as isArraySubject, z as SeekAvoid } from "./module-Dy124Jyk.js";
|
|
2
2
|
//#region ../../node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.mjs
|
|
3
3
|
function dset(obj, keys, val) {
|
|
4
4
|
keys.split && (keys = keys.split("."));
|
|
@@ -10521,7 +10521,7 @@ var RpgPlayer = class extends BasicPlayerMixins(RpgCommonPlayer) {
|
|
|
10521
10521
|
const height = hitbox?.h ?? 32;
|
|
10522
10522
|
const centerX = positions.x + width / 2;
|
|
10523
10523
|
const centerY = positions.y + height / 2;
|
|
10524
|
-
this.map.physic.
|
|
10524
|
+
this.map.physic.teleportEntity(entity, {
|
|
10525
10525
|
x: centerX,
|
|
10526
10526
|
y: centerY
|
|
10527
10527
|
});
|
|
@@ -15743,7 +15743,11 @@ var RpgMap = class RpgMap extends RpgCommonMap {
|
|
|
15743
15743
|
* ```
|
|
15744
15744
|
*/
|
|
15745
15745
|
onAction(player, action) {
|
|
15746
|
-
const
|
|
15746
|
+
const direction = typeof player.getDirection === "function" ? player.getDirection() : typeof player.direction === "function" ? player.direction() : void 0;
|
|
15747
|
+
const collisions = new Set(this.getCollisions(player.id));
|
|
15748
|
+
const interactionCollisions = this.getInteractionCollisions?.(player.id, direction);
|
|
15749
|
+
if (Array.isArray(interactionCollisions)) interactionCollisions.forEach((id) => collisions.add(id));
|
|
15750
|
+
const events = Array.from(collisions).map((id) => this.getEvent(id)).filter((event) => !!event && this.isEventVisibleForPlayer(event, player));
|
|
15747
15751
|
if (events.length > 0) events.forEach((event) => {
|
|
15748
15752
|
event.execMethod("onAction", [player, action]);
|
|
15749
15753
|
});
|
|
@@ -16895,18 +16899,13 @@ var RpgMap = class RpgMap extends RpgCommonMap {
|
|
|
16895
16899
|
const centerX = x + width / 2;
|
|
16896
16900
|
const centerY = y + height / 2;
|
|
16897
16901
|
const entityId = `shape-${name}`;
|
|
16898
|
-
this.physic.
|
|
16899
|
-
|
|
16900
|
-
|
|
16901
|
-
x: centerX,
|
|
16902
|
-
y: centerY
|
|
16903
|
-
},
|
|
16902
|
+
this.physic.createStaticObstacle(entityId, {
|
|
16903
|
+
x: centerX,
|
|
16904
|
+
y: centerY,
|
|
16904
16905
|
width,
|
|
16905
16906
|
height,
|
|
16906
|
-
mass: Infinity,
|
|
16907
|
-
state: EntityState.Static,
|
|
16908
16907
|
restitution: 0
|
|
16909
|
-
})
|
|
16908
|
+
});
|
|
16910
16909
|
const properties = { ...obj.properties || {} };
|
|
16911
16910
|
if (obj.z !== void 0) properties.z = obj.z;
|
|
16912
16911
|
if (obj.color !== void 0) properties.color = obj.color;
|