@kingdomsconnected/types 1.6.0 → 1.6.1
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/generated/client-api.d.ts +35 -6
- package/generated/server-api.d.ts +254 -29
- package/package.json +1 -1
|
@@ -835,7 +835,7 @@ declare global {
|
|
|
835
835
|
readonly local: boolean;
|
|
836
836
|
|
|
837
837
|
/**
|
|
838
|
-
* The engine entity this
|
|
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.
|
|
839
839
|
*/
|
|
840
840
|
readonly entityId: number;
|
|
841
841
|
|
|
@@ -1093,6 +1093,13 @@ declare global {
|
|
|
1093
1093
|
* @returns False once it has been removed and faded, has run its duration out, or was dropped by its resource stopping, the session ending or the level changing.
|
|
1094
1094
|
*/
|
|
1095
1095
|
isScreenEffectActive(handle: number): boolean;
|
|
1096
|
+
|
|
1097
|
+
/**
|
|
1098
|
+
* Projects a world point through the camera this frame is drawn with, so a resource can pin its own overlay to the world.
|
|
1099
|
+
* @param point World position to project.
|
|
1100
|
+
* @returns Its screen position, or null when the point is behind the camera or there is no view to place it in.
|
|
1101
|
+
*/
|
|
1102
|
+
worldToScreen(point: Vector3): ScreenPoint | null;
|
|
1096
1103
|
};
|
|
1097
1104
|
|
|
1098
1105
|
/**
|
|
@@ -1150,6 +1157,26 @@ declare global {
|
|
|
1150
1157
|
params: ScreenEffectParam[];
|
|
1151
1158
|
}
|
|
1152
1159
|
|
|
1160
|
+
/**
|
|
1161
|
+
* Where a world point lands on screen, in the pixels Web views are placed in.
|
|
1162
|
+
*/
|
|
1163
|
+
interface ScreenPoint {
|
|
1164
|
+
/**
|
|
1165
|
+
* Pixels from the left edge of the window's client area.
|
|
1166
|
+
*/
|
|
1167
|
+
x: number;
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* Pixels from the top edge of the window's client area.
|
|
1171
|
+
*/
|
|
1172
|
+
y: number;
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* Whether the point is inside the view. One past an edge keeps its coordinates with this false.
|
|
1176
|
+
*/
|
|
1177
|
+
onScreen: boolean;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1153
1180
|
/**
|
|
1154
1181
|
* The game's own sound triggers, played at this machine. A trigger is a name the game's audio data declares -- `a_o_bell_kkut_kostelni`, `c_torch_whoosh1`, `f_ge_cough_woman` -- standing for an FMOD event. The full vocabulary is `Libs/GameAudio/*.xml` in `IPL_GameData.pak`, with the gameplay-facing subset listed in `Libs/Tables/GameAudio/SkaldAtlTrigger.xml`. Nothing here is replicated: a sound everyone should hear is one the server tells every client to play. Every call returns false while the audio system is not up, which is the case before a world is loaded, and for a trigger name the audio data does not declare.
|
|
1155
1182
|
*/
|
|
@@ -1228,7 +1255,7 @@ declare global {
|
|
|
1228
1255
|
};
|
|
1229
1256
|
|
|
1230
1257
|
/**
|
|
1231
|
-
* What the server streams, seen from this machine. Models, materials, textures, sounds and particle libraries a server streams load by path like the game's own -- `objects/kcdc/<resource>/chair.cgf` works wherever a model path does -- so nothing here is needed to use them. Clips play through the server's `
|
|
1258
|
+
* What the server streams, seen from this machine. Models, materials, textures, sounds and particle libraries a server streams load by path like the game's own -- `objects/kcdc/<resource>/chair.cgf` works wherever a model path does -- so nothing here is needed to use them. Clips play through the server's `playAnimation("", { clip })`.
|
|
1232
1259
|
*/
|
|
1233
1260
|
const Assets: {
|
|
1234
1261
|
/**
|
|
@@ -2539,12 +2566,12 @@ declare global {
|
|
|
2539
2566
|
/**
|
|
2540
2567
|
* The world builder: a free camera, the game's mesh catalog as an asset library, a placement brush, a gizmo that moves anything, and maps saved to and loaded from files.
|
|
2541
2568
|
*
|
|
2542
|
-
*
|
|
2569
|
+
* F7 or a client resource opens it. Multiplayer requires the server to grant this player access with `player.setWorldBuilderEnabled(true)`; single-player and offline editing are always allowed. While it is open it holds the one free camera, so a `NoClip` flight in progress ends and `NoClip.enable` refuses. The player can still close it from its own window.
|
|
2543
2570
|
*/
|
|
2544
2571
|
const MapEditor: {
|
|
2545
2572
|
/**
|
|
2546
2573
|
* Opens the editor.
|
|
2547
|
-
* @returns `opened` when it opened. `alreadyOpen` when it was open already. `disabled` when
|
|
2574
|
+
* @returns `opened` when it opened. `alreadyOpen` when it was open already. `disabled` when this multiplayer connection has not been granted access.
|
|
2548
2575
|
*/
|
|
2549
2576
|
open(): "opened" | "alreadyOpen" | "disabled";
|
|
2550
2577
|
|
|
@@ -2561,8 +2588,8 @@ declare global {
|
|
|
2561
2588
|
isOpen(): boolean;
|
|
2562
2589
|
|
|
2563
2590
|
/**
|
|
2564
|
-
* Whether
|
|
2565
|
-
* @returns True when
|
|
2591
|
+
* Whether this client may open World Builder.
|
|
2592
|
+
* @returns True offline or when the server has granted this player access.
|
|
2566
2593
|
*/
|
|
2567
2594
|
isEnabled(): boolean;
|
|
2568
2595
|
};
|
|
@@ -5107,6 +5134,8 @@ declare global {
|
|
|
5107
5134
|
* Arbitrary key/value state attached to one replicated entity, reached as `entity.state`. Keys set on the server replicate to every client that can currently see the entity.
|
|
5108
5135
|
*/
|
|
5109
5136
|
class StateBag {
|
|
5137
|
+
private constructor();
|
|
5138
|
+
|
|
5110
5139
|
/**
|
|
5111
5140
|
* Reads one key from this entity's state.
|
|
5112
5141
|
* @param key Key to read.
|
|
@@ -23,7 +23,7 @@ declare global {
|
|
|
23
23
|
playerDied: [player: Player, killer: Player | null, reason: "unknown" | "combat" | "gunshot" | "starvation" | "collision" | "scripted" | "disintegrate" | "fall" | "poison" | "bleeding" | "selfHarm"];
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* Dispatched when something takes health off a player: a weapon, an arrow, a fall, a collision, a scripted hit.
|
|
26
|
+
* Dispatched when something takes health off a player: a weapon, an arrow, a fall, a collision, a scripted hit. Another player's blow is raised by the server as it rules on it, after `playerHit` had its say, so `amount` is what the ruling takes; anything else is reported by the hit player's own client, which resolved it against its armour and its skills. It arrives ahead of the `playerDied` a killing blow causes.
|
|
27
27
|
*
|
|
28
28
|
* `attacker` is the player who dealt it, or null. `bodyPart` is where it landed, or null for damage that lands nowhere in particular. The weapon is the attacker's own `rightHandItem` or `leftHandItem`.
|
|
29
29
|
*
|
|
@@ -31,6 +31,23 @@ declare global {
|
|
|
31
31
|
*/
|
|
32
32
|
playerDamage: [player: Player, attacker: Player | null, amount: number, bodyPart: "head" | "torso" | "leftArm" | "rightArm" | "leftLeg" | "rightLeg" | null, reason: "unknown" | "combat" | "gunshot" | "starvation" | "collision" | "scripted" | "disintegrate" | "fall" | "poison" | "bleeding" | "selfHarm"];
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* A melee swing aimed at another player was admitted by the server, including a miss. Raised once per attack generation, after presentation admission. Use it to track combat inactivity in your resource.
|
|
36
|
+
*/
|
|
37
|
+
playerAttack: [player: Player, opponent: Player];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A resource called cancelCombat for this pair. Raised after the cancellation was sent to both players and their observers.
|
|
41
|
+
*/
|
|
42
|
+
playerCombatCancelled: [first: Player, second: Player];
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Dispatched when another player's blade or arrow lands on a player, before anything is taken -- the place for teams, safe zones, friendly fire and damage rules. The game resolved the blow against the guard the victim really held -- whether it was blocked, perfectly or not, and where it landed -- and the server works out what a swing takes from there; it has checked that the swing was one it relayed and could still land, or that the arrow was one whose impact it accepted, and that the two stood within reach. Only what is ruled here comes off the victim's health, on every client at once.
|
|
46
|
+
*
|
|
47
|
+
* Return `false` from a handler to refuse the blow: no health is taken and no `playerDamage` follows. Scale `hit.modifiers` to change how a swing is worked out -- a stronger attack, weaker armour -- or set `hit.damage` to say outright what it takes: `0` for a blow that lands harmlessly, more for a heavier one. Either way the blow is still seen and heard: the blades met. Handlers run synchronously, so the decision cannot wait on anything awaited.
|
|
48
|
+
*/
|
|
49
|
+
playerHit: [player: Player, attacker: Player, hit: PlayerHit];
|
|
50
|
+
|
|
34
51
|
/**
|
|
35
52
|
* Dispatched when a limb becomes injured -- usually a blow landing there, sometimes a fall on both legs. `player.injuries` already says so. A limb hit again while injured stays injured and raises nothing new.
|
|
36
53
|
*/
|
|
@@ -442,7 +459,7 @@ declare global {
|
|
|
442
459
|
siegeFire: [engine: SiegeEngine, attacker: Player | null, target: Vector3];
|
|
443
460
|
|
|
444
461
|
/**
|
|
445
|
-
* Dispatched where a projectile came down: what the player nearest the target saw it hit, checked against the arc it was thrown on, or the target itself when nobody could see it. Players within `damageRadius` have already been told to take their share, and NPCs have taken theirs. `engine` is null when it was destroyed while the stone was in the air.
|
|
462
|
+
* Dispatched where a projectile came down: what the reporting player -- the attacker when near enough, else whoever is nearest the target -- saw it hit, checked against the arc it was thrown on, or the target itself when nobody could see it. Players within `damageRadius` have already been told to take their share, and NPCs have taken theirs. `engine` is null when it was destroyed while the stone was in the air.
|
|
446
463
|
*/
|
|
447
464
|
siegeImpact: [engine: SiegeEngine | null, position: Vector3, attacker: Player | null];
|
|
448
465
|
|
|
@@ -456,6 +473,11 @@ declare global {
|
|
|
456
473
|
*/
|
|
457
474
|
areaExit: [area: Area, entity: Player | Horse | Cart | Npc, matchingVirtualWorld: boolean];
|
|
458
475
|
|
|
476
|
+
/**
|
|
477
|
+
* Raised once after every configured world export has loaded successfully, including an empty list. WorldResource.ready is true inside the handler. A script starting later must check WorldResource.ready first; the event is not replayed. Do not await this event inside resourceStart: exports load after script startup. Handler promises are not awaited.
|
|
478
|
+
*/
|
|
479
|
+
worldResourcesReady: [];
|
|
480
|
+
|
|
459
481
|
/**
|
|
460
482
|
* A container now exists: a scripted chest, a virtual stash, or one the level places, built in a virtual world the first time anything there asked for it. Every container starts empty; restore saved contents here with `setInventory`. The level's containers in the global world are built before any resource runs, so restore those from `resourceStart` by walking `Stash.all()`.
|
|
461
483
|
*/
|
|
@@ -956,6 +978,136 @@ declare global {
|
|
|
956
978
|
walkEnforced: boolean;
|
|
957
979
|
}
|
|
958
980
|
|
|
981
|
+
/**
|
|
982
|
+
* One number per damage type a blow is worked out in. A blade's stab, slash and smash are priced separately and added; a blow runs only the passes its attack and weapon call for.
|
|
983
|
+
*/
|
|
984
|
+
interface DamagePasses {
|
|
985
|
+
/**
|
|
986
|
+
* The stab pass.
|
|
987
|
+
*/
|
|
988
|
+
stab: number;
|
|
989
|
+
|
|
990
|
+
/**
|
|
991
|
+
* The slash pass.
|
|
992
|
+
*/
|
|
993
|
+
slash: number;
|
|
994
|
+
|
|
995
|
+
/**
|
|
996
|
+
* The smash pass.
|
|
997
|
+
*/
|
|
998
|
+
smash: number;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* Scales a `playerHit` handler puts on the server's price of a melee blow, each 1 until a handler changes it. The server works the blow out again with them, step by step as the game does: a heavier attack has to get through the same armour and the same block, so doubling `attack` does not simply double the damage. Never negative.
|
|
1003
|
+
*/
|
|
1004
|
+
interface PlayerHitModifiers {
|
|
1005
|
+
/**
|
|
1006
|
+
* Scales the attacker's attack in every pass, after their weapon, strength, skill and the swing itself.
|
|
1007
|
+
*/
|
|
1008
|
+
attack: number;
|
|
1009
|
+
|
|
1010
|
+
/**
|
|
1011
|
+
* Scales the victim's armour where the blow landed.
|
|
1012
|
+
*/
|
|
1013
|
+
defense: number;
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* Scales what the victim's block put up. Nothing for a blow that was not blocked.
|
|
1017
|
+
*/
|
|
1018
|
+
block: number;
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* Scales the health the blow takes, once everything else is worked out. The game's own cap of 200 a blow is applied before it, so this can go past it.
|
|
1022
|
+
*/
|
|
1023
|
+
health: number;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Another player's blow, as `playerHit` shows it before the referee rules. `damage` is what the blow will take and `modifiers` scale how the server works it out; a handler may change either. Every other field describes what happened and is read-only in effect.
|
|
1028
|
+
*/
|
|
1029
|
+
interface PlayerHit {
|
|
1030
|
+
/**
|
|
1031
|
+
* Health the blow takes. For a swing the server works it out itself, the way the game does, from the attacker's weapon and its wear, both players' strength and skills, the armour the victim wears where it landed, the block and the perks and buffs it can vouch for; for an arrow it is what the victim's own game worked out. Set it and it stands as set: `modifiers` are then ignored. Never negative.
|
|
1032
|
+
*/
|
|
1033
|
+
damage: number;
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* Health the game itself took for the blow on the machine that saw it land. Matches `damage` unless a perk that depends on the moment -- a heavy weapon's, a first strike's -- was in play, which the server leaves out.
|
|
1037
|
+
*/
|
|
1038
|
+
engineDamage: number;
|
|
1039
|
+
|
|
1040
|
+
/**
|
|
1041
|
+
* Whether the server worked `damage` out itself: true for a swing, false for an arrow.
|
|
1042
|
+
*/
|
|
1043
|
+
priced: boolean;
|
|
1044
|
+
|
|
1045
|
+
/**
|
|
1046
|
+
* The attacker's weapon as 32 hex digits, or null for a bare hand.
|
|
1047
|
+
*/
|
|
1048
|
+
weapon: string | null;
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* The attacker's attack in each pass, after the swing's own strength and before `modifiers`.
|
|
1052
|
+
*/
|
|
1053
|
+
attack: DamagePasses;
|
|
1054
|
+
|
|
1055
|
+
/**
|
|
1056
|
+
* The victim's armour in each pass where the blow landed, before `modifiers`.
|
|
1057
|
+
*/
|
|
1058
|
+
armor: DamagePasses;
|
|
1059
|
+
|
|
1060
|
+
/**
|
|
1061
|
+
* What the victim's block put up, or 0 when nothing blocked it.
|
|
1062
|
+
*/
|
|
1063
|
+
blockDefense: number;
|
|
1064
|
+
|
|
1065
|
+
/**
|
|
1066
|
+
* How much the place it landed multiplies the damage by: 1.5 for the head, 1 for the torso, 0.7 for a limb.
|
|
1067
|
+
*/
|
|
1068
|
+
bodyPartCoefficient: number;
|
|
1069
|
+
|
|
1070
|
+
/**
|
|
1071
|
+
* Scales on the server's price; see `PlayerHitModifiers`. Ignored for an arrow.
|
|
1072
|
+
*/
|
|
1073
|
+
modifiers: PlayerHitModifiers;
|
|
1074
|
+
|
|
1075
|
+
/**
|
|
1076
|
+
* Stamina the blow cost the victim. Already spent: stamina decides their next block, which cannot wait for a ruling.
|
|
1077
|
+
*/
|
|
1078
|
+
stamina: number;
|
|
1079
|
+
|
|
1080
|
+
/**
|
|
1081
|
+
* The limb it landed on, or null for none in particular.
|
|
1082
|
+
*/
|
|
1083
|
+
bodyPart: "head" | "torso" | "leftArm" | "rightArm" | "leftLeg" | "rightLeg" | null;
|
|
1084
|
+
|
|
1085
|
+
/**
|
|
1086
|
+
* The game's own reason for the damage: `combat` for a blade or a bow.
|
|
1087
|
+
*/
|
|
1088
|
+
reason: "unknown" | "combat" | "gunshot" | "starvation" | "collision" | "scripted" | "disintegrate" | "fall" | "poison" | "bleeding" | "selfHarm";
|
|
1089
|
+
|
|
1090
|
+
/**
|
|
1091
|
+
* Whether it was a swing or an arrow.
|
|
1092
|
+
*/
|
|
1093
|
+
source: "melee" | "missile";
|
|
1094
|
+
|
|
1095
|
+
/**
|
|
1096
|
+
* The victim's block caught it.
|
|
1097
|
+
*/
|
|
1098
|
+
blocked: boolean;
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* The victim's perfect block caught it. The game takes nothing for one.
|
|
1102
|
+
*/
|
|
1103
|
+
perfectBlock: boolean;
|
|
1104
|
+
|
|
1105
|
+
/**
|
|
1106
|
+
* The victim's block gave way under it.
|
|
1107
|
+
*/
|
|
1108
|
+
blockBroken: boolean;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
959
1111
|
/**
|
|
960
1112
|
* Which of a player's limbs carry an injury, one flag per limb. An injury is the game's own: it lowers the stamina ceiling (`healthyStamina`), can bleed, and heals slowly by itself or at once with a bandage or `player.heal`.
|
|
961
1113
|
*/
|
|
@@ -1356,6 +1508,13 @@ declare global {
|
|
|
1356
1508
|
*/
|
|
1357
1509
|
revive(): boolean;
|
|
1358
1510
|
|
|
1511
|
+
/**
|
|
1512
|
+
* Ends melee combat between these two players and retires their pending blows against each other. Other opponents are left alone. A later attack can start combat again. Consent and timeout rules belong to your resource.
|
|
1513
|
+
* @param opponent The other player. Both sides are cancelled.
|
|
1514
|
+
* @returns True when sent; false for disconnected players, the same player, or different virtual worlds.
|
|
1515
|
+
*/
|
|
1516
|
+
cancelCombat(opponent: Player): boolean;
|
|
1517
|
+
|
|
1359
1518
|
/**
|
|
1360
1519
|
* Puts this player somewhere, as a spawn rather than as a teleport: their client holds the body still until there is real ground under it, so it cannot fall through a world that has not streamed in yet.
|
|
1361
1520
|
*
|
|
@@ -1434,6 +1593,13 @@ declare global {
|
|
|
1434
1593
|
*/
|
|
1435
1594
|
setAppearance(appearance: Partial<Appearance>): boolean;
|
|
1436
1595
|
|
|
1596
|
+
/**
|
|
1597
|
+
* Grants or revokes World Builder access for this player. Multiplayer connections start without access. Enabling allows F7 and the client MapEditor.open API; disabling also closes an open editor. The permission lasts until changed or disconnected and does not affect other players. Offline editing is always allowed.
|
|
1598
|
+
* @param enabled Whether this player may open World Builder.
|
|
1599
|
+
* @returns True when the permission was sent; false for a player with no connection. Throws unless enabled is a boolean.
|
|
1600
|
+
*/
|
|
1601
|
+
setWorldBuilderEnabled(enabled: boolean): boolean;
|
|
1602
|
+
|
|
1437
1603
|
/**
|
|
1438
1604
|
* Puts a pace rule on this player. `walkByDefault` makes walking the pace they keep coming back to and leaves their own key working; `walkEnforced` forbids running and sprinting outright, and their key stops mattering.
|
|
1439
1605
|
*
|
|
@@ -1448,7 +1614,7 @@ declare global {
|
|
|
1448
1614
|
setMovementMode(mode: Partial<MovementMode>): boolean;
|
|
1449
1615
|
|
|
1450
1616
|
/**
|
|
1451
|
-
* Grants items into this player's inventory, which the server holds; their game shows them on the next tick. `Inventory.add` does the same
|
|
1617
|
+
* Grants items into this player's inventory, which the server holds; their game shows them on the next tick and announces them with its own "You received" toast. `Inventory.add` does the same, can set the items' properties, and can leave out the toast.
|
|
1452
1618
|
* @param item Item class GUID, or the exact name the game's own item tables use.
|
|
1453
1619
|
* @param amount How many to grant; defaults to 1, and at most 10000.
|
|
1454
1620
|
* @returns True when the items were added; false for an unknown item, an amount outside 1..10000, or a player with no inventory.
|
|
@@ -1456,7 +1622,7 @@ declare global {
|
|
|
1456
1622
|
giveItem(item: string, amount?: number): boolean;
|
|
1457
1623
|
|
|
1458
1624
|
/**
|
|
1459
|
-
* Takes items of a class out of this player's inventory, across its rows, all of them or none. The server holds the inventory, so the promise is already settled when it is returned; it stays a promise so existing scripts keep working. To move items between players use `Inventory.transfer`, which cannot lose them half way.
|
|
1625
|
+
* Takes items of a class out of this player's inventory, across its rows, all of them or none. The server holds the inventory, so the promise is already settled when it is returned; it stays a promise so existing scripts keep working. Their game announces the loss with its own toast; `Inventory.remove` can leave it out. To move items between players use `Inventory.transfer`, which cannot lose them half way.
|
|
1460
1626
|
* @param item Item class GUID, or the exact name the game's own item tables use. The same spelling `giveItem` takes.
|
|
1461
1627
|
* @param amount How many units to take; defaults to 1, and at most 10000. Zero is refused rather than read as "all of them".
|
|
1462
1628
|
* @returns An object carrying `removed` (the amount when it happened, otherwise 0), `requested`, `ok`, and `reason` (empty on success, otherwise the inventory code, such as `insufficientItems`).
|
|
@@ -1676,7 +1842,7 @@ declare global {
|
|
|
1676
1842
|
revision: number;
|
|
1677
1843
|
|
|
1678
1844
|
/**
|
|
1679
|
-
* `add`, `remove`, `properties`, `set`, `transfer`, `wear` when the player's game wore an item down in use, `use` for food, potions and ointments, `shot` for a fired round, `pickpocket`, `trade` for a vendor deal, `drop` for `player.dropInventory`, or the ground, stash and gathering reasons.
|
|
1845
|
+
* `add`, `remove`, `properties`, `set`, `transfer`, `wear` when the player's game wore an item down in use, `use` for food, potions and ointments, `shot` for a fired round, `pickpocket`, `trade` for a vendor deal, `repair` for a repair kit, `drop` for `player.dropInventory`, or the ground, stash and gathering reasons.
|
|
1680
1846
|
*/
|
|
1681
1847
|
reason: string;
|
|
1682
1848
|
|
|
@@ -1696,7 +1862,7 @@ declare global {
|
|
|
1696
1862
|
ok: boolean;
|
|
1697
1863
|
|
|
1698
1864
|
/**
|
|
1699
|
-
* Empty on success, otherwise why not: `inventoryUnavailable`, `invalidRequest`, `staleRevision`, `invalidItem`, `invalidItems`, `invalidAmount`, `unknownItem`, `insufficientItems`, `inventoryCapacity`, `sameInventory`, or a property policy code (`invalidMetadata`, `unknownItemClass`, `questItem`, `invalidQuality`, `immutableItemHealth`, `invalidItemHealth`, `contradictoryItemHealth`, `invalidCreationSentinel`, `unsupportedPoisonProperties`, `unsupportedOnEquipBuffs`).
|
|
1865
|
+
* Empty on success, otherwise why not: `inventoryUnavailable`, `invalidRequest`, `staleRevision`, `invalidItem`, `invalidItems`, `invalidAmount`, `unknownItem`, `insufficientItems`, `inventoryCapacity`, `sameInventory`, `invalidEquipment`, or a property policy code (`invalidMetadata`, `unknownItemClass`, `questItem`, `invalidQuality`, `immutableItemHealth`, `invalidItemHealth`, `contradictoryItemHealth`, `invalidCreationSentinel`, `unsupportedPoisonProperties`, `unsupportedOnEquipBuffs`).
|
|
1700
1866
|
*/
|
|
1701
1867
|
code: string;
|
|
1702
1868
|
|
|
@@ -1722,14 +1888,14 @@ declare global {
|
|
|
1722
1888
|
get(player: Player): InventoryState | null;
|
|
1723
1889
|
|
|
1724
1890
|
/**
|
|
1725
|
-
* Gives a player items of a class, 1 to 10000 at a time. `item` is the class GUID or the exact name the game's own item tables use, the same spelling `giveItem` takes. Left-out properties mean quality 1 at full condition; `metadata.quality` asks for a higher tier, up to what the class is made in, and `invalidQuality` refuses one past it. The units join the row that already holds this class with these properties, if there is one.
|
|
1891
|
+
* Gives a player items of a class, 1 to 10000 at a time. `item` is the class GUID or the exact name the game's own item tables use, the same spelling `giveItem` takes. Left-out properties mean quality 1 at full condition; `metadata.quality` asks for a higher tier, up to what the class is made in, and `invalidQuality` refuses one past it. The units join the row that already holds this class with these properties, if there is one. The player's game announces them with its own "You received" toast unless `notify` is false.
|
|
1726
1892
|
*/
|
|
1727
|
-
add(player: Player, request: { item: string; amount: number; metadata?: Record<string, unknown>; revision?: number }): InventoryResult;
|
|
1893
|
+
add(player: Player, request: { item: string; amount: number; metadata?: Record<string, unknown>; revision?: number; notify?: boolean }): InventoryResult;
|
|
1728
1894
|
|
|
1729
1895
|
/**
|
|
1730
|
-
* Takes exact units from named rows, every one of them or none.
|
|
1896
|
+
* Takes exact units from named rows, every one of them or none. The player's game announces the loss with its own toast unless `notify` is false.
|
|
1731
1897
|
*/
|
|
1732
|
-
remove(player: Player, request: { units: InventoryUnit[]; revision?: number }): InventoryResult;
|
|
1898
|
+
remove(player: Player, request: { units: InventoryUnit[]; revision?: number; notify?: boolean }): InventoryResult;
|
|
1733
1899
|
|
|
1734
1900
|
/**
|
|
1735
1901
|
* Replaces a row's properties. The row keeps its identity and amount. It replaces rather than merges: carry over anything you want to keep, and give `health` or `condition`, not two that disagree.
|
|
@@ -1737,14 +1903,14 @@ declare global {
|
|
|
1737
1903
|
setProperties(player: Player, request: { id: string; metadata: Record<string, unknown>; revision?: number }): InventoryResult;
|
|
1738
1904
|
|
|
1739
1905
|
/**
|
|
1740
|
-
* Replaces a player's whole inventory, which is how a saved one comes back. Rows keep the ids they are given (letters, digits and `-_:.`, up to 64) and get new ones when they have none. `equipped` is how many units of a gear row the body wears, up to 48 in all; their game dresses in them. An empty list clears the inventory.
|
|
1906
|
+
* Replaces a player's whole inventory, which is how a saved one comes back. It is never announced in the player's game. Rows keep the ids they are given (letters, digits and `-_:.`, up to 64) and get new ones when they have none. `equipped` is how many units of a gear row the body wears, up to 48 in all; their game dresses in them. An empty list clears the inventory.
|
|
1741
1907
|
*/
|
|
1742
1908
|
set(player: Player, request: { items: { id?: string; item: string; amount: number; metadata?: Record<string, unknown>; equipped?: number }[]; revision?: number }): InventoryResult;
|
|
1743
1909
|
|
|
1744
1910
|
/**
|
|
1745
|
-
* Moves exact units from one player to another with their properties, all or nothing. They join matching rows in the target, so the target's row ids are the ones in the result's `items`. Whether the two may trade -- distance, consent, price -- is for the script to decide.
|
|
1911
|
+
* Moves exact units from one player to another with their properties, all or nothing. They join matching rows in the target, so the target's row ids are the ones in the result's `items`. Whether the two may trade -- distance, consent, price -- is for the script to decide. Both players' games announce what they lost and gained unless `notify` is false.
|
|
1746
1912
|
*/
|
|
1747
|
-
transfer(source: Player, target: Player, request: { units: InventoryUnit[]; sourceRevision?: number; targetRevision?: number }): InventoryResult;
|
|
1913
|
+
transfer(source: Player, target: Player, request: { units: InventoryUnit[]; sourceRevision?: number; targetRevision?: number; notify?: boolean }): InventoryResult;
|
|
1748
1914
|
|
|
1749
1915
|
/**
|
|
1750
1916
|
* What the game prices one unit of an item at, in money units, worked out the way the game does it. `pristine` is the price at the best health its quality allows, `current` at its own health. Quality changes the price only through that health. The metadata reads as `Inventory.add` reads it -- left out, quality 1 at full condition -- so `Inventory.getItemPrice(row.item, row.metadata)` prices a row. This is the item's own worth: what the game's shopkeepers would ask depends on their terms and the haggling, and a `Vendor` charges whatever its script says.
|
|
@@ -3009,12 +3175,12 @@ declare global {
|
|
|
3009
3175
|
* @param model Mesh to build, as either a full catalog path (`objects/manmade/barrels/barrel_a.cgf`) or its file stem (`barrel_a`). A stem several meshes share resolves to the first of them, so pass the path when it matters which. A mesh this server streams -- a `.cgf` in a resource's `stream/objects/kcdc/<resource>/` folder -- is named by its full path, `objects/kcdc/<resource>/chair.cgf`; a player whose game does not have it yet sees the prop as soon as it does.
|
|
3010
3176
|
* @param position Optional world-space spawn position; omitted components default to zero.
|
|
3011
3177
|
* @param rotation Optional initial orientation: a Quaternion, or a Vector3 of Euler angles in degrees.
|
|
3012
|
-
* @param scale
|
|
3178
|
+
* @param scale Uniform size or separate X/Y/Z sizes, each from 0.01 to 100. Omitted uses the mesh size. Nonuniform collision follows the native engine limitations.
|
|
3013
3179
|
* @param physics Optional collision: `static` (the default), `rigid` or `none`.
|
|
3014
3180
|
* @param virtualWorld Optional virtual world the prop belongs to; omitted puts it in the global one.
|
|
3015
3181
|
* @returns The newly spawned prop handle.
|
|
3016
3182
|
*/
|
|
3017
|
-
static spawn(model: string, position?: Vector3 | Partial<Vector3>, rotation?: Vector3 | Quaternion, scale?: number, physics?: string, virtualWorld?: number): Prop;
|
|
3183
|
+
static spawn(model: string, position?: Vector3 | Partial<Vector3>, rotation?: Vector3 | Quaternion, scale?: number | Vector3, physics?: string, virtualWorld?: number): Prop;
|
|
3018
3184
|
|
|
3019
3185
|
/**
|
|
3020
3186
|
* Lists every prop the server currently has.
|
|
@@ -3536,7 +3702,7 @@ declare global {
|
|
|
3536
3702
|
*/
|
|
3537
3703
|
class LevelEdit {
|
|
3538
3704
|
/**
|
|
3539
|
-
* Wraps an edit the server already holds; use LevelEdit.apply or
|
|
3705
|
+
* Wraps an edit the server already holds; use LevelEdit.apply to make one, or WorldResource for a whole export.
|
|
3540
3706
|
* @param id Network entity identifier.
|
|
3541
3707
|
*/
|
|
3542
3708
|
constructor(id: number);
|
|
@@ -3620,14 +3786,6 @@ declare global {
|
|
|
3620
3786
|
*/
|
|
3621
3787
|
static apply(definition: LevelEditDefinition, virtualWorld?: number): LevelEdit;
|
|
3622
3788
|
|
|
3623
|
-
/**
|
|
3624
|
-
* Applies every entry of a map's `world` array, which is how edits made in the World Builder reach every player instead of being loaded by hand on each.
|
|
3625
|
-
* @param map A World Builder map saved from the editor, as its JSON text or the parsed object. Only its `world` array is read: its placed objects are `Prop.spawn`'s, its areas `Area.create`'s.
|
|
3626
|
-
* @param virtualWorld Optional virtual world whose players see the edits; the global one when omitted.
|
|
3627
|
-
* @returns One edit per entry, in the map's order. Throws, naming the entry, for one no client could find the object by.
|
|
3628
|
-
*/
|
|
3629
|
-
static applyMap(map: string | Record<string, unknown>, virtualWorld?: number): LevelEdit[];
|
|
3630
|
-
|
|
3631
3789
|
/**
|
|
3632
3790
|
* Lists every edit the server currently has.
|
|
3633
3791
|
* @param virtualWorld Optional virtual world to list; omitted lists every one of them.
|
|
@@ -4557,7 +4715,7 @@ declare global {
|
|
|
4557
4715
|
}
|
|
4558
4716
|
|
|
4559
4717
|
/**
|
|
4560
|
-
* Replicated handle for one of the level's
|
|
4718
|
+
* Replicated handle for one of the level's castle gates.
|
|
4561
4719
|
*/
|
|
4562
4720
|
class Gate {
|
|
4563
4721
|
/**
|
|
@@ -4567,12 +4725,12 @@ declare global {
|
|
|
4567
4725
|
constructor(id: number);
|
|
4568
4726
|
|
|
4569
4727
|
/**
|
|
4570
|
-
* The level's own EntityGuid, as sixteen lowercase hex digits. The same on every machine, so it is the identity to store a gate under; `Gate.find` takes it back.
|
|
4728
|
+
* The level's own EntityGuid, as sixteen lowercase hex digits. The same on every machine, so it is the identity to store a gate under; `Gate.find` takes it back. A `gate` has no entity of its own, so its key is the GUID of the layer that draws it shut.
|
|
4571
4729
|
*/
|
|
4572
4730
|
readonly guid: string;
|
|
4573
4731
|
|
|
4574
4732
|
/**
|
|
4575
|
-
* What piece of architecture this is: `drawbridge` or `portcullis
|
|
4733
|
+
* What piece of architecture this is: `drawbridge` or `portcullis`, which animate, or `gate`, a pair of leaves the level swaps between drawn open and drawn shut -- the Ratborsch and Nebakov fortress gates and the Ruthard palace gate. A `gate` opens and closes at once.
|
|
4576
4734
|
*/
|
|
4577
4735
|
readonly kind: string;
|
|
4578
4736
|
|
|
@@ -4592,7 +4750,7 @@ declare global {
|
|
|
4592
4750
|
readonly moving: boolean;
|
|
4593
4751
|
|
|
4594
4752
|
/**
|
|
4595
|
-
* How long opening takes, in seconds, from the key range the asset's animation database stores. A gate with no opening clip runs its closing one backwards, so this is that clip's length.
|
|
4753
|
+
* How long opening takes, in seconds, from the key range the asset's animation database stores. A gate with no opening clip runs its closing one backwards, so this is that clip's length. 0 for a `gate`.
|
|
4596
4754
|
*/
|
|
4597
4755
|
readonly openDuration: number;
|
|
4598
4756
|
|
|
@@ -4743,7 +4901,7 @@ declare global {
|
|
|
4743
4901
|
load(): SiegeResult;
|
|
4744
4902
|
|
|
4745
4903
|
/**
|
|
4746
|
-
* Turns a loaded engine to face the target and shoots at it. A trebuchet's arm lets the stone go at one angle, so its speed is solved for the distance; a cannon fires at one speed, so its elevation is. The stone is let go partway through the shot (`seconds`), then every client nearby draws it along the same arc. It comes down where the world stops it, which the
|
|
4904
|
+
* Turns a loaded engine to face the target and shoots at it. A trebuchet's arm lets the stone go at one angle, so its speed is solved for the distance; a cannon fires at one speed, so its elevation is. The stone is let go partway through the shot (`seconds`), then every client nearby draws it along the same arc. It comes down where the world stops it, which the attacker is asked to report when near enough, else the player nearest the target, or on the target when nobody can.
|
|
4747
4905
|
* @param target Where the projectile should come down.
|
|
4748
4906
|
* @param attacker The player credited with whatever it hits, in `playerDamage`, `npcDamage` and `siegeImpact`.
|
|
4749
4907
|
* @returns What happened, and the phrase to explain it with when nothing did.
|
|
@@ -5091,6 +5249,71 @@ declare global {
|
|
|
5091
5249
|
static all(kind?: 'level' | 'script'): Area[];
|
|
5092
5250
|
}
|
|
5093
5251
|
|
|
5252
|
+
/**
|
|
5253
|
+
* A named world export loaded from mod.world_resources. Server-owned, with live access to its surviving props, effects, level edits and areas. Obtain handles through all or find; runtime loading, reloading and unloading are not exposed.
|
|
5254
|
+
*/
|
|
5255
|
+
class WorldResource {
|
|
5256
|
+
private constructor();
|
|
5257
|
+
|
|
5258
|
+
/**
|
|
5259
|
+
* Unique case-sensitive resource name: the filename without .world.json, or the explicit config name. Empty after shutdown.
|
|
5260
|
+
*/
|
|
5261
|
+
readonly name: string;
|
|
5262
|
+
|
|
5263
|
+
/**
|
|
5264
|
+
* Resolved absolute source file path, in UTF-8. Empty after shutdown.
|
|
5265
|
+
*/
|
|
5266
|
+
readonly path: string;
|
|
5267
|
+
|
|
5268
|
+
/**
|
|
5269
|
+
* The exported game level, checked against the server level at startup. Empty after shutdown.
|
|
5270
|
+
*/
|
|
5271
|
+
readonly level: string;
|
|
5272
|
+
|
|
5273
|
+
/**
|
|
5274
|
+
* Whether this export is registered. Remains true even if scripts destroy all of its contents.
|
|
5275
|
+
*/
|
|
5276
|
+
readonly loaded: boolean;
|
|
5277
|
+
|
|
5278
|
+
/**
|
|
5279
|
+
* A fresh array of surviving props in export order. Changing the array does not change membership; the handles support normal Prop operations.
|
|
5280
|
+
*/
|
|
5281
|
+
readonly props: Prop[];
|
|
5282
|
+
|
|
5283
|
+
/**
|
|
5284
|
+
* A fresh array of surviving effects in export order, excluding destroyed effects.
|
|
5285
|
+
*/
|
|
5286
|
+
readonly effects: Vfx[];
|
|
5287
|
+
|
|
5288
|
+
/**
|
|
5289
|
+
* A fresh array of surviving level edits in export order, excluding restored edits.
|
|
5290
|
+
*/
|
|
5291
|
+
readonly levelEdits: LevelEdit[];
|
|
5292
|
+
|
|
5293
|
+
/**
|
|
5294
|
+
* A fresh array of surviving exported areas in export order, excluding destroyed areas.
|
|
5295
|
+
*/
|
|
5296
|
+
readonly areas: Area[];
|
|
5297
|
+
|
|
5298
|
+
/**
|
|
5299
|
+
* True after every configured export has loaded successfully, even when the config list is empty. Check this before subscribing to worldResourcesReady when a script may start later.
|
|
5300
|
+
*/
|
|
5301
|
+
static readonly ready: boolean;
|
|
5302
|
+
|
|
5303
|
+
/**
|
|
5304
|
+
* Lists config-loaded world exports in configuration order. Empty before successful startup and after shutdown.
|
|
5305
|
+
* @returns A fresh array of resource handles.
|
|
5306
|
+
*/
|
|
5307
|
+
static all(): WorldResource[];
|
|
5308
|
+
|
|
5309
|
+
/**
|
|
5310
|
+
* Finds a config-loaded export by name. Throws for a non-string argument.
|
|
5311
|
+
* @param name Exact, case-sensitive resource name.
|
|
5312
|
+
* @returns The resource, or null when absent or startup has not completed.
|
|
5313
|
+
*/
|
|
5314
|
+
static find(name: string): WorldResource | null;
|
|
5315
|
+
}
|
|
5316
|
+
|
|
5094
5317
|
/**
|
|
5095
5318
|
* Container handle for a spawned chest, a level chest, or virtual stock without a world entity.
|
|
5096
5319
|
*/
|
|
@@ -7289,6 +7512,8 @@ declare global {
|
|
|
7289
7512
|
* Arbitrary key/value state attached to one replicated entity, reached as `entity.state`. Keys set on the server replicate to every client that can currently see the entity.
|
|
7290
7513
|
*/
|
|
7291
7514
|
class StateBag {
|
|
7515
|
+
private constructor();
|
|
7516
|
+
|
|
7292
7517
|
/**
|
|
7293
7518
|
* Reads one key from this entity's state.
|
|
7294
7519
|
* @param key Key to read.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kingdomsconnected/types",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "TypeScript declarations for the Kingdoms Connected scripting API, one entry per side: @kingdomsconnected/types/server and @kingdomsconnected/types/client",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"keywords": [
|