@kubeverse/sdk 0.1.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.
- package/dist/context.d.ts +137 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +3 -0
- package/dist/context.js.map +1 -0
- package/dist/entities.d.ts +50 -0
- package/dist/entities.d.ts.map +1 -0
- package/dist/entities.js +3 -0
- package/dist/entities.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/math.d.ts +57 -0
- package/dist/math.d.ts.map +1 -0
- package/dist/math.js +267 -0
- package/dist/math.js.map +1 -0
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/worldModule.d.ts +40 -0
- package/dist/worldModule.d.ts.map +1 -0
- package/dist/worldModule.js +22 -0
- package/dist/worldModule.js.map +1 -0
- package/package.json +23 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { INPC, IPlayer } from "./entities";
|
|
2
|
+
import { Quaternion, Vector3 } from "./math";
|
|
3
|
+
export type ModuleSocketHandler<TPlayer extends IPlayer = IPlayer> = (player: TPlayer, data: any, socket: unknown) => void | Promise<void>;
|
|
4
|
+
export type ModuleUIDataHandler<TPlayer extends IPlayer = IPlayer> = (player: TPlayer, data: any) => void | Promise<void>;
|
|
5
|
+
export type CollisionCallback<TPlayer extends IPlayer = IPlayer> = (player: TPlayer, primitiveId: string) => void | Promise<void>;
|
|
6
|
+
export type TriggerZoneEnterCallback<TPlayer extends IPlayer = IPlayer> = (player: TPlayer) => void | Promise<void>;
|
|
7
|
+
export type TriggerZoneLeaveCallback<TPlayer extends IPlayer = IPlayer> = (player: TPlayer) => void | Promise<void>;
|
|
8
|
+
export type ChatMessageHandler<TPlayer extends IPlayer = IPlayer> = (player: TPlayer, text: string) => boolean | void | Promise<boolean | void>;
|
|
9
|
+
export type PrimitiveOptions = {
|
|
10
|
+
type: "cube" | "sphere" | "cylinder" | "ramp" | "halfcube";
|
|
11
|
+
position: Vector3;
|
|
12
|
+
rotation?: Quaternion;
|
|
13
|
+
scale?: {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
z: number;
|
|
17
|
+
};
|
|
18
|
+
color?: number;
|
|
19
|
+
materialType?: "standard" | "basic";
|
|
20
|
+
opacity?: number;
|
|
21
|
+
colliderType?: "fixed" | "dynamic" | "kinematic" | "none";
|
|
22
|
+
renderMode?: "voxel" | "default";
|
|
23
|
+
};
|
|
24
|
+
export type PrimitiveUpdateOptions = {
|
|
25
|
+
position?: Vector3;
|
|
26
|
+
rotation?: Quaternion;
|
|
27
|
+
scale?: {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
z: number;
|
|
31
|
+
};
|
|
32
|
+
color?: number;
|
|
33
|
+
materialType?: "standard" | "basic";
|
|
34
|
+
opacity?: number;
|
|
35
|
+
colliderType?: "fixed" | "dynamic" | "kinematic" | "none";
|
|
36
|
+
};
|
|
37
|
+
export type VoxelBlockOptions = {
|
|
38
|
+
color: number;
|
|
39
|
+
solid?: boolean;
|
|
40
|
+
opacity?: number;
|
|
41
|
+
};
|
|
42
|
+
export type VoxelBlockDef = {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
z: number;
|
|
46
|
+
} & VoxelBlockOptions;
|
|
47
|
+
export type RuntimePrimitive = {
|
|
48
|
+
id: string;
|
|
49
|
+
primitiveType: PrimitiveOptions["type"];
|
|
50
|
+
position: Vector3;
|
|
51
|
+
quaternion: Quaternion;
|
|
52
|
+
scale: {
|
|
53
|
+
x: number;
|
|
54
|
+
y: number;
|
|
55
|
+
z: number;
|
|
56
|
+
};
|
|
57
|
+
primitiveData: {
|
|
58
|
+
color?: number;
|
|
59
|
+
materialType?: "standard" | "basic";
|
|
60
|
+
opacity?: number;
|
|
61
|
+
};
|
|
62
|
+
colliderType: "fixed" | "dynamic" | "kinematic" | "none";
|
|
63
|
+
renderMode?: PrimitiveOptions["renderMode"];
|
|
64
|
+
};
|
|
65
|
+
export type RuntimeProp = {
|
|
66
|
+
id: string;
|
|
67
|
+
type: string;
|
|
68
|
+
position: Vector3;
|
|
69
|
+
quaternion: Quaternion;
|
|
70
|
+
scale?: {
|
|
71
|
+
x: number;
|
|
72
|
+
y: number;
|
|
73
|
+
z: number;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export type RaycastHit = {
|
|
77
|
+
position: Vector3;
|
|
78
|
+
normal: Vector3;
|
|
79
|
+
distance: number;
|
|
80
|
+
entityId?: string;
|
|
81
|
+
entityType?: "player" | "npc" | "primitive" | "world";
|
|
82
|
+
};
|
|
83
|
+
export type WorldSettingsLike = object;
|
|
84
|
+
export type TimerHandle = ReturnType<typeof globalThis.setTimeout>;
|
|
85
|
+
export interface IWorldContext<TPlayer extends IPlayer = IPlayer, TNPC extends INPC = INPC> {
|
|
86
|
+
spawnNPC(position: Vector3): TNPC;
|
|
87
|
+
spawnProp(type: string, position: Vector3, rotation?: Quaternion, scale?: {
|
|
88
|
+
x: number;
|
|
89
|
+
y: number;
|
|
90
|
+
z: number;
|
|
91
|
+
}): string;
|
|
92
|
+
spawnPrimitive(options: PrimitiveOptions): string;
|
|
93
|
+
spawnPrimitives(options: PrimitiveOptions[]): string[];
|
|
94
|
+
setVoxelBlock(x: number, y: number, z: number, options: VoxelBlockOptions): void;
|
|
95
|
+
setVoxelBlocks(blocks: VoxelBlockDef[]): void;
|
|
96
|
+
removeVoxelBlock(x: number, y: number, z: number): void;
|
|
97
|
+
getVoxelBlock(x: number, y: number, z: number): VoxelBlockOptions | null;
|
|
98
|
+
onPlayerEnterPrimitive(primitiveId: string, callback: CollisionCallback<TPlayer>): void;
|
|
99
|
+
onPlayerLeavePrimitive(primitiveId: string, callback: CollisionCallback<TPlayer>): void;
|
|
100
|
+
createTriggerZone(position: Vector3, size: Vector3, onEnter: TriggerZoneEnterCallback<TPlayer>, onLeave?: TriggerZoneLeaveCallback<TPlayer>): string;
|
|
101
|
+
removeTriggerZone(id: string): void;
|
|
102
|
+
removeNPC(npc: TNPC, delay?: number): void;
|
|
103
|
+
removeProp(id: string): void;
|
|
104
|
+
removePrimitive(id: string): void;
|
|
105
|
+
updatePrimitive(id: string, updates: PrimitiveUpdateOptions): boolean;
|
|
106
|
+
getPlayers(): Map<string, TPlayer>;
|
|
107
|
+
getPlayerById(id: string): TPlayer | null;
|
|
108
|
+
getPlayerByUserId(userId: string): TPlayer | null;
|
|
109
|
+
getNPCs(): TNPC[];
|
|
110
|
+
getWorldSettings(): WorldSettingsLike;
|
|
111
|
+
getPrimitives(): RuntimePrimitive[];
|
|
112
|
+
getProps(): RuntimeProp[];
|
|
113
|
+
getSpawnPoints(): Vector3[];
|
|
114
|
+
randomSpawnPoint(): Vector3;
|
|
115
|
+
broadcast(event: string, data: any): void;
|
|
116
|
+
sendChatMessage(text: string): void;
|
|
117
|
+
onChatMessage(handler: ChatMessageHandler<TPlayer>): void;
|
|
118
|
+
playSoundAll(audioKey: string, volume?: number, detune?: number): void;
|
|
119
|
+
loadUITemplate(moduleDir: string): void;
|
|
120
|
+
onUIData(handler: ModuleUIDataHandler<TPlayer>): void;
|
|
121
|
+
loadWorldData<T>(): Promise<T | null>;
|
|
122
|
+
saveWorldData(data: unknown): Promise<void>;
|
|
123
|
+
onSocket(event: string, handler: ModuleSocketHandler<TPlayer>): void;
|
|
124
|
+
setGravity(gravity: number): void;
|
|
125
|
+
setAmbientLight(color: number, intensity: number): void;
|
|
126
|
+
setDirectionalLight(color: number, intensity: number): void;
|
|
127
|
+
setFog(enabled: boolean, color?: number, near?: number, far?: number): void;
|
|
128
|
+
setViewMode(mode: "first-person" | "third-person" | "both"): void;
|
|
129
|
+
raycast(origin: Vector3, direction: Vector3, maxDistance: number, options?: {
|
|
130
|
+
excludePlayer?: IPlayer;
|
|
131
|
+
}): RaycastHit | null;
|
|
132
|
+
setTimeout(fn: () => void, ms: number): TimerHandle;
|
|
133
|
+
clearTimeout(handle: TimerHandle): void;
|
|
134
|
+
setInterval(fn: () => void, ms: number): TimerHandle;
|
|
135
|
+
clearInterval(handle: TimerHandle): void;
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE7C,MAAM,MAAM,mBAAmB,CAAC,OAAO,SAAS,OAAO,GAAG,OAAO,IAAI,CACnE,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,OAAO,KACZ,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B,MAAM,MAAM,mBAAmB,CAAC,OAAO,SAAS,OAAO,GAAG,OAAO,IAAI,CACnE,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,GAAG,KACN,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B,MAAM,MAAM,iBAAiB,CAAC,OAAO,SAAS,OAAO,GAAG,OAAO,IAAI,CACjE,MAAM,EAAE,OAAO,EACf,WAAW,EAAE,MAAM,KAChB,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B,MAAM,MAAM,wBAAwB,CAAC,OAAO,SAAS,OAAO,GAAG,OAAO,IAAI,CACxE,MAAM,EAAE,OAAO,KACZ,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B,MAAM,MAAM,wBAAwB,CAAC,OAAO,SAAS,OAAO,GAAG,OAAO,IAAI,CACxE,MAAM,EAAE,OAAO,KACZ,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAA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WAAW,CAAC;IACpD,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IACxC,WAAW,CAAC,EAAE,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,CAAC;IACrD,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;CAC1C"}
|
package/dist/context.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Quaternion, Vector3 } from "./math";
|
|
2
|
+
import { PurchaseRequest, PurchaseResult } from "./types";
|
|
3
|
+
export interface IPlayer {
|
|
4
|
+
id: string;
|
|
5
|
+
userId: string;
|
|
6
|
+
nickname: string | null;
|
|
7
|
+
health: number;
|
|
8
|
+
isDead: boolean;
|
|
9
|
+
grounded: boolean;
|
|
10
|
+
velocity: Vector3;
|
|
11
|
+
position: Vector3;
|
|
12
|
+
quaternion: Quaternion;
|
|
13
|
+
viewQuaternion: Quaternion | null;
|
|
14
|
+
camPos: Vector3 | null;
|
|
15
|
+
controlledObject: {
|
|
16
|
+
id: string;
|
|
17
|
+
} | null;
|
|
18
|
+
isSitting: boolean;
|
|
19
|
+
isFrozen: boolean;
|
|
20
|
+
walkSpeed: number;
|
|
21
|
+
runSpeed: number;
|
|
22
|
+
notify(message: string): void;
|
|
23
|
+
sendRawEvent(event: string, payload: unknown): void;
|
|
24
|
+
emit(event: string, data: any): void;
|
|
25
|
+
loadUI(): void;
|
|
26
|
+
sendUIData(data: any): void;
|
|
27
|
+
clearUI(): void;
|
|
28
|
+
playSound(audioKey: string, volume?: number, detune?: number): void;
|
|
29
|
+
setSpeed(walkSpeed: number, runSpeed: number): void;
|
|
30
|
+
setFrozen(frozen: boolean): void;
|
|
31
|
+
setGravity(gravity: number): void;
|
|
32
|
+
requestPurchase(request: PurchaseRequest): Promise<PurchaseResult>;
|
|
33
|
+
getKoins(): Promise<number>;
|
|
34
|
+
loadData<T>(): Promise<T | null>;
|
|
35
|
+
saveData(data: unknown): Promise<void>;
|
|
36
|
+
teleportTo(position: Vector3): void;
|
|
37
|
+
}
|
|
38
|
+
export interface INPC {
|
|
39
|
+
id: string;
|
|
40
|
+
position: Vector3;
|
|
41
|
+
quaternion: Quaternion;
|
|
42
|
+
velocity: Vector3;
|
|
43
|
+
health: number;
|
|
44
|
+
isDead: boolean;
|
|
45
|
+
teleportTo(position: Vector3): void;
|
|
46
|
+
damage(amount: number, attackerId?: string): void;
|
|
47
|
+
heal(amount: number): void;
|
|
48
|
+
setTarget(target: IPlayer | INPC | null): void;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=entities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../src/entities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE1D,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC;IACvB,cAAc,EAAE,UAAU,GAAG,IAAI,CAAC;IAClC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,gBAAgB,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACxC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,SA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AC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;IACpC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClD,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CAChD"}
|
package/dist/entities.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../src/entities.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./math"), exports);
|
|
18
|
+
__exportStar(require("./entities"), exports);
|
|
19
|
+
__exportStar(require("./context"), exports);
|
|
20
|
+
__exportStar(require("./worldModule"), exports);
|
|
21
|
+
__exportStar(require("./types"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,6CAA2B;AAC3B,4CAA0B;AAC1B,gDAA8B;AAC9B,0CAAwB"}
|
package/dist/math.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare class Vector3 {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
z: number;
|
|
5
|
+
constructor(x?: number, y?: number, z?: number);
|
|
6
|
+
add(vec: Vector3): this;
|
|
7
|
+
sub(vec: Vector3): this;
|
|
8
|
+
set(x: number, y: number, z: number): this;
|
|
9
|
+
multiplyScalar(scalar: number): this;
|
|
10
|
+
distanceTo(vec: Vector3): number;
|
|
11
|
+
clone(): Vector3;
|
|
12
|
+
static zero(): Vector3;
|
|
13
|
+
normalize(): this;
|
|
14
|
+
length(): number;
|
|
15
|
+
cross(vec: Vector3): this;
|
|
16
|
+
applyQuaternion(q: {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
z: number;
|
|
20
|
+
w: number;
|
|
21
|
+
}): this;
|
|
22
|
+
dot(vec: Vector3): number;
|
|
23
|
+
copy(vec: Vector3): this;
|
|
24
|
+
}
|
|
25
|
+
export declare class Quaternion {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
z: number;
|
|
29
|
+
w: number;
|
|
30
|
+
constructor(x?: number, y?: number, z?: number, w?: number);
|
|
31
|
+
set(x: number, y: number, z: number, w: number): this;
|
|
32
|
+
clone(): Quaternion;
|
|
33
|
+
copy(q: Quaternion): this;
|
|
34
|
+
normalize(): this;
|
|
35
|
+
multiply(q: Quaternion): this;
|
|
36
|
+
multiplied(q: Quaternion): Quaternion;
|
|
37
|
+
invert(): this;
|
|
38
|
+
conjugate(): this;
|
|
39
|
+
setFromAxisAngle(axis: {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
z: number;
|
|
43
|
+
}, angle: number): this;
|
|
44
|
+
setFromEuler(x: number, y: number, z: number, order?: "XYZ" | "YXZ" | "ZXY" | "ZYX" | "YZX" | "XZY"): this;
|
|
45
|
+
applyToVector3(v: {
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
z: number;
|
|
49
|
+
}): {
|
|
50
|
+
x: number;
|
|
51
|
+
y: number;
|
|
52
|
+
z: number;
|
|
53
|
+
};
|
|
54
|
+
slerp(q: Quaternion, t: number): this;
|
|
55
|
+
static identity(): Quaternion;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=math.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../src/math.ts"],"names":[],"mappings":"AAAA,qBAAa,OAAO;IACC,CAAC;IAAa,CAAC;IAAa,CAAC;gBAA7B,CAAC,SAAI,EAAS,CAAC,SAAI,EAAS,CAAC,SAAI;IAEpD,GAAG,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAOvB,GAAG,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAOvB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IAO1C,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAOpC,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM;IAOhC,KAAK,IAAI,OAAO;IAIhB,MAAM,CAAC,IAAI,IAAI,OAAO;IAItB,SAAS,IAAI,IAAI;IAU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C,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG;QACtD,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;KACX;IAqBD,KAAK,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IAsCrC,MAAM,CAAC,QAAQ,IAAI,UAAU;CAG9B"}
|
package/dist/math.js
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Quaternion = exports.Vector3 = void 0;
|
|
4
|
+
class Vector3 {
|
|
5
|
+
constructor(x = 0, y = 0, z = 0) {
|
|
6
|
+
this.x = x;
|
|
7
|
+
this.y = y;
|
|
8
|
+
this.z = z;
|
|
9
|
+
}
|
|
10
|
+
add(vec) {
|
|
11
|
+
this.x += vec.x;
|
|
12
|
+
this.y += vec.y;
|
|
13
|
+
this.z += vec.z;
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
sub(vec) {
|
|
17
|
+
this.x -= vec.x;
|
|
18
|
+
this.y -= vec.y;
|
|
19
|
+
this.z -= vec.z;
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
set(x, y, z) {
|
|
23
|
+
this.x = x;
|
|
24
|
+
this.y = y;
|
|
25
|
+
this.z = z;
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
multiplyScalar(scalar) {
|
|
29
|
+
this.x *= scalar;
|
|
30
|
+
this.y *= scalar;
|
|
31
|
+
this.z *= scalar;
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
distanceTo(vec) {
|
|
35
|
+
const dx = this.x - vec.x;
|
|
36
|
+
const dy = this.y - vec.y;
|
|
37
|
+
const dz = this.z - vec.z;
|
|
38
|
+
return Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
39
|
+
}
|
|
40
|
+
clone() {
|
|
41
|
+
return new Vector3(this.x, this.y, this.z);
|
|
42
|
+
}
|
|
43
|
+
static zero() {
|
|
44
|
+
return new Vector3(0, 0, 0);
|
|
45
|
+
}
|
|
46
|
+
normalize() {
|
|
47
|
+
const length = Math.sqrt(this.x ** 2 + this.y ** 2 + this.z ** 2);
|
|
48
|
+
if (length > 0) {
|
|
49
|
+
this.x /= length;
|
|
50
|
+
this.y /= length;
|
|
51
|
+
this.z /= length;
|
|
52
|
+
}
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
length() {
|
|
56
|
+
return Math.sqrt(this.x ** 2 + this.y ** 2 + this.z ** 2);
|
|
57
|
+
}
|
|
58
|
+
cross(vec) {
|
|
59
|
+
const x = this.y * vec.z - this.z * vec.y;
|
|
60
|
+
const y = this.z * vec.x - this.x * vec.z;
|
|
61
|
+
const z = this.x * vec.y - this.y * vec.x;
|
|
62
|
+
this.x = x;
|
|
63
|
+
this.y = y;
|
|
64
|
+
this.z = z;
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
applyQuaternion(q) {
|
|
68
|
+
const x = this.x;
|
|
69
|
+
const y = this.y;
|
|
70
|
+
const z = this.z;
|
|
71
|
+
const qx = q.x;
|
|
72
|
+
const qy = q.y;
|
|
73
|
+
const qz = q.z;
|
|
74
|
+
const qw = q.w;
|
|
75
|
+
const ix = qw * x + qy * z - qz * y;
|
|
76
|
+
const iy = qw * y + qz * x - qx * z;
|
|
77
|
+
const iz = qw * z + qx * y - qy * x;
|
|
78
|
+
const iw = -qx * x - qy * y - qz * z;
|
|
79
|
+
this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy;
|
|
80
|
+
this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz;
|
|
81
|
+
this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx;
|
|
82
|
+
return this;
|
|
83
|
+
}
|
|
84
|
+
dot(vec) {
|
|
85
|
+
return this.x * vec.x + this.y * vec.y + this.z * vec.z;
|
|
86
|
+
}
|
|
87
|
+
copy(vec) {
|
|
88
|
+
this.x = vec.x;
|
|
89
|
+
this.y = vec.y;
|
|
90
|
+
this.z = vec.z;
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.Vector3 = Vector3;
|
|
95
|
+
class Quaternion {
|
|
96
|
+
constructor(x = 0, y = 0, z = 0, w = 1) {
|
|
97
|
+
this.x = x;
|
|
98
|
+
this.y = y;
|
|
99
|
+
this.z = z;
|
|
100
|
+
this.w = w;
|
|
101
|
+
}
|
|
102
|
+
set(x, y, z, w) {
|
|
103
|
+
this.x = x;
|
|
104
|
+
this.y = y;
|
|
105
|
+
this.z = z;
|
|
106
|
+
this.w = w;
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
clone() {
|
|
110
|
+
return new Quaternion(this.x, this.y, this.z, this.w);
|
|
111
|
+
}
|
|
112
|
+
copy(q) {
|
|
113
|
+
this.x = q.x;
|
|
114
|
+
this.y = q.y;
|
|
115
|
+
this.z = q.z;
|
|
116
|
+
this.w = q.w;
|
|
117
|
+
return this;
|
|
118
|
+
}
|
|
119
|
+
normalize() {
|
|
120
|
+
const len = Math.sqrt(this.x ** 2 + this.y ** 2 + this.z ** 2 + this.w ** 2);
|
|
121
|
+
if (len === 0) {
|
|
122
|
+
this.x = this.y = this.z = 0;
|
|
123
|
+
this.w = 1;
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
this.x /= len;
|
|
127
|
+
this.y /= len;
|
|
128
|
+
this.z /= len;
|
|
129
|
+
this.w /= len;
|
|
130
|
+
}
|
|
131
|
+
return this;
|
|
132
|
+
}
|
|
133
|
+
multiply(q) {
|
|
134
|
+
const x = this.x;
|
|
135
|
+
const y = this.y;
|
|
136
|
+
const z = this.z;
|
|
137
|
+
const w = this.w;
|
|
138
|
+
this.x = w * q.x + x * q.w + y * q.z - z * q.y;
|
|
139
|
+
this.y = w * q.y - x * q.z + y * q.w + z * q.x;
|
|
140
|
+
this.z = w * q.z + x * q.y - y * q.x + z * q.w;
|
|
141
|
+
this.w = w * q.w - x * q.x - y * q.y - z * q.z;
|
|
142
|
+
return this;
|
|
143
|
+
}
|
|
144
|
+
multiplied(q) {
|
|
145
|
+
return this.clone().multiply(q);
|
|
146
|
+
}
|
|
147
|
+
invert() {
|
|
148
|
+
return this.conjugate().normalize();
|
|
149
|
+
}
|
|
150
|
+
conjugate() {
|
|
151
|
+
this.x *= -1;
|
|
152
|
+
this.y *= -1;
|
|
153
|
+
this.z *= -1;
|
|
154
|
+
return this;
|
|
155
|
+
}
|
|
156
|
+
setFromAxisAngle(axis, angle) {
|
|
157
|
+
const half = angle / 2;
|
|
158
|
+
const s = Math.sin(half);
|
|
159
|
+
this.x = axis.x * s;
|
|
160
|
+
this.y = axis.y * s;
|
|
161
|
+
this.z = axis.z * s;
|
|
162
|
+
this.w = Math.cos(half);
|
|
163
|
+
return this;
|
|
164
|
+
}
|
|
165
|
+
setFromEuler(x, y, z, order = "XYZ") {
|
|
166
|
+
const c1 = Math.cos(x / 2);
|
|
167
|
+
const c2 = Math.cos(y / 2);
|
|
168
|
+
const c3 = Math.cos(z / 2);
|
|
169
|
+
const s1 = Math.sin(x / 2);
|
|
170
|
+
const s2 = Math.sin(y / 2);
|
|
171
|
+
const s3 = Math.sin(z / 2);
|
|
172
|
+
switch (order) {
|
|
173
|
+
case "XYZ":
|
|
174
|
+
this.x = s1 * c2 * c3 + c1 * s2 * s3;
|
|
175
|
+
this.y = c1 * s2 * c3 - s1 * c2 * s3;
|
|
176
|
+
this.z = c1 * c2 * s3 + s1 * s2 * c3;
|
|
177
|
+
this.w = c1 * c2 * c3 - s1 * s2 * s3;
|
|
178
|
+
break;
|
|
179
|
+
case "YXZ":
|
|
180
|
+
this.x = s1 * c2 * c3 + c1 * s2 * s3;
|
|
181
|
+
this.y = c1 * s2 * c3 - s1 * c2 * s3;
|
|
182
|
+
this.z = c1 * c2 * s3 - s1 * s2 * c3;
|
|
183
|
+
this.w = c1 * c2 * c3 + s1 * s2 * s3;
|
|
184
|
+
break;
|
|
185
|
+
case "ZXY":
|
|
186
|
+
this.x = s1 * c2 * c3 - c1 * s2 * s3;
|
|
187
|
+
this.y = c1 * s2 * c3 + s1 * c2 * s3;
|
|
188
|
+
this.z = c1 * c2 * s3 + s1 * s2 * c3;
|
|
189
|
+
this.w = c1 * c2 * c3 - s1 * s2 * s3;
|
|
190
|
+
break;
|
|
191
|
+
case "ZYX":
|
|
192
|
+
this.x = s1 * c2 * c3 - c1 * s2 * s3;
|
|
193
|
+
this.y = c1 * s2 * c3 + s1 * c2 * s3;
|
|
194
|
+
this.z = c1 * c2 * s3 - s1 * s2 * c3;
|
|
195
|
+
this.w = c1 * c2 * c3 + s1 * s2 * s3;
|
|
196
|
+
break;
|
|
197
|
+
case "YZX":
|
|
198
|
+
this.x = s1 * c2 * c3 + c1 * s2 * s3;
|
|
199
|
+
this.y = c1 * s2 * c3 + s1 * c2 * s3;
|
|
200
|
+
this.z = c1 * c2 * s3 - s1 * s2 * c3;
|
|
201
|
+
this.w = c1 * c2 * c3 - s1 * s2 * s3;
|
|
202
|
+
break;
|
|
203
|
+
case "XZY":
|
|
204
|
+
this.x = s1 * c2 * c3 - c1 * s2 * s3;
|
|
205
|
+
this.y = c1 * s2 * c3 - s1 * c2 * s3;
|
|
206
|
+
this.z = c1 * c2 * s3 + s1 * s2 * c3;
|
|
207
|
+
this.w = c1 * c2 * c3 + s1 * s2 * s3;
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
return this;
|
|
211
|
+
}
|
|
212
|
+
applyToVector3(v) {
|
|
213
|
+
const qx = this.x;
|
|
214
|
+
const qy = this.y;
|
|
215
|
+
const qz = this.z;
|
|
216
|
+
const qw = this.w;
|
|
217
|
+
const x = v.x;
|
|
218
|
+
const y = v.y;
|
|
219
|
+
const z = v.z;
|
|
220
|
+
const ix = qw * x + qy * z - qz * y;
|
|
221
|
+
const iy = qw * y + qz * x - qx * z;
|
|
222
|
+
const iz = qw * z + qx * y - qy * x;
|
|
223
|
+
const iw = -qx * x - qy * y - qz * z;
|
|
224
|
+
return {
|
|
225
|
+
x: ix * qw + iw * -qx + iy * -qz - iz * -qy,
|
|
226
|
+
y: iy * qw + iw * -qy + iz * -qx - ix * -qz,
|
|
227
|
+
z: iz * qw + iw * -qz + ix * -qy - iy * -qx,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
slerp(q, t) {
|
|
231
|
+
let cosHalfTheta = this.x * q.x + this.y * q.y + this.z * q.z + this.w * q.w;
|
|
232
|
+
if (cosHalfTheta < 0) {
|
|
233
|
+
this.x = -q.x;
|
|
234
|
+
this.y = -q.y;
|
|
235
|
+
this.z = -q.z;
|
|
236
|
+
this.w = -q.w;
|
|
237
|
+
cosHalfTheta = -cosHalfTheta;
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
this.copy(q);
|
|
241
|
+
}
|
|
242
|
+
if (cosHalfTheta >= 1.0) {
|
|
243
|
+
return this;
|
|
244
|
+
}
|
|
245
|
+
const sinHalfTheta = Math.sqrt(1.0 - cosHalfTheta * cosHalfTheta);
|
|
246
|
+
if (Math.abs(sinHalfTheta) < 0.001) {
|
|
247
|
+
this.x = 0.5 * (this.x + q.x);
|
|
248
|
+
this.y = 0.5 * (this.y + q.y);
|
|
249
|
+
this.z = 0.5 * (this.z + q.z);
|
|
250
|
+
this.w = 0.5 * (this.w + q.w);
|
|
251
|
+
return this;
|
|
252
|
+
}
|
|
253
|
+
const halfTheta = Math.acos(cosHalfTheta);
|
|
254
|
+
const ratioA = Math.sin((1 - t) * halfTheta) / sinHalfTheta;
|
|
255
|
+
const ratioB = Math.sin(t * halfTheta) / sinHalfTheta;
|
|
256
|
+
this.x = this.x * ratioA + q.x * ratioB;
|
|
257
|
+
this.y = this.y * ratioA + q.y * ratioB;
|
|
258
|
+
this.z = this.z * ratioA + q.z * ratioB;
|
|
259
|
+
this.w = this.w * ratioA + q.w * ratioB;
|
|
260
|
+
return this;
|
|
261
|
+
}
|
|
262
|
+
static identity() {
|
|
263
|
+
return new Quaternion(0, 0, 0, 1);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
exports.Quaternion = Quaternion;
|
|
267
|
+
//# sourceMappingURL=math.js.map
|
package/dist/math.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.js","sourceRoot":"","sources":["../src/math.ts"],"names":[],"mappings":";;;AAAA,MAAa,OAAO;IAClB,YAAmB,IAAI,CAAC,EAAS,IAAI,CAAC,EAAS,IAAI,CAAC;QAAjC,MAAC,GAAD,CAAC,CAAI;QAAS,MAAC,GAAD,CAAC,CAAI;QAAS,MAAC,GAAD,CAAC,CAAI;IAAG,CAAC;IAExD,GAAG,CAAC,GAAY;QACd,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAChB,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAChB,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,GAAG,CAAC,GAAY;QACd,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAChB,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAChB,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS;QACjC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IAED,cAAc,CAAC,MAAc;QAC3B,IAAI,CAAC,CAAC,IAAI,MAAM,CAAC;QACjB,IAAI,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<string, number>;
|
|
6
|
+
};
|
|
7
|
+
export type PurchaseResult = {
|
|
8
|
+
success: boolean;
|
|
9
|
+
cancelled?: boolean;
|
|
10
|
+
timedOut?: boolean;
|
|
11
|
+
newKoins: number;
|
|
12
|
+
newData: Record<string, unknown> | null;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACzC,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { INPC, IPlayer } from "./entities";
|
|
2
|
+
import { Vector3 } from "./math";
|
|
3
|
+
import { IWorldContext } from "./context";
|
|
4
|
+
/**
|
|
5
|
+
* Capabilities are free-form string→boolean flags.
|
|
6
|
+
* Each module defines whatever it needs; the engine checks specific keys
|
|
7
|
+
* only when gating engine-level behaviour (e.g. `inventory`, `persistence`).
|
|
8
|
+
*/
|
|
9
|
+
export type WorldCapabilities = {
|
|
10
|
+
[key: string]: boolean | undefined;
|
|
11
|
+
};
|
|
12
|
+
export interface IWorldModule<TContext extends IWorldContext = IWorldContext, TPlayer extends IPlayer = IPlayer, TNPC extends INPC = INPC> {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
getCapabilities(): WorldCapabilities;
|
|
15
|
+
onInit(ctx: TContext): void;
|
|
16
|
+
onCleanup(ctx: TContext): void;
|
|
17
|
+
onUpdate(ctx: TContext, delta: number): void;
|
|
18
|
+
onFixedUpdate(ctx: TContext, delta: number): void;
|
|
19
|
+
onPlayerReady(ctx: TContext, player: TPlayer): Promise<void>;
|
|
20
|
+
onPlayerRemove(ctx: TContext, player: TPlayer, isLogout: boolean): Promise<void>;
|
|
21
|
+
onPlayerTransferOut(ctx: TContext, player: TPlayer): Promise<void>;
|
|
22
|
+
onPlayerResume?(ctx: TContext, player: TPlayer): void;
|
|
23
|
+
onEvent?(ctx: TContext, event: string, data: Record<string, unknown>): void | Promise<void>;
|
|
24
|
+
getSpawnPosition(ctx: TContext, userId: string): Promise<Vector3 | null>;
|
|
25
|
+
}
|
|
26
|
+
export declare abstract class BaseWorldModule<TContext extends IWorldContext = IWorldContext, TPlayer extends IPlayer = IPlayer, TNPC extends INPC = INPC> implements IWorldModule<TContext, TPlayer, TNPC> {
|
|
27
|
+
abstract readonly id: string;
|
|
28
|
+
getCapabilities(): WorldCapabilities;
|
|
29
|
+
onInit(_ctx: TContext): void;
|
|
30
|
+
onCleanup(_ctx: TContext): void;
|
|
31
|
+
onUpdate(_ctx: TContext, _delta: number): void;
|
|
32
|
+
onFixedUpdate(_ctx: TContext, _delta: number): void;
|
|
33
|
+
onPlayerReady(_ctx: TContext, _player: TPlayer): Promise<void>;
|
|
34
|
+
onPlayerRemove(_ctx: TContext, _player: TPlayer, _isLogout: boolean): Promise<void>;
|
|
35
|
+
onPlayerTransferOut(_ctx: TContext, _player: TPlayer): Promise<void>;
|
|
36
|
+
onPlayerResume?(_ctx: TContext, _player: TPlayer): void;
|
|
37
|
+
onEvent?(_ctx: TContext, _event: string, _data: Record<string, unknown>): void | Promise<void>;
|
|
38
|
+
getSpawnPosition(_ctx: TContext, _userId: string): Promise<Vector3 | null>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=worldModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worldModule.d.ts","sourceRoot":"","sources":["../src/worldModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACpC,CAAC;AAEF,MAAM,WAAW,YAAY,CAC3B,QAAQ,SAAS,aAAa,GAAG,aAAa,EAC9C,OAAO,SAAS,OAAO,GAAG,OAAO,EACjC,IAAI,SAAS,IAAI,GAAG,IAAI;IAExB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,eAAe,IAAI,iBAAiB,CAAC;IAGrC,MAAM,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAGlD,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC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,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1E,cAAc,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IACvD,OAAO,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IACxF,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;CAGjF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseWorldModule = void 0;
|
|
4
|
+
class BaseWorldModule {
|
|
5
|
+
getCapabilities() {
|
|
6
|
+
return {};
|
|
7
|
+
}
|
|
8
|
+
onInit(_ctx) { }
|
|
9
|
+
onCleanup(_ctx) { }
|
|
10
|
+
onUpdate(_ctx, _delta) { }
|
|
11
|
+
onFixedUpdate(_ctx, _delta) { }
|
|
12
|
+
async onPlayerReady(_ctx, _player) { }
|
|
13
|
+
async onPlayerRemove(_ctx, _player, _isLogout) { }
|
|
14
|
+
async onPlayerTransferOut(_ctx, _player) { }
|
|
15
|
+
onPlayerResume(_ctx, _player) { }
|
|
16
|
+
onEvent(_ctx, _event, _data) { }
|
|
17
|
+
async getSpawnPosition(_ctx, _userId) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.BaseWorldModule = BaseWorldModule;
|
|
22
|
+
//# sourceMappingURL=worldModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worldModule.js","sourceRoot":"","sources":["../src/worldModule.ts"],"names":[],"mappings":";;;AAyCA,MAAsB,eAAe;IAOnC,eAAe;QACb,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,CAAC,IAAc,IAAS,CAAC;IAC/B,SAAS,CAAC,IAAc,IAAS,CAAC;IAClC,QAAQ,CAAC,IAAc,EAAE,MAAc,IAAS,CAAC;IACjD,aAAa,CAAC,IAAc,EAAE,MAAc,IAAS,CAAC;IACtD,KAAK,CAAC,aAAa,CAAC,IAAc,EAAE,OAAgB,IAAkB,CAAC;IACvE,KAAK,CAAC,cAAc,CAClB,IAAc,EACd,OAAgB,EAChB,SAAkB,IACF,CAAC;IACnB,KAAK,CAAC,mBAAmB,CAAC,IAAc,EAAE,OAAgB,IAAkB,CAAC;IAC7E,cAAc,CAAE,IAAc,EAAE,OAAgB,IAAS,CAAC;IAC1D,OAAO,CAAE,IAAc,EAAE,MAAc,EAAE,KAA8B,IAAyB,CAAC;IACjG,KAAK,CAAC,gBAAgB,CAAC,IAAc,EAAE,OAAe;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA3BD,0CA2BC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kubeverse/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Kubeverse world module SDK",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": ["dist"],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"build:watch": "tsc --watch",
|
|
17
|
+
"clean": "rm -rf dist"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"typescript": "^5.0.0"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT"
|
|
23
|
+
}
|