@kingdomsconnected/types 1.6.1 → 1.6.3

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.
@@ -37,6 +37,11 @@ declare global {
37
37
  */
38
38
  progressionPerkRefused: [perk: string, reason: "points" | "level" | "parent" | "exclusive" | "blocked" | "script" | "owned" | "hidden"];
39
39
 
40
+ /**
41
+ * Dispatched when a monologue line of the local character -- a photo-mode comment, the sharpening remark -- was kept silent and unsubtitled. `text` is localized; `textKey` is its localization key. Not raised while `Hud.setMonologueEnabled(true)` has released it. Handler promises are not awaited.
42
+ */
43
+ monologueSuppressed: [text: string, textKey: string];
44
+
40
45
  /**
41
46
  * Dispatched when this player starts or stops following a server quest in the game's journal, whichever way it happened: the track button, the game auto-tracking a quest that turns active, or the untrack that follows finishing or failing one. Local to this machine and raised before the server is told; the server raises its own `questTrackingChanged` when the report arrives. Repeats are filtered, so it only fires on an actual change. Handler promises are not awaited.
42
47
  */
@@ -94,6 +99,16 @@ declare global {
94
99
  */
95
100
  bookClosed: [bookId: number, reason: "player" | "script" | "failed" | "sessionOver"];
96
101
 
102
+ /**
103
+ * The local native follow action has entered. A successful start request may still fail before this event.
104
+ */
105
+ followStarted: [target: FollowTarget];
106
+
107
+ /**
108
+ * A queued or active scripted follow ended on this client.
109
+ */
110
+ followStopped: [target: FollowTarget, reason: "script" | "input" | "targetLost" | "mountChanged" | "teleported" | "unavailable" | "interrupted" | "failed" | "resourceStopped" | "sessionEnded" | "worldChanged"];
111
+
97
112
  /**
98
113
  * Dispatched once for every creator, on this machine only, whatever ended it. `appearance` is the look the player accepted, and null for every other ending. `reason` is `accepted`, `cancelled` for the player backing out, `closed` for `CharacterCreator.close`, `replaced` for another `CharacterCreator.open`, `unavailable` when the stage could not be put up, and `interrupted` when the session or the body went away under it. Nothing is put on the body: send the look wherever it should go -- `Events.emitServer`, then `player.setAppearance` on the server -- or open the next creator straight from the handler.
99
114
  */
@@ -178,6 +193,161 @@ declare global {
178
193
  /** Names of native events available in this scripting environment. */
179
194
  type EventName = keyof EventMap;
180
195
 
196
+ /**
197
+ * Writable player stats, in native units. Use getStat and the server's setStat.
198
+ */
199
+ const PlayerStat: {
200
+ /**
201
+ * Current health, in native units. Zero can kill.
202
+ */
203
+ readonly Health: "health";
204
+
205
+ /**
206
+ * Current stamina; the game continues spending and regenerating it.
207
+ */
208
+ readonly Stamina: "stamina";
209
+
210
+ /**
211
+ * Current energy reserve; higher means better rested.
212
+ */
213
+ readonly Exhaust: "exhaust";
214
+
215
+ /**
216
+ * Current nourishment; higher means better fed.
217
+ */
218
+ readonly Hunger: "hunger";
219
+ };
220
+
221
+ /**
222
+ * Read-only computed player stats. Use getDerivedStat; these values cannot be passed to setStat.
223
+ */
224
+ const DerivedPlayerStat: {
225
+ /**
226
+ * Total bleeding strength.
227
+ */
228
+ readonly Bleeding: "bleeding";
229
+
230
+ /**
231
+ * Sleepiness; above zero means asleep.
232
+ */
233
+ readonly Sleeping: "sleeping";
234
+
235
+ /**
236
+ * Consciousness; zero means knocked out.
237
+ */
238
+ readonly Consciousness: "consciousness";
239
+
240
+ /**
241
+ * Native drunkenness value.
242
+ */
243
+ readonly Drunkenness: "drunkenness";
244
+
245
+ /**
246
+ * Native poisoning value; not every named poison changes this value.
247
+ */
248
+ readonly Poisoning: "poisoning";
249
+
250
+ /**
251
+ * Effective charisma.
252
+ */
253
+ readonly Charisma: "charisma";
254
+
255
+ /**
256
+ * Effective visibility.
257
+ */
258
+ readonly Visibility: "visibility";
259
+
260
+ /**
261
+ * Effective conspicuousness.
262
+ */
263
+ readonly Conspicuousness: "conspicuousness";
264
+
265
+ /**
266
+ * Effective noise.
267
+ */
268
+ readonly Noise: "noise";
269
+
270
+ /**
271
+ * Native dirtiness reading; reading it does not clean the body or equipment.
272
+ */
273
+ readonly Dirtiness: "dirtiness";
274
+
275
+ /**
276
+ * Native bloodiness reading.
277
+ */
278
+ readonly Bloodiness: "bloodiness";
279
+
280
+ /**
281
+ * Native smell reading.
282
+ */
283
+ readonly Smell: "smell";
284
+
285
+ /**
286
+ * Native smell intensity.
287
+ */
288
+ readonly SmellIntensity: "smellIntensity";
289
+
290
+ /**
291
+ * Native fragrance reading.
292
+ */
293
+ readonly Fragrance: "fragrance";
294
+
295
+ /**
296
+ * Carried weight in the same units as InventoryCapacity.
297
+ */
298
+ readonly CarriedWeight: "carriedWeight";
299
+
300
+ /**
301
+ * Native carrying capacity, including applicable equipment effects.
302
+ */
303
+ readonly InventoryCapacity: "inventoryCapacity";
304
+
305
+ /**
306
+ * Native encumbrance reading.
307
+ */
308
+ readonly Encumbrance: "encumbrance";
309
+
310
+ /**
311
+ * Native hangover reading.
312
+ */
313
+ readonly Hangover: "hangover";
314
+
315
+ /**
316
+ * Computed alcoholism reading, not the persistent soul resource.
317
+ */
318
+ readonly Alcoholism: "alcoholism";
319
+
320
+ /**
321
+ * Effective armor rating.
322
+ */
323
+ readonly ArmorRating: "armorRating";
324
+
325
+ /**
326
+ * Overall armor defense.
327
+ */
328
+ readonly OverallArmorDefense: "overallArmorDefense";
329
+
330
+ /**
331
+ * Overall weapon attack.
332
+ */
333
+ readonly OverallWeaponAttack: "overallWeaponAttack";
334
+
335
+ /**
336
+ * Normalized run speed; not world-space velocity.
337
+ */
338
+ readonly NormalizedRunSpeed: "normalizedRunSpeed";
339
+
340
+ /**
341
+ * Native base run speed.
342
+ */
343
+ readonly RunSpeedBase: "runSpeedBase";
344
+
345
+ /**
346
+ * Native morale reading.
347
+ */
348
+ readonly Morale: "morale";
349
+ };
350
+
181
351
  /**
182
352
  * How a player's body looks: four of the game's own character-component names, and the gender whose catalog they come from.
183
353
  *
@@ -670,12 +840,12 @@ declare global {
670
840
  readonly healthyStamina: number;
671
841
 
672
842
  /**
673
- * Current tiredness, in the game's own units.
843
+ * Current energy reserve, in the game's own units. Higher means better rested.
674
844
  */
675
845
  readonly exhaust: number;
676
846
 
677
847
  /**
678
- * Tiredness capacity, in the game's own units.
848
+ * Maximum energy reserve, in the game's own units.
679
849
  */
680
850
  readonly maxExhaust: number;
681
851
 
@@ -745,7 +915,7 @@ declare global {
745
915
  readonly relativeSkills: SoulSkills;
746
916
 
747
917
  /**
748
- * The velocity the body's own animation was driven by this frame, not the one its physics settled on.
918
+ * On the owning machine, the velocity the body's own animation was driven by this frame, not the one its physics settled on. Everywhere else, measured from successive replicated positions.
749
919
  */
750
920
  readonly velocity: Vector3;
751
921
 
@@ -759,21 +929,6 @@ declare global {
759
929
  */
760
930
  readonly inAir: boolean;
761
931
 
762
- /**
763
- * The engine's own locomotion pace tag -- walk, jog, sprint -- as its animation system picked it. Raw Mannequin tag ids; 255 means nothing is set.
764
- */
765
- readonly moveSpeedTag: number;
766
-
767
- /**
768
- * The engine's own movement direction tag. Raw Mannequin tag ids; 255 means nothing is set.
769
- */
770
- readonly moveDirTag: number;
771
-
772
- /**
773
- * The engine's own stance tag -- upright, sneaking, sitting, lying. Raw Mannequin tag ids; 255 means nothing is set.
774
- */
775
- readonly stanceTag: number;
776
-
777
932
  /**
778
933
  * Whether this player is crouched, as their own game's crouch action reports it. False once their body is gone.
779
934
  */
@@ -830,12 +985,27 @@ declare global {
830
985
  readonly perks: string[];
831
986
 
832
987
  /**
833
- * Whether this handle is the player sitting at this machine, rather than someone else's puppet.
988
+ * The locomotion pace tag -- walk, jog, sprint -- this machine's animation system picked for this body. Raw Mannequin tag ids; 255 means nothing is set.
989
+ */
990
+ readonly moveSpeedTag: number;
991
+
992
+ /**
993
+ * The movement direction tag this machine's animation system picked for this body. Raw Mannequin tag ids; 255 means nothing is set.
994
+ */
995
+ readonly moveDirTag: number;
996
+
997
+ /**
998
+ * The stance tag -- upright, sneaking, sitting, lying -- this machine's animation system picked for this body. Raw Mannequin tag ids; 255 means nothing is set.
999
+ */
1000
+ readonly stanceTag: number;
1001
+
1002
+ /**
1003
+ * Whether this handle is the player sitting at this machine, rather than someone else's copy.
834
1004
  */
835
1005
  readonly local: boolean;
836
1006
 
837
1007
  /**
838
- * The engine entity behind this player: the game's own player entity for the local player, otherwise the entity the puppet was spawned as, or 0 across a level load and before it exists. Not stable across a session: the engine reuses entity ids.
1008
+ * The engine entity behind this player: the game's own player entity for the local player, otherwise the entity the copy was spawned as, or 0 across a level load and before it exists. Not stable across a session: the engine reuses entity ids.
839
1009
  */
840
1010
  readonly entityId: number;
841
1011
 
@@ -862,6 +1032,18 @@ declare global {
862
1032
  */
863
1033
  toString(): string;
864
1034
 
1035
+ /**
1036
+ * Reads the latest reported stat in native units. Returns zero when no valid body snapshot exists; check player.ready to distinguish that from a real zero. Throws for an unknown stat or invalid arguments.
1037
+ * @param stat A PlayerStat value.
1038
+ */
1039
+ getStat(stat: "health" | "stamina" | "exhaust" | "hunger"): number;
1040
+
1041
+ /**
1042
+ * Reads a computed stat from the latest body snapshot. Bleeding, Sleeping, Consciousness, Drunkenness and Poisoning follow the body as it changes; the others are sampled about every 250 ms to a hundredth of a native unit, then replicated. Values use native units and can be negative; they are not universally percentages. Returns zero without a valid snapshot. Throws for an unknown stat or invalid arguments. These readings do not override another player's native calculations.
1043
+ * @param stat A DerivedPlayerStat value.
1044
+ */
1045
+ getDerivedStat(stat: "bleeding" | "sleeping" | "consciousness" | "drunkenness" | "poisoning" | "charisma" | "visibility" | "conspicuousness" | "noise" | "dirtiness" | "bloodiness" | "smell" | "smellIntensity" | "fragrance" | "carriedWeight" | "inventoryCapacity" | "encumbrance" | "hangover" | "alcoholism" | "armorRating" | "overallArmorDefense" | "overallWeaponAttack" | "normalizedRunSpeed" | "runSpeedBase" | "morale"): number;
1046
+
865
1047
  /**
866
1048
  * Where the local player stands on one track: level, XP towards the next one, and unspent perk points. Only the local player carries XP and points; for anyone else this is null.
867
1049
  * @param track A track name, from `Progression.tracks()`.
@@ -1043,6 +1225,18 @@ declare global {
1043
1225
  */
1044
1226
  isElementVisible(element: string): boolean;
1045
1227
 
1228
+ /**
1229
+ * The local character's own monologue -- photo-mode comments, the sharpening remark -- is spoken in Henry's voice and captioned with his name whoever is playing, so multiplayer suppresses it and raises each line as `monologueSuppressed`. Releasing it lasts until the session ends.
1230
+ * @param enabled True lets the game voice and subtitle it again; false suppresses it.
1231
+ */
1232
+ setMonologueEnabled(enabled: boolean): void;
1233
+
1234
+ /**
1235
+ * Whether the game voices and subtitles the local character's monologue.
1236
+ * @returns False while multiplayer suppresses it, which is the default.
1237
+ */
1238
+ isMonologueEnabled(): boolean;
1239
+
1046
1240
  /**
1047
1241
  * Every effect `addScreenEffect` accepts, with each parameter's range, default and neutral value.
1048
1242
  * @returns The effects, in a fixed order.
@@ -3240,6 +3434,68 @@ declare global {
3240
3434
  image(path: string): string;
3241
3435
  };
3242
3436
 
3437
+ /**
3438
+ * A streamed player or human NPC. Its network identity is resolved again when follow starts; position and name are snapshots.
3439
+ */
3440
+ interface FollowTarget {
3441
+ /**
3442
+ * The target's network id.
3443
+ */
3444
+ id: number;
3445
+
3446
+ /**
3447
+ * Which replicated entity the id identifies.
3448
+ */
3449
+ kind: "player" | "npc";
3450
+
3451
+ /**
3452
+ * Player nickname or NPC name.
3453
+ */
3454
+ name: string;
3455
+
3456
+ /**
3457
+ * Current native body position, in world-space metres.
3458
+ */
3459
+ position: Vector3;
3460
+ }
3461
+
3462
+ /**
3463
+ * Follow another player or a streamed human NPC using the local player's native walking or riding action. Native combat, interaction and mount restrictions still apply. Only one scripted follow can be queued or active. Movement input, target loss, mount changes and resource shutdown stop it. This controls only the local player; it does not command an NPC to follow.
3464
+ */
3465
+ const Follow: {
3466
+ /**
3467
+ * Lists streamed players and human NPCs within 20 metres. Use canStart to check whether one can currently be followed.
3468
+ */
3469
+ targets(): FollowTarget[];
3470
+
3471
+ /**
3472
+ * Checks the target and native follow restrictions, including the game's start distance.
3473
+ * @param target A remote player handle or a descriptor from targets().
3474
+ */
3475
+ canStart(target: Player | FollowTarget): boolean;
3476
+
3477
+ /**
3478
+ * Queues native follow for the calling resource. True means queued; followStarted confirms entry. False means the request was refused.
3479
+ * @param target Who the local player should follow.
3480
+ */
3481
+ start(target: Player | FollowTarget): boolean;
3482
+
3483
+ /**
3484
+ * The active scripted follow target, or null while idle or pending.
3485
+ */
3486
+ getTarget(): FollowTarget | null;
3487
+
3488
+ /**
3489
+ * Whether a scripted follow is queued but has not entered yet.
3490
+ */
3491
+ isPending(): boolean;
3492
+
3493
+ /**
3494
+ * Cancels the calling resource's queued or active follow. Other resources' follow actions are left alone.
3495
+ */
3496
+ stop(): void;
3497
+ };
3498
+
3243
3499
  /**
3244
3500
  * What `CharacterCreator.open` shows.
3245
3501
  */
@@ -3293,7 +3549,7 @@ declare global {
3293
3549
  *
3294
3550
  * A hint names one of the game's keys by its control -- `primary_action`, `jump` and the rest of `keys()` -- and never a physical key: the glyph is whatever the player has bound to that control, keyboard or pad, and follows a rebind. A press hint fires on the press; a hold hint draws the game's ring and fires once it fills.
3295
3551
  *
3296
- * Hints are drawn while the player is in control of their character, on foot or in the saddle, and the game takes them down in dialogue, minigames and menus. Two hints on one key stack: the newest is drawn and gets the press, and removing it brings back the one under it. A hint does not stop the game's own action on that key -- put a hint on `primary_action` and the player still interacts with whatever they look at.
3552
+ * Hints are drawn while the player is in control of their character, on foot or in the saddle, and the game takes them down in dialogue, minigames and menus. Two hints on one key stack: the newest is drawn and gets the press, and removing it brings back the one under it. A hint normally leaves the game's own action on that key enabled. `chat_focus_follow_init` replaces the native focus/follow toggle while its hint is shown, so a scripted Follow action receives one press.
3297
3553
  *
3298
3554
  * Client-only and local: a hint is shown to the player at this machine. Hints go when the resource that made them stops.
3299
3555
  */
@@ -4266,6 +4522,16 @@ declare global {
4266
4522
  * True in the authoritative server scripting runtime.
4267
4523
  */
4268
4524
  readonly isServer: boolean;
4525
+
4526
+ /**
4527
+ * Local Framework release version.
4528
+ */
4529
+ readonly frameworkVersion: string;
4530
+
4531
+ /**
4532
+ * Local mod version from InstanceOptions.modVersion; empty when unset.
4533
+ */
4534
+ readonly modVersion: string;
4269
4535
  };
4270
4536
 
4271
4537
  /**
@@ -4861,7 +5127,7 @@ declare global {
4861
5127
  update(): boolean;
4862
5128
 
4863
5129
  /**
4864
- * Clears the published Discord activity and resets staged state.
5130
+ * Clears what scripts published and resets staged state.
4865
5131
  * @returns True when dispatched; false when Discord is unavailable.
4866
5132
  */
4867
5133
  clear(): boolean;
@@ -5040,7 +5306,7 @@ declare global {
5040
5306
  };
5041
5307
 
5042
5308
  /**
5043
- * The local player's view of the nametags above other players: whether they draw at all, and whether they carry a health bar.
5309
+ * The local player's view of the nametags above players: whether they draw at all, whether they carry a health bar, and whether their own is shown.
5044
5310
  */
5045
5311
  const Nametags: {
5046
5312
  /**
@@ -5067,6 +5333,18 @@ declare global {
5067
5333
  */
5068
5334
  isHealthVisible(): boolean;
5069
5335
 
5336
+ /**
5337
+ * Shows or hides this player's own nametag, drawn as others see it, with any label set on their own id.
5338
+ * @param visible True to draw this player's own nametag, false (default) to leave it off.
5339
+ */
5340
+ setSelfVisible(visible: boolean): void;
5341
+
5342
+ /**
5343
+ * Checks whether this player draws their own nametag.
5344
+ * @returns False unless it was turned on locally.
5345
+ */
5346
+ isSelfVisible(): boolean;
5347
+
5070
5348
  /**
5071
5349
  * Hangs a transient line on that entity's nametag, above its name -- speech, an emote, a status. It follows the body, fades with distance and hides behind cover exactly as the name does. Local to this player: the line is not replicated, and a nametag hidden with Nametags.setVisible draws neither. Player.setNametagText is the server-side counterpart for a lasting name.
5072
5350
  * @param entityId Network id of the entity to label (server-side `player.id`).