@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.
- package/generated/client-api.d.ts +301 -23
- package/generated/server-api.d.ts +936 -98
- package/package.json +1 -1
|
@@ -18,18 +18,18 @@ declare global {
|
|
|
18
18
|
/**
|
|
19
19
|
* Dispatched once per accepted death report. Call player.revive() to request revival; there is no automatic respawn.
|
|
20
20
|
*
|
|
21
|
-
* `killer` is the player whose blow took the last of the health, as the dying player's own client saw it -- null for a fall, a bleed-out, or anything
|
|
21
|
+
* `killer` is the player or server NPC whose blow took the last of the health, as the dying player's own client saw it -- null for a fall, a bleed-out, or anything without an identified attacker. `reason` is the game's own for that last write: `combat` for a blade or a bow, `fall`, `bleeding`, `poison` and so on.
|
|
22
22
|
*/
|
|
23
|
-
playerDied: [player: Player, killer: Player | null, reason: "unknown" | "combat" | "gunshot" | "starvation" | "collision" | "scripted" | "disintegrate" | "fall" | "poison" | "bleeding" | "selfHarm"];
|
|
23
|
+
playerDied: [player: Player, killer: Player | Npc | 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. Player combat and server NPC melee are raised by the server as it rules on them, 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
|
-
* `attacker` is the player who dealt it, or null. `bodyPart` is where it landed, or null for damage that lands nowhere in particular.
|
|
28
|
+
* `attacker` is the player or server NPC who dealt it, or null. `bodyPart` is where it landed, or null for damage that lands nowhere in particular. A player attacker's weapon is available through `rightHandItem` or `leftHandItem`; an NPC's equipped items are in `wearing`.
|
|
29
29
|
*
|
|
30
30
|
* Bleeding, poison and hunger wear health down a tick at a time without raising this -- `bleeding`, `poisoning` and `hunger` are live numbers already. The tick that kills does arrive, with its own reason, just before the `playerDied` it causes.
|
|
31
31
|
*/
|
|
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"];
|
|
32
|
+
playerDamage: [player: Player, attacker: Player | Npc | 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
34
|
/**
|
|
35
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.
|
|
@@ -42,11 +42,11 @@ declare global {
|
|
|
42
42
|
playerCombatCancelled: [first: Player, second: Player];
|
|
43
43
|
|
|
44
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.
|
|
45
|
+
* Dispatched when another player's blade or arrow, or a server NPC's melee attack, 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
46
|
*
|
|
47
|
-
* Return `false` from a handler to refuse the blow: no health is taken and no `playerDamage` follows.
|
|
47
|
+
* Return `false` from a handler to refuse the blow: no health is taken and no `playerDamage` follows. NPC melee uses the victim client's native damage with `priced: false`; set `hit.damage` to change it. For priced player swings, 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
48
|
*/
|
|
49
|
-
playerHit: [player: Player, attacker: Player, hit: PlayerHit];
|
|
49
|
+
playerHit: [player: Player, attacker: Player | Npc, hit: PlayerHit];
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
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.
|
|
@@ -137,6 +137,11 @@ declare global {
|
|
|
137
137
|
*/
|
|
138
138
|
playerInventoryReady: [player: Player];
|
|
139
139
|
|
|
140
|
+
/**
|
|
141
|
+
* A move or patrol leg reached its destination, was blocked, or failed. Intermediate path corners do not emit this event.
|
|
142
|
+
*/
|
|
143
|
+
horseIntentDone: [horse: Horse, status: string];
|
|
144
|
+
|
|
140
145
|
/**
|
|
141
146
|
* Dispatched immediately after a horse is created and replicated, whether by `Horse.spawn`, the `/horse` command, or anything else.
|
|
142
147
|
*/
|
|
@@ -367,14 +372,14 @@ declare global {
|
|
|
367
372
|
npcIntentDone: [npc: Npc, status: string];
|
|
368
373
|
|
|
369
374
|
/**
|
|
370
|
-
* Dispatched after health came off the ledger.
|
|
375
|
+
* Dispatched after health came off the ledger. For melee, the victim's simulator resolves the native hit and the server checks the accepted swing before changing health. `amount` is what was actually taken.
|
|
371
376
|
*/
|
|
372
|
-
npcDamage: [npc: Npc, attacker: Player | null, amount: number];
|
|
377
|
+
npcDamage: [npc: Npc, attacker: Player | Npc | null, amount: number];
|
|
373
378
|
|
|
374
379
|
/**
|
|
375
380
|
* Dispatched when the last of an NPC's health goes. The body stays as a corpse and the handle keeps resolving.
|
|
376
381
|
*/
|
|
377
|
-
npcDeath: [npc: Npc, attacker: Player | null];
|
|
382
|
+
npcDeath: [npc: Npc, attacker: Player | Npc | null];
|
|
378
383
|
|
|
379
384
|
/**
|
|
380
385
|
* Dispatched when a dead NPC is brought back. Every client makes a new body for it.
|
|
@@ -396,6 +401,16 @@ declare global {
|
|
|
396
401
|
*/
|
|
397
402
|
npcSimulatorChange: [npc: Npc, player: Player | null];
|
|
398
403
|
|
|
404
|
+
/**
|
|
405
|
+
* One accepted waypoint outcome; intermediate path corners do not emit it.
|
|
406
|
+
*/
|
|
407
|
+
patrolWaypoint: [actor: Npc, info: PatrolState & { status: 'reached' | 'blocked' | 'failed' }];
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* A patrol ended, failed, or was replaced. Edits to its definition do not replace its snapshot.
|
|
411
|
+
*/
|
|
412
|
+
patrolFinished: [actor: Npc, info: PatrolState & { status: 'completed' | 'failed' | 'cancelled' }];
|
|
413
|
+
|
|
399
414
|
/**
|
|
400
415
|
* Dispatched when a player starts or stops following a 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. The client reports it -- following a quest is decided there and cannot be refused here -- so a handler reacts rather than vetoes. It fires only on an actual change, and only for a quest that player was given.
|
|
401
416
|
*/
|
|
@@ -449,9 +464,9 @@ declare global {
|
|
|
449
464
|
siegeEngineReady: [engine: SiegeEngine];
|
|
450
465
|
|
|
451
466
|
/**
|
|
452
|
-
* Dispatched when a player
|
|
467
|
+
* Dispatched when a player asks something of a `usable` engine, standing at it: to take its place (`operate`) or a free winch (`winch`) from the game's own prompt, or -- in its place -- to `load` it or `fire` it where they laid it, with the player as the attacker. Return false to refuse. `leave` reports a player stepping away from either and cannot be refused. A handler that works the engine itself should refuse, so it is not worked twice.
|
|
453
468
|
*/
|
|
454
|
-
siegeEngineUse: [player: Player, engine: SiegeEngine, action: "load" | "fire"];
|
|
469
|
+
siegeEngineUse: [player: Player, engine: SiegeEngine, action: "operate" | "winch" | "leave" | "load" | "fire"];
|
|
455
470
|
|
|
456
471
|
/**
|
|
457
472
|
* Dispatched the moment an engine lets its projectile go, partway through the shot `fire` started.
|
|
@@ -604,11 +619,221 @@ declare global {
|
|
|
604
619
|
* Dispatched when a player asks to join, before the connection exists: they hold no player slot, are not counted as online, and are sent nothing -- no resource list, no download, no body. The request waits until every handler has returned and every Promise a handler returned has settled, then it is let in if a player slot is free (otherwise it is refused as full). `connection.reject()` turns it away instead, and so does a handler that throws or rejects, or handlers that have not settled within the server's admission timeout (30 seconds by default, restarted by every `connection.update()`). With no handler at all, every request is let in at once.
|
|
605
620
|
*/
|
|
606
621
|
playerConnecting: [connection: PendingConnection];
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Dispatched when a blast takes `amount` off an engine with a `maxHealth`, before it is wrecked by it. `health` already reads what is left.
|
|
625
|
+
*/
|
|
626
|
+
siegeEngineDamage: [engine: SiegeEngine, amount: number, attacker: Player | null];
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Dispatched when an engine's health runs out. Its operator and crew have been let go, and a stone still in its sling went down with it.
|
|
630
|
+
*/
|
|
631
|
+
siegeEngineWreck: [engine: SiegeEngine, attacker: Player | null];
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Dispatched immediately after a siege ladder is placed.
|
|
635
|
+
*/
|
|
636
|
+
siegeLadderSpawn: [ladder: SiegeLadder];
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Dispatched while a siege ladder is being removed. The handle still resolves.
|
|
640
|
+
*/
|
|
641
|
+
siegeLadderDestroy: [ladder: SiegeLadder];
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Dispatched when a player asks to push a `usable` ladder from the walk at its top, or to raise a fallen one from beside its foot. Return false to refuse.
|
|
645
|
+
*/
|
|
646
|
+
siegeLadderUse: [player: Player, ladder: SiegeLadder, action: "push" | "raise"];
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Dispatched when a pushed ladder hits the ground. Anyone who was on it was thrown off as it began to fall, and took the game's own fall.
|
|
650
|
+
*/
|
|
651
|
+
siegeLadderFall: [ladder: SiegeLadder, pusher: Player | null];
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Dispatched when a raised ladder leans on its wall again and can be climbed.
|
|
655
|
+
*/
|
|
656
|
+
siegeLadderRaise: [ladder: SiegeLadder];
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Dispatched immediately after a stone pile is placed.
|
|
660
|
+
*/
|
|
661
|
+
stonePileSpawn: [pile: StonePile];
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* Dispatched while a stone pile is being removed. The handle still resolves.
|
|
665
|
+
*/
|
|
666
|
+
stonePileDestroy: [pile: StonePile];
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Dispatched when a player takes a stone off a pile. The game's own stone throwing has already lifted it and heaves it over the wall at once, so it cannot be refused; make the pile not `usable` to stop the next one.
|
|
670
|
+
*/
|
|
671
|
+
stonePileThrow: [player: Player, pile: StonePile];
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Dispatched where a thrown stone first met something, as its thrower saw it, checked to lie within 30 m of its pile. Players within the pile's `damageRadius` have been told to take their share, and NPCs have taken theirs.
|
|
675
|
+
*/
|
|
676
|
+
stoneImpact: [pile: StonePile | null, position: Vector3, attacker: Player];
|
|
607
677
|
}
|
|
608
678
|
|
|
609
679
|
/** Names of native events available in this scripting environment. */
|
|
610
680
|
type EventName = keyof EventMap;
|
|
611
681
|
|
|
682
|
+
/**
|
|
683
|
+
* Writable player stats, in native units. Use getStat and the server's setStat.
|
|
684
|
+
*/
|
|
685
|
+
const PlayerStat: {
|
|
686
|
+
/**
|
|
687
|
+
* Current health, in native units. Zero can kill.
|
|
688
|
+
*/
|
|
689
|
+
readonly Health: "health";
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Current stamina; the game continues spending and regenerating it.
|
|
693
|
+
*/
|
|
694
|
+
readonly Stamina: "stamina";
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Current energy reserve; higher means better rested.
|
|
698
|
+
*/
|
|
699
|
+
readonly Exhaust: "exhaust";
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* Current nourishment; higher means better fed.
|
|
703
|
+
*/
|
|
704
|
+
readonly Hunger: "hunger";
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* Read-only computed player stats. Use getDerivedStat; these values cannot be passed to setStat.
|
|
709
|
+
*/
|
|
710
|
+
const DerivedPlayerStat: {
|
|
711
|
+
/**
|
|
712
|
+
* Total bleeding strength.
|
|
713
|
+
*/
|
|
714
|
+
readonly Bleeding: "bleeding";
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Sleepiness; above zero means asleep.
|
|
718
|
+
*/
|
|
719
|
+
readonly Sleeping: "sleeping";
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Consciousness; zero means knocked out.
|
|
723
|
+
*/
|
|
724
|
+
readonly Consciousness: "consciousness";
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* Native drunkenness value.
|
|
728
|
+
*/
|
|
729
|
+
readonly Drunkenness: "drunkenness";
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Native poisoning value; not every named poison changes this value.
|
|
733
|
+
*/
|
|
734
|
+
readonly Poisoning: "poisoning";
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* Effective charisma.
|
|
738
|
+
*/
|
|
739
|
+
readonly Charisma: "charisma";
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Effective visibility.
|
|
743
|
+
*/
|
|
744
|
+
readonly Visibility: "visibility";
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* Effective conspicuousness.
|
|
748
|
+
*/
|
|
749
|
+
readonly Conspicuousness: "conspicuousness";
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* Effective noise.
|
|
753
|
+
*/
|
|
754
|
+
readonly Noise: "noise";
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* Native dirtiness reading; reading it does not clean the body or equipment.
|
|
758
|
+
*/
|
|
759
|
+
readonly Dirtiness: "dirtiness";
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* Native bloodiness reading.
|
|
763
|
+
*/
|
|
764
|
+
readonly Bloodiness: "bloodiness";
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* Native smell reading.
|
|
768
|
+
*/
|
|
769
|
+
readonly Smell: "smell";
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* Native smell intensity.
|
|
773
|
+
*/
|
|
774
|
+
readonly SmellIntensity: "smellIntensity";
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* Native fragrance reading.
|
|
778
|
+
*/
|
|
779
|
+
readonly Fragrance: "fragrance";
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* Carried weight in the same units as InventoryCapacity.
|
|
783
|
+
*/
|
|
784
|
+
readonly CarriedWeight: "carriedWeight";
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* Native carrying capacity, including applicable equipment effects.
|
|
788
|
+
*/
|
|
789
|
+
readonly InventoryCapacity: "inventoryCapacity";
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* Native encumbrance reading.
|
|
793
|
+
*/
|
|
794
|
+
readonly Encumbrance: "encumbrance";
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Native hangover reading.
|
|
798
|
+
*/
|
|
799
|
+
readonly Hangover: "hangover";
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* Computed alcoholism reading, not the persistent soul resource.
|
|
803
|
+
*/
|
|
804
|
+
readonly Alcoholism: "alcoholism";
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* Effective armor rating.
|
|
808
|
+
*/
|
|
809
|
+
readonly ArmorRating: "armorRating";
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* Overall armor defense.
|
|
813
|
+
*/
|
|
814
|
+
readonly OverallArmorDefense: "overallArmorDefense";
|
|
815
|
+
|
|
816
|
+
/**
|
|
817
|
+
* Overall weapon attack.
|
|
818
|
+
*/
|
|
819
|
+
readonly OverallWeaponAttack: "overallWeaponAttack";
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* Normalized run speed; not world-space velocity.
|
|
823
|
+
*/
|
|
824
|
+
readonly NormalizedRunSpeed: "normalizedRunSpeed";
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* Native base run speed.
|
|
828
|
+
*/
|
|
829
|
+
readonly RunSpeedBase: "runSpeedBase";
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* Native morale reading.
|
|
833
|
+
*/
|
|
834
|
+
readonly Morale: "morale";
|
|
835
|
+
};
|
|
836
|
+
|
|
612
837
|
/**
|
|
613
838
|
* How a player's body looks: four of the game's own character-component names, and the gender whose catalog they come from.
|
|
614
839
|
*
|
|
@@ -1024,11 +1249,11 @@ declare global {
|
|
|
1024
1249
|
}
|
|
1025
1250
|
|
|
1026
1251
|
/**
|
|
1027
|
-
*
|
|
1252
|
+
* A player or NPC 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
1253
|
*/
|
|
1029
1254
|
interface PlayerHit {
|
|
1030
1255
|
/**
|
|
1031
|
-
* Health the blow takes. For
|
|
1256
|
+
* Health the blow takes. For melee between players 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 NPC melee or 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
1257
|
*/
|
|
1033
1258
|
damage: number;
|
|
1034
1259
|
|
|
@@ -1221,12 +1446,12 @@ declare global {
|
|
|
1221
1446
|
readonly healthyStamina: number;
|
|
1222
1447
|
|
|
1223
1448
|
/**
|
|
1224
|
-
* Current
|
|
1449
|
+
* Current energy reserve, in the game's own units. Higher means better rested.
|
|
1225
1450
|
*/
|
|
1226
1451
|
readonly exhaust: number;
|
|
1227
1452
|
|
|
1228
1453
|
/**
|
|
1229
|
-
*
|
|
1454
|
+
* Maximum energy reserve, in the game's own units.
|
|
1230
1455
|
*/
|
|
1231
1456
|
readonly maxExhaust: number;
|
|
1232
1457
|
|
|
@@ -1296,7 +1521,7 @@ declare global {
|
|
|
1296
1521
|
readonly relativeSkills: SoulSkills;
|
|
1297
1522
|
|
|
1298
1523
|
/**
|
|
1299
|
-
*
|
|
1524
|
+
* 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.
|
|
1300
1525
|
*/
|
|
1301
1526
|
readonly velocity: Vector3;
|
|
1302
1527
|
|
|
@@ -1310,21 +1535,6 @@ declare global {
|
|
|
1310
1535
|
*/
|
|
1311
1536
|
readonly inAir: boolean;
|
|
1312
1537
|
|
|
1313
|
-
/**
|
|
1314
|
-
* 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.
|
|
1315
|
-
*/
|
|
1316
|
-
readonly moveSpeedTag: number;
|
|
1317
|
-
|
|
1318
|
-
/**
|
|
1319
|
-
* The engine's own movement direction tag. Raw Mannequin tag ids; 255 means nothing is set.
|
|
1320
|
-
*/
|
|
1321
|
-
readonly moveDirTag: number;
|
|
1322
|
-
|
|
1323
|
-
/**
|
|
1324
|
-
* The engine's own stance tag -- upright, sneaking, sitting, lying. Raw Mannequin tag ids; 255 means nothing is set.
|
|
1325
|
-
*/
|
|
1326
|
-
readonly stanceTag: number;
|
|
1327
|
-
|
|
1328
1538
|
/**
|
|
1329
1539
|
* Whether this player is crouched, as their own game's crouch action reports it. False once their body is gone.
|
|
1330
1540
|
*/
|
|
@@ -1437,6 +1647,18 @@ declare global {
|
|
|
1437
1647
|
*/
|
|
1438
1648
|
toString(): string;
|
|
1439
1649
|
|
|
1650
|
+
/**
|
|
1651
|
+
* 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.
|
|
1652
|
+
* @param stat A PlayerStat value.
|
|
1653
|
+
*/
|
|
1654
|
+
getStat(stat: "health" | "stamina" | "exhaust" | "hunger"): number;
|
|
1655
|
+
|
|
1656
|
+
/**
|
|
1657
|
+
* 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.
|
|
1658
|
+
* @param stat A DerivedPlayerStat value.
|
|
1659
|
+
*/
|
|
1660
|
+
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;
|
|
1661
|
+
|
|
1440
1662
|
/**
|
|
1441
1663
|
* Where this player stands on one track: level, XP towards the next one, and unspent perk points.
|
|
1442
1664
|
* @param track A track name, from `Progression.tracks()`.
|
|
@@ -1636,6 +1858,13 @@ declare global {
|
|
|
1636
1858
|
*/
|
|
1637
1859
|
dropInventory(options?: { keepEquipped?: boolean }): Stash | null;
|
|
1638
1860
|
|
|
1861
|
+
/**
|
|
1862
|
+
* Dresses this player in one of the game's own outfits. Every piece of clothing they wear comes off and stays in their inventory, and a new set of the outfit's clothes is added and worn; weapons and everything else are left as they are. Their game dresses them a moment later, as it does after `Inventory.set`.
|
|
1863
|
+
* @param preset One of the game's own outfits for this player's gender, by a name from `Player.outfitPresets(player.appearance.gender)` or its GUID.
|
|
1864
|
+
* @returns True when the inventory was changed; false for a preset that is not in the catalog or is the other gender's, a player with no inventory, or an inventory with no room.
|
|
1865
|
+
*/
|
|
1866
|
+
setOutfit(preset: string): boolean;
|
|
1867
|
+
|
|
1639
1868
|
/**
|
|
1640
1869
|
* Reads this player's inventory; the same as `Inventory.get(player)`.
|
|
1641
1870
|
* @returns A copy of it, or null for a player who is not connected.
|
|
@@ -1672,6 +1901,28 @@ declare global {
|
|
|
1672
1901
|
*/
|
|
1673
1902
|
hasBuff(buff: string): boolean;
|
|
1674
1903
|
|
|
1904
|
+
/**
|
|
1905
|
+
* Sets health, stamina, energy or nourishment on the living body. Call once player.ready is true. Lowering health raises playerDamage with a null attacker; a fatal change also raises playerDied with a null killer. Zero health can kill. Does not clear buffs or revive; normal regeneration and consumption continue.
|
|
1906
|
+
* @param stat Writable PlayerStat; derived stats are rejected.
|
|
1907
|
+
* @param value Finite native value from 0 to 1000000, clamped to the native maximum. Positive health must exceed 0.00001; positive values must not underflow to zero.
|
|
1908
|
+
* @returns True when sent, not confirmation of application; false for a missing, unready or dead body. Throws for invalid arguments or a read-only stat. Requests for a previous life are discarded. Read getStat after the client's next report to observe the result.
|
|
1909
|
+
*/
|
|
1910
|
+
setStat(stat: "health" | "stamina" | "exhaust" | "hunger", value: number): boolean;
|
|
1911
|
+
|
|
1912
|
+
/**
|
|
1913
|
+
* Sets this living player's health, raising or lowering it. Lowering raises playerDamage with a null attacker and the amount removed; a fatal change also raises playerDied with a null killer. This includes restoring a lower saved value. Zero can kill; this never revives a dead player. Leaves injuries, poison and bleeding in place. Call after playerSpawned or playerReady when restoring a saved value. The client applies the request asynchronously; health continues to show its last report until a new one arrives.
|
|
1914
|
+
* @param value Health in the same units as player.health. Clamped to maxHealth on the player's client.
|
|
1915
|
+
* @returns True when sent; false when the body is missing, not ready or dead. Throws unless value is a finite number from 0 to 1000000, with positive health greater than 0.00001 after conversion to native float units. A request for a life that has since ended is ignored.
|
|
1916
|
+
*/
|
|
1917
|
+
setHealth(value: number): boolean;
|
|
1918
|
+
|
|
1919
|
+
/**
|
|
1920
|
+
* Sets this living player's nourishment, raising or lowering it. Call after playerSpawned or playerReady when restoring a saved value. The client applies the request asynchronously; hunger continues to show its last report until a new one arrives.
|
|
1921
|
+
* @param value Nourishment in the same units as player.hunger. Higher means better fed. Clamped to maxHunger on the player's client.
|
|
1922
|
+
* @returns True when sent; false when the body is missing, not ready or dead. Throws unless value is a finite number from 0 to 1000000 that does not round from positive to zero in native float units. A request for a life that has since ended is ignored.
|
|
1923
|
+
*/
|
|
1924
|
+
setHunger(value: number): boolean;
|
|
1925
|
+
|
|
1675
1926
|
/**
|
|
1676
1927
|
* Nurses this player back, on their own client and with the game's own recipe -- the one its quests use for a full heal: the `remove_injuries` and `remove_all_posions` cures, which each wipe their whole kind of effect as they land, then health raised through the soul's own setter, the way a potion raises it. What comes off raises `playerInjuryHealed` and `playerBuffRemoved` as usual.
|
|
1677
1928
|
*
|
|
@@ -1725,11 +1976,19 @@ declare global {
|
|
|
1725
1976
|
putDownItem(options?: { immediate?: boolean }): boolean;
|
|
1726
1977
|
|
|
1727
1978
|
/**
|
|
1728
|
-
* Puts this player in a horse's saddle
|
|
1729
|
-
* @param horse The horse to
|
|
1979
|
+
* Puts this player in a horse's saddle. Everyone near enough to watch sees it the way it was asked for -- the get-on, or the instant seat -- while a client that only streams the rider in later finds them already seated. It is an instruction to their client, so the seat is reported back like any other mount: `horseMounting` can still refuse it, and `horseMount` and `player.horse` follow once it lands. The player has to be standing near the horse; teleport them beside it first.
|
|
1980
|
+
* @param horse The horse to get on.
|
|
1981
|
+
* @param options `instant` puts them straight into the seat, as the game's own forced mount does; by default they play the get-on a player plays at a horse.
|
|
1730
1982
|
* @returns True when the order went out; false when the horse is dead or somebody else is riding it, or the player has no connection.
|
|
1731
1983
|
*/
|
|
1732
|
-
mount(horse: Horse): boolean;
|
|
1984
|
+
mount(horse: Horse, options?: { instant?: boolean }): boolean;
|
|
1985
|
+
|
|
1986
|
+
/**
|
|
1987
|
+
* The game's own outfits, from its clothing presets: what `player.setOutfit` and `Npc.setOutfit` dress a body in. Many belong to one named character.
|
|
1988
|
+
* @param gender Only the outfits authored for this gender. The game will not put a man's clothes on a woman or the reverse, so `player.setOutfit` takes only the presets of the player's own `appearance.gender`.
|
|
1989
|
+
* @returns Preset names, men's first, each gender's in name order.
|
|
1990
|
+
*/
|
|
1991
|
+
static outfitPresets(gender?: "male" | "female"): string[];
|
|
1733
1992
|
|
|
1734
1993
|
/**
|
|
1735
1994
|
* Lists every player currently connected, including those whose body has no pose yet.
|
|
@@ -1938,6 +2197,11 @@ declare global {
|
|
|
1938
2197
|
*/
|
|
1939
2198
|
constructor(id: number);
|
|
1940
2199
|
|
|
2200
|
+
/**
|
|
2201
|
+
* The current route's status: idle, running, reached, blocked, or failed.
|
|
2202
|
+
*/
|
|
2203
|
+
readonly navigationStatus: string;
|
|
2204
|
+
|
|
1941
2205
|
/**
|
|
1942
2206
|
* What this horse wears, by slot: `saddle` (the saddlebags are part of it, and so is the carrying capacity they add), `head` (a bridle or chanfron), `torso` (a caparison), `shoe`. Item class names, null for an empty slot. A spawned horse wears the game's own tack for it unless `Horse.spawn` said otherwise. The gear changes the horse's stats as well as its look.
|
|
1943
2207
|
*/
|
|
@@ -2029,6 +2293,25 @@ declare global {
|
|
|
2029
2293
|
*/
|
|
2030
2294
|
destroy(): void;
|
|
2031
2295
|
|
|
2296
|
+
/**
|
|
2297
|
+
* Routes an unridden horse over the server navigation mesh. Mounting cancels the order. Returns false without a mesh, for a dead or mounted horse, or invalid input.
|
|
2298
|
+
* @param position Destination in world coordinates.
|
|
2299
|
+
* @param options Defaults to walking and a 1.5 metre arrival radius.
|
|
2300
|
+
*/
|
|
2301
|
+
moveTo(position: Vector3, options?: { speed?: 'walk' | 'jog' | 'run'; radius?: number }): boolean;
|
|
2302
|
+
|
|
2303
|
+
/**
|
|
2304
|
+
* Patrols using the NPC route state machine. Requires a loaded mesh and an alive, unridden horse. Mounting cancels the patrol.
|
|
2305
|
+
* @param points One to 256 waypoints.
|
|
2306
|
+
* @param options Defaults to walking, looping, and no wait.
|
|
2307
|
+
*/
|
|
2308
|
+
patrol(points: Vector3[], options?: { speed?: 'walk' | 'jog' | 'run'; loop?: boolean; waitSeconds?: number }): boolean;
|
|
2309
|
+
|
|
2310
|
+
/**
|
|
2311
|
+
* Cancels navigation and holds an unridden horse where it stands. Does not take control from a rider.
|
|
2312
|
+
*/
|
|
2313
|
+
hold(): void;
|
|
2314
|
+
|
|
2032
2315
|
/**
|
|
2033
2316
|
* Makes this horse another player's. Every client makes it that player's horse in the game's own terms -- theirs is never a stolen horse -- and `horseOwnerChanged` follows. Ownership decides nothing about who may ride it: that is `horseMounting`'s to refuse. Throws when `player` is not a connected player.
|
|
2034
2317
|
* @param player The horse's new owner, or null to leave it ownerless.
|
|
@@ -3824,7 +4107,7 @@ declare global {
|
|
|
3824
4107
|
readonly soul: string;
|
|
3825
4108
|
|
|
3826
4109
|
/**
|
|
3827
|
-
*
|
|
4110
|
+
* Native entity class, including `NPC`, `NPC_Female`, or the matching animal class from `Npc.animals()`.
|
|
3828
4111
|
*/
|
|
3829
4112
|
readonly actorClass: string;
|
|
3830
4113
|
|
|
@@ -3844,7 +4127,7 @@ declare global {
|
|
|
3844
4127
|
faction: number;
|
|
3845
4128
|
|
|
3846
4129
|
/**
|
|
3847
|
-
* The server's ledger of this body's health, clamped to `maxHealth`.
|
|
4130
|
+
* The server's ledger of this body's health, clamped to `maxHealth`. Combat damage arrives here after the server has agreed to it.
|
|
3848
4131
|
*/
|
|
3849
4132
|
health: number;
|
|
3850
4133
|
|
|
@@ -3889,10 +4172,15 @@ declare global {
|
|
|
3889
4172
|
locomotion: string;
|
|
3890
4173
|
|
|
3891
4174
|
/**
|
|
3892
|
-
* What the NPC has been told to do: `hold`, `moveTo`, `follow`, `flee`, `lookAt`, `playAnim` or `
|
|
4175
|
+
* What the NPC has been told to do: `hold`, `moveTo`, `follow`, `flee`, `lookAt`, `playAnim`, `talk` or `attack`.
|
|
3893
4176
|
*/
|
|
3894
4177
|
readonly intent: string;
|
|
3895
4178
|
|
|
4179
|
+
/**
|
|
4180
|
+
* Current patrol snapshot and progress, or null when not patrolling. Updating a route does not change a running patrol.
|
|
4181
|
+
*/
|
|
4182
|
+
readonly patrolState: PatrolState | null;
|
|
4183
|
+
|
|
3896
4184
|
/**
|
|
3897
4185
|
* What has become of the current order: `idle`, `running`, `reached`, `blocked` or `failed`. A move reads `running` from the moment it is given -- while its route is planned and while it walks the route's corners -- until it ends, and then the outcome `npcIntentDone` announced, which stays until the next order. A follow reads `reached` while it is within its radius. Dormant moves in `auto` or `server` mode are carried out and decided by the server; dormant `game` moves wait for a client simulator.
|
|
3898
4186
|
*/
|
|
@@ -3995,11 +4283,19 @@ declare global {
|
|
|
3995
4283
|
* Walks the waypoints in order. The server stores the route and replicates the current target. `npcIntentDone` fires once per leg, after its final mesh corner or a movement failure.
|
|
3996
4284
|
*
|
|
3997
4285
|
* A leg that ends `blocked` or `failed` is skipped after at least 2 seconds. When every leg of a lap has failed in a row, the patrol is abandoned and that last leg reports `failed` instead.
|
|
3998
|
-
* @param points
|
|
3999
|
-
* @param options
|
|
4286
|
+
* @param points Waypoints, a named route handle, or its stable id. Named routes are copied at start.
|
|
4287
|
+
* @param options Point arrays retain their defaults: loop, walk, zero wait. Named routes use their authored defaults. Call options override route defaults; waypoint overrides take priority. Use mode for once, loop or pingPong; do not combine mode and loop. radius is the arrival distance. pathfinding uses the moveTo modes for every leg.
|
|
4000
4288
|
* @returns True when the route was accepted; false for an empty route, more than 256 waypoints, a waypoint that is not finite or lies outside the world, or a `waitSeconds` that is not a number. Throws if server mode has no loaded mesh, leaving the previous order intact.
|
|
4001
4289
|
*/
|
|
4002
|
-
patrol(points: (Vector3 | Partial<Vector3>)[], options?: { speed?: 'walk' | 'jog' | 'run'; loop?: boolean; waitSeconds?: number; pathfinding?: 'auto' | 'game' | 'server' }): boolean;
|
|
4290
|
+
patrol(points: (Vector3 | Partial<Vector3>)[] | PatrolRoute | string, options?: { speed?: 'walk' | 'jog' | 'run'; loop?: boolean; mode?: 'once' | 'loop' | 'pingPong'; radius?: number; waitSeconds?: number; pathfinding?: 'auto' | 'game' | 'server' }): boolean;
|
|
4291
|
+
|
|
4292
|
+
/**
|
|
4293
|
+
* Orders native combat against a live player or NPC in the same visible world within 128 metres. Another order stops it. The order fails when its target dies, disappears or leaves that range. It waits while dormant; no offline damage is simulated. Bow attacks stop within 18 metres and use native projectiles. Equipped NPC arrows are replenished while shooting.
|
|
4294
|
+
* @param target The combatant to pursue and attack.
|
|
4295
|
+
* @param options Defaults to melee. Bow requires an equipped bow and compatible arrows.
|
|
4296
|
+
* @returns True when accepted. Invalid targets leave the previous order unchanged.
|
|
4297
|
+
*/
|
|
4298
|
+
attack(target: Player | Npc | number, options?: { weapon?: "melee" | "bow" }): boolean;
|
|
4003
4299
|
|
|
4004
4300
|
/**
|
|
4005
4301
|
* Keeps the NPC near somebody as they move, steering straight at them. `npcIntentDone` reports `reached` the first time it catches up, and the follow carries on. If the body reports `blocked`, a loaded mesh lets the server route to the target's current position before reporting it. After recovery it resumes following the moving target.
|
|
@@ -4125,7 +4421,7 @@ declare global {
|
|
|
4125
4421
|
* Spawns an NPC and replicates it. It exists on the server from this moment: every client near enough makes a body for it, one of them is elected to run it, and the rest draw what that one reports.
|
|
4126
4422
|
*
|
|
4127
4423
|
* The body is not simulated until somebody is close enough to run it, which is not a failure -- a guard on the other side of the map has nothing to do that anybody can see. Read `simulator` to tell.
|
|
4128
|
-
* @param options `soul` is a role name from `Npc.
|
|
4424
|
+
* @param options `soul` is a role from `Npc.roles()`, an animal name from `Npc.animals()`, or a soul GUID; `position` is where to put it. Everything else has a default.
|
|
4129
4425
|
* @returns The new NPC's handle.
|
|
4130
4426
|
*/
|
|
4131
4427
|
static create(options: { soul?: string; class?: string; name?: string; outfit?: string; wearing?: string[]; appearance?: Partial<Appearance>; position?: Vector3 | Partial<Vector3>; rotation?: Quaternion | Vector3 | Partial<Vector3>; faction?: number; health?: number; maxHealth?: number; locomotion?: 'kinematic' | 'native'; invulnerable?: boolean; frozen?: boolean; interactable?: boolean; nametag?: boolean; lootable?: boolean; virtualWorld?: number }): Npc;
|
|
@@ -4160,114 +4456,275 @@ declare global {
|
|
|
4160
4456
|
static removeAll(virtualWorld?: number): number;
|
|
4161
4457
|
|
|
4162
4458
|
/**
|
|
4163
|
-
* The named kinds of NPC this build ships -- `guard`, `bandit`, `townswoman` and the rest. Each is a real soul out of the game's own tables, so a role spawns a body that already looks the part.
|
|
4459
|
+
* The named kinds of NPC this build ships -- `guard`, `bandit`, `townswoman` and the rest. Each is a real soul out of the game's own tables, so a role spawns a body that already looks the part. Animal names are listed separately by `Npc.animals()`. Other values are taken as soul GUIDs.
|
|
4164
4460
|
* @returns The role names.
|
|
4165
4461
|
*/
|
|
4166
4462
|
static roles(): string[];
|
|
4463
|
+
|
|
4464
|
+
/**
|
|
4465
|
+
* Animal souls with matching native classes. Pass a name or soul to Npc.create. Chickens use flock entities and are excluded.
|
|
4466
|
+
*/
|
|
4467
|
+
static animals(): { name: string; soul: string; actorClass: string }[];
|
|
4468
|
+
|
|
4469
|
+
/**
|
|
4470
|
+
* Level-authored animal spawners. Positions are markers and must be projected onto navigation. GUIDs are hex strings. Counts and respawn days describe the original game; scripts decide their population and respawn policy.
|
|
4471
|
+
* @param level Defaults to the running server's level. Pass * for all levels.
|
|
4472
|
+
*/
|
|
4473
|
+
static animalSpawnpoints(level?: string): { level: string; guid: string; name: string; layer: string; soul: string; actorClass: string; position: Vector3; count: number; respawnDays: number; spawnInFlock: boolean; spawnAreaGuid: string }[];
|
|
4167
4474
|
}
|
|
4168
4475
|
|
|
4169
4476
|
interface Npc extends Entity {}
|
|
4170
4477
|
|
|
4171
4478
|
/**
|
|
4172
|
-
*
|
|
4479
|
+
* One authored stop, independent of actor type.
|
|
4173
4480
|
*/
|
|
4174
|
-
|
|
4481
|
+
interface PatrolPoint {
|
|
4175
4482
|
/**
|
|
4176
|
-
*
|
|
4177
|
-
* @param id Network entity identifier.
|
|
4483
|
+
* World-space waypoint.
|
|
4178
4484
|
*/
|
|
4179
|
-
|
|
4485
|
+
position: Vector3;
|
|
4180
4486
|
|
|
4181
4487
|
/**
|
|
4182
|
-
*
|
|
4488
|
+
* Overrides the route and call speed for this leg.
|
|
4183
4489
|
*/
|
|
4184
|
-
|
|
4490
|
+
speed?: 'walk' | 'jog' | 'run' | undefined;
|
|
4185
4491
|
|
|
4186
4492
|
/**
|
|
4187
|
-
*
|
|
4493
|
+
* Wait after arrival, 0 to 3600 seconds.
|
|
4188
4494
|
*/
|
|
4189
|
-
|
|
4495
|
+
waitSeconds?: number | undefined;
|
|
4190
4496
|
|
|
4191
4497
|
/**
|
|
4192
|
-
*
|
|
4498
|
+
* Arrival radius in metres.
|
|
4193
4499
|
*/
|
|
4194
|
-
|
|
4500
|
+
radius?: number | undefined;
|
|
4501
|
+
}
|
|
4195
4502
|
|
|
4503
|
+
/**
|
|
4504
|
+
* The format saved by World Builder and accepted by PatrolRoute.create.
|
|
4505
|
+
*/
|
|
4506
|
+
interface PatrolRouteDefinition {
|
|
4196
4507
|
/**
|
|
4197
|
-
*
|
|
4508
|
+
* Stable globally unique id, up to 128 bytes. Use a namespace such as town.guard-loop.
|
|
4198
4509
|
*/
|
|
4199
|
-
|
|
4510
|
+
id: string;
|
|
4200
4511
|
|
|
4201
4512
|
/**
|
|
4202
|
-
*
|
|
4513
|
+
* Display name, up to 256 bytes.
|
|
4203
4514
|
*/
|
|
4204
|
-
|
|
4515
|
+
name?: string | undefined;
|
|
4205
4516
|
|
|
4206
4517
|
/**
|
|
4207
|
-
*
|
|
4518
|
+
* 1 to 256 ordered waypoints.
|
|
4208
4519
|
*/
|
|
4209
|
-
|
|
4520
|
+
points: PatrolPoint[];
|
|
4210
4521
|
|
|
4211
4522
|
/**
|
|
4212
|
-
*
|
|
4523
|
+
* Defaults to loop. Ping-pong visits each endpoint once per turn.
|
|
4213
4524
|
*/
|
|
4214
|
-
|
|
4525
|
+
mode?: 'once' | 'loop' | 'pingPong' | undefined;
|
|
4215
4526
|
|
|
4216
4527
|
/**
|
|
4217
|
-
*
|
|
4218
|
-
* @returns The quest ID, its key, its state and how many objectives it carries.
|
|
4528
|
+
* Default leg speed; walk when omitted.
|
|
4219
4529
|
*/
|
|
4220
|
-
|
|
4530
|
+
speed?: 'walk' | 'jog' | 'run' | undefined;
|
|
4221
4531
|
|
|
4222
4532
|
/**
|
|
4223
|
-
*
|
|
4533
|
+
* Default arrival wait, 0 to 3600; defaults to zero.
|
|
4224
4534
|
*/
|
|
4225
|
-
|
|
4535
|
+
waitSeconds?: number | undefined;
|
|
4226
4536
|
|
|
4227
4537
|
/**
|
|
4228
|
-
*
|
|
4229
|
-
* @param progress Where the quest now stands.
|
|
4230
|
-
* @param announce Whether to raise the game's quest-updated toast; defaults to true. Pass false for a correction the player should not be told about.
|
|
4538
|
+
* Default arrival radius; 1.5 metres when omitted.
|
|
4231
4539
|
*/
|
|
4232
|
-
|
|
4540
|
+
radius?: number | undefined;
|
|
4541
|
+
}
|
|
4233
4542
|
|
|
4543
|
+
/**
|
|
4544
|
+
* A running patrol's snapshot. Indices and laps start at zero.
|
|
4545
|
+
*/
|
|
4546
|
+
interface PatrolState {
|
|
4234
4547
|
/**
|
|
4235
|
-
*
|
|
4236
|
-
* @param index Which objective to rewrite, counting from zero. An index past the end is ignored.
|
|
4237
|
-
* @param objective The line, as text or as an object carrying its state.
|
|
4238
|
-
* @param announce Whether to raise the quest-updated toast; defaults to true.
|
|
4548
|
+
* Stable route id; null for an anonymous point-array patrol.
|
|
4239
4549
|
*/
|
|
4240
|
-
|
|
4550
|
+
routeId: string | null;
|
|
4241
4551
|
|
|
4242
4552
|
/**
|
|
4243
|
-
*
|
|
4244
|
-
* @param objectives The whole list, at most eight entries; anything past that is dropped.
|
|
4245
|
-
* @param announce Whether to raise the quest-updated toast; defaults to true.
|
|
4553
|
+
* Target waypoint index.
|
|
4246
4554
|
*/
|
|
4247
|
-
|
|
4555
|
+
waypointIndex: number;
|
|
4248
4556
|
|
|
4249
4557
|
/**
|
|
4250
|
-
*
|
|
4251
|
-
* @returns One entry per objective, in journal order. `position` is present only on an objective that has one.
|
|
4558
|
+
* Completed loops or round trips.
|
|
4252
4559
|
*/
|
|
4253
|
-
|
|
4560
|
+
lap: number;
|
|
4254
4561
|
|
|
4255
4562
|
/**
|
|
4256
|
-
*
|
|
4257
|
-
* @param player Network id of the player who should follow the quest. Omitted, everyone who has the quest follows it: its one owner, or every player in its world.
|
|
4258
|
-
* @returns How many clients were told. Zero when the player does not have this quest.
|
|
4563
|
+
* 1 forward, -1 backward.
|
|
4259
4564
|
*/
|
|
4260
|
-
|
|
4565
|
+
direction: number;
|
|
4261
4566
|
|
|
4262
4567
|
/**
|
|
4263
|
-
*
|
|
4264
|
-
* @param player Network id of the player who should stop following the quest. Omitted, everyone who has the quest stops.
|
|
4265
|
-
* @returns How many clients were told.
|
|
4568
|
+
* Whether the actor is approaching or waiting at the waypoint.
|
|
4266
4569
|
*/
|
|
4267
|
-
|
|
4570
|
+
phase: 'moving' | 'waiting';
|
|
4571
|
+
}
|
|
4572
|
+
|
|
4573
|
+
/**
|
|
4574
|
+
* Named patrol definition. Actors snapshot it when ordered; update or destroy affects future starts.
|
|
4575
|
+
*/
|
|
4576
|
+
class PatrolRoute {
|
|
4577
|
+
private constructor();
|
|
4268
4578
|
|
|
4269
4579
|
/**
|
|
4270
|
-
*
|
|
4580
|
+
* False after destruction.
|
|
4581
|
+
*/
|
|
4582
|
+
readonly exists: boolean;
|
|
4583
|
+
|
|
4584
|
+
/**
|
|
4585
|
+
* Stable id; empty after destruction.
|
|
4586
|
+
*/
|
|
4587
|
+
readonly id: string;
|
|
4588
|
+
|
|
4589
|
+
/**
|
|
4590
|
+
* Display name.
|
|
4591
|
+
*/
|
|
4592
|
+
readonly name: string;
|
|
4593
|
+
|
|
4594
|
+
/**
|
|
4595
|
+
* Returns an independent definition, or null after destruction.
|
|
4596
|
+
*/
|
|
4597
|
+
toJSON(): PatrolRouteDefinition | null;
|
|
4598
|
+
|
|
4599
|
+
/**
|
|
4600
|
+
* Removes the definition. Active patrols keep their snapshots.
|
|
4601
|
+
*/
|
|
4602
|
+
destroy(): boolean;
|
|
4603
|
+
|
|
4604
|
+
/**
|
|
4605
|
+
* Updates defaults or waypoints atomically. Invalid input throws; a destroyed handle returns false.
|
|
4606
|
+
* @param changes Fields to replace; id cannot change.
|
|
4607
|
+
*/
|
|
4608
|
+
update(changes: Partial<PatrolRouteDefinition>): boolean;
|
|
4609
|
+
|
|
4610
|
+
/**
|
|
4611
|
+
* Registers a route. Invalid data or a duplicate id throws.
|
|
4612
|
+
* @param definition The route to register.
|
|
4613
|
+
*/
|
|
4614
|
+
static create(definition: PatrolRouteDefinition): PatrolRoute;
|
|
4615
|
+
|
|
4616
|
+
/**
|
|
4617
|
+
* Looks up a registered route.
|
|
4618
|
+
* @param id Exact route id.
|
|
4619
|
+
*/
|
|
4620
|
+
static getById(id: string): PatrolRoute | null;
|
|
4621
|
+
|
|
4622
|
+
/**
|
|
4623
|
+
* Lists registered routes in creation order.
|
|
4624
|
+
*/
|
|
4625
|
+
static all(): PatrolRoute[];
|
|
4626
|
+
}
|
|
4627
|
+
|
|
4628
|
+
/**
|
|
4629
|
+
* Replicated journal quest handle.
|
|
4630
|
+
*/
|
|
4631
|
+
class Quest {
|
|
4632
|
+
/**
|
|
4633
|
+
* Creates a script wrapper for an existing quest with this ID; use Quest.give() to write one.
|
|
4634
|
+
* @param id Network entity identifier.
|
|
4635
|
+
*/
|
|
4636
|
+
constructor(id: number);
|
|
4637
|
+
|
|
4638
|
+
/**
|
|
4639
|
+
* The key the quest is filed under, and the name the game knows the quest node by. Read-only: it is the quest's identity.
|
|
4640
|
+
*/
|
|
4641
|
+
readonly key: string;
|
|
4642
|
+
|
|
4643
|
+
/**
|
|
4644
|
+
* The line the journal row and the quest toast show. Assignment is silent; it does not raise a toast.
|
|
4645
|
+
*/
|
|
4646
|
+
title: string;
|
|
4647
|
+
|
|
4648
|
+
/**
|
|
4649
|
+
* The body of the journal's diary page for this quest. Assignment is silent.
|
|
4650
|
+
*/
|
|
4651
|
+
description: string;
|
|
4652
|
+
|
|
4653
|
+
/**
|
|
4654
|
+
* Which section of the journal the quest files under. Read-only: it is decided when the quest is given.
|
|
4655
|
+
*/
|
|
4656
|
+
readonly type: string;
|
|
4657
|
+
|
|
4658
|
+
/**
|
|
4659
|
+
* `active`, `done` or `failed`. Assignment announces the change; `setProgress` can do it quietly.
|
|
4660
|
+
*/
|
|
4661
|
+
progress: string;
|
|
4662
|
+
|
|
4663
|
+
/**
|
|
4664
|
+
* Network id of the one player this quest was written for, or 0 when it went to everyone in the world. Read-only: who a quest belongs to is decided when it is given.
|
|
4665
|
+
*/
|
|
4666
|
+
readonly player: number;
|
|
4667
|
+
|
|
4668
|
+
/**
|
|
4669
|
+
* How many objectives the quest carries, up to eight.
|
|
4670
|
+
*/
|
|
4671
|
+
readonly objectiveCount: number;
|
|
4672
|
+
|
|
4673
|
+
/**
|
|
4674
|
+
* Formats this quest handle for logging and debugging.
|
|
4675
|
+
* @returns The quest ID, its key, its state and how many objectives it carries.
|
|
4676
|
+
*/
|
|
4677
|
+
toString(): string;
|
|
4678
|
+
|
|
4679
|
+
/**
|
|
4680
|
+
* Takes this quest out of every journal it was written into.
|
|
4681
|
+
*/
|
|
4682
|
+
remove(): void;
|
|
4683
|
+
|
|
4684
|
+
/**
|
|
4685
|
+
* Moves the quest on. There is no way back to unstarted: a quest nobody should see any more is removed.
|
|
4686
|
+
* @param progress Where the quest now stands.
|
|
4687
|
+
* @param announce Whether to raise the game's quest-updated toast; defaults to true. Pass false for a correction the player should not be told about.
|
|
4688
|
+
*/
|
|
4689
|
+
setProgress(progress: 'active' | 'done' | 'failed', announce?: boolean): void;
|
|
4690
|
+
|
|
4691
|
+
/**
|
|
4692
|
+
* Rewrites one line of the quest in place.
|
|
4693
|
+
* @param index Which objective to rewrite, counting from zero. An index past the end is ignored.
|
|
4694
|
+
* @param objective The line, as text or as an object carrying its state.
|
|
4695
|
+
* @param announce Whether to raise the quest-updated toast; defaults to true.
|
|
4696
|
+
*/
|
|
4697
|
+
setObjective(index: number, objective: string | { text: string; progress?: 'active' | 'done' | 'failed'; optional?: boolean; position?: Vector3 }, announce?: boolean): void;
|
|
4698
|
+
|
|
4699
|
+
/**
|
|
4700
|
+
* Replaces the quest's objective list.
|
|
4701
|
+
* @param objectives The whole list, at most eight entries; anything past that is dropped.
|
|
4702
|
+
* @param announce Whether to raise the quest-updated toast; defaults to true.
|
|
4703
|
+
*/
|
|
4704
|
+
setObjectives(objectives: (string | { text: string; progress?: 'active' | 'done' | 'failed'; optional?: boolean; position?: Vector3 })[], announce?: boolean): void;
|
|
4705
|
+
|
|
4706
|
+
/**
|
|
4707
|
+
* Reads the quest's objectives back.
|
|
4708
|
+
* @returns One entry per objective, in journal order. `position` is present only on an objective that has one.
|
|
4709
|
+
*/
|
|
4710
|
+
objectives(): { text: string; progress: 'active' | 'done' | 'failed' | 'none'; optional: boolean; position?: Vector3 }[];
|
|
4711
|
+
|
|
4712
|
+
/**
|
|
4713
|
+
* Makes the game follow this quest, exactly as the journal's track button does: it is listed in the HUD tracker, and every active objective that has a `position` is drawn as the game's own quest marker on the map and the compass. It is an instruction, not a lock -- the player can untrack it from the journal -- and the outcome arrives as `questTrackingChanged` like any other change. A quest given a moment ago can be tracked at once; the client waits for it to arrive.
|
|
4714
|
+
* @param player Network id of the player who should follow the quest. Omitted, everyone who has the quest follows it: its one owner, or every player in its world.
|
|
4715
|
+
* @returns How many clients were told. Zero when the player does not have this quest.
|
|
4716
|
+
*/
|
|
4717
|
+
track(player?: number): number;
|
|
4718
|
+
|
|
4719
|
+
/**
|
|
4720
|
+
* Makes the game stop following this quest, which takes its markers off the map and the compass. The outcome arrives as `questTrackingChanged`.
|
|
4721
|
+
* @param player Network id of the player who should stop following the quest. Omitted, everyone who has the quest stops.
|
|
4722
|
+
* @returns How many clients were told.
|
|
4723
|
+
*/
|
|
4724
|
+
untrack(player?: number): number;
|
|
4725
|
+
|
|
4726
|
+
/**
|
|
4727
|
+
* Writes a quest into the game's own journal. It is a replicated entity, so a player who joins late, reloads or walks away still finds it in their log -- which is what a quest needs and what a one-shot notification cannot do. What the player sees is the game's quest UI: its journal row, its diary page, its objective tracker and its quest-updated toast, all reading a quest node the client builds with the game's own constructor.
|
|
4271
4728
|
* @param key What the quest is filed under: up to 64 letters, digits, underscores or dashes, unique within its virtual world.
|
|
4272
4729
|
* @param title The line the journal row shows.
|
|
4273
4730
|
* @param options `description` is the diary page, `type` the journal section, `objectives` the lines under it -- each with an optional world `position` the game marks on the map and compass while the quest is followed -- `player` the network id of the one player it belongs to, `announce` whether to raise the toast, and `track` whether its recipients start following it.
|
|
@@ -4529,6 +4986,88 @@ declare global {
|
|
|
4529
4986
|
items: InventoryUnit[];
|
|
4530
4987
|
}
|
|
4531
4988
|
|
|
4989
|
+
/**
|
|
4990
|
+
* A frozen snapshot of one stew pot in one virtual world.
|
|
4991
|
+
*/
|
|
4992
|
+
interface CookPotSnapshot {
|
|
4993
|
+
/**
|
|
4994
|
+
* The fireplace's level GUID.
|
|
4995
|
+
*/
|
|
4996
|
+
guid: string;
|
|
4997
|
+
|
|
4998
|
+
/**
|
|
4999
|
+
* Position of the eating trigger.
|
|
5000
|
+
*/
|
|
5001
|
+
position: { readonly x: number; readonly y: number; readonly z: number };
|
|
5002
|
+
|
|
5003
|
+
/**
|
|
5004
|
+
* Unreserved meals remaining.
|
|
5005
|
+
*/
|
|
5006
|
+
portions: number;
|
|
5007
|
+
|
|
5008
|
+
/**
|
|
5009
|
+
* Portions in the most recent refill; sets the halfway point.
|
|
5010
|
+
*/
|
|
5011
|
+
capacity: number;
|
|
5012
|
+
|
|
5013
|
+
/**
|
|
5014
|
+
* Whether eating is allowed. Disabling preserves the contents.
|
|
5015
|
+
*/
|
|
5016
|
+
enabled: boolean;
|
|
5017
|
+
|
|
5018
|
+
/**
|
|
5019
|
+
* Visible food level, derived from remaining portions.
|
|
5020
|
+
*/
|
|
5021
|
+
state: "empty" | "half" | "full";
|
|
5022
|
+
|
|
5023
|
+
/**
|
|
5024
|
+
* Virtual world that owns this stock.
|
|
5025
|
+
*/
|
|
5026
|
+
virtualWorld: number;
|
|
5027
|
+
}
|
|
5028
|
+
|
|
5029
|
+
/**
|
|
5030
|
+
* Server-owned stew pots. Stocked pots begin with four shared meals, with no automatic refill. State lasts until the server stops.
|
|
5031
|
+
*/
|
|
5032
|
+
const CookPot: {
|
|
5033
|
+
/**
|
|
5034
|
+
* Lists every catalogued pot on the server's level in one virtual world; empty for a world no player or write has used yet.
|
|
5035
|
+
* @param virtualWorld Virtual world id; defaults to 0. The global visibility sentinel is not a stock world.
|
|
5036
|
+
*/
|
|
5037
|
+
all(virtualWorld?: number): CookPotSnapshot[];
|
|
5038
|
+
|
|
5039
|
+
/**
|
|
5040
|
+
* Returns a snapshot, or null for an unknown pot.
|
|
5041
|
+
* @param guid Fireplace level GUID from CookPot.all().
|
|
5042
|
+
* @param virtualWorld Virtual world id; defaults to 0. The global visibility sentinel is not a stock world.
|
|
5043
|
+
*/
|
|
5044
|
+
get(guid: string, virtualWorld?: number): CookPotSnapshot | null;
|
|
5045
|
+
|
|
5046
|
+
/**
|
|
5047
|
+
* Replaces remaining stock and capacity, preserving enabled. Returns false for an unknown pot.
|
|
5048
|
+
* @param guid Fireplace level GUID from CookPot.all().
|
|
5049
|
+
* @param portions Integer from 0 to 1000; defaults to four.
|
|
5050
|
+
* @param virtualWorld Virtual world id; defaults to 0. The global visibility sentinel is not a stock world.
|
|
5051
|
+
*/
|
|
5052
|
+
refill(guid: string, portions?: number, virtualWorld?: number): boolean;
|
|
5053
|
+
|
|
5054
|
+
/**
|
|
5055
|
+
* Allows or blocks eating. Returns false for an unknown pot.
|
|
5056
|
+
* @param guid Fireplace level GUID from CookPot.all().
|
|
5057
|
+
* @param enabled False blocks eating without changing stock or its appearance.
|
|
5058
|
+
* @param virtualWorld Virtual world id; defaults to 0. The global visibility sentinel is not a stock world.
|
|
5059
|
+
*/
|
|
5060
|
+
setEnabled(guid: string, enabled: boolean, virtualWorld?: number): boolean;
|
|
5061
|
+
|
|
5062
|
+
/**
|
|
5063
|
+
* Changes food level and stock together, preserving enabled. Returns false for an unknown pot.
|
|
5064
|
+
* @param guid Fireplace level GUID from CookPot.all().
|
|
5065
|
+
* @param state Empty, two portions, or four portions; resets capacity to four.
|
|
5066
|
+
* @param virtualWorld Virtual world id; defaults to 0. The global visibility sentinel is not a stock world.
|
|
5067
|
+
*/
|
|
5068
|
+
setState(guid: string, state: "empty" | "half" | "full", virtualWorld?: number): boolean;
|
|
5069
|
+
};
|
|
5070
|
+
|
|
4532
5071
|
/** */
|
|
4533
5072
|
interface NearestDoor {
|
|
4534
5073
|
/**
|
|
@@ -4864,12 +5403,12 @@ declare global {
|
|
|
4864
5403
|
damageRadius: number;
|
|
4865
5404
|
|
|
4866
5405
|
/**
|
|
4867
|
-
* Whether players within
|
|
5406
|
+
* Whether players may work the engine. A player within 2 m of an empty one gets the game's own action hint on the use key to take its place, and becomes its `operator`; near a trebuchet with a `crewRequired`, a free winch is offered too. Each ask raises `siegeEngineUse` first, which may refuse it. Off by default.
|
|
4868
5407
|
*/
|
|
4869
5408
|
usable: boolean;
|
|
4870
5409
|
|
|
4871
5410
|
/**
|
|
4872
|
-
* How far a shot
|
|
5411
|
+
* How far a shot goes along the operator's facing when they fire before laying the engine anywhere, in metres; kept between `minRange` and `maxRange`. 150 for a trebuchet and 120 for a cannon to start with.
|
|
4873
5412
|
*/
|
|
4874
5413
|
range: number;
|
|
4875
5414
|
|
|
@@ -4888,6 +5427,46 @@ declare global {
|
|
|
4888
5427
|
*/
|
|
4889
5428
|
readonly loadDuration: number;
|
|
4890
5429
|
|
|
5430
|
+
/**
|
|
5431
|
+
* What the engine can take before it is wrecked; 0, the default, means nothing harms it. Setting it heals the engine to the new maximum and repairs a wreck. A blast within `damageRadius` of an engine -- any engine's, its own included -- takes its share of that shot's `damage` off it, raising `siegeEngineDamage`.
|
|
5432
|
+
*/
|
|
5433
|
+
maxHealth: number;
|
|
5434
|
+
|
|
5435
|
+
/**
|
|
5436
|
+
* What is left of `maxHealth`. Setting it to 0 wrecks the engine and raising it from 0 repairs one; ignored while `maxHealth` is 0.
|
|
5437
|
+
*/
|
|
5438
|
+
health: number;
|
|
5439
|
+
|
|
5440
|
+
/**
|
|
5441
|
+
* Whether the engine's health ran out. A wrecked cannon shows the game's broken gun and a wrecked trebuchet leans and settles; nothing loads, aims or fires it, and its operator and crew are let go, until `repair` or a new `maxHealth`.
|
|
5442
|
+
*/
|
|
5443
|
+
readonly wrecked: boolean;
|
|
5444
|
+
|
|
5445
|
+
/**
|
|
5446
|
+
* Shots left to load; each `load` takes one, and an engine with none refuses to load. -1, the default, never runs out; any negative value means the same.
|
|
5447
|
+
*/
|
|
5448
|
+
ammo: number;
|
|
5449
|
+
|
|
5450
|
+
/**
|
|
5451
|
+
* How many of the engine's winches must be manned for its arm to be winched down; 0, the default, winds it by itself. With fewer hands than this the winding holds where it is, and goes on when they come back. Players near a usable engine that needs them are offered its winches, and each one there plays the game's own pull. Kept to `crewPlaces`.
|
|
5452
|
+
*/
|
|
5453
|
+
crewRequired: number;
|
|
5454
|
+
|
|
5455
|
+
/**
|
|
5456
|
+
* How many winches the engine has: 2 on a trebuchet, 0 on a cannon.
|
|
5457
|
+
*/
|
|
5458
|
+
readonly crewPlaces: number;
|
|
5459
|
+
|
|
5460
|
+
/**
|
|
5461
|
+
* The player in the engine's place, or null. They lay it where they look while they hold the block key, load it with the torch key, fire it with the attack key and step away with the use key; walking off lets go of it too. `setOperator` puts somebody there.
|
|
5462
|
+
*/
|
|
5463
|
+
readonly operator: Player | null;
|
|
5464
|
+
|
|
5465
|
+
/**
|
|
5466
|
+
* Who mans each winch, in place order, with null for an empty one.
|
|
5467
|
+
*/
|
|
5468
|
+
readonly crew: (Player | null)[];
|
|
5469
|
+
|
|
4891
5470
|
/**
|
|
4892
5471
|
* Formats this engine handle for logging and debugging.
|
|
4893
5472
|
* @returns The engine ID, its kind and where it is in its cycle.
|
|
@@ -4922,6 +5501,30 @@ declare global {
|
|
|
4922
5501
|
*/
|
|
4923
5502
|
canHit(target: Vector3 | Partial<Vector3>): string;
|
|
4924
5503
|
|
|
5504
|
+
/**
|
|
5505
|
+
* Shows or hides the operator's aim guide: a translucent red beam along the shot's path -- out of a trebuchet's sling and along its arc, or straight from a cannon's muzzle -- to where it would come down, with a ball there. Off by default, which leaves laying the engine to the eye; the Fire hint says how far the shot goes either way.
|
|
5506
|
+
* @param enabled Whether the operator sees the beam.
|
|
5507
|
+
*/
|
|
5508
|
+
setAimGuide(enabled: boolean): void;
|
|
5509
|
+
|
|
5510
|
+
/**
|
|
5511
|
+
* Whether the operator sees the aim guide; see `setAimGuide`.
|
|
5512
|
+
* @returns True when the beam is shown.
|
|
5513
|
+
*/
|
|
5514
|
+
getAimGuide(): boolean;
|
|
5515
|
+
|
|
5516
|
+
/**
|
|
5517
|
+
* Makes the engine whole again: `health` back to `maxHealth`, and a wreck idle and unloaded.
|
|
5518
|
+
*/
|
|
5519
|
+
repair(): void;
|
|
5520
|
+
|
|
5521
|
+
/**
|
|
5522
|
+
* Puts a player in the engine's place without asking them, or takes whoever is there out of it. A player holds one place at a time, so they leave any other engine or winch first. Raises no `siegeEngineUse`.
|
|
5523
|
+
* @param player Who takes the engine's place, or null to empty it.
|
|
5524
|
+
* @returns False for a player who is no longer connected.
|
|
5525
|
+
*/
|
|
5526
|
+
setOperator(player: Player | null): boolean;
|
|
5527
|
+
|
|
4925
5528
|
/**
|
|
4926
5529
|
* Removes the engine on every client after emitting `siegeEngineDestroy`. A projectile already in the air still lands.
|
|
4927
5530
|
*/
|
|
@@ -5250,7 +5853,7 @@ declare global {
|
|
|
5250
5853
|
}
|
|
5251
5854
|
|
|
5252
5855
|
/**
|
|
5253
|
-
* A named world export loaded from mod.world_resources. Server-owned, with live access to its surviving props, effects, level edits and
|
|
5856
|
+
* A named world export loaded from mod.world_resources. Server-owned, with live access to its surviving props, effects, level edits, areas and patrol routes. Obtain handles through all or find; runtime loading, reloading and unloading are not exposed.
|
|
5254
5857
|
*/
|
|
5255
5858
|
class WorldResource {
|
|
5256
5859
|
private constructor();
|
|
@@ -5295,6 +5898,11 @@ declare global {
|
|
|
5295
5898
|
*/
|
|
5296
5899
|
readonly areas: Area[];
|
|
5297
5900
|
|
|
5901
|
+
/**
|
|
5902
|
+
* Surviving exported patrol definitions, in export order.
|
|
5903
|
+
*/
|
|
5904
|
+
readonly patrolRoutes: PatrolRoute[];
|
|
5905
|
+
|
|
5298
5906
|
/**
|
|
5299
5907
|
* 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
5908
|
*/
|
|
@@ -5847,7 +6455,7 @@ declare global {
|
|
|
5847
6455
|
/**
|
|
5848
6456
|
* Queries the level's navigation mesh on the server. The mesh includes walkable floors, bridges and stairs.
|
|
5849
6457
|
*
|
|
5850
|
-
* Copy the game's `Data/Levels/<level>/recast.pak` to the server's `files/<level>/` directory. The server searches `files/` recursively at startup. An optional `mod.navmesh` in `server.json` takes priority and can name a game install, level folder or pak file. The game data must be supplied separately. Without a mesh, `ready` is false and geometry queries return null or false. Points are world-space metres, Z up. Every query takes an optional options object. `searchRadius` and `searchHeight` limit how far a point may be from the mesh, across the ground and up or down: 2 metres by default, up to 64, and 4 by default, up to 128. Keep `searchHeight` under a storey's height, or a point on one floor snaps to the floor above. `doors` picks which doors a query walks through: `unlocked`, the default, is how an NPC treats a door -- open or shut, it goes through unless the door is locked; `open` only through doors that stand open; `any` ignores locks; `none` treats every doorway as a wall.
|
|
6458
|
+
* Copy the game's `Data/Levels/<level>/recast.pak` to the server's `files/<level>/` directory. The server searches `files/` recursively at startup. An optional `mod.navmesh` in `server.json` takes priority and can name a game install, level folder or pak file. The game data must be supplied separately. Without a mesh, `ready` is false and geometry queries return null or false. Points are world-space metres, Z up. Every query takes an optional options object. `searchRadius` and `searchHeight` limit how far a point may be from the mesh, across the ground and up or down: 2 metres by default, up to 64, and 4 by default, up to 128. Keep `searchHeight` under a storey's height, or a point on one floor snaps to the floor above. `doors` picks which doors a query walks through: `unlocked`, the default, is how an NPC treats a door -- open or shut, it goes through unless the door is locked; `open` only through doors that stand open; `any` ignores locks; `none` treats every doorway as a wall. Door states are read in the global world, except validatePatrol with an actor, which uses that actor's world. A field given with the wrong type or out of range throws.
|
|
5851
6459
|
*/
|
|
5852
6460
|
const Navigation: {
|
|
5853
6461
|
/**
|
|
@@ -5865,6 +6473,13 @@ declare global {
|
|
|
5865
6473
|
*/
|
|
5866
6474
|
readonly activeOverlays: string[];
|
|
5867
6475
|
|
|
6476
|
+
/**
|
|
6477
|
+
* Checks all legs, including the closing leg of a loop and reverse legs of ping-pong. Uses the patrol runner's search budget. A single waypoint is checked against itself. Missing mesh reports available false; partial paths are incomplete. This does not start or change an actor's order.
|
|
6478
|
+
* @param route A registered route or its id.
|
|
6479
|
+
* @param options Optional actor chooses door policy in its virtual world: unlocked doors for humanoids, no doorways for horses and animals.
|
|
6480
|
+
*/
|
|
6481
|
+
validatePatrol(route: PatrolRoute | string, options?: { actor?: Npc | Horse }): { available: boolean; complete: boolean; legs: { fromIndex: number; toIndex: number; complete: boolean; path: NavigationPath | null }[] };
|
|
6482
|
+
|
|
5868
6483
|
/**
|
|
5869
6484
|
* Snaps a point to the nearest walkable surface.
|
|
5870
6485
|
* @param point The point to snap; omitted components default to zero.
|
|
@@ -7250,6 +7865,16 @@ declare global {
|
|
|
7250
7865
|
* True in the authoritative server scripting runtime.
|
|
7251
7866
|
*/
|
|
7252
7867
|
readonly isServer: boolean;
|
|
7868
|
+
|
|
7869
|
+
/**
|
|
7870
|
+
* Local Framework release version.
|
|
7871
|
+
*/
|
|
7872
|
+
readonly frameworkVersion: string;
|
|
7873
|
+
|
|
7874
|
+
/**
|
|
7875
|
+
* Local mod version from InstanceOptions.modVersion; empty when unset.
|
|
7876
|
+
*/
|
|
7877
|
+
readonly modVersion: string;
|
|
7253
7878
|
};
|
|
7254
7879
|
|
|
7255
7880
|
/**
|
|
@@ -7663,7 +8288,7 @@ declare global {
|
|
|
7663
8288
|
|
|
7664
8289
|
/**
|
|
7665
8290
|
* Overrides the text drawn on this player's nametag.
|
|
7666
|
-
* @param text Text to show instead of the player's name; empty or omitted restores the name.
|
|
8291
|
+
* @param text Text to show instead of the player's name, cut to 64 bytes; empty or omitted restores the name.
|
|
7667
8292
|
*/
|
|
7668
8293
|
setNametagText(text?: string): void;
|
|
7669
8294
|
|
|
@@ -7676,6 +8301,219 @@ declare global {
|
|
|
7676
8301
|
|
|
7677
8302
|
interface BasePlayer extends Entity {}
|
|
7678
8303
|
|
|
8304
|
+
/** */
|
|
8305
|
+
interface SiegeLadderKind {
|
|
8306
|
+
/**
|
|
8307
|
+
* Its name: `siege`, `tall`, `short` or `low`.
|
|
8308
|
+
*/
|
|
8309
|
+
kind: string;
|
|
8310
|
+
|
|
8311
|
+
/**
|
|
8312
|
+
* The mesh it stands as, a path from the shared prop catalog.
|
|
8313
|
+
*/
|
|
8314
|
+
model: string;
|
|
8315
|
+
|
|
8316
|
+
/**
|
|
8317
|
+
* How far up its rungs go, in metres.
|
|
8318
|
+
*/
|
|
8319
|
+
height: number;
|
|
8320
|
+
|
|
8321
|
+
/**
|
|
8322
|
+
* How far it leans towards the wall standing, in degrees about its own X; it leans towards its forward.
|
|
8323
|
+
*/
|
|
8324
|
+
lean: number;
|
|
8325
|
+
}
|
|
8326
|
+
|
|
8327
|
+
/**
|
|
8328
|
+
* Replicated handle for a siege ladder leaning on a wall.
|
|
8329
|
+
*/
|
|
8330
|
+
class SiegeLadder {
|
|
8331
|
+
/**
|
|
8332
|
+
* Creates a script wrapper for an existing siege ladder with this ID; use SiegeLadder.spawn() to place one.
|
|
8333
|
+
* @param id Network entity identifier.
|
|
8334
|
+
*/
|
|
8335
|
+
constructor(id: number);
|
|
8336
|
+
|
|
8337
|
+
/**
|
|
8338
|
+
* Which of the game's ladders it is: `siege` (the Suchdol siege ladder, 9.75 m), `tall` (5.5 m), `short` (3.25 m) or `low` (2 m).
|
|
8339
|
+
*/
|
|
8340
|
+
readonly kind: string;
|
|
8341
|
+
|
|
8342
|
+
/**
|
|
8343
|
+
* `standing` against its wall, `pushed` (a defender's swing, then its fall), `down`, `raising` or `broken`. Named `pose` because every entity already has a `state`, which is its state bag.
|
|
8344
|
+
*/
|
|
8345
|
+
readonly pose: string;
|
|
8346
|
+
|
|
8347
|
+
/**
|
|
8348
|
+
* How far up its rungs go, in metres: its top rests this high above its foot on the wall's top. Pick the kind whose height meets the walk.
|
|
8349
|
+
*/
|
|
8350
|
+
readonly height: number;
|
|
8351
|
+
|
|
8352
|
+
/**
|
|
8353
|
+
* Whether the game's own climb is offered on it: while it stands and nobody has started to push it.
|
|
8354
|
+
*/
|
|
8355
|
+
readonly climbable: boolean;
|
|
8356
|
+
|
|
8357
|
+
/**
|
|
8358
|
+
* Whether players are offered the push at its top and the raise at the foot of a fallen one, each raising `siegeLadderUse` first. On by default. The climb is the game's and is offered whenever the ladder stands.
|
|
8359
|
+
*/
|
|
8360
|
+
usable: boolean;
|
|
8361
|
+
|
|
8362
|
+
/**
|
|
8363
|
+
* Who last pushed it, or null.
|
|
8364
|
+
*/
|
|
8365
|
+
readonly pusher: Player | null;
|
|
8366
|
+
|
|
8367
|
+
/**
|
|
8368
|
+
* Formats this ladder handle for logging and debugging.
|
|
8369
|
+
* @returns The ladder ID, its kind and its pose.
|
|
8370
|
+
*/
|
|
8371
|
+
toString(): string;
|
|
8372
|
+
|
|
8373
|
+
/**
|
|
8374
|
+
* Pushes a standing ladder off its wall. It stands through the swing, falls away from the wall as the blade meets it -- throwing off anyone climbing it -- and lies where it lands, about 4.5 seconds later.
|
|
8375
|
+
* @param player Who pushes it: they play the game's own halberd push, and are credited with it in `siegeLadderFall`.
|
|
8376
|
+
* @returns What happened, and the phrase to explain it with when nothing did.
|
|
8377
|
+
*/
|
|
8378
|
+
push(player?: Player | number | null): SiegeResult;
|
|
8379
|
+
|
|
8380
|
+
/**
|
|
8381
|
+
* Lays a fallen ladder back against its wall, over the lift's 5.7 seconds.
|
|
8382
|
+
* @param player Who raises it: they play the game's own ladder lift.
|
|
8383
|
+
* @returns What happened, and the phrase to explain it with when nothing did.
|
|
8384
|
+
*/
|
|
8385
|
+
raise(player?: Player | number | null): SiegeResult;
|
|
8386
|
+
|
|
8387
|
+
/**
|
|
8388
|
+
* Breaks the ladder: it lies in pieces where it stands, anyone on it falls, and nothing raises it until `repair`.
|
|
8389
|
+
*/
|
|
8390
|
+
break(): void;
|
|
8391
|
+
|
|
8392
|
+
/**
|
|
8393
|
+
* Puts a fallen or broken ladder back against its wall at once.
|
|
8394
|
+
*/
|
|
8395
|
+
repair(): void;
|
|
8396
|
+
|
|
8397
|
+
/**
|
|
8398
|
+
* Removes the ladder on every client after emitting `siegeLadderDestroy`.
|
|
8399
|
+
*/
|
|
8400
|
+
destroy(): void;
|
|
8401
|
+
|
|
8402
|
+
/**
|
|
8403
|
+
* Places one of the game's own ladders leaning on a wall, the way the Suchdol and Nebakov sieges stand theirs: the game's climb, and the game's step off over the palisade at its top, which wants the top a little over the walk.
|
|
8404
|
+
* @param kind `siege`, `tall`, `short` or `low`.
|
|
8405
|
+
* @param position Where its foot stands, on the ground below the wall.
|
|
8406
|
+
* @param rotation Its facing: forward is the way to the wall it leans on. A Quaternion, or a Vector3 of Euler angles in degrees.
|
|
8407
|
+
* @param virtualWorld Optional virtual world the ladder belongs to; omitted puts it in the global one.
|
|
8408
|
+
* @returns The new ladder's handle.
|
|
8409
|
+
*/
|
|
8410
|
+
static spawn(kind: string, position: Vector3 | Partial<Vector3>, rotation?: Vector3 | Quaternion, virtualWorld?: number): SiegeLadder;
|
|
8411
|
+
|
|
8412
|
+
/**
|
|
8413
|
+
* What one kind of ladder is: its mesh, its climb and its lean -- what a placement preview needs to show it as it will stand.
|
|
8414
|
+
* @param kind `siege`, `tall`, `short` or `low`.
|
|
8415
|
+
* @returns The kind, or null for a name that is not one.
|
|
8416
|
+
*/
|
|
8417
|
+
static describe(kind: string): SiegeLadderKind | null;
|
|
8418
|
+
|
|
8419
|
+
/**
|
|
8420
|
+
* Lists the siege ladders the server has.
|
|
8421
|
+
* @param virtualWorld Optional virtual world to list; omitted lists every one.
|
|
8422
|
+
* @returns One handle per ladder, in no particular order.
|
|
8423
|
+
*/
|
|
8424
|
+
static all(virtualWorld?: number): SiegeLadder[];
|
|
8425
|
+
|
|
8426
|
+
/**
|
|
8427
|
+
* Looks a ladder up by its network entity ID.
|
|
8428
|
+
* @param id Network entity identifier.
|
|
8429
|
+
* @returns The ladder's handle, or null when no live ladder has that ID.
|
|
8430
|
+
*/
|
|
8431
|
+
static getById(id: number): SiegeLadder | null;
|
|
8432
|
+
|
|
8433
|
+
/**
|
|
8434
|
+
* Removes siege ladders, emitting `siegeLadderDestroy` for each one.
|
|
8435
|
+
* @param virtualWorld Optional virtual world to clear; omitted clears every one.
|
|
8436
|
+
* @returns How many were removed.
|
|
8437
|
+
*/
|
|
8438
|
+
static destroyAll(virtualWorld?: number): number;
|
|
8439
|
+
}
|
|
8440
|
+
|
|
8441
|
+
interface SiegeLadder extends Entity {}
|
|
8442
|
+
|
|
8443
|
+
/**
|
|
8444
|
+
* Replicated handle for a pile of hurling stones on a battlement.
|
|
8445
|
+
*/
|
|
8446
|
+
class StonePile {
|
|
8447
|
+
/**
|
|
8448
|
+
* Creates a script wrapper for an existing stone pile with this ID; use StonePile.spawn() to place one.
|
|
8449
|
+
* @param id Network entity identifier.
|
|
8450
|
+
*/
|
|
8451
|
+
constructor(id: number);
|
|
8452
|
+
|
|
8453
|
+
/**
|
|
8454
|
+
* Stones left to throw; each throw takes one, and a pile with none offers nothing. Players see at most nine in the heap. -1, the default, never runs out; any negative value means the same.
|
|
8455
|
+
*/
|
|
8456
|
+
stones: number;
|
|
8457
|
+
|
|
8458
|
+
/**
|
|
8459
|
+
* Whether players are offered the game's own prompt at the pile. On by default.
|
|
8460
|
+
*/
|
|
8461
|
+
usable: boolean;
|
|
8462
|
+
|
|
8463
|
+
/**
|
|
8464
|
+
* Health taken from anyone at the point a stone comes down, up to 1000; a quarter of it reaches the edge of `damageRadius`. 60 to start with; a player has 100.
|
|
8465
|
+
*/
|
|
8466
|
+
damage: number;
|
|
8467
|
+
|
|
8468
|
+
/**
|
|
8469
|
+
* How far from where a stone comes down anyone is hurt, in metres, up to 10. 1.5 to start with.
|
|
8470
|
+
*/
|
|
8471
|
+
damageRadius: number;
|
|
8472
|
+
|
|
8473
|
+
/**
|
|
8474
|
+
* Formats this pile handle for logging and debugging.
|
|
8475
|
+
* @returns The pile ID and the stones it has left.
|
|
8476
|
+
*/
|
|
8477
|
+
toString(): string;
|
|
8478
|
+
|
|
8479
|
+
/**
|
|
8480
|
+
* Removes the pile on every client after emitting `stonePileDestroy`. A stone already thrown still lands.
|
|
8481
|
+
*/
|
|
8482
|
+
destroy(): void;
|
|
8483
|
+
|
|
8484
|
+
/**
|
|
8485
|
+
* Places the game's own battlement pile of hurling stones, the Nebakov and Suchdol defenders' heap. Its prompt, the lift and the heave over the wall are the game's stone throwing; each stone is a real rigid body that falls where it falls.
|
|
8486
|
+
* @param position Where the thrower stands on the walk, behind the parapet.
|
|
8487
|
+
* @param rotation Its facing: forward is the way the stones go, over the wall. A Quaternion, or a Vector3 of Euler angles in degrees.
|
|
8488
|
+
* @param virtualWorld Optional virtual world the pile belongs to; omitted puts it in the global one.
|
|
8489
|
+
* @returns The new pile's handle.
|
|
8490
|
+
*/
|
|
8491
|
+
static spawn(position: Vector3 | Partial<Vector3>, rotation?: Vector3 | Quaternion, virtualWorld?: number): StonePile;
|
|
8492
|
+
|
|
8493
|
+
/**
|
|
8494
|
+
* Lists the stone piles the server has.
|
|
8495
|
+
* @param virtualWorld Optional virtual world to list; omitted lists every one.
|
|
8496
|
+
* @returns One handle per pile, in no particular order.
|
|
8497
|
+
*/
|
|
8498
|
+
static all(virtualWorld?: number): StonePile[];
|
|
8499
|
+
|
|
8500
|
+
/**
|
|
8501
|
+
* Looks a pile up by its network entity ID.
|
|
8502
|
+
* @param id Network entity identifier.
|
|
8503
|
+
* @returns The pile's handle, or null when no live pile has that ID.
|
|
8504
|
+
*/
|
|
8505
|
+
static getById(id: number): StonePile | null;
|
|
8506
|
+
|
|
8507
|
+
/**
|
|
8508
|
+
* Removes stone piles, emitting `stonePileDestroy` for each one.
|
|
8509
|
+
* @param virtualWorld Optional virtual world to clear; omitted clears every one.
|
|
8510
|
+
* @returns How many were removed.
|
|
8511
|
+
*/
|
|
8512
|
+
static destroyAll(virtualWorld?: number): number;
|
|
8513
|
+
}
|
|
8514
|
+
|
|
8515
|
+
interface StonePile extends Entity {}
|
|
8516
|
+
|
|
7679
8517
|
/**
|
|
7680
8518
|
* Calls a function once after a delay.
|
|
7681
8519
|
* @param handler Function to call.
|