@crowdedkingdoms/crowdyjs 8.1.0 → 8.2.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/README.md +23 -2
- package/dist/crowdy-client.js +1 -1
- package/dist/generated/graphql.d.ts +1 -1
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/kit/blueprints.d.ts +113 -2
- package/dist/kit/blueprints.d.ts.map +1 -1
- package/dist/kit/blueprints.js +163 -0
- package/dist/kit/index.d.ts +2 -1
- package/dist/kit/index.d.ts.map +1 -1
- package/dist/kit/index.js +2 -1
- package/dist/kit/kit.d.ts +6 -1
- package/dist/kit/kit.d.ts.map +1 -1
- package/dist/kit/kit.js +3 -1
- package/dist/kit/npcs.d.ts.map +1 -1
- package/dist/kit/objects.d.ts +9 -1
- package/dist/kit/objects.d.ts.map +1 -1
- package/dist/kit/objects.js +10 -1
- package/dist/kit/plots.d.ts +81 -0
- package/dist/kit/plots.d.ts.map +1 -0
- package/dist/kit/plots.js +113 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
* or internal tooling, never an untrusted browser.
|
|
46
46
|
*/
|
|
47
47
|
/** The published package version. Mirrors `package.json`. */
|
|
48
|
-
export declare const VERSION = "8.
|
|
48
|
+
export declare const VERSION = "8.2.0";
|
|
49
49
|
export { LbCookieStore } from './lb-cookie-store.js';
|
|
50
50
|
export { CrowdyClient, createCrowdyClient, type CrowdyClientConfig, } from './crowdy-client.js';
|
|
51
51
|
export { BrowserLocalStorageTokenStore, SessionStore, type SessionListener, type TokenStore, } from './session.js';
|
|
52
52
|
export { GraphQLClient, GraphQLTransport, type GraphQLClientConfig, } from './client.js';
|
|
53
53
|
export { RealtimeClient, type RealtimeConfig, type RealtimeStatus, type SpatialNotification, type UdpNotification, type UdpNotificationHandlers, } from './realtime.js';
|
|
54
54
|
export { WorldClient, ActorClient, type ActorOptions } from './world.js';
|
|
55
|
-
export { GameKitClient, InventoryKit, NpcsKit, ObjectsKit, inventoryBlueprint, inventoryNames, kitInvoke, kitPolicyJson, lockBlueprint, lockNames, mergeBlueprints, npcBehaviorFunctionName, npcBlueprint, toKitInvokeResult, type GameKitOptions, type InventoryBlueprintOptions, type InventoryKitOptions, type InventoryNames, type KitAutomationSpec, type KitAutomationTriggerSpec, type KitBlueprint, type KitDeployResult, type KitInvokePolicy, type KitInvokeResult, type KitItemStack, type KitNpc, type LockAuthority, type LockBlueprintOptions, type LockNames, type MergedBlueprints, type NpcBehaviorSpec, type NpcBehaviorTrigger, type NpcBlueprintOptions, type NpcsKitOptions, type ObjectsKitOptions, } from './kit/index.js';
|
|
55
|
+
export { GameKitClient, InventoryKit, NpcsKit, ObjectsKit, PlotsKit, inventoryBlueprint, inventoryNames, kitInvoke, kitPolicyJson, lockBlueprint, lockNames, mergeBlueprints, npcBehaviorFunctionName, npcBlueprint, plotBlueprint, plotNames, toKitInvokeResult, type GameKitOptions, type InventoryBlueprintOptions, type InventoryKitOptions, type InventoryNames, type KitAutomationSpec, type KitAutomationTriggerSpec, type KitBlueprint, type KitDeployResult, type KitInvokePolicy, type KitInvokeResult, type KitItemStack, type KitNpc, type KitPlot, type KitSelectorSpec, type LockAuthority, type LockBlueprintOptions, type LockNames, type MergedBlueprints, type NpcBehaviorSpec, type NpcBehaviorTrigger, type NpcBlueprintOptions, type NpcsKitOptions, type ObjectsKitOptions, type PlotBlueprintOptions, type PlotNames, type PlotsKitOptions, type SelectorPermissionPredicate, } from './kit/index.js';
|
|
56
56
|
export { CrowdyError, CrowdyGraphQLError, CrowdyHttpError, CrowdyNetworkError, CrowdyProtocolError, CrowdyRealtimeError, CrowdyTimeoutError, } from './errors.js';
|
|
57
57
|
export { SequenceAllocator, decodeBase64, encodeBase64, generateCrowdyUuid, validateChunkCoordinates, validateCrowdyUuid, } from './utils.js';
|
|
58
58
|
export type { BigInt, ChunkCoordinates, VoxelCoordinates, ActorUpdateNotification, ActorUpdateResponse, VoxelUpdateNotification, VoxelUpdateResponse, ClientAudioNotification, ClientTextNotification, ClientEventNotification, ServerEventNotification, GenericErrorResponse, ActorUpdateHandler, ActorUpdateResponseHandler, VoxelUpdateHandler, VoxelUpdateResponseHandler, ClientAudioHandler, ClientTextHandler, ClientEventHandler, ServerEventHandler, GenericErrorHandler, UnsubscribeFn, } from './types.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,6DAA6D;AAC7D,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,KAAK,kBAAkB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,6BAA6B,EAC7B,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,UAAU,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,KAAK,mBAAmB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,uBAAuB,GAC7B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EACL,aAAa,EACb,YAAY,EACZ,OAAO,EACP,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,SAAS,EACT,aAAa,EACb,aAAa,EACb,SAAS,EACT,eAAe,EACf,uBAAuB,EACvB,YAAY,EACZ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SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,4BAA4B,EAG5B,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EACpB,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,wBAAwB,EACxB,sBAAsB,EACtB,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,EACzB,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EAEvB,OAAO,GACR,MAAM,wBAAwB,CAAC;AAMhC,YAAY,EACV,cAAc,EACd,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,GACd,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
* or internal tooling, never an untrusted browser.
|
|
46
46
|
*/
|
|
47
47
|
/** The published package version. Mirrors `package.json`. */
|
|
48
|
-
export const VERSION = '8.
|
|
48
|
+
export const VERSION = '8.2.0';
|
|
49
49
|
export { LbCookieStore } from './lb-cookie-store.js';
|
|
50
50
|
export { CrowdyClient, createCrowdyClient, } from './crowdy-client.js';
|
|
51
51
|
export { BrowserLocalStorageTokenStore, SessionStore, } from './session.js';
|
|
52
52
|
export { GraphQLClient, GraphQLTransport, } from './client.js';
|
|
53
53
|
export { RealtimeClient, } from './realtime.js';
|
|
54
54
|
export { WorldClient, ActorClient } from './world.js';
|
|
55
|
-
export { GameKitClient, InventoryKit, NpcsKit, ObjectsKit, inventoryBlueprint, inventoryNames, kitInvoke, kitPolicyJson, lockBlueprint, lockNames, mergeBlueprints, npcBehaviorFunctionName, npcBlueprint, toKitInvokeResult, } from './kit/index.js';
|
|
55
|
+
export { GameKitClient, InventoryKit, NpcsKit, ObjectsKit, PlotsKit, inventoryBlueprint, inventoryNames, kitInvoke, kitPolicyJson, lockBlueprint, lockNames, mergeBlueprints, npcBehaviorFunctionName, npcBlueprint, plotBlueprint, plotNames, toKitInvokeResult, } from './kit/index.js';
|
|
56
56
|
export { CrowdyError, CrowdyGraphQLError, CrowdyHttpError, CrowdyNetworkError, CrowdyProtocolError, CrowdyRealtimeError, CrowdyTimeoutError, } from './errors.js';
|
|
57
57
|
export { SequenceAllocator, decodeBase64, encodeBase64, generateCrowdyUuid, validateChunkCoordinates, validateCrowdyUuid, } from './utils.js';
|
|
58
58
|
export { UdpErrorCode } from './types.js';
|
package/dist/kit/blueprints.d.ts
CHANGED
|
@@ -42,6 +42,59 @@ export type KitInvokePolicy = {
|
|
|
42
42
|
};
|
|
43
43
|
/** Serialize a {@link KitInvokePolicy} tree to the wire `invokePolicyJson`. */
|
|
44
44
|
export declare function kitPolicyJson(policy: KitInvokePolicy): string;
|
|
45
|
+
/**
|
|
46
|
+
* A grid-permission filter inside a selector: gates selves/candidates by
|
|
47
|
+
* whether the USER behind each container has/lacks an unexpired runtime grid
|
|
48
|
+
* permission. Requires a game-api with the permission-read selector support
|
|
49
|
+
* (v0.13.12+).
|
|
50
|
+
*/
|
|
51
|
+
export interface SelectorPermissionPredicate {
|
|
52
|
+
/** Where the container's user id comes from: its owner, or a property. */
|
|
53
|
+
userFrom: 'owner' | {
|
|
54
|
+
property: string;
|
|
55
|
+
};
|
|
56
|
+
op: 'has' | 'lacks';
|
|
57
|
+
/** Runtime permission key (e.g. 'access', 'update_voxel_data'). */
|
|
58
|
+
key: string;
|
|
59
|
+
/** Literal grid id, a property holding one, or omitted for "on ANY grid". */
|
|
60
|
+
grid?: number | string | {
|
|
61
|
+
property: string;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Typed automation selector (serialized into `selectorJson` at deploy).
|
|
66
|
+
* Property predicates (`selfWhere`/`where`) filter on model data; permission
|
|
67
|
+
* predicates (`selfPermissionWhere`/`candidatePermissionWhere`) filter on the
|
|
68
|
+
* live grid ACL. Extra fields pass through untouched.
|
|
69
|
+
*/
|
|
70
|
+
export interface KitSelectorSpec {
|
|
71
|
+
selfWhere?: Array<{
|
|
72
|
+
key: string;
|
|
73
|
+
op: string;
|
|
74
|
+
value: unknown;
|
|
75
|
+
}>;
|
|
76
|
+
selfPermissionWhere?: SelectorPermissionPredicate[];
|
|
77
|
+
pick?: 'nearest' | 'lowest' | 'highest' | 'random';
|
|
78
|
+
ofType?: string;
|
|
79
|
+
where?: Array<{
|
|
80
|
+
key: string;
|
|
81
|
+
op: string;
|
|
82
|
+
value: unknown;
|
|
83
|
+
}>;
|
|
84
|
+
candidatePermissionWhere?: SelectorPermissionPredicate[];
|
|
85
|
+
by?: 'manhattan' | {
|
|
86
|
+
property: string;
|
|
87
|
+
};
|
|
88
|
+
bindAs?: {
|
|
89
|
+
ref?: string;
|
|
90
|
+
x?: string;
|
|
91
|
+
y?: string;
|
|
92
|
+
approachX?: string;
|
|
93
|
+
approachY?: string;
|
|
94
|
+
approachStop?: number;
|
|
95
|
+
};
|
|
96
|
+
[key: string]: unknown;
|
|
97
|
+
}
|
|
45
98
|
/** An automation spec inside a blueprint (the `appId` is bound at deploy). */
|
|
46
99
|
export type KitAutomationSpec = Omit<UpsertAutomationInput, 'appId'>;
|
|
47
100
|
/** An automation event-trigger spec inside a blueprint. */
|
|
@@ -134,6 +187,18 @@ export type LockAuthority = {
|
|
|
134
187
|
kind: 'gridPermission';
|
|
135
188
|
key: string;
|
|
136
189
|
gridId?: string;
|
|
190
|
+
} | {
|
|
191
|
+
/**
|
|
192
|
+
* The caller must hold the runtime permission on the grid covering the
|
|
193
|
+
* chunk the OBJECT stands in (`cx`/`cy`/`cz` int properties, seeded via
|
|
194
|
+
* `ObjectsKit.create({ chunk })`). No hand-pinned grid id — one function
|
|
195
|
+
* serves every such object in the world. `mode` picks the covering grid
|
|
196
|
+
* when several overlap: 'first' (enforcement parity, default) |
|
|
197
|
+
* 'smallest' (innermost plot) | 'largest'. Requires game-api v0.13.12+.
|
|
198
|
+
*/
|
|
199
|
+
kind: 'chunkPermission';
|
|
200
|
+
key: string;
|
|
201
|
+
mode?: 'first' | 'smallest' | 'largest';
|
|
137
202
|
} | {
|
|
138
203
|
kind: 'groupPermission';
|
|
139
204
|
groupId: string;
|
|
@@ -174,6 +239,51 @@ export declare function lockNames(objectTypeName?: string, keyTypeName?: string)
|
|
|
174
239
|
* Runtime counterpart: `client.kit(appId).objects`.
|
|
175
240
|
*/
|
|
176
241
|
export declare function lockBlueprint(options: LockBlueprintOptions): KitBlueprint;
|
|
242
|
+
/** Options for {@link plotBlueprint}. */
|
|
243
|
+
export interface PlotBlueprintOptions {
|
|
244
|
+
/** Plot container type name. Defaults to `'Plot'`. */
|
|
245
|
+
typeName?: string;
|
|
246
|
+
/**
|
|
247
|
+
* Runtime permission keys buying/renting grants on the plot's grid.
|
|
248
|
+
* Defaults to `['access', 'update_voxel_data']`.
|
|
249
|
+
*/
|
|
250
|
+
permissionKeys?: string[];
|
|
251
|
+
/** Currency property on the wallet container. Defaults to `'gold'`. */
|
|
252
|
+
currencyProperty?: string;
|
|
253
|
+
/**
|
|
254
|
+
* Property on the wallet container mirroring its owner's user id (the
|
|
255
|
+
* standard kit convention, since expressions can't read container
|
|
256
|
+
* ownership). Defaults to `'owner_user_id'`.
|
|
257
|
+
*/
|
|
258
|
+
walletOwnerProperty?: string;
|
|
259
|
+
/**
|
|
260
|
+
* Also generate `rent_plot`: a TTL grant priced by the plot's `rent_price`
|
|
261
|
+
* property, expiring after `rent_ttl_seconds`. Defaults to false.
|
|
262
|
+
*/
|
|
263
|
+
rentable?: boolean;
|
|
264
|
+
}
|
|
265
|
+
/** Names derived by {@link plotBlueprint} for a given plot type. */
|
|
266
|
+
export interface PlotNames {
|
|
267
|
+
plotType: string;
|
|
268
|
+
buyFn: string;
|
|
269
|
+
rentFn: string;
|
|
270
|
+
evictFn: string;
|
|
271
|
+
}
|
|
272
|
+
/** Compute the type/function names a plot blueprint (and its runtime helper) uses. */
|
|
273
|
+
export declare function plotNames(typeName?: string): PlotNames;
|
|
274
|
+
/**
|
|
275
|
+
* Blueprint for **sellable/rentable land**: a `Plot` container mapping a world
|
|
276
|
+
* [grid](../domains/gameApps.js) to a price, whose `buy`/`rent` functions
|
|
277
|
+
* consume currency AND grant runtime grid permissions in one transaction (via
|
|
278
|
+
* permission effects) — the canonical read+write permission loop. Buying sets
|
|
279
|
+
* the plot's `owner_user_id`; renting grants with a TTL; `evict` revokes.
|
|
280
|
+
* The grants are enforced by the replication layer on movement/voxel writes
|
|
281
|
+
* immediately at commit. Requires game-api v0.13.11+ (effects) — pair with
|
|
282
|
+
* chunk-permission locks (v0.13.12+) for doors that honor the purchase.
|
|
283
|
+
*
|
|
284
|
+
* Runtime counterpart: `client.kit(appId).plots`.
|
|
285
|
+
*/
|
|
286
|
+
export declare function plotBlueprint(options?: PlotBlueprintOptions): KitBlueprint;
|
|
177
287
|
/** A trigger for an NPC behavior: a schedule (interval or cron) or a model event. */
|
|
178
288
|
export type NpcBehaviorTrigger = {
|
|
179
289
|
intervalMs: number;
|
|
@@ -203,9 +313,10 @@ export interface NpcBehaviorSpec {
|
|
|
203
313
|
trigger: NpcBehaviorTrigger;
|
|
204
314
|
/**
|
|
205
315
|
* Selector choosing/filtering targets and binding params (see the Game API
|
|
206
|
-
* "Autonomous Processes → Selectors" guide)
|
|
316
|
+
* "Autonomous Processes → Selectors" guide), including grid-permission
|
|
317
|
+
* predicates ({@link KitSelectorSpec}). JSON-encoded at deploy.
|
|
207
318
|
*/
|
|
208
|
-
selector?:
|
|
319
|
+
selector?: KitSelectorSpec;
|
|
209
320
|
/**
|
|
210
321
|
* Convenience: only NPCs whose `role` property equals this act (adds a
|
|
211
322
|
* `selfWhere` filter when no explicit `selector` is given).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blueprints.d.ts","sourceRoot":"","sources":["../../src/kit/blueprints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,kBAAkB,EAClB,OAAO,EACP,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,4BAA4B,EAC7B,MAAM,yBAAyB,CAAC;AAEjC;;;;GAIG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,GACzB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,GAC3B;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAC1B;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,GACzB;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAClE;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACzD;IAAE,IAAI,EA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BAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EACjC,UAAU,EAAE,YAAY,EAAE,EAC1B,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GACnC,gBAAgB,CAyElB"}
|
package/dist/kit/blueprints.js
CHANGED
|
@@ -186,6 +186,12 @@ function lockAuthorityRule(authority) {
|
|
|
186
186
|
key: authority.key,
|
|
187
187
|
...(authority.gridId !== undefined ? { gridId: authority.gridId } : {}),
|
|
188
188
|
};
|
|
189
|
+
case 'chunkPermission':
|
|
190
|
+
// Resolved per-invocation against the grid covering the object's chunk.
|
|
191
|
+
return {
|
|
192
|
+
type: 'condition',
|
|
193
|
+
expression: `has_chunk_permission($caller_user_id, "${authority.key}", self.cx, self.cy, self.cz, "${authority.mode ?? 'first'}")`,
|
|
194
|
+
};
|
|
189
195
|
case 'groupPermission':
|
|
190
196
|
return {
|
|
191
197
|
type: 'group_permission',
|
|
@@ -216,6 +222,7 @@ export function lockBlueprint(options) {
|
|
|
216
222
|
}
|
|
217
223
|
const names = lockNames(options.objectTypeName, options.keyTypeName);
|
|
218
224
|
const usesKey = authorities.some((a) => a.kind === 'key');
|
|
225
|
+
const usesChunk = authorities.some((a) => a.kind === 'chunkPermission');
|
|
219
226
|
const rules = authorities.map(lockAuthorityRule);
|
|
220
227
|
const policy = rules.length === 1 ? rules[0] : { type: 'or', rules };
|
|
221
228
|
const policyJson = kitPolicyJson(policy);
|
|
@@ -238,6 +245,17 @@ export function lockBlueprint(options) {
|
|
|
238
245
|
defaultValueJson: 'false',
|
|
239
246
|
},
|
|
240
247
|
];
|
|
248
|
+
if (usesChunk) {
|
|
249
|
+
// The chunk the object stands in, read by has_chunk_permission().
|
|
250
|
+
for (const axis of ['cx', 'cy', 'cz']) {
|
|
251
|
+
propertyDefinitions.push({
|
|
252
|
+
containerTypeName: names.objectType,
|
|
253
|
+
key: axis,
|
|
254
|
+
valueType: 'int',
|
|
255
|
+
defaultValueJson: '0',
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
241
259
|
if (usesKey) {
|
|
242
260
|
propertyDefinitions.push({
|
|
243
261
|
containerTypeName: names.objectType,
|
|
@@ -294,6 +312,151 @@ export function lockBlueprint(options) {
|
|
|
294
312
|
],
|
|
295
313
|
};
|
|
296
314
|
}
|
|
315
|
+
/** Compute the type/function names a plot blueprint (and its runtime helper) uses. */
|
|
316
|
+
export function plotNames(typeName = 'Plot') {
|
|
317
|
+
const snake = toSnakeCase(typeName);
|
|
318
|
+
return {
|
|
319
|
+
plotType: typeName,
|
|
320
|
+
buyFn: `buy_${snake}`,
|
|
321
|
+
rentFn: `rent_${snake}`,
|
|
322
|
+
evictFn: `evict_${snake}`,
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Blueprint for **sellable/rentable land**: a `Plot` container mapping a world
|
|
327
|
+
* [grid](../domains/gameApps.js) to a price, whose `buy`/`rent` functions
|
|
328
|
+
* consume currency AND grant runtime grid permissions in one transaction (via
|
|
329
|
+
* permission effects) — the canonical read+write permission loop. Buying sets
|
|
330
|
+
* the plot's `owner_user_id`; renting grants with a TTL; `evict` revokes.
|
|
331
|
+
* The grants are enforced by the replication layer on movement/voxel writes
|
|
332
|
+
* immediately at commit. Requires game-api v0.13.11+ (effects) — pair with
|
|
333
|
+
* chunk-permission locks (v0.13.12+) for doors that honor the purchase.
|
|
334
|
+
*
|
|
335
|
+
* Runtime counterpart: `client.kit(appId).plots`.
|
|
336
|
+
*/
|
|
337
|
+
export function plotBlueprint(options = {}) {
|
|
338
|
+
const names = plotNames(options.typeName);
|
|
339
|
+
const keys = options.permissionKeys ?? ['access', 'update_voxel_data'];
|
|
340
|
+
const currency = options.currencyProperty ?? 'gold';
|
|
341
|
+
const walletOwner = options.walletOwnerProperty ?? 'owner_user_id';
|
|
342
|
+
const rentable = options.rentable ?? false;
|
|
343
|
+
const walletParam = [
|
|
344
|
+
{ name: 'wallet_id', valueType: 'container_ref', required: true },
|
|
345
|
+
];
|
|
346
|
+
const walletGuard = (priceExpr) => kitPolicyJson({
|
|
347
|
+
type: 'condition',
|
|
348
|
+
expression: `ref($wallet_id).${walletOwner} == $caller_user_id && ref($wallet_id).${currency} >= ${priceExpr}`,
|
|
349
|
+
});
|
|
350
|
+
const propertyDefinitions = [
|
|
351
|
+
{ containerTypeName: names.plotType, key: 'grid_id', valueType: 'int' },
|
|
352
|
+
{ containerTypeName: names.plotType, key: 'price', valueType: 'int', defaultValueJson: '0' },
|
|
353
|
+
{
|
|
354
|
+
containerTypeName: names.plotType,
|
|
355
|
+
key: 'owner_user_id',
|
|
356
|
+
valueType: 'int',
|
|
357
|
+
defaultValueJson: '0',
|
|
358
|
+
},
|
|
359
|
+
];
|
|
360
|
+
if (rentable) {
|
|
361
|
+
propertyDefinitions.push({
|
|
362
|
+
containerTypeName: names.plotType,
|
|
363
|
+
key: 'rent_price',
|
|
364
|
+
valueType: 'int',
|
|
365
|
+
defaultValueJson: '0',
|
|
366
|
+
}, {
|
|
367
|
+
containerTypeName: names.plotType,
|
|
368
|
+
key: 'rent_ttl_seconds',
|
|
369
|
+
valueType: 'int',
|
|
370
|
+
defaultValueJson: '86400',
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
const functions = [
|
|
374
|
+
{
|
|
375
|
+
name: names.buyFn,
|
|
376
|
+
containerTypeName: names.plotType,
|
|
377
|
+
returnType: 'int',
|
|
378
|
+
parameters: walletParam,
|
|
379
|
+
mutations: [
|
|
380
|
+
{
|
|
381
|
+
target: 'ref($wallet_id)',
|
|
382
|
+
property: currency,
|
|
383
|
+
expression: `ref($wallet_id).${currency} - self.price`,
|
|
384
|
+
},
|
|
385
|
+
{ target: 'self', property: 'owner_user_id', expression: '$caller_user_id' },
|
|
386
|
+
],
|
|
387
|
+
permissionEffects: [
|
|
388
|
+
{
|
|
389
|
+
action: 'grant',
|
|
390
|
+
permissionKeys: keys,
|
|
391
|
+
userExpression: '$caller_user_id',
|
|
392
|
+
gridIdExpression: 'self.grid_id',
|
|
393
|
+
},
|
|
394
|
+
],
|
|
395
|
+
returnExpression: `ref($wallet_id).${currency}`,
|
|
396
|
+
invokePolicyJson: walletGuard('self.price'),
|
|
397
|
+
description: 'Buy this plot: spend the price AND receive grid permissions atomically.',
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
name: names.evictFn,
|
|
401
|
+
containerTypeName: names.plotType,
|
|
402
|
+
parameters: [{ name: 'target_user_id', valueType: 'int', required: true }],
|
|
403
|
+
mutations: [],
|
|
404
|
+
permissionEffects: [
|
|
405
|
+
{
|
|
406
|
+
action: 'revoke',
|
|
407
|
+
permissionKeys: keys,
|
|
408
|
+
userExpression: '$target_user_id',
|
|
409
|
+
gridIdExpression: 'self.grid_id',
|
|
410
|
+
},
|
|
411
|
+
],
|
|
412
|
+
invokePolicyJson: kitPolicyJson({
|
|
413
|
+
type: 'condition',
|
|
414
|
+
expression: 'self.owner_user_id == $caller_user_id',
|
|
415
|
+
}),
|
|
416
|
+
description: "Revoke a user's permissions on this plot (owner-gated; admins bypass).",
|
|
417
|
+
},
|
|
418
|
+
];
|
|
419
|
+
if (rentable) {
|
|
420
|
+
functions.push({
|
|
421
|
+
name: names.rentFn,
|
|
422
|
+
containerTypeName: names.plotType,
|
|
423
|
+
returnType: 'int',
|
|
424
|
+
parameters: walletParam,
|
|
425
|
+
mutations: [
|
|
426
|
+
{
|
|
427
|
+
target: 'ref($wallet_id)',
|
|
428
|
+
property: currency,
|
|
429
|
+
expression: `ref($wallet_id).${currency} - self.rent_price`,
|
|
430
|
+
},
|
|
431
|
+
],
|
|
432
|
+
permissionEffects: [
|
|
433
|
+
{
|
|
434
|
+
action: 'grant',
|
|
435
|
+
permissionKeys: keys,
|
|
436
|
+
userExpression: '$caller_user_id',
|
|
437
|
+
gridIdExpression: 'self.grid_id',
|
|
438
|
+
ttlSecondsExpression: 'self.rent_ttl_seconds',
|
|
439
|
+
},
|
|
440
|
+
],
|
|
441
|
+
returnExpression: `ref($wallet_id).${currency}`,
|
|
442
|
+
invokePolicyJson: walletGuard('self.rent_price'),
|
|
443
|
+
description: 'Rent this plot: spend the rent AND receive an expiring grid grant atomically.',
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
return {
|
|
447
|
+
name: names.plotType,
|
|
448
|
+
containerTypes: [
|
|
449
|
+
{
|
|
450
|
+
typeName: names.plotType,
|
|
451
|
+
displayName: names.plotType,
|
|
452
|
+
instantiableBy: 'admin',
|
|
453
|
+
description: 'A sellable/rentable plot of land mapped to a world grid.',
|
|
454
|
+
},
|
|
455
|
+
],
|
|
456
|
+
propertyDefinitions,
|
|
457
|
+
functions,
|
|
458
|
+
};
|
|
459
|
+
}
|
|
297
460
|
/** Compute the function/automation names an NPC behavior deploys under. */
|
|
298
461
|
export function npcBehaviorFunctionName(behavior) {
|
|
299
462
|
return behavior.functionName ?? toSnakeCase(behavior.name);
|
package/dist/kit/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { inventoryBlueprint, inventoryNames, kitPolicyJson, lockBlueprint, lockNames, mergeBlueprints, npcBehaviorFunctionName, npcBlueprint, toSnakeCase, type InventoryBlueprintOptions, type InventoryNames, type KitAutomationSpec, type KitAutomationTriggerSpec, type KitBlueprint, type KitInvokePolicy, type LockAuthority, type LockBlueprintOptions, type LockNames, type MergedBlueprints, type NpcBehaviorSpec, type NpcBehaviorTrigger, type NpcBlueprintOptions, } from './blueprints.js';
|
|
1
|
+
export { inventoryBlueprint, inventoryNames, kitPolicyJson, lockBlueprint, lockNames, mergeBlueprints, npcBehaviorFunctionName, npcBlueprint, plotBlueprint, plotNames, toSnakeCase, type InventoryBlueprintOptions, type InventoryNames, type KitAutomationSpec, type KitAutomationTriggerSpec, type KitBlueprint, type KitInvokePolicy, type KitSelectorSpec, type LockAuthority, type LockBlueprintOptions, type LockNames, type MergedBlueprints, type NpcBehaviorSpec, type NpcBehaviorTrigger, type NpcBlueprintOptions, type PlotBlueprintOptions, type PlotNames, type SelectorPermissionPredicate, } from './blueprints.js';
|
|
2
2
|
export { GameKitClient, type GameKitOptions, type KitDeployResult, } from './kit.js';
|
|
3
3
|
export { InventoryKit, type InventoryKitOptions, type KitItemStack } from './inventory.js';
|
|
4
4
|
export { ObjectsKit, type ObjectsKitOptions } from './objects.js';
|
|
5
5
|
export { NpcsKit, type NpcsKitOptions, type KitNpc } from './npcs.js';
|
|
6
|
+
export { PlotsKit, type PlotsKitOptions, type KitPlot } from './plots.js';
|
|
6
7
|
export { kitInvoke, toKitInvokeResult, type KitInvokeResult, type RawInvokeResult, } from './shared.js';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/kit/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/kit/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,aAAa,EACb,SAAS,EACT,eAAe,EACf,uBAAuB,EACvB,YAAY,EACZ,WAAW,EACX,KAAK,yBAAyB,EAC9B,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/kit/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,aAAa,EACb,SAAS,EACT,eAAe,EACf,uBAAuB,EACvB,YAAY,EACZ,aAAa,EACb,SAAS,EACT,WAAW,EACX,KAAK,yBAAyB,EAC9B,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACd,KAAK,2BAA2B,GACjC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,aAAa,EACb,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,aAAa,CAAC"}
|
package/dist/kit/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { inventoryBlueprint, inventoryNames, kitPolicyJson, lockBlueprint, lockNames, mergeBlueprints, npcBehaviorFunctionName, npcBlueprint, toSnakeCase, } from './blueprints.js';
|
|
1
|
+
export { inventoryBlueprint, inventoryNames, kitPolicyJson, lockBlueprint, lockNames, mergeBlueprints, npcBehaviorFunctionName, npcBlueprint, plotBlueprint, plotNames, toSnakeCase, } from './blueprints.js';
|
|
2
2
|
export { GameKitClient, } from './kit.js';
|
|
3
3
|
export { InventoryKit } from './inventory.js';
|
|
4
4
|
export { ObjectsKit } from './objects.js';
|
|
5
5
|
export { NpcsKit } from './npcs.js';
|
|
6
|
+
export { PlotsKit } from './plots.js';
|
|
6
7
|
export { kitInvoke, toKitInvokeResult, } from './shared.js';
|
package/dist/kit/kit.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
import type { GameAppsAPI } from '../domains/gameApps.js';
|
|
1
2
|
import type { GameModelAPI } from '../domains/gameModel.js';
|
|
2
3
|
import type { GameModelSeedMutation, GameModelUpsertAutomationMutation, GameModelUpsertAutomationTriggerMutation, Scalars } from '../generated/graphql.js';
|
|
3
4
|
import { type KitBlueprint } from './blueprints.js';
|
|
4
5
|
import { InventoryKit, type InventoryKitOptions } from './inventory.js';
|
|
5
6
|
import { NpcsKit, type NpcsKitOptions } from './npcs.js';
|
|
6
7
|
import { ObjectsKit, type ObjectsKitOptions } from './objects.js';
|
|
8
|
+
import { PlotsKit, type PlotsKitOptions } from './plots.js';
|
|
7
9
|
/** Options for {@link GameKitClient}, configuring the runtime helpers to match your deployed blueprints. */
|
|
8
10
|
export interface GameKitOptions {
|
|
9
11
|
inventory?: InventoryKitOptions;
|
|
10
12
|
objects?: ObjectsKitOptions;
|
|
11
13
|
npcs?: NpcsKitOptions;
|
|
14
|
+
plots?: PlotsKitOptions;
|
|
12
15
|
}
|
|
13
16
|
/** The result of {@link GameKitClient.deploy}: the seed outcome plus each automation/trigger upserted. */
|
|
14
17
|
export interface KitDeployResult {
|
|
@@ -65,7 +68,9 @@ export declare class GameKitClient {
|
|
|
65
68
|
readonly objects: ObjectsKit;
|
|
66
69
|
/** NPC helpers (spawn/read instances, manage the automations behind them). */
|
|
67
70
|
readonly npcs: NpcsKit;
|
|
68
|
-
|
|
71
|
+
/** Plot helpers (buy/rent land with transactional, enforced grid grants). */
|
|
72
|
+
readonly plots: PlotsKit;
|
|
73
|
+
constructor(appId: Scalars['BigInt']['input'], gameModel: GameModelAPI, gameApps: GameAppsAPI, options?: GameKitOptions);
|
|
69
74
|
/**
|
|
70
75
|
* Helpers for an additional lockable object type deployed under a different
|
|
71
76
|
* type name (e.g. both `Door` and `Chest` lock blueprints in one app).
|
package/dist/kit/kit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../../src/kit/kit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EACV,qBAAqB,EACrB,iCAAiC,EACjC,wCAAwC,EACxC,OAAO,EACR,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../../src/kit/kit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EACV,qBAAqB,EACrB,iCAAiC,EACjC,wCAAwC,EACxC,OAAO,EACR,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAE5D,4GAA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O,CAAC,eAAe,CAAC;CAsB5B"}
|
package/dist/kit/kit.js
CHANGED
|
@@ -2,6 +2,7 @@ import { mergeBlueprints } from './blueprints.js';
|
|
|
2
2
|
import { InventoryKit } from './inventory.js';
|
|
3
3
|
import { NpcsKit } from './npcs.js';
|
|
4
4
|
import { ObjectsKit } from './objects.js';
|
|
5
|
+
import { PlotsKit } from './plots.js';
|
|
5
6
|
/**
|
|
6
7
|
* App-scoped **Game Kit** facade returned by `client.kit(appId)` — high-level
|
|
7
8
|
* building blocks that map traditional game concepts (inventory, lockable
|
|
@@ -41,12 +42,13 @@ import { ObjectsKit } from './objects.js';
|
|
|
41
42
|
* ```
|
|
42
43
|
*/
|
|
43
44
|
export class GameKitClient {
|
|
44
|
-
constructor(appId, gameModel, options = {}) {
|
|
45
|
+
constructor(appId, gameModel, gameApps, options = {}) {
|
|
45
46
|
this.appId = appId;
|
|
46
47
|
this.gameModel = gameModel;
|
|
47
48
|
this.inventory = new InventoryKit(appId, gameModel, options.inventory);
|
|
48
49
|
this.objects = new ObjectsKit(appId, gameModel, options.objects);
|
|
49
50
|
this.npcs = new NpcsKit(appId, gameModel, options.npcs);
|
|
51
|
+
this.plots = new PlotsKit(appId, gameModel, gameApps, options.plots);
|
|
50
52
|
}
|
|
51
53
|
/**
|
|
52
54
|
* Helpers for an additional lockable object type deployed under a different
|
package/dist/kit/npcs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npcs.d.ts","sourceRoot":"","sources":["../../src/kit/npcs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG1E,0EAA0E;AAC1E,MAAM,WAAW,cAAc;IAC7B,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qCAAqC;AACrC,MAAM,WAAW,MA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I,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAC/C,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAC;QACjC,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;;;;;;;;;;;IAuBD;;;;OAIG;IACG,IAAI,CAAC,OAAO,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAclF,gDAAgD;IAC1C,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ3C,8EAA8E;IACxE,MAAM,CAAC,cAAc,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;IAInC;;;OAGG;IACG,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAQzD,6EAA6E;IACvE,KAAK,CAAC,aAAa,CAAC,EAAE,MAAM;;;;;;;;;;;;sBA+B+2gc,CAAC;;;;;;;;;;IAxBl5gc,2DAA2D;IACrD,IAAI,CAAC,OAAO,GAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO;;;;;;;;;;;;;;;;;;;;;;YAIzE,KAAK;CAkBpB"}
|
package/dist/kit/objects.d.ts
CHANGED
|
@@ -25,12 +25,20 @@ export declare class ObjectsKit {
|
|
|
25
25
|
/**
|
|
26
26
|
* Instantiate a lockable object (admin/studio call — the type is
|
|
27
27
|
* admin-instantiable). For key-gated objects set `requiredKeyId` to the key
|
|
28
|
-
* id that opens it; for owner-gated objects set `ownerUserId
|
|
28
|
+
* id that opens it; for owner-gated objects set `ownerUserId`; for
|
|
29
|
+
* chunk-permission-gated objects set `chunk` to where the object stands
|
|
30
|
+
* (feeds the `has_chunk_permission` policy).
|
|
29
31
|
*/
|
|
30
32
|
create(input: {
|
|
31
33
|
displayName: string;
|
|
32
34
|
requiredKeyId?: string;
|
|
33
35
|
ownerUserId?: Scalars['BigInt']['input'];
|
|
36
|
+
/** The chunk the object occupies (chunkPermission authority). */
|
|
37
|
+
chunk?: {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
z: number;
|
|
41
|
+
};
|
|
34
42
|
properties?: SeedPropertyInput[];
|
|
35
43
|
sessionId?: string;
|
|
36
44
|
}): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objects.d.ts","sourceRoot":"","sources":["../../src/kit/objects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB,8EAA8E;AAC9E,MAAM,WAAW,iBAAiB;IAChC,2FAA2F;IAC3F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,qBAAa,UAAU;IAInB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAJ5B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAY;gBAGf,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EACjC,SAAS,EAAE,YAAY,EACxC,OAAO,GAAE,iBAAsB;IAKjC
|
|
1
|
+
{"version":3,"file":"objects.d.ts","sourceRoot":"","sources":["../../src/kit/objects.ts"],"names":[],"mappings":"AAAA,OAAO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AAyC;IACnC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC;;;;;;;;;;;IAU/C;;;;OAIG;IACG,IAAI,CACR,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GAC/B,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IASpC,8DAA8D;IACxD,KAAK,CACT,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GAC/B,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IASpC,gDAAgD;IAC1C,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAShD,8CAA8C;IACxC,IAAI,CAAC,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO;;;;;;;;;;;CAOhD"}
|
package/dist/kit/objects.js
CHANGED
|
@@ -18,7 +18,9 @@ export class ObjectsKit {
|
|
|
18
18
|
/**
|
|
19
19
|
* Instantiate a lockable object (admin/studio call — the type is
|
|
20
20
|
* admin-instantiable). For key-gated objects set `requiredKeyId` to the key
|
|
21
|
-
* id that opens it; for owner-gated objects set `ownerUserId
|
|
21
|
+
* id that opens it; for owner-gated objects set `ownerUserId`; for
|
|
22
|
+
* chunk-permission-gated objects set `chunk` to where the object stands
|
|
23
|
+
* (feeds the `has_chunk_permission` policy).
|
|
22
24
|
*/
|
|
23
25
|
async create(input) {
|
|
24
26
|
const properties = [
|
|
@@ -32,6 +34,13 @@ export class ObjectsKit {
|
|
|
32
34
|
},
|
|
33
35
|
]
|
|
34
36
|
: []),
|
|
37
|
+
...(input.chunk
|
|
38
|
+
? [
|
|
39
|
+
{ key: 'cx', valueType: 'int', valueJson: String(input.chunk.x) },
|
|
40
|
+
{ key: 'cy', valueType: 'int', valueJson: String(input.chunk.y) },
|
|
41
|
+
{ key: 'cz', valueType: 'int', valueJson: String(input.chunk.z) },
|
|
42
|
+
]
|
|
43
|
+
: []),
|
|
35
44
|
...(input.properties ?? []),
|
|
36
45
|
];
|
|
37
46
|
return this.gameModel.createContainer({
|