pw-js-world 0.0.5-dev.05281d1 → 0.0.5-dev.24aedef

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.
@@ -1,6 +1,5 @@
1
1
  import type { ProtoGen } from "pw-js-api";
2
- import type { Point } from "./types";
3
-
2
+ import type { Point } from "./types/index.js";
4
3
  export interface IPlayer {
5
4
  /**
6
5
  * ID of the player.
@@ -28,7 +27,7 @@ export interface IPlayer {
28
27
  isFriend: boolean;
29
28
  /**
30
29
  * Position of the user.
31
- *
30
+ *
32
31
  * Note: This helper does not simulate physics so positions will always be inaccurate.
33
32
  */
34
33
  position?: Point;
@@ -44,18 +43,15 @@ export interface IPlayer {
44
43
  * current world state.
45
44
  */
46
45
  states: IPlayerWorldState;
47
-
48
46
  /**
49
47
  * List of active effects the player has.
50
48
  */
51
49
  effects: PlayerEffect[];
52
-
53
50
  /**
54
51
  * If this player is the bot.
55
52
  */
56
53
  isMe: boolean;
57
54
  }
58
-
59
55
  export interface IPlayerRights {
60
56
  /**
61
57
  * If the player has edit rights.
@@ -78,7 +74,6 @@ export interface IPlayerRights {
78
74
  */
79
75
  availableCommands: string[];
80
76
  }
81
-
82
77
  export interface IPlayerWorldState {
83
78
  /**
84
79
  * Number of gold coins the player has.
@@ -121,7 +116,6 @@ export interface IPlayerWorldState {
121
116
  */
122
117
  teamId: number;
123
118
  }
124
-
125
119
  export interface IPlayerEffect {
126
120
  /**
127
121
  * The ID of the effect.
@@ -136,7 +130,6 @@ export interface IPlayerEffect {
136
130
  */
137
131
  strength?: number;
138
132
  }
139
-
140
133
  export default class Player {
141
134
  /**
142
135
  * ID of the player.
@@ -164,7 +157,7 @@ export default class Player {
164
157
  isFriend: boolean;
165
158
  /**
166
159
  * Position of the user.
167
- *
160
+ *
168
161
  * Note: This helper does not simulate physics so positions will always be inaccurate.
169
162
  */
170
163
  position?: Point;
@@ -175,100 +168,30 @@ export default class Player {
175
168
  /**
176
169
  * Rights
177
170
  */
178
- rights!: IPlayerRights;
171
+ rights: IPlayerRights;
179
172
  /**
180
173
  * current world state.
181
174
  */
182
- states!: IPlayerWorldState;
183
-
175
+ states: IPlayerWorldState;
184
176
  /**
185
177
  * List of active effects the player has.
186
178
  */
187
- effects:PlayerEffect[] = [];
188
-
179
+ effects: PlayerEffect[];
189
180
  /**
190
181
  * If this player is the bot.
191
182
  */
192
- isMe: boolean = false;
193
-
194
- constructor(props: ProtoGen.PlayerProperties, states?: IPlayerWorldState | boolean) {
195
- this.accountId = props.accountId;
196
- this.face = props.face;
197
- this.isFriend = props.isFriend;
198
- this.isWorldOwner = props.isWorldOwner;
199
- this.playerId = props.playerId;
200
- this.position = props.position ? {
201
- x: props.position.x,
202
- y: props.position.y
203
- } : undefined;
204
-
205
- if (!props.rights) this.resetRights();
206
- else this.rights = {
207
- availableCommands: props.rights.availableCommands,
208
- canChangeWorldSettings: props.rights.canChangeWorldSettings,
209
- canEdit: props.rights.canEdit,
210
- canGod: props.rights.canGod,
211
- canToggleMinimap: props.rights.canToggleMinimap,
212
- };
213
-
214
- this.role = props.role;
215
- this.username = props.username;
216
-
217
- if (typeof states === "boolean") {
218
- this.isMe = states;
219
- states = undefined;
220
- }
221
-
222
- if (!states) {
223
- // Could be bot via init that don't get states.
224
- this.resetState()
225
- } else this.states = {
226
- coinsBlue: states.coinsBlue,
227
- coinsGold: states.coinsGold,
228
- collectedItems: states.collectedItems.map(v => ({ x: v.x, y: v.y })),
229
- deaths: states.deaths,
230
- godmode: states.godmode,
231
- hasGoldCrown: states.hasGoldCrown,
232
- hasSilverCrown: states.hasSilverCrown,
233
- modmode: states.modmode,
234
- switches: states.switches,
235
- teamId: states.teamId,
236
- };
237
- }
238
-
183
+ isMe: boolean;
184
+ constructor(props: ProtoGen.PlayerProperties, states?: IPlayerWorldState | boolean);
239
185
  /**
240
186
  * This is destructive, this is only for on reset packet.
241
187
  */
242
- resetState() {
243
- this.states = {
244
- coinsBlue: 0,
245
- coinsGold: 0,
246
- collectedItems: [],
247
- deaths: 0,
248
- godmode: false,
249
- hasGoldCrown: false,
250
- hasSilverCrown: false,
251
- modmode: false,
252
- switches: new Array(1000).fill(false),
253
- teamId: 0,
254
- }
255
- }
256
-
188
+ resetState(): void;
257
189
  /**
258
190
  * Destructive.
259
191
  */
260
- resetRights() {
261
- this.rights = {
262
- availableCommands: [],
263
- canChangeWorldSettings: false,
264
- canEdit: false,
265
- canGod: false,
266
- canToggleMinimap: false
267
- }
268
- }
192
+ resetRights(): void;
269
193
  }
270
-
271
- export class PlayerEffect {
194
+ export declare class PlayerEffect {
272
195
  /**
273
196
  * The ID of the effect.
274
197
  */
@@ -285,33 +208,15 @@ export class PlayerEffect {
285
208
  * The time the effect occurred.
286
209
  */
287
210
  triggeredAt: number;
288
-
289
- constructor(effect: IPlayerEffect, triggeredAt?: number) {
290
- this.effectId = effect.effectId;
291
- this.duration = effect.duration;
292
- this.strength = effect.strength;
293
-
294
- this.triggeredAt = triggeredAt ?? Date.now();
295
- }
296
-
297
-
211
+ constructor(effect: IPlayerEffect, triggeredAt?: number);
298
212
  /**
299
213
  * Note: If this effect is non timed, this will always return false.
300
214
  */
301
- get hasExpired() {
302
- if (this.duration === undefined) return false;
303
-
304
- return Date.now() > (this.triggeredAt + this.duration);
305
- }
306
-
215
+ get hasExpired(): boolean;
307
216
  /**
308
217
  * Milliseconds showing how long before this expires.
309
- *
218
+ *
310
219
  * Note: If this effect is non timed, this will return infinity.
311
220
  */
312
- get remaining() {
313
- if (this.duration === undefined) return Infinity;
314
-
315
- return Math.max(0, Date.now() - (this.triggeredAt + this.duration));
316
- }
317
- }
221
+ get remaining(): number;
222
+ }
package/esm/Player.js ADDED
@@ -0,0 +1,110 @@
1
+ export default class Player {
2
+ constructor(props, states) {
3
+ /**
4
+ * List of active effects the player has.
5
+ */
6
+ this.effects = [];
7
+ /**
8
+ * If this player is the bot.
9
+ */
10
+ this.isMe = false;
11
+ this.accountId = props.accountId;
12
+ this.face = props.face;
13
+ this.isFriend = props.isFriend;
14
+ this.isWorldOwner = props.isWorldOwner;
15
+ this.playerId = props.playerId;
16
+ this.position = props.position ? {
17
+ x: props.position.x,
18
+ y: props.position.y
19
+ } : undefined;
20
+ if (!props.rights)
21
+ this.resetRights();
22
+ else
23
+ this.rights = {
24
+ availableCommands: props.rights.availableCommands,
25
+ canChangeWorldSettings: props.rights.canChangeWorldSettings,
26
+ canEdit: props.rights.canEdit,
27
+ canGod: props.rights.canGod,
28
+ canToggleMinimap: props.rights.canToggleMinimap,
29
+ };
30
+ this.role = props.role;
31
+ this.username = props.username;
32
+ if (typeof states === "boolean") {
33
+ this.isMe = states;
34
+ states = undefined;
35
+ }
36
+ if (!states) {
37
+ // Could be bot via init that don't get states.
38
+ this.resetState();
39
+ }
40
+ else
41
+ this.states = {
42
+ coinsBlue: states.coinsBlue,
43
+ coinsGold: states.coinsGold,
44
+ collectedItems: states.collectedItems.map(v => ({ x: v.x, y: v.y })),
45
+ deaths: states.deaths,
46
+ godmode: states.godmode,
47
+ hasGoldCrown: states.hasGoldCrown,
48
+ hasSilverCrown: states.hasSilverCrown,
49
+ modmode: states.modmode,
50
+ switches: states.switches,
51
+ teamId: states.teamId,
52
+ };
53
+ }
54
+ /**
55
+ * This is destructive, this is only for on reset packet.
56
+ */
57
+ resetState() {
58
+ this.states = {
59
+ coinsBlue: 0,
60
+ coinsGold: 0,
61
+ collectedItems: [],
62
+ deaths: 0,
63
+ godmode: false,
64
+ hasGoldCrown: false,
65
+ hasSilverCrown: false,
66
+ modmode: false,
67
+ switches: new Array(1000).fill(false),
68
+ teamId: 0,
69
+ };
70
+ }
71
+ /**
72
+ * Destructive.
73
+ */
74
+ resetRights() {
75
+ this.rights = {
76
+ availableCommands: [],
77
+ canChangeWorldSettings: false,
78
+ canEdit: false,
79
+ canGod: false,
80
+ canToggleMinimap: false
81
+ };
82
+ }
83
+ }
84
+ export class PlayerEffect {
85
+ constructor(effect, triggeredAt) {
86
+ this.effectId = effect.effectId;
87
+ this.duration = effect.duration;
88
+ this.strength = effect.strength;
89
+ this.triggeredAt = triggeredAt !== null && triggeredAt !== void 0 ? triggeredAt : Date.now();
90
+ }
91
+ /**
92
+ * Note: If this effect is non timed, this will always return false.
93
+ */
94
+ get hasExpired() {
95
+ if (this.duration === undefined)
96
+ return false;
97
+ return Date.now() > (this.triggeredAt + this.duration);
98
+ }
99
+ /**
100
+ * Milliseconds showing how long before this expires.
101
+ *
102
+ * Note: If this effect is non timed, this will return infinity.
103
+ */
104
+ get remaining() {
105
+ if (this.duration === undefined)
106
+ return Infinity;
107
+ return Math.max(0, Date.now() - (this.triggeredAt + this.duration));
108
+ }
109
+ }
110
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUGxheWVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vbGliL1BsYXllci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUEySUEsTUFBTSxDQUFDLE9BQU8sT0FBTyxNQUFNO0lBc0R2QixZQUFZLEtBQWdDLEVBQUUsTUFBb0M7UUFWbEY7O1dBRUc7UUFDSCxZQUFPLEdBQWtCLEVBQUUsQ0FBQztRQUU1Qjs7V0FFRztRQUNILFNBQUksR0FBWSxLQUFLLENBQUM7UUFHbEIsSUFBSSxDQUFDLFNBQVMsR0FBRyxLQUFLLENBQUMsU0FBUyxDQUFDO1FBQ2pDLElBQUksQ0FBQyxJQUFJLEdBQUcsS0FBSyxDQUFDLElBQUksQ0FBQztRQUN2QixJQUFJLENBQUMsUUFBUSxHQUFHLEtBQUssQ0FBQyxRQUFRLENBQUM7UUFDL0IsSUFBSSxDQUFDLFlBQVksR0FBRyxLQUFLLENBQUMsWUFBWSxDQUFDO1FBQ3ZDLElBQUksQ0FBQyxRQUFRLEdBQUcsS0FBSyxDQUFDLFFBQVEsQ0FBQztRQUMvQixJQUFJLENBQUMsUUFBUSxHQUFHLEtBQUssQ0FBQyxRQUFRLENBQUMsQ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QUMsUUFBUSxDQUFDLENBQUMsQ0FBQztJQUN4RSxDQUFDO0NBQ0oifQ==
@@ -1,12 +1,6 @@
1
1
  export type * from "./types/index.d.ts";
2
2
  export { default as PWGameWorldHelper } from "./Helper.js";
3
-
4
3
  export { ComponentTypeHeader, default as BufferReader } from "./BufferReader.js";
5
-
6
4
  export { default as Block, BlockArgsHeadings } from "./Block.js";
7
-
8
5
  export { default as Player, PlayerEffect, IPlayer, IPlayerEffect, IPlayerRights, IPlayerWorldState } from "./Player.js";
9
-
10
6
  export * as Constants from "./Constants.js";
11
-
12
- // import * from "./Helper";
package/esm/index.js ADDED
@@ -0,0 +1,8 @@
1
+ export { default as PWGameWorldHelper } from "./Helper.js";
2
+ export { ComponentTypeHeader, default as BufferReader } from "./BufferReader.js";
3
+ export { default as Block, BlockArgsHeadings } from "./Block.js";
4
+ export { default as Player, PlayerEffect } from "./Player.js";
5
+ import * as Constants_1 from "./Constants.js";
6
+ export { Constants_1 as Constants };
7
+ // import * from "./Helper";
8
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9saWIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLE9BQU8sSUFBSSxpQkFBaUIsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUUzRCxPQUFPLEVBQUUsbUJBQW1CLEVBQUUsT0FBTyxJQUFJLFlBQVksRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBRWpGLE9BQU8sRUFBRSxPQUFPLElBQUksS0FBSyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sWUFBWSxDQUFDO0FBRWpFLE9BQU8sRUFBRSxPQUFPLElBQUksTUFBTSxFQUFFLFlBQVksRUFBNEQsTUFBTSxhQUFhLENBQUM7NkJBRTdGLGdCQUFnQjt3QkFBL0IsU0FBUztBQUVyQiw0QkFBNEIifQ==
@@ -1,7 +1,7 @@
1
1
  // I cba so all of the typings will go here
2
2
 
3
- import Block from "../Block";
4
- import Player, { IPlayerEffect, IPlayerRights } from "../Player";
3
+ import Block from "../Block.js";
4
+ import Player, { IPlayerEffect, IPlayerRights } from "../Player.js";
5
5
 
6
6
  type Point = { x: number, y: number };
7
7
 
package/package.json CHANGED
@@ -1,13 +1,11 @@
1
1
  {
2
2
  "name": "pw-js-world",
3
- "version": "0.0.5-dev.05281d1",
3
+ "version": "0.0.5-dev.24aedef",
4
4
  "description": "An optional package for PW-JS-Api, aims to serve world purposes.",
5
- "main": "lib/index.ts",
6
5
  "exports": {
7
- "bun": "./dist/index.js",
8
- "import": "./esm.mjs",
9
- "require": "./dist/index.js",
10
- "types": "./dist/index.d.ts"
6
+ "types": "./esm/index.js",
7
+ "import": "./esm/index.js",
8
+ "require": "./cm/index.js"
11
9
  },
12
10
  "keywords": [
13
11
  "PixelWalker",
@@ -36,6 +34,7 @@
36
34
  },
37
35
  "scripts": {
38
36
  "test": "bun test/index.ts",
39
- "build": "rimraf dist && tsc -p tsconfig.json && ncp lib/types dist/types"
37
+ "build:ts": "tsc -p tsconfig-cm.json & tsc -p tsconfig-esm.json",
38
+ "build": "rimraf cm esm && npm run build:ts && ncp lib/types esm/types"
40
39
  }
41
40
  }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig",
3
+ "compilerOptions": {
4
+ "outDir": "cm",
5
+ "module": "Node16",
6
+ "moduleResolution": "node16",
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig",
3
+ "compilerOptions": {
4
+ "outDir": "esm",
5
+ "module": "ES6",
6
+ "moduleResolution": "bundler",
7
+ }
8
+ }
@@ -1,49 +0,0 @@
1
- // I cba so all of the typings will go here
2
-
3
- import Block from "../Block";
4
- import Player, { IPlayerEffect, IPlayerRights } from "../Player";
5
-
6
- type Point = { x: number, y: number };
7
-
8
- export interface SendableBlockPacket {
9
- /**
10
- * If true, just leave one position
11
- */
12
- isFillOperation: boolean;
13
- blockId: number;
14
- layer: number;
15
- /**
16
- * Note: (I THINK) 250 positions limit.
17
- */
18
- positions: Point[];
19
- extraFields?: Uint8Array;
20
- }
21
-
22
- export type BlockArg = (string | number | bigint | boolean | Buffer);
23
-
24
- export type PWGameHook = {
25
- worldBlockPlacedPacket: { player: Player, oldBlocks: Block[], newBlocks: Block[] },
26
- playerJoinedPacket: { player: Player },
27
- playerLeftPacket: { player: Player },
28
- playerInitPacket: { player: Player },
29
- playerFacePacket: { player: Player, oldFace: number },
30
- playerModModePacket: { player: Player, oldState: boolean },
31
- playerGodModePacket: { player: Player, oldState: boolean },
32
- playerAddEffectPacket: { player: Player, effect: IPlayerEffect },
33
- playerRemoveEffectPacket: { player: Player, effect: IPlayerEffect },
34
- playerResetEffectsPacket: { player: Player, effects: IPlayerEffect[] },
35
- playerMovedPacket: { player: Player },
36
- playerResetPacket: { player: Player },
37
- playerRespawnPacket: { player: Player },
38
- playerUpdateRightsPacket: { player: Player, rights: IPlayerRights },
39
- playerTeamUpdatePacket: { player: Player, oldTeam: number },
40
- playerCountersUpdatePacket: { player: Player, oldState: { coinsBlue: number, coinsGold: number, deaths: number } },
41
- playerTeleportedPacket: { player: Player },
42
- globalSwitchChangedPacket: { player: Player },
43
- globalSwitchResetPacket: { player: Player },
44
- playerLocalSwitchChangedPacket: { player: Player },
45
- playerLocalSwitchResetPacket: { player: Player },
46
- playerChatPacket: { player: Player },
47
- playerDirectMessagePacket: { player: Player },
48
- playerTouchBlockPacket: { player: Player },
49
- };
package/esm.mjs DELETED
@@ -1,33 +0,0 @@
1
- // TODO: clean this code to make it easier to get named exports.
2
- let PWGameWorldHelper = (await import("./dist/Helper.js")).default;
3
- let Block = (await import("./dist/Block.js")).default;
4
- let BufferReader = (await import("./dist/BufferReader.js"));
5
-
6
- let ComponentTypeHeader = BufferReader.ComponentTypeHeader;
7
-
8
- BufferReader = BufferReader.default;
9
-
10
- let Player = (await import("./dist/Player.js"));
11
-
12
- let PlayerEffect = Player.PlayerEffect;
13
-
14
- Player = Player.default;
15
-
16
- if ("default" in PWGameWorldHelper) PWGameWorldHelper = PWGameWorldHelper.default;
17
- if ("default" in Block) Block = Block.default;
18
- if ("default" in BufferReader) BufferReader = BufferReader.default;
19
- if ("default" in Player) Player = Player.default;
20
-
21
- const Constants = (await import("./dist/Constants.js")).default;
22
-
23
- export default {
24
- PWGameWorldHelper, Block, BufferReader,
25
- Player, Constants, ComponentTypeHeader,
26
- PlayerEffect
27
- };
28
-
29
- export {
30
- PWGameWorldHelper, Block, BufferReader,
31
- Player, Constants, ComponentTypeHeader,
32
- PlayerEffect
33
- };