@falloutmp/types 0.3.1 → 0.3.2
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 +273 -29
- package/generated/server-api.d.ts +1007 -11
- package/package.json +1 -1
|
@@ -46,9 +46,14 @@ declare global {
|
|
|
46
46
|
playerAppearanceChange: [player: Player];
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
* Dispatched when a player's game lands a hit on another player, before the victim takes it. Return `false` to drop the hit. `damage` is the attacker's game's own. `kind` is a shot or a blow, an explosion's blast,
|
|
49
|
+
* Dispatched when a player's game lands a hit on another player, before the victim takes it. Return `false` to drop the hit. `damage` is the attacker's game's own. `kind` is a shot or a blow, an explosion's blast, a hazard the attacker left (a radiation or gas cloud), which casts its spell and carries no damage figure, or a shot of a VATS attack, whose hit the attacker's game rolled against the chance it showed: refusing one decides VATS hits on the server (their chances are the game's fVATS* settings, `setGameSetting`). `vatsChance` is the chance the attacker's VATS showed for the shot, 0 to 1, and 0 for any other kind; with `setVatsRolledByServer` every such shot strikes on the attacker's screen, and the handler rolls it, as `Math.random() < vatsChance`.
|
|
50
50
|
*/
|
|
51
|
-
playerHit: [attacker: Player, victim: Player, damage: number, kind: "direct" | "blast" | "hazard"];
|
|
51
|
+
playerHit: [attacker: Player, victim: Player, damage: number, kind: "direct" | "blast" | "hazard" | "vats", vatsChance: number];
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Dispatched when a player activates another player's body, the Activate button on them: where a trade, a search, a handover or any player-to-player interaction starts. The two stand within reach in the same space.
|
|
55
|
+
*/
|
|
56
|
+
playerActivatePlayer: [player: Player, target: Player];
|
|
52
57
|
|
|
53
58
|
/**
|
|
54
59
|
* Dispatched when a player starts a reload, before it is shown to the players around them. `event` is the animation event their game played.
|
|
@@ -95,6 +100,21 @@ declare global {
|
|
|
95
100
|
*/
|
|
96
101
|
worldHourChange: [hour: number];
|
|
97
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Dispatched when the server strikes lightning on its own, for a thundery weather a sky is held to: the World's, or one a player was given. `World.strikeLightning` does not raise it.
|
|
105
|
+
*/
|
|
106
|
+
worldLightning: [weather: number];
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Dispatched when a player's game finds them under another weather region, as they change cell: `region` is the TESRegion form ID, 0 for none. Its weathers come from `World.getRegionWeathers`.
|
|
110
|
+
*/
|
|
111
|
+
playerWeatherRegionChange: [player: Player, region: number, previous: number];
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Dispatched when the running clock passes midnight into a new day, with the new date and day count. `World.setDate` and `World.setDaysPassed` do not raise it.
|
|
115
|
+
*/
|
|
116
|
+
worldDayChange: [date: WorldDate, daysPassed: number];
|
|
117
|
+
|
|
98
118
|
/**
|
|
99
119
|
* Dispatched when a player opens or closes a door. Return `false` to refuse: their door swings back.
|
|
100
120
|
*/
|
|
@@ -170,6 +190,16 @@ declare global {
|
|
|
170
190
|
*/
|
|
171
191
|
playerValueChange: [player: Player, value: string, base: number, previous: number];
|
|
172
192
|
|
|
193
|
+
/**
|
|
194
|
+
* Dispatched when a player comes into a zone `Zone.create` made, or is in it when it is made.
|
|
195
|
+
*/
|
|
196
|
+
zoneEnter: [player: Player, zone: number, name: string];
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Dispatched when a player goes out of a zone, or the zone is removed around them. A player who leaves the server is not told.
|
|
200
|
+
*/
|
|
201
|
+
zoneLeave: [player: Player, zone: number, name: string];
|
|
202
|
+
|
|
173
203
|
/**
|
|
174
204
|
* Dispatched when a player's game is about to fast travel: a marker picked on the Pip-Boy map, or the game's own scripts. `destination` is the reference they would arrive at, a map marker's form ID. Their game waits for the answer. Return `false` to refuse it: they stay where they are. Otherwise they travel.
|
|
175
205
|
*/
|
|
@@ -336,9 +366,9 @@ declare global {
|
|
|
336
366
|
mineRemove: [mine: Mine];
|
|
337
367
|
|
|
338
368
|
/**
|
|
339
|
-
* Dispatched when a player's game lands a hit on an NPC, before the NPC takes it. Return `false` to drop the hit. `damage` is the attacker's game's own; `kind` is a shot or a blow,
|
|
369
|
+
* Dispatched when a player's game lands a hit on an NPC, before the NPC takes it. Return `false` to drop the hit, except on an NPC the attacker's own game runs (`getSimulator`), which took it already: that one is told so scripts learn who hit it, and the attacker is still the killer `npcDeath` names. `damage` is the attacker's game's own; `kind` is a shot or a blow, an explosion's blast, or a shot of a VATS attack, whose hit the attacker's game rolled against the chance it showed: refusing one decides VATS hits on the server. `vatsChance` is the chance the attacker's VATS showed, 0 to 1, and 0 for any other kind, as for `playerHit`.
|
|
340
370
|
*/
|
|
341
|
-
npcHit: [attacker: Player, npc: Npc, damage: number, kind: "direct" | "blast"];
|
|
371
|
+
npcHit: [attacker: Player, npc: Npc, damage: number, kind: "direct" | "blast" | "vats", vatsChance: number];
|
|
342
372
|
|
|
343
373
|
/**
|
|
344
374
|
* Dispatched when an NPC lands a hit on a player, before the victim takes it. Return `false` to drop the hit. `damage` is the game's own, from the client that runs the NPC.
|
|
@@ -350,6 +380,21 @@ declare global {
|
|
|
350
380
|
*/
|
|
351
381
|
npcDeath: [npc: Npc, killer: Player | null];
|
|
352
382
|
|
|
383
|
+
/**
|
|
384
|
+
* Dispatched when a player activates an NPC, the Activate button on its body: what a shopkeeper, a quest giver or any interaction starts from. Raised whether or not `setActivationBlocked` stops the game's own greeting and dialogue.
|
|
385
|
+
*/
|
|
386
|
+
npcActivate: [player: Player, npc: Npc];
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Dispatched when the player or NPC an NPC fights changes, as the game that runs it decides: it noticed an enemy, switched to another, or stopped fighting (`target` null, also on its death). Where aggro, bounties and wanted levels start.
|
|
390
|
+
*/
|
|
391
|
+
npcTarget: [npc: Npc, target: Player | Npc | null];
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Dispatched once when an NPC reaches where `goTo` sent it; it then stands there until `stopGoing` or the next `goTo`. Sent after a body, it is raised again each time it catches up after the body walked off.
|
|
395
|
+
*/
|
|
396
|
+
npcArrive: [npc: Npc];
|
|
397
|
+
|
|
353
398
|
/**
|
|
354
399
|
* Dispatched when an NPC is back at its placement, whole: on its own after its death, or from `respawn`.
|
|
355
400
|
*/
|
|
@@ -559,6 +604,11 @@ declare global {
|
|
|
559
604
|
*/
|
|
560
605
|
readonly armor: number;
|
|
561
606
|
|
|
607
|
+
/**
|
|
608
|
+
* Whether `setInvulnerable` made the player unhurtable.
|
|
609
|
+
*/
|
|
610
|
+
readonly isInvulnerable: boolean;
|
|
611
|
+
|
|
562
612
|
/**
|
|
563
613
|
* Whether the player is knocked down, alive: in their ragdoll or getting up, after a blast or a client script's `LocalPlayer.knockDown`.
|
|
564
614
|
*/
|
|
@@ -689,6 +739,34 @@ declare global {
|
|
|
689
739
|
*/
|
|
690
740
|
fire(shots?: number): boolean;
|
|
691
741
|
|
|
742
|
+
/**
|
|
743
|
+
* Holds the player's weapon out or away, as FiveM's SetCurrentPedWeapon forces a ped's: their game draws or holsters it at once and keeps it so against their own ready-weapon key and the game's. Away for a safe zone, out for a scripted scene. With no weapon in hand, out raises their fists. To stop attacks too, a client script turns off `Controls` "fighting".
|
|
744
|
+
* @param drawn True to hold their weapon out, false to keep it away, null to hand it back to them.
|
|
745
|
+
* @returns True when sent; false when the player is gone.
|
|
746
|
+
*/
|
|
747
|
+
setWeaponDrawn(drawn: boolean | null): boolean;
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Loads rounds into the player's weapon, as FiveM's SetAmmoInClip does a ped's. The rounds come from those they carry, as a reload takes them: never more than they have, so `giveItem` the ammo first. Their game ignores it without a weapon that loads ammo in hand.
|
|
751
|
+
* @param rounds The rounds to load, 0 to 100000; more than the weapon's clip loads a full clip.
|
|
752
|
+
* @returns True when sent; false when the player is gone.
|
|
753
|
+
*/
|
|
754
|
+
setClipAmmo(rounds: number): boolean;
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* Takes the player's collision away or gives it back, as FiveM's SetEntityCollision does a ped and the console's tcl the player: without it they move along where they look, through walls and floors, without gravity. An admin's noclip on foot; everyone else sees their body pass through. It ends with their session.
|
|
758
|
+
* @param enabled False to take their collision away, true to give it back.
|
|
759
|
+
* @returns True when sent; false when the player is gone.
|
|
760
|
+
*/
|
|
761
|
+
setCollision(enabled: boolean): boolean;
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Rebuilds the player on another race, as the console's setrace and Actor.SetRace do: a ghoul. Their skin and body become the race's, their head parts stay their own, and every other player sees their puppet rebuilt the same way. Only human and ghoul are supported; any other race is refused. The race they had comes back with null, and when their session ends.
|
|
765
|
+
* @param race 0x13746 (HumanRace) or 0xEAFB6 (GhoulRace); null for the race they had.
|
|
766
|
+
* @returns True when sent; false when the player is gone.
|
|
767
|
+
*/
|
|
768
|
+
setRace(race: number | string | null): boolean;
|
|
769
|
+
|
|
692
770
|
/**
|
|
693
771
|
* Places a power armor frame where the player stands and puts them into it at once, as `Actor.SwitchToPowerArmor` does. `playerPowerArmor` follows. The suit's pieces are the frame's; dress them with `setOutfit`.
|
|
694
772
|
* @param frame The TESFurniture of the frame to place; the game's empty frame when left out.
|
|
@@ -836,6 +914,50 @@ declare global {
|
|
|
836
914
|
*/
|
|
837
915
|
unequipItem(form: number | string): boolean;
|
|
838
916
|
|
|
917
|
+
/**
|
|
918
|
+
* Makes the player unhurtable, as FiveM's SetPlayerInvincible does: their game makes them a ghost, which shots, blows and explosions pass over, and turns on the game's immortal mode, so a fall or radiation never takes their last point of health; the server drops every hit still reported on them, from players and NPCs, before `playerHit` or `npcAttack`. It lasts until undone or they leave.
|
|
919
|
+
* @param invulnerable True to make them unhurtable, false to make them hurtable again.
|
|
920
|
+
* @returns True when sent; false when the player is gone.
|
|
921
|
+
*/
|
|
922
|
+
setInvulnerable(invulnerable: boolean): boolean;
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* Has the player's character speak, voice and subtitle, as FiveM's PlayAmbientSpeechNative does a player's ped: their own game says it, picking a topic's line among those whose conditions pass, and every other player's game hears their puppet say the same line in the player voice of their sex. Lines the character says on its own, in dialogue or in a fight, are heard the same way.
|
|
926
|
+
* @param line A dialogue topic (DIAL) by form ID or editor ID, such as `0x1B40FA`, the player's combat lines, or one of its lines (INFO) by form ID.
|
|
927
|
+
* @returns True when sent; false when the player is gone. Throws for a form no DIAL or INFO record has.
|
|
928
|
+
*/
|
|
929
|
+
say(line: number | string): boolean;
|
|
930
|
+
|
|
931
|
+
/**
|
|
932
|
+
* Knocks the player off their feet into their ragdoll from the server, as FiveM's SetPedToRagdoll does a player's ped: their game pushes them, as `LocalPlayer.knockDown` does, they lie a moment and get up by themselves, and every other player sees them fall. A player who is down, dead, held in place or in furniture is left as they are.
|
|
933
|
+
* @param force How hard they are thrown, as ObjectReference.PushActorAway takes it: small numbers, 1 to 50 (600 threw an NPC 8,700 units); 0, the default, drops them where they stand.
|
|
934
|
+
* @param from The point they are thrown away from; where they stand by default.
|
|
935
|
+
* @returns True when sent; false when the player is gone.
|
|
936
|
+
*/
|
|
937
|
+
knockDown(force?: number, from?: Vector3): boolean;
|
|
938
|
+
|
|
939
|
+
/**
|
|
940
|
+
* Scales the player in every game, as ObjectReference.SetScale does: their own game scales their character, and every other game their body. It lasts until set again or they leave.
|
|
941
|
+
* @param scale 1 for their normal size, from 0.01 to 10.
|
|
942
|
+
* @returns True when sent; false when the player is gone.
|
|
943
|
+
*/
|
|
944
|
+
setScale(scale: number): boolean;
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* Draws the player more or less see-through for everyone, as FiveM's SetEntityAlpha and SetEntityVisible do a player's ped: their own game sets it, as `LocalPlayer.setAlpha` does, and every other game draws their body the same. At 0 no game shows their nametag either. An admin's invisibility, a spectator, a spawn's protection.
|
|
948
|
+
* @param alpha 0, invisible, to 1, solid.
|
|
949
|
+
* @param fade Fade there rather than cut (default false).
|
|
950
|
+
* @returns True when sent; false when the player is gone.
|
|
951
|
+
*/
|
|
952
|
+
setAlpha(alpha: number, fade?: boolean): boolean;
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* Holds the player in place from the server, as FiveM's FreezeEntityPosition does a player's ped and Actor.SetRestrained an actor: their game keeps them standing where they are, neither moving nor acting, until let go. Cuffs, an arrest, an admin freeze, a cutscene. A player who is down or dead is left as they are.
|
|
956
|
+
* @param restrained True to hold them where they stand, false to let them go.
|
|
957
|
+
* @returns True when sent; false when the player is gone.
|
|
958
|
+
*/
|
|
959
|
+
setRestrained(restrained: boolean): boolean;
|
|
960
|
+
|
|
839
961
|
/**
|
|
840
962
|
* Plays an idle animation on the player, as `Actor.PlayIdle` does; everyone around them sees it. The idle's own conditions apply, so one meant for another skeleton, a piece of furniture or a state the player is not in does nothing. Moving ends most idles; `stopIdle` ends any.
|
|
841
963
|
* @param idle An idle animation from the game's data (an IDLE record): its editor ID, such as `"Salute"`, or its form ID.
|
|
@@ -1091,6 +1213,55 @@ declare global {
|
|
|
1091
1213
|
*/
|
|
1092
1214
|
setGameSetting(name: string, value: number | boolean): boolean;
|
|
1093
1215
|
|
|
1216
|
+
/**
|
|
1217
|
+
* Moves the roll of the player's VATS hits to the server. Their game rolls each queued shot against the chance it shows; while this is on, every shot with a chance above 0 strikes instead, and its hit reaches `playerHit` or `npcHit` as kind "vats" with that chance: the handler rolls it (`Math.random() < vatsChance`) and returns `false` for a miss. Lasts until they leave; set it again for each player as they join.
|
|
1218
|
+
* @param enabled True to roll the player's VATS hits on the server, false to leave them to their game.
|
|
1219
|
+
* @returns True when sent; false when the player is gone.
|
|
1220
|
+
*/
|
|
1221
|
+
setVatsRolledByServer(enabled: boolean): boolean;
|
|
1222
|
+
|
|
1223
|
+
/**
|
|
1224
|
+
* Gives the player a sky of their own, over the one `World` holds for everyone: the weather of the worldspace they stand in, a storm over one quest, a clear sky for a cutscene. The server strikes its lightning as for the World's. Lasts until they leave: to make it a rule, set it on `playerSpaceChange`, `playerWeatherRegionChange` or as they join.
|
|
1225
|
+
* @param weather A TESWeather form ID for this player alone; null to follow `World.weather` again.
|
|
1226
|
+
* @param force Swap it in at once rather than transition to it.
|
|
1227
|
+
* @returns True when sent; false when the player is gone.
|
|
1228
|
+
*/
|
|
1229
|
+
setWeather(weather: number | string | null, force?: boolean): boolean;
|
|
1230
|
+
|
|
1231
|
+
/**
|
|
1232
|
+
* Holds the player's clock, and the sun and the sky with it, at an hour of their own until it is released. Their game's day count and date stay the world's. Lasts until they leave.
|
|
1233
|
+
* @param hour The hour to hold the player's clock at, wrapped into 0-24; null to follow `World.hour` again.
|
|
1234
|
+
* @returns True when sent; false when the player is gone.
|
|
1235
|
+
*/
|
|
1236
|
+
setHour(hour: number | null): boolean;
|
|
1237
|
+
|
|
1238
|
+
/**
|
|
1239
|
+
* The weather `setWeather` gave the player alone.
|
|
1240
|
+
* @returns Null while they follow `World.weather`, or once they are gone.
|
|
1241
|
+
*/
|
|
1242
|
+
getWeather(): number | null;
|
|
1243
|
+
|
|
1244
|
+
/**
|
|
1245
|
+
* Strikes lightning in the player's sky alone: a flash and a thunderclap, if their sky is in a weather that thunders. In a session the game's own strikes come from the server (`World.setLightningEnabled`).
|
|
1246
|
+
* @returns True when sent; false when the player is gone.
|
|
1247
|
+
*/
|
|
1248
|
+
strikeLightning(): boolean;
|
|
1249
|
+
|
|
1250
|
+
/**
|
|
1251
|
+
* The region whose weathers the player's game would roll where they stand, as their game finds it each time they change cell: the TESRegion form ID, for `World.getRegionWeathers`.
|
|
1252
|
+
* @returns 0 when they stand in no region with weathers, or their game has not said yet.
|
|
1253
|
+
*/
|
|
1254
|
+
getWeatherRegion(): number;
|
|
1255
|
+
|
|
1256
|
+
/**
|
|
1257
|
+
* The players around a point, a player or an NPC, nearest first, as FiveM scripts run GetActivePlayers through a distance check: who hears a shout, who stands in a zone, who is close enough to trade. Positions are the ones the players' games last reported.
|
|
1258
|
+
* @param center A point, or a player or an NPC, whose position and space are then the search's; a player is not counted among its own.
|
|
1259
|
+
* @param radius How far from it, in game units.
|
|
1260
|
+
* @param options `space`: where a point is, the Commonwealth when left out. `limit`: how many at most, 32 by default, never more than 512.
|
|
1261
|
+
* @returns Empty when nobody is in range, or the center is gone. Throws for a center that is none of these, or a negative radius.
|
|
1262
|
+
*/
|
|
1263
|
+
static getInRange(center: Vector3 | Player | Npc, radius: number, options?: { space?: { worldSpace: number } | { interiorCell: number }; limit?: number }): Player[];
|
|
1264
|
+
|
|
1094
1265
|
/**
|
|
1095
1266
|
* Every connected player.
|
|
1096
1267
|
* @returns One handle per player, in no particular order.
|
|
@@ -1108,7 +1279,77 @@ declare global {
|
|
|
1108
1279
|
interface Player extends BasePlayer {}
|
|
1109
1280
|
|
|
1110
1281
|
/**
|
|
1111
|
-
*
|
|
1282
|
+
* A calendar date as the game keeps it: twelve months of 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30 and 31 days, no leap years.
|
|
1283
|
+
*/
|
|
1284
|
+
interface WorldDate {
|
|
1285
|
+
/**
|
|
1286
|
+
* The full year, 2000 to 2999.
|
|
1287
|
+
*/
|
|
1288
|
+
year: number;
|
|
1289
|
+
|
|
1290
|
+
/**
|
|
1291
|
+
* 1 to 12.
|
|
1292
|
+
*/
|
|
1293
|
+
month: number;
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* 1 to the month's last.
|
|
1297
|
+
*/
|
|
1298
|
+
day: number;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
/**
|
|
1302
|
+
* A weather the game's data files define.
|
|
1303
|
+
*/
|
|
1304
|
+
interface WeatherRecord {
|
|
1305
|
+
/**
|
|
1306
|
+
* The TESWeather form ID.
|
|
1307
|
+
*/
|
|
1308
|
+
weather: number;
|
|
1309
|
+
|
|
1310
|
+
/**
|
|
1311
|
+
* Its editor ID: "CommonwealthClear", "CommonwealthRadstorm".
|
|
1312
|
+
*/
|
|
1313
|
+
editorId: string;
|
|
1314
|
+
|
|
1315
|
+
/**
|
|
1316
|
+
* Its classification, as the game's GetIsPleasant/Cloudy/Rain/Snow conditions read it.
|
|
1317
|
+
*/
|
|
1318
|
+
kind: "none" | "pleasant" | "cloudy" | "rain" | "snow";
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
/**
|
|
1322
|
+
* One weather a climate rolls.
|
|
1323
|
+
*/
|
|
1324
|
+
interface ClimateWeather {
|
|
1325
|
+
/**
|
|
1326
|
+
* The TESWeather form ID.
|
|
1327
|
+
*/
|
|
1328
|
+
weather: number;
|
|
1329
|
+
|
|
1330
|
+
/**
|
|
1331
|
+
* Its weight among the climate's weathers, as the data files give it (they sum to 100 in the official climates).
|
|
1332
|
+
*/
|
|
1333
|
+
chance: number;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
/**
|
|
1337
|
+
* The weathers a worldspace's sky rolls once a weather has run its course.
|
|
1338
|
+
*/
|
|
1339
|
+
interface Climate {
|
|
1340
|
+
/**
|
|
1341
|
+
* The climate's editor ID.
|
|
1342
|
+
*/
|
|
1343
|
+
editorId: string;
|
|
1344
|
+
|
|
1345
|
+
/**
|
|
1346
|
+
* Its weathers and their chances.
|
|
1347
|
+
*/
|
|
1348
|
+
weathers: ClimateWeather[];
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
/**
|
|
1352
|
+
* The server's clock, calendar and weather, which every client follows, and what the game's data files say of weathers and climates.
|
|
1112
1353
|
*/
|
|
1113
1354
|
const World: {
|
|
1114
1355
|
/**
|
|
@@ -1121,6 +1362,16 @@ declare global {
|
|
|
1121
1362
|
*/
|
|
1122
1363
|
readonly timeScale: number;
|
|
1123
1364
|
|
|
1365
|
+
/**
|
|
1366
|
+
* The calendar date every client's game shows. It turns over at midnight as the clock runs.
|
|
1367
|
+
*/
|
|
1368
|
+
readonly date: WorldDate;
|
|
1369
|
+
|
|
1370
|
+
/**
|
|
1371
|
+
* Whole days the clock has run, the game's GameDaysPassed: what its timers, vendors' restocks and crops count in.
|
|
1372
|
+
*/
|
|
1373
|
+
readonly daysPassed: number;
|
|
1374
|
+
|
|
1124
1375
|
/**
|
|
1125
1376
|
* The TESWeather form ID every client shows.
|
|
1126
1377
|
*/
|
|
@@ -1132,7 +1383,17 @@ declare global {
|
|
|
1132
1383
|
readonly weatherForced: boolean;
|
|
1133
1384
|
|
|
1134
1385
|
/**
|
|
1135
|
-
*
|
|
1386
|
+
* The weather the sky is still moving away from, 0 once the move is over: up to two game hours after `setWeather`, past the game's longest transition.
|
|
1387
|
+
*/
|
|
1388
|
+
readonly previousWeather: number;
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* Whether the server strikes lightning on its own while `weather` thunders, at the pace the game would. In a session the game strikes only on the server's word, so every player sees the same strikes.
|
|
1392
|
+
*/
|
|
1393
|
+
readonly lightningEnabled: boolean;
|
|
1394
|
+
|
|
1395
|
+
/**
|
|
1396
|
+
* Sets the clock. Every client jumps to it. The date stays as it is.
|
|
1136
1397
|
* @param hour The hour, wrapped into 0-24; 13.5 is half past one.
|
|
1137
1398
|
*/
|
|
1138
1399
|
setHour(hour: number): void;
|
|
@@ -1144,11 +1405,164 @@ declare global {
|
|
|
1144
1405
|
setTimeScale(scale: number): void;
|
|
1145
1406
|
|
|
1146
1407
|
/**
|
|
1147
|
-
* Sets the
|
|
1408
|
+
* Sets the calendar date every client's Pip-Boy shows. The hour and the day count stay as they are.
|
|
1409
|
+
* @param year The full year, 2000 to 2999.
|
|
1410
|
+
* @param month 1 to 12.
|
|
1411
|
+
* @param day 1 to the month's last; the calendar has no leap years.
|
|
1412
|
+
*/
|
|
1413
|
+
setDate(year: number, month: number, day: number): void;
|
|
1414
|
+
|
|
1415
|
+
/**
|
|
1416
|
+
* Sets how many days the clock has run, which the game's timers count in. The date stays as it is.
|
|
1417
|
+
* @param days Whole days, 0 or more.
|
|
1418
|
+
*/
|
|
1419
|
+
setDaysPassed(days: number): void;
|
|
1420
|
+
|
|
1421
|
+
/**
|
|
1422
|
+
* Sets the weather every client shows. A transition runs on the game clock, so every client fades at the same point, one that joins during it included. Only a client's data files can tell whether the form is a weather, so a wrong one leaves the sky as it is.
|
|
1148
1423
|
* @param weather A TESWeather form ID, as a number or hex string; null for the server's default, CommonwealthClear.
|
|
1149
1424
|
* @param force Swap it in at once rather than transition to it.
|
|
1150
1425
|
*/
|
|
1151
1426
|
setWeather(weather: number | string | null, force?: boolean): void;
|
|
1427
|
+
|
|
1428
|
+
/**
|
|
1429
|
+
* Every weather the game's official masters define, by form ID.
|
|
1430
|
+
* @returns Empty when the server could not read the game's data files.
|
|
1431
|
+
*/
|
|
1432
|
+
getWeathers(): WeatherRecord[];
|
|
1433
|
+
|
|
1434
|
+
/**
|
|
1435
|
+
* Starts or stops the server's own lightning.
|
|
1436
|
+
* @param enabled On, or off: no lightning but what scripts strike.
|
|
1437
|
+
*/
|
|
1438
|
+
setLightningEnabled(enabled: boolean): void;
|
|
1439
|
+
|
|
1440
|
+
/**
|
|
1441
|
+
* Strikes lightning in every player's sky that thunders: a flash and a thunderclap, at the same moment for all.
|
|
1442
|
+
* @param weather Only for skies in this weather; any weather that thunders when left out.
|
|
1443
|
+
*/
|
|
1444
|
+
strikeLightning(weather?: number | string): void;
|
|
1445
|
+
|
|
1446
|
+
/**
|
|
1447
|
+
* The weathers a region rolls, as the data files give it: the game takes them over the worldspace's climate while the player stands in the region.
|
|
1448
|
+
* @param region A TESRegion form ID, as `Player.getWeatherRegion` gives it.
|
|
1449
|
+
* @returns Null when the region has no weathers, or the form is not one.
|
|
1450
|
+
*/
|
|
1451
|
+
getRegionWeathers(region: number | string): Climate | null;
|
|
1452
|
+
|
|
1453
|
+
/**
|
|
1454
|
+
* The climate a worldspace's sky rolls its weathers from, as the data files give it: the base a script rolls its own weather cycle on.
|
|
1455
|
+
* @param worldSpace A TESWorldSpace form ID.
|
|
1456
|
+
* @returns Null when the worldspace has none, or the form is not one.
|
|
1457
|
+
*/
|
|
1458
|
+
getClimate(worldSpace: number | string): Climate | null;
|
|
1459
|
+
};
|
|
1460
|
+
|
|
1461
|
+
/**
|
|
1462
|
+
* Explosions set off in every player's game at once, as the game sets off its own: the blast, its light, sound, debris and decals, and whatever the explosion leaves behind. An explosion is named by form ID (a number or hex string) or by its editor ID in the official masters ("FragGrenadeExplosion").
|
|
1463
|
+
*/
|
|
1464
|
+
const Explosion: {
|
|
1465
|
+
/**
|
|
1466
|
+
* Sets off an explosion in the game of every player in that space whose game has the spot loaded. Each game's blast hurts what that game simulates: its own player, the NPCs it runs.
|
|
1467
|
+
* @param explosion A BGSExplosion (EXPL) form ID: a frag grenade's, a mini nuke's, a car's.
|
|
1468
|
+
* @param position Where it goes off.
|
|
1469
|
+
* @param options `space`: the worldspace or interior cell; the owner's when an owner is given, else the Commonwealth. `scale`: of its radii, 1 by default. `damage`: a multiplier of its damage, 0 for one that hurts nobody. `owner`: who it is credited to.
|
|
1470
|
+
*/
|
|
1471
|
+
spawn(explosion: number | string, position: Vector3, options?: { space?: { worldSpace?: number | string; interiorCell?: number | string }; scale?: number; damage?: number; owner?: Player | Npc }): void;
|
|
1472
|
+
};
|
|
1473
|
+
|
|
1474
|
+
/**
|
|
1475
|
+
* Effects in every player's game: placed effects that stream like any entity, effect shaders and visual effects on bodies and references, and impacts. Forms are named by form ID (a number or hex string) or by their editor ID in the official masters; an editor ID made only of hex digits reads as a form ID.
|
|
1476
|
+
*/
|
|
1477
|
+
const Effect: {
|
|
1478
|
+
/**
|
|
1479
|
+
* Places an effect every player near it sees, players who come near later included: each game places its own copy while they are in range. Attached, it is a prop: a box carried, a lantern on the back, a flame over a head.
|
|
1480
|
+
* @param form The base object to place: a fog patch, a smoke column or a fire (the game's FX statics, movable statics and activators), a hazard (HAZD), a light (LIGH), any other placeable object.
|
|
1481
|
+
* @param position Where it stands; null for an attached one, which starts where its body stands.
|
|
1482
|
+
* @param options `angle`: its rotation in radians. `space`: the worldspace or interior cell; the body's when attached, else the Commonwealth. `lifetime`: seconds until it is removed on its own; it stays until `remove` when left out. `range`: how near players must be to have it, 8192 units by default. `attach`: holds it on a body or a placed reference every frame, on the named node ("WEAPON", "RArm_Hand", "Head"; the root when left out), shifted by `offset` and turned by `rotation` (radians) in the node's frame; everyone in the space has it. Give it something without collision, or it pushes what it touches.
|
|
1483
|
+
* @returns The effect's ID, for `remove`; 0 when it could not be made.
|
|
1484
|
+
*/
|
|
1485
|
+
spawn(form: number | string, position: Vector3 | null, options?: { angle?: Vector3; space?: { worldSpace?: number | string; interiorCell?: number | string }; lifetime?: number; range?: number; attach?: { to: Player | Npc | number | string; node?: string; offset?: Vector3; rotation?: Vector3 } }): number;
|
|
1486
|
+
|
|
1487
|
+
/**
|
|
1488
|
+
* Removes a placed effect from every game.
|
|
1489
|
+
* @param effect An ID `spawn` gave.
|
|
1490
|
+
* @returns False when there is no such effect.
|
|
1491
|
+
*/
|
|
1492
|
+
remove(effect: number): boolean;
|
|
1493
|
+
|
|
1494
|
+
/**
|
|
1495
|
+
* Moves a placed effect in every game, players who come near later included: a lift, a gate, a prop a script carries. Each call is one step; call it each tick for a glide.
|
|
1496
|
+
* @param effect An ID `spawn` gave.
|
|
1497
|
+
* @param position Where it stands now.
|
|
1498
|
+
* @param angle Its rotation in radians; kept when left out.
|
|
1499
|
+
* @returns False when there is no such effect, or it is attached.
|
|
1500
|
+
*/
|
|
1501
|
+
move(effect: number, position: Vector3, angle?: Vector3): boolean;
|
|
1502
|
+
|
|
1503
|
+
/**
|
|
1504
|
+
* Whether a placed effect is still there: its lifetime may have run out.
|
|
1505
|
+
* @param effect An ID `spawn` gave.
|
|
1506
|
+
*/
|
|
1507
|
+
exists(effect: number): boolean;
|
|
1508
|
+
|
|
1509
|
+
/**
|
|
1510
|
+
* Plays an effect shader over a body or a reference in every game where it is loaded, as EffectShader.Play does.
|
|
1511
|
+
* @param target A player, an NPC, or a placed reference's form ID.
|
|
1512
|
+
* @param shader A TESEffectShader (EFSH) form ID: a glow, a burn, a membrane.
|
|
1513
|
+
* @param seconds How long; until `stopShader` when left out.
|
|
1514
|
+
*/
|
|
1515
|
+
playShader(target: Player | Npc | number | string, shader: number | string, seconds?: number): void;
|
|
1516
|
+
|
|
1517
|
+
/**
|
|
1518
|
+
* Stops an effect shader on a body or a reference.
|
|
1519
|
+
* @param target A player, an NPC, or a placed reference's form ID.
|
|
1520
|
+
* @param shader The shader played.
|
|
1521
|
+
*/
|
|
1522
|
+
stopShader(target: Player | Npc | number | string, shader: number | string): void;
|
|
1523
|
+
|
|
1524
|
+
/**
|
|
1525
|
+
* Attaches a visual effect to a body or a reference in every game where it is loaded, as VisualEffect.Play does.
|
|
1526
|
+
* @param target A player, an NPC, or a placed reference's form ID.
|
|
1527
|
+
* @param effect A BGSReferenceEffect (RFCT) form ID: an art object's particles or model, with or without a shader.
|
|
1528
|
+
* @param seconds How long; until `stopVisual` when left out.
|
|
1529
|
+
*/
|
|
1530
|
+
playVisual(target: Player | Npc | number | string, effect: number | string, seconds?: number): void;
|
|
1531
|
+
|
|
1532
|
+
/**
|
|
1533
|
+
* Takes a visual effect off a body or a reference.
|
|
1534
|
+
* @param target A player, an NPC, or a placed reference's form ID.
|
|
1535
|
+
* @param effect The visual effect played.
|
|
1536
|
+
*/
|
|
1537
|
+
stopVisual(target: Player | Npc | number | string, effect: number | string): void;
|
|
1538
|
+
|
|
1539
|
+
/**
|
|
1540
|
+
* Plays an impact where a ray from the target lands, in every game where the target is loaded, as ObjectReference.PlayImpactEffect does: the decal, particles and sound of the surface's material.
|
|
1541
|
+
* @param target A player, an NPC, or a placed reference's form ID.
|
|
1542
|
+
* @param impactSet A BGSImpactDataSet (IPDS) form ID: what each material shows when hit.
|
|
1543
|
+
* @param options The ray: from the named node of the target (its root when left out), along the direction (straight down by default), for the length in game units (512).
|
|
1544
|
+
*/
|
|
1545
|
+
playImpact(target: Player | Npc | number | string, impactSet: number | string, options?: { node?: string; direction?: Vector3; length?: number }): void;
|
|
1546
|
+
};
|
|
1547
|
+
|
|
1548
|
+
/**
|
|
1549
|
+
* Sounds in every player's game at once, heard where each game places its listener.
|
|
1550
|
+
*/
|
|
1551
|
+
const Sound: {
|
|
1552
|
+
/**
|
|
1553
|
+
* Plays a sound for every player near enough to hear it: the descriptor's own attenuation decides how far it carries.
|
|
1554
|
+
* @param sound A sound descriptor (SNDR) by form ID or editor ID.
|
|
1555
|
+
* @param at A spot, or a player, an NPC or a placed reference the sound follows as it moves.
|
|
1556
|
+
* @param options `space`: the spot's worldspace or interior cell, the Commonwealth when left out. `volume`: 0 to 1, 1 by default.
|
|
1557
|
+
* @returns The sound's number, for `stop`.
|
|
1558
|
+
*/
|
|
1559
|
+
play(sound: number | string, at: Vector3 | Player | Npc | number | string, options?: { space?: { worldSpace?: number | string; interiorCell?: number | string }; volume?: number }): number;
|
|
1560
|
+
|
|
1561
|
+
/**
|
|
1562
|
+
* Stops a sound in every game still playing it.
|
|
1563
|
+
* @param sound A number `play` gave.
|
|
1564
|
+
*/
|
|
1565
|
+
stop(sound: number): void;
|
|
1152
1566
|
};
|
|
1153
1567
|
|
|
1154
1568
|
/**
|
|
@@ -1183,6 +1597,36 @@ declare global {
|
|
|
1183
1597
|
*/
|
|
1184
1598
|
setActivationBlocked(ref: number | string, blocked: boolean): void;
|
|
1185
1599
|
|
|
1600
|
+
/**
|
|
1601
|
+
* Whether a script left a reference in the world or took it out.
|
|
1602
|
+
* @param ref The placed reference's form ID.
|
|
1603
|
+
* @returns Null when no script decided this session: the game's own state stands.
|
|
1604
|
+
*/
|
|
1605
|
+
isEnabled(ref: number | string): boolean | null;
|
|
1606
|
+
|
|
1607
|
+
/**
|
|
1608
|
+
* Takes a reference the data files place out of every player's world, as ObjectReference.Disable does, or puts it back, players who join later included: a barricade torn down, a door bricked up, a prop shown for an event. Held against the game's own scripts and cell loads, which put references back as they please.
|
|
1609
|
+
* @param ref The placed reference's form ID.
|
|
1610
|
+
* @param enabled In the world, or out of it.
|
|
1611
|
+
*/
|
|
1612
|
+
setEnabled(ref: number | string, enabled: boolean): void;
|
|
1613
|
+
|
|
1614
|
+
/**
|
|
1615
|
+
* Moves a placed reference for everyone, players who join later included, as a player moving it in a settlement's build mode does: the power it receives through the air and its wires follow it.
|
|
1616
|
+
* @param ref The placed reference's form ID.
|
|
1617
|
+
* @param position Where it stands now.
|
|
1618
|
+
* @param angle Its rotation, radians.
|
|
1619
|
+
* @returns False for a reference the session scrapped or a pose that is not finite.
|
|
1620
|
+
*/
|
|
1621
|
+
move(ref: number | string, position: Vector3, angle?: Vector3): boolean;
|
|
1622
|
+
|
|
1623
|
+
/**
|
|
1624
|
+
* Where a player's build mode or a script last put a placed reference.
|
|
1625
|
+
* @param ref The placed reference's form ID.
|
|
1626
|
+
* @returns Null while it stands where the data files place it.
|
|
1627
|
+
*/
|
|
1628
|
+
getMovedPosition(ref: number | string): Vector3 | null;
|
|
1629
|
+
|
|
1186
1630
|
/**
|
|
1187
1631
|
* Opens or closes a door for everyone, players who join later included.
|
|
1188
1632
|
* @param ref The placed reference's form ID.
|
|
@@ -1385,6 +1829,47 @@ declare global {
|
|
|
1385
1829
|
clearReaction(faction: number | string, other: number | string, mutual?: boolean): boolean;
|
|
1386
1830
|
};
|
|
1387
1831
|
|
|
1832
|
+
/**
|
|
1833
|
+
* Areas of the world the server watches, as FiveM resources do with PolyZone: an upright cylinder, around a point in a worldspace or an interior. `zoneEnter` and `zoneLeave` tell scripts who came in and who went out, from the places players' games report: a safe zone, a shop's floor, a job's drop point. The server alone knows of them.
|
|
1834
|
+
*/
|
|
1835
|
+
const Zone: {
|
|
1836
|
+
/**
|
|
1837
|
+
* Starts watching an area. Players already in it are told so at the next update.
|
|
1838
|
+
* @param options `center` and `radius`, on the ground plane, in game units. `height`: how far above and below the center it reaches, no limit when left out. `name`: given back with its events. `space`: its worldspace or interior, the Commonwealth when left out.
|
|
1839
|
+
* @returns The zone's ID. Throws for a missing center or a radius that is not above 0.
|
|
1840
|
+
*/
|
|
1841
|
+
create(options: { center: Vector3; radius: number; height?: number; name?: string; space?: { worldSpace: number } | { interiorCell: number } }): number;
|
|
1842
|
+
|
|
1843
|
+
/**
|
|
1844
|
+
* Stops watching an area; the players in it are told they left.
|
|
1845
|
+
* @param zone The zone's ID, as `create` gave it.
|
|
1846
|
+
* @returns False for an unknown ID.
|
|
1847
|
+
*/
|
|
1848
|
+
remove(zone: number): boolean;
|
|
1849
|
+
|
|
1850
|
+
/**
|
|
1851
|
+
* The players in an area, as the last update found them.
|
|
1852
|
+
* @param zone The zone's ID, as `create` gave it.
|
|
1853
|
+
* @returns Empty for an unknown ID.
|
|
1854
|
+
*/
|
|
1855
|
+
getPlayers(zone: number): Player[];
|
|
1856
|
+
|
|
1857
|
+
/**
|
|
1858
|
+
* Whether a point lies in an area: where an NPC stands, a drop, a spawn.
|
|
1859
|
+
* @param zone The zone's ID, as `create` gave it.
|
|
1860
|
+
* @param position The point.
|
|
1861
|
+
* @param space Where the point is; the Commonwealth when left out.
|
|
1862
|
+
* @returns False for an unknown ID.
|
|
1863
|
+
*/
|
|
1864
|
+
contains(zone: number, position: Vector3, space?: { worldSpace: number } | { interiorCell: number }): boolean;
|
|
1865
|
+
|
|
1866
|
+
/**
|
|
1867
|
+
* Every zone's ID.
|
|
1868
|
+
* @returns In the order they were made.
|
|
1869
|
+
*/
|
|
1870
|
+
all(): number[];
|
|
1871
|
+
};
|
|
1872
|
+
|
|
1388
1873
|
/**
|
|
1389
1874
|
* The game's own quests, given to players as scripts decide. A player's game lists the quests they have in the Pip-Boy, and tracks the active ones on the HUD with the data files' quest name and objective texts. There is no quest logic here: scripts decide which quest a player has, which objectives they see, and when each is done. A player's quests go when they disconnect.
|
|
1390
1875
|
*/
|
|
@@ -1593,7 +2078,228 @@ declare global {
|
|
|
1593
2078
|
interface RadioStation extends Entity {}
|
|
1594
2079
|
|
|
1595
2080
|
/**
|
|
1596
|
-
* A
|
|
2081
|
+
* A marker on every player's HUD compass and Pip-Boy map, as FiveM's blips: at a point, or following a player or an NPC. A player sees it while they are in its worldspace or interior. A blip outlives the resource that made it until destroyed. Move it with `setPosition` or `attachTo`, not by setting `position`.
|
|
2082
|
+
*/
|
|
2083
|
+
class Blip {
|
|
2084
|
+
/**
|
|
2085
|
+
* Wraps the blip with this ID; it creates nothing.
|
|
2086
|
+
* @param id Network entity identifier.
|
|
2087
|
+
*/
|
|
2088
|
+
constructor(id: number);
|
|
2089
|
+
|
|
2090
|
+
/**
|
|
2091
|
+
* What the Pip-Boy map's tooltip says; empty once it is gone.
|
|
2092
|
+
*/
|
|
2093
|
+
readonly label: string;
|
|
2094
|
+
|
|
2095
|
+
/**
|
|
2096
|
+
* Takes the blip off every player's compass and map.
|
|
2097
|
+
* @returns False once it is gone.
|
|
2098
|
+
*/
|
|
2099
|
+
destroy(): boolean;
|
|
2100
|
+
|
|
2101
|
+
/**
|
|
2102
|
+
* Formats this handle for logging.
|
|
2103
|
+
* @returns The blip's network ID and label.
|
|
2104
|
+
*/
|
|
2105
|
+
toString(): string;
|
|
2106
|
+
|
|
2107
|
+
/**
|
|
2108
|
+
* Moves the blip to a point, as FiveM's SetBlipCoords does; it stops following anyone.
|
|
2109
|
+
* @param position Where, in world units.
|
|
2110
|
+
* @param space Where that is; its current space when left out.
|
|
2111
|
+
* @returns False once it is gone.
|
|
2112
|
+
*/
|
|
2113
|
+
setPosition(position: Vector3, space?: { worldSpace: number } | { interiorCell: number }): boolean;
|
|
2114
|
+
|
|
2115
|
+
/**
|
|
2116
|
+
* Has the blip follow a player or an NPC, as FiveM's AddBlipForEntity does: each player's game puts it on that body while it has it loaded, and on where the server last saw it otherwise.
|
|
2117
|
+
* @param target Whose body to follow; null to stay where it is.
|
|
2118
|
+
* @returns False once it is gone.
|
|
2119
|
+
*/
|
|
2120
|
+
attachTo(target: Player | Npc | null): boolean;
|
|
2121
|
+
|
|
2122
|
+
/**
|
|
2123
|
+
* Whom the blip follows.
|
|
2124
|
+
* @returns Null for a blip at a point, or once that body is gone.
|
|
2125
|
+
*/
|
|
2126
|
+
getAttached(): Player | Npc | null;
|
|
2127
|
+
|
|
2128
|
+
/**
|
|
2129
|
+
* Shows the blip to one player only, as a FiveM blip a client script made for its own player: a delivery's drop point, a bounty on someone's own map.
|
|
2130
|
+
* @param player The one player who sees it; null for everyone.
|
|
2131
|
+
* @returns False once it is gone.
|
|
2132
|
+
*/
|
|
2133
|
+
setPlayer(player: Player | null): boolean;
|
|
2134
|
+
|
|
2135
|
+
/**
|
|
2136
|
+
* The one player who sees the blip.
|
|
2137
|
+
* @returns Null while everyone does.
|
|
2138
|
+
*/
|
|
2139
|
+
getPlayer(): Player | null;
|
|
2140
|
+
|
|
2141
|
+
/**
|
|
2142
|
+
* Changes what the Pip-Boy map's tooltip says.
|
|
2143
|
+
* @param label Up to 63 bytes of UTF-8.
|
|
2144
|
+
* @returns False once it is gone.
|
|
2145
|
+
*/
|
|
2146
|
+
setLabel(label: string): boolean;
|
|
2147
|
+
|
|
2148
|
+
/**
|
|
2149
|
+
* Puts a blip on every player's compass and map, as FiveM's AddBlipForCoord and AddBlipForEntity do.
|
|
2150
|
+
* @param options `position` or `entity`, where it is or whom it follows. `label`: the map's tooltip. `kind`: the icon, "quest" by default. `compass` and `map`: where it shows, both by default. `space`: a point's worldspace or interior, the Commonwealth when left out. `player`: the one player who sees it, everyone when left out.
|
|
2151
|
+
* @returns The blip; null when it could not be made. Throws for options that name neither a position nor a body.
|
|
2152
|
+
*/
|
|
2153
|
+
static create(options: { position?: Vector3; entity?: Player | Npc; label?: string; kind?: "quest" | "custom" | "powerArmor"; compass?: boolean; map?: boolean; space?: { worldSpace: number } | { interiorCell: number }; player?: Player }): Blip | null;
|
|
2154
|
+
|
|
2155
|
+
/**
|
|
2156
|
+
* Every blip.
|
|
2157
|
+
* @returns One handle per blip.
|
|
2158
|
+
*/
|
|
2159
|
+
static all(): Blip[];
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
interface Blip extends Entity {}
|
|
2163
|
+
|
|
2164
|
+
/**
|
|
2165
|
+
* Text floating in the world on every player's screen, as FiveM resources draw 3D text: over a shop's door, a ped's head, a player. A player sees it while they are in its worldspace or interior and within its range. A label outlives the resource that made it until destroyed. Move it with `setPosition` or `attachTo`, not by setting `position`.
|
|
2166
|
+
*/
|
|
2167
|
+
class TextLabel {
|
|
2168
|
+
/**
|
|
2169
|
+
* Wraps the label with this ID; it creates nothing.
|
|
2170
|
+
* @param id Network entity identifier.
|
|
2171
|
+
*/
|
|
2172
|
+
constructor(id: number);
|
|
2173
|
+
|
|
2174
|
+
/**
|
|
2175
|
+
* What it says; empty once it is gone.
|
|
2176
|
+
*/
|
|
2177
|
+
readonly text: string;
|
|
2178
|
+
|
|
2179
|
+
/**
|
|
2180
|
+
* Takes the label off every player's screen.
|
|
2181
|
+
* @returns False once it is gone.
|
|
2182
|
+
*/
|
|
2183
|
+
destroy(): boolean;
|
|
2184
|
+
|
|
2185
|
+
/**
|
|
2186
|
+
* Formats this handle for logging.
|
|
2187
|
+
* @returns The label's network ID and text.
|
|
2188
|
+
*/
|
|
2189
|
+
toString(): string;
|
|
2190
|
+
|
|
2191
|
+
/**
|
|
2192
|
+
* Changes what the label says.
|
|
2193
|
+
* @param text Up to 127 bytes of UTF-8; a line break starts a new line.
|
|
2194
|
+
* @returns False once it is gone.
|
|
2195
|
+
*/
|
|
2196
|
+
setText(text: string): boolean;
|
|
2197
|
+
|
|
2198
|
+
/**
|
|
2199
|
+
* Changes the text's color.
|
|
2200
|
+
* @param color 0xRRGGBBAA: 0xFFFFFFFF is opaque white.
|
|
2201
|
+
* @returns False once it is gone.
|
|
2202
|
+
*/
|
|
2203
|
+
setColor(color: number): boolean;
|
|
2204
|
+
|
|
2205
|
+
/**
|
|
2206
|
+
* Moves the label to a point; it stops floating over anyone.
|
|
2207
|
+
* @param position Where, in world units.
|
|
2208
|
+
* @param space Where that is; its current space when left out.
|
|
2209
|
+
* @returns False once it is gone.
|
|
2210
|
+
*/
|
|
2211
|
+
setPosition(position: Vector3, space?: { worldSpace: number } | { interiorCell: number }): boolean;
|
|
2212
|
+
|
|
2213
|
+
/**
|
|
2214
|
+
* Has the label float over a player or an NPC: each player's game draws it over that body while it has it loaded, and over where the server last saw it otherwise.
|
|
2215
|
+
* @param target Whose body to float over; null to stay where it is.
|
|
2216
|
+
* @returns False once it is gone.
|
|
2217
|
+
*/
|
|
2218
|
+
attachTo(target: Player | Npc | null): boolean;
|
|
2219
|
+
|
|
2220
|
+
/**
|
|
2221
|
+
* Puts floating text in the world for every player, as FiveM's DrawText3D is drawn: "[E] Shop" over a counter, a name over a head.
|
|
2222
|
+
* @param options `text`: what it says. `position` or `entity`: where it is or whom it floats over. `height`: how far above, 140 over a body and 0 at a point by default. `color`: 0xRRGGBBAA, white by default. `range`: how far from a player it is drawn, 1000 by default, at most 20000. `space`: a point's worldspace or interior, the Commonwealth when left out. `player`: the one player who sees it, everyone when left out.
|
|
2223
|
+
* @returns The label; null when it could not be made. Throws for options without text, or naming neither a position nor a body.
|
|
2224
|
+
*/
|
|
2225
|
+
static create(options: { text: string; position?: Vector3; entity?: Player | Npc; height?: number; color?: number; range?: number; space?: { worldSpace: number } | { interiorCell: number }; player?: Player }): TextLabel | null;
|
|
2226
|
+
|
|
2227
|
+
/**
|
|
2228
|
+
* Every label.
|
|
2229
|
+
* @returns One handle per label.
|
|
2230
|
+
*/
|
|
2231
|
+
static all(): TextLabel[];
|
|
2232
|
+
}
|
|
2233
|
+
|
|
2234
|
+
interface TextLabel extends Entity {}
|
|
2235
|
+
|
|
2236
|
+
/**
|
|
2237
|
+
* A ring on the ground on every player's screen, as FiveM resources draw a marker with CreateCheckpoint or DrawMarker: a translucent upright cylinder at a job's pickup, a shop's door, a race's next gate. A player sees it while they are in its worldspace or interior and within its range. It shows the place; `Zone.create` with the same center and radius tells scripts who steps in. Move it with `setPosition`, not by setting `position`.
|
|
2238
|
+
*/
|
|
2239
|
+
class Checkpoint {
|
|
2240
|
+
/**
|
|
2241
|
+
* Wraps the checkpoint with this ID; it creates nothing.
|
|
2242
|
+
* @param id Network entity identifier.
|
|
2243
|
+
*/
|
|
2244
|
+
constructor(id: number);
|
|
2245
|
+
|
|
2246
|
+
/**
|
|
2247
|
+
* Its radius in game units; 0 once it is gone.
|
|
2248
|
+
*/
|
|
2249
|
+
readonly radius: number;
|
|
2250
|
+
|
|
2251
|
+
/**
|
|
2252
|
+
* Takes the checkpoint off every player's screen.
|
|
2253
|
+
* @returns False once it is gone.
|
|
2254
|
+
*/
|
|
2255
|
+
destroy(): boolean;
|
|
2256
|
+
|
|
2257
|
+
/**
|
|
2258
|
+
* Formats this handle for logging.
|
|
2259
|
+
* @returns The checkpoint's network ID and radius.
|
|
2260
|
+
*/
|
|
2261
|
+
toString(): string;
|
|
2262
|
+
|
|
2263
|
+
/**
|
|
2264
|
+
* Changes its color.
|
|
2265
|
+
* @param color 0xRRGGBBAA; the alpha is the wall's, the rim is drawn more solid.
|
|
2266
|
+
* @returns False once it is gone.
|
|
2267
|
+
*/
|
|
2268
|
+
setColor(color: number): boolean;
|
|
2269
|
+
|
|
2270
|
+
/**
|
|
2271
|
+
* Widens or narrows it.
|
|
2272
|
+
* @param radius Game units, above 0 and at most 5000.
|
|
2273
|
+
* @returns False once it is gone.
|
|
2274
|
+
*/
|
|
2275
|
+
setRadius(radius: number): boolean;
|
|
2276
|
+
|
|
2277
|
+
/**
|
|
2278
|
+
* Moves it.
|
|
2279
|
+
* @param position The middle of its base, on the ground.
|
|
2280
|
+
* @param space Where that is; its current space when left out.
|
|
2281
|
+
* @returns False once it is gone.
|
|
2282
|
+
*/
|
|
2283
|
+
setPosition(position: Vector3, space?: { worldSpace: number } | { interiorCell: number }): boolean;
|
|
2284
|
+
|
|
2285
|
+
/**
|
|
2286
|
+
* Puts a ring on the ground for every player, or one player.
|
|
2287
|
+
* @param options `position`: the middle of its base, on the ground. `radius`: 100 by default, at most 5000. `height`: how high its wall rises, 50 by default, 0 for a flat ring. `color`: 0xRRGGBBAA, a translucent amber by default. `range`: how far from a player it is drawn, 3000 by default, at most 20000. `space`: its worldspace or interior, the Commonwealth when left out. `player`: the one player who sees it, everyone when left out.
|
|
2288
|
+
* @returns The checkpoint; null when it could not be made. Throws for options without a position, or a radius out of range.
|
|
2289
|
+
*/
|
|
2290
|
+
static create(options: { position: Vector3; radius?: number; height?: number; color?: number; range?: number; space?: { worldSpace: number } | { interiorCell: number }; player?: Player }): Checkpoint | null;
|
|
2291
|
+
|
|
2292
|
+
/**
|
|
2293
|
+
* Every checkpoint.
|
|
2294
|
+
* @returns One handle per checkpoint.
|
|
2295
|
+
*/
|
|
2296
|
+
static all(): Checkpoint[];
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
interface Checkpoint extends Entity {}
|
|
2300
|
+
|
|
2301
|
+
/**
|
|
2302
|
+
* A non-player actor the server took over from the data files: the generic placed ones, not the unique, essential or quest actors, which stay each client's own. A client near it runs it with the game's own AI and reports its health; nobody near, the server walks it. It lives for the whole session and comes back on its own a while after it dies. A script also makes its own with `Npc.spawn`: those stay dead until `respawn` and leave with `remove`. Move it with `teleport`, not by setting `position`.
|
|
1597
2303
|
*/
|
|
1598
2304
|
class Npc {
|
|
1599
2305
|
/**
|
|
@@ -1603,7 +2309,7 @@ declare global {
|
|
|
1603
2309
|
constructor(id: number);
|
|
1604
2310
|
|
|
1605
2311
|
/**
|
|
1606
|
-
* The form ID of the placed reference (ACHR) it stands for.
|
|
2312
|
+
* The form ID of the placed reference (ACHR) it stands for; 0 for one a script spawned.
|
|
1607
2313
|
*/
|
|
1608
2314
|
readonly ref: number;
|
|
1609
2315
|
|
|
@@ -1637,6 +2343,31 @@ declare global {
|
|
|
1637
2343
|
*/
|
|
1638
2344
|
readonly isDead: boolean;
|
|
1639
2345
|
|
|
2346
|
+
/**
|
|
2347
|
+
* Whether `setRestrained` froze it in place.
|
|
2348
|
+
*/
|
|
2349
|
+
readonly isRestrained: boolean;
|
|
2350
|
+
|
|
2351
|
+
/**
|
|
2352
|
+
* Whether the game that runs it has it in the sneak stance, as its last report says.
|
|
2353
|
+
*/
|
|
2354
|
+
readonly isSneaking: boolean;
|
|
2355
|
+
|
|
2356
|
+
/**
|
|
2357
|
+
* Whether `setActivationBlocked` stopped the game's own activation of it.
|
|
2358
|
+
*/
|
|
2359
|
+
readonly isActivationBlocked: boolean;
|
|
2360
|
+
|
|
2361
|
+
/**
|
|
2362
|
+
* The name `setName` gave it; empty while it shows its record's own.
|
|
2363
|
+
*/
|
|
2364
|
+
readonly name: string;
|
|
2365
|
+
|
|
2366
|
+
/**
|
|
2367
|
+
* Whether `setInvulnerable` made it unhurtable.
|
|
2368
|
+
*/
|
|
2369
|
+
readonly isInvulnerable: boolean;
|
|
2370
|
+
|
|
1640
2371
|
/**
|
|
1641
2372
|
* Facing, in radians around Z.
|
|
1642
2373
|
*/
|
|
@@ -1648,6 +2379,12 @@ declare global {
|
|
|
1648
2379
|
*/
|
|
1649
2380
|
kill(): boolean;
|
|
1650
2381
|
|
|
2382
|
+
/**
|
|
2383
|
+
* Takes an NPC a script spawned out of the session; every player's game drops it at the next update. The handle resolves to nothing after.
|
|
2384
|
+
* @returns True when it goes; false for one that stands for a placed reference, which lives for the whole session.
|
|
2385
|
+
*/
|
|
2386
|
+
remove(): boolean;
|
|
2387
|
+
|
|
1651
2388
|
/**
|
|
1652
2389
|
* Puts it back at its placement, whole, dead or alive; `npcRespawn` follows.
|
|
1653
2390
|
* @returns True when done.
|
|
@@ -1672,6 +2409,12 @@ declare global {
|
|
|
1672
2409
|
*/
|
|
1673
2410
|
getSimulator(): Player | null;
|
|
1674
2411
|
|
|
2412
|
+
/**
|
|
2413
|
+
* Who the NPC fights, as the game that runs it reports: its own choice, or the target `attack` gave it. The `npcTarget` event tells each change.
|
|
2414
|
+
* @returns Null while it fights nobody, or is dead.
|
|
2415
|
+
*/
|
|
2416
|
+
getCombatTarget(): Player | Npc | null;
|
|
2417
|
+
|
|
1675
2418
|
/**
|
|
1676
2419
|
* The player the NPC follows as a companion.
|
|
1677
2420
|
* @returns Null when it follows nobody.
|
|
@@ -1692,6 +2435,240 @@ declare global {
|
|
|
1692
2435
|
*/
|
|
1693
2436
|
damage(amount: number): boolean;
|
|
1694
2437
|
|
|
2438
|
+
/**
|
|
2439
|
+
* Gives the NPC health back, as FiveM's SetEntityHealth raises a ped's and Actor.RestoreValue does: the game that runs it restores it, and `health` follows with its next report. One nobody runs is healed on the server.
|
|
2440
|
+
* @param amount Health to give back, above 0; the NPC stops at its maximum.
|
|
2441
|
+
* @returns True when sent; false when it is dead or gone.
|
|
2442
|
+
*/
|
|
2443
|
+
heal(amount: number): boolean;
|
|
2444
|
+
|
|
2445
|
+
/**
|
|
2446
|
+
* Sends the NPC somewhere, as FiveM's TaskGoToCoord does a ped: the game that runs it has it travel there as a commanded companion does, along the navmesh, and the server walks it there while nobody near runs it. `npcArrive` follows once it is there; it then stands there until `stopGoing` or the next `goTo`. Its fights still come first.
|
|
2447
|
+
* @param target A point of the NPC's space, or a player or NPC to walk up to.
|
|
2448
|
+
* @returns True when sent; false when it is dead or the target is itself.
|
|
2449
|
+
*/
|
|
2450
|
+
goTo(target: Vector3 | Player | Npc): boolean;
|
|
2451
|
+
|
|
2452
|
+
/**
|
|
2453
|
+
* Has the NPC use a piece of furniture, as FiveM's TaskStartScenarioAtPosition puts a ped to a scenario and a companion obeys the player's command: the game that runs it walks it there and activates it, sitting down or getting to work, and sends it back if it gets up on its own. It replaces a `goTo` order, and `goTo` replaces it. `stopUsing` lets it go.
|
|
2454
|
+
* @param ref A placed piece of furniture, by its reference's form ID: a chair, a bench, a workstation.
|
|
2455
|
+
* @returns True when sent; false when it is dead or gone.
|
|
2456
|
+
*/
|
|
2457
|
+
use(ref: number | string): boolean;
|
|
2458
|
+
|
|
2459
|
+
/**
|
|
2460
|
+
* Sets the NPC's health at full, as FiveM's SetEntityMaxHealth does an entity: the game that runs it carries it as the NPC's permanent Health, and every player's copy takes it from there. The damage it took is kept, so an unhurt NPC stays at full. It lasts while the NPC does, through respawns.
|
|
2461
|
+
* @param value Health at full, at least 1.
|
|
2462
|
+
* @returns True when sent; false when it is dead or gone.
|
|
2463
|
+
*/
|
|
2464
|
+
setMaxHealth(value: number): boolean;
|
|
2465
|
+
|
|
2466
|
+
/**
|
|
2467
|
+
* Scales the NPC on every player's copy, as ObjectReference.SetScale does: its body, its collision and its reach grow or shrink together. It lasts while the NPC does, through respawns.
|
|
2468
|
+
* @param scale 1 for its record's size, from 0.01 to 10: 1.5 a hulking boss, 0.5 a runt.
|
|
2469
|
+
* @returns True when sent; false when it is gone.
|
|
2470
|
+
*/
|
|
2471
|
+
setScale(scale: number): boolean;
|
|
2472
|
+
|
|
2473
|
+
/**
|
|
2474
|
+
* Sets one of the NPC's actor values on every player's copy, as FiveM's ped natives tune a ped: SpeedMult (100 is its own speed) for SetPedMoveRateOverride, Aggression, Confidence and Assistance for SetPedCombatAttributes. Each copy holds the base, its own coming back with `resetValue`. A value the game derives from something else keeps its own: DamageResist comes from the armor worn, so dress the NPC (`setOutfit`) instead. An `attack` or `flee` order holds Aggression or Confidence while it runs. Up to 16 values per NPC; it lasts while the NPC does.
|
|
2475
|
+
* @param value An actor value by editor ID, such as `"SpeedMult"`, `"Aggression"` or `"Confidence"`, or by form ID. Not Health: `setMaxHealth` sets that.
|
|
2476
|
+
* @param base The base every copy holds.
|
|
2477
|
+
* @returns True when sent; false when the NPC is gone or 16 values are already set. Throws for a name or form no actor value has, and for Health.
|
|
2478
|
+
*/
|
|
2479
|
+
setValue(value: string | number, base: number): boolean;
|
|
2480
|
+
|
|
2481
|
+
/**
|
|
2482
|
+
* The base `setValue` gave one of the NPC's actor values.
|
|
2483
|
+
* @param value An actor value by editor ID, such as `"SpeedMult"`, `"Aggression"` or `"Confidence"`, or by form ID. Not Health: `setMaxHealth` sets that.
|
|
2484
|
+
* @returns Null when the script set none; the record's own is in each player's game alone.
|
|
2485
|
+
*/
|
|
2486
|
+
getValue(value: string | number): number | null;
|
|
2487
|
+
|
|
2488
|
+
/**
|
|
2489
|
+
* Gives every copy its own base for one actor value back.
|
|
2490
|
+
* @param value An actor value by editor ID, such as `"SpeedMult"`, `"Aggression"` or `"Confidence"`, or by form ID. Not Health: `setMaxHealth` sets that.
|
|
2491
|
+
* @returns True when sent; false when the NPC is gone or the value was not set.
|
|
2492
|
+
*/
|
|
2493
|
+
resetValue(value: string | number): boolean;
|
|
2494
|
+
|
|
2495
|
+
/**
|
|
2496
|
+
* Holds the NPC's weapon out or away, as FiveM's SetCurrentPedWeapon draws a ped's: the game that runs it draws or holsters it (Actor.DrawWeapon) and keeps it so when its AI would change it, and every player's copy follows. A guard on watch, a trader with nothing in hand. It does not start or end a fight.
|
|
2497
|
+
* @param drawn True to hold its weapon out, false to keep it away, null to leave it to its AI.
|
|
2498
|
+
* @returns True when sent; false when it is dead or gone.
|
|
2499
|
+
*/
|
|
2500
|
+
setWeaponDrawn(drawn: boolean | null): boolean;
|
|
2501
|
+
|
|
2502
|
+
/**
|
|
2503
|
+
* Takes the NPC's collision away or gives it back on every player's copy, as FiveM's SetEntityCollision does a ped and the console's tcl a selected actor: without it the NPC moves along where it looks, through walls and floors, without gravity. A ghost through a wall, a body walked out of a locked room. It lasts while the NPC does.
|
|
2504
|
+
* @param enabled False to take its collision away, true to give it back.
|
|
2505
|
+
* @returns True when sent; false when it is dead or gone.
|
|
2506
|
+
*/
|
|
2507
|
+
setCollision(enabled: boolean): boolean;
|
|
2508
|
+
|
|
2509
|
+
/**
|
|
2510
|
+
* Has the NPC sneak, as FiveM's SetPedStealthMovement does a ped: the game that runs it holds it in the sneak stance (the console's SetForceSneak) wherever its AI takes it, and every player's copy crouches with it. `isSneaking` reports the stance its game runs.
|
|
2511
|
+
* @param sneaking True to crouch into sneak, false to stand up.
|
|
2512
|
+
* @returns True when sent; false when it is dead or gone.
|
|
2513
|
+
*/
|
|
2514
|
+
setSneaking(sneaking: boolean): boolean;
|
|
2515
|
+
|
|
2516
|
+
/**
|
|
2517
|
+
* Knocks the NPC off its feet into its ragdoll, as FiveM's SetPedToRagdoll does a ped: the game that runs it pushes its body, it lies a moment and gets up by itself, and every player's copy falls and gets up with it. One that is down already, seated or held in place is left as it is.
|
|
2518
|
+
* @param force How hard it is thrown, as ObjectReference.PushActorAway takes it: small numbers, 1 to 50 (600 threw an NPC 8,700 units); 0, the default, drops it where it stands.
|
|
2519
|
+
* @param from The point it is thrown away from; where it stands by default.
|
|
2520
|
+
* @returns True when sent; false when it is dead, gone, or no player's game runs it.
|
|
2521
|
+
*/
|
|
2522
|
+
knockDown(force?: number, from?: Vector3): boolean;
|
|
2523
|
+
|
|
2524
|
+
/**
|
|
2525
|
+
* Draws the NPC more or less see-through on every player's copy, as FiveM's SetEntityAlpha does a ped and Actor.SetAlpha an actor: a ghost, a stalker, an NPC kept out of sight. Its collision and its AI are left as they are. It lasts while the NPC does.
|
|
2526
|
+
* @param alpha 0, invisible, to 1, solid.
|
|
2527
|
+
* @returns True when sent; false when it is gone.
|
|
2528
|
+
*/
|
|
2529
|
+
setAlpha(alpha: number): boolean;
|
|
2530
|
+
|
|
2531
|
+
/**
|
|
2532
|
+
* Has the NPC run from a player or an NPC, as FiveM's TaskSmartFleePed does a ped: the game that runs it puts it in combat with that body with its Confidence at Cowardly, so it runs and hides as a frightened settler does, and every player sees it. Its own Confidence comes back when it stops. It replaces an `attack` order, and `attack` replaces it. `stopFleeing` ends it.
|
|
2533
|
+
* @param from The body it runs from.
|
|
2534
|
+
* @returns True when sent; false when it is dead or gone, or the body is not alive in its space.
|
|
2535
|
+
*/
|
|
2536
|
+
flee(from: Player | Npc): boolean;
|
|
2537
|
+
|
|
2538
|
+
/**
|
|
2539
|
+
* Ends a `flee` order: the NPC's fight ends and its own Confidence comes back.
|
|
2540
|
+
* @returns True when sent; false when it is dead, gone or not fleeing.
|
|
2541
|
+
*/
|
|
2542
|
+
stopFleeing(): boolean;
|
|
2543
|
+
|
|
2544
|
+
/**
|
|
2545
|
+
* Has the NPC live around a point, as FiveM's TaskWanderInArea does a ped: the game that runs it idles, sits, leans and walks about within 512 units of the center, as Fallout 4's settlers sandbox, and every player sees it do so. It replaces a `goTo` or `use` order, and either replaces it. `stopWandering` gives it back its own packages.
|
|
2546
|
+
* @param center The middle of the area, in the NPC's space; where it stands when left out.
|
|
2547
|
+
* @returns True when sent; false when it is dead or gone.
|
|
2548
|
+
*/
|
|
2549
|
+
wander(center?: Vector3): boolean;
|
|
2550
|
+
|
|
2551
|
+
/**
|
|
2552
|
+
* Ends a `wander` order: the NPC goes back to its own packages.
|
|
2553
|
+
* @returns True when sent; false when it is dead, gone or not wandering.
|
|
2554
|
+
*/
|
|
2555
|
+
stopWandering(): boolean;
|
|
2556
|
+
|
|
2557
|
+
/**
|
|
2558
|
+
* Freezes the NPC in place on every player's copy, as FiveM's FreezeEntityPosition does a ped and Actor.SetRestrained an actor: it stands where it is and neither walks, fights nor talks, its head still free to turn (`lookAt`). A shopkeeper behind his counter, a prisoner. It lasts through respawns.
|
|
2559
|
+
* @param restrained True to freeze it where it stands, false to let it go.
|
|
2560
|
+
* @returns True when sent; false when the NPC is gone.
|
|
2561
|
+
*/
|
|
2562
|
+
setRestrained(restrained: boolean): boolean;
|
|
2563
|
+
|
|
2564
|
+
/**
|
|
2565
|
+
* Turns the NPC's head and eyes toward a player or another NPC and keeps them there, on every player's copy, as FiveM's TaskLookAtEntity does a ped and Actor.SetLookAt an actor: a shopkeeper watching his customer, a guard eyeing a stranger. It does not turn its body or stop what it does.
|
|
2566
|
+
* @param target Whose body to watch; null to look where it pleases again.
|
|
2567
|
+
* @returns True when sent; false when the NPC is gone, the target is itself, or it looked at nobody and null was given.
|
|
2568
|
+
*/
|
|
2569
|
+
lookAt(target: Player | Npc | null): boolean;
|
|
2570
|
+
|
|
2571
|
+
/**
|
|
2572
|
+
* Drops the order `use` gave: the NPC gets up and goes back to its own business.
|
|
2573
|
+
* @returns True when it had one.
|
|
2574
|
+
*/
|
|
2575
|
+
stopUsing(): boolean;
|
|
2576
|
+
|
|
2577
|
+
/**
|
|
2578
|
+
* Drops the order `goTo` gave: the NPC goes back to its own business.
|
|
2579
|
+
* @returns True when it had one.
|
|
2580
|
+
*/
|
|
2581
|
+
stopGoing(): boolean;
|
|
2582
|
+
|
|
2583
|
+
/**
|
|
2584
|
+
* Sets the NPC on someone, as FiveM's TaskCombatPed does a ped: the game that runs it starts combat with the target, as Actor.StartCombat does, and keeps its aim on it whatever its own target choice would be. It fights with what it carries, and the hits go through `npcAttack` as any other. The order ends when the target dies or leaves, or with `stopAttacking`.
|
|
2585
|
+
* @param target Who to fight: a living player or NPC of its space.
|
|
2586
|
+
* @returns True when sent; false when it is dead, or the target is itself or no living player or NPC of its space.
|
|
2587
|
+
*/
|
|
2588
|
+
attack(target: Player | Npc): boolean;
|
|
2589
|
+
|
|
2590
|
+
/**
|
|
2591
|
+
* The memberships scripts changed on the NPC, each with its rank, or -1 for a faction it was taken out of. The factions its record gives it and no script touched are not listed.
|
|
2592
|
+
* @returns One entry per faction, in the order they were first changed; empty when the NPC is gone.
|
|
2593
|
+
*/
|
|
2594
|
+
getFactions(): { faction: number; rank: number }[];
|
|
2595
|
+
|
|
2596
|
+
/**
|
|
2597
|
+
* Puts the NPC in a faction at a rank, or re-ranks it, as `Actor.SetFactionRank` does and FiveM's relationship groups do for a ped: every player's copy holds the membership, so the game's own hostility follows. A raider taken out of RaiderFaction and put in PlayerFaction (0x1C21C) treats players as its own. Up to 16 factions per NPC.
|
|
2598
|
+
* @param faction A TESFaction form ID, as a number or hex string.
|
|
2599
|
+
* @param rank 0 to 127; 0 when left out.
|
|
2600
|
+
* @returns True when set; false when the NPC is gone or 16 of its factions are already changed.
|
|
2601
|
+
*/
|
|
2602
|
+
setFactionRank(faction: number | string, rank?: number): boolean;
|
|
2603
|
+
|
|
2604
|
+
/**
|
|
2605
|
+
* Takes the NPC out of a faction on every player's copy, as `Actor.RemoveFromFaction` does, whether its record or a script put it there.
|
|
2606
|
+
* @param faction A TESFaction form ID, as a number or hex string.
|
|
2607
|
+
* @returns True when sent; false when the NPC is gone or 16 of its factions are already changed.
|
|
2608
|
+
*/
|
|
2609
|
+
removeFromFaction(faction: number | string): boolean;
|
|
2610
|
+
|
|
2611
|
+
/**
|
|
2612
|
+
* Names the NPC on every player's copy, as a named ped in a FiveM resource: the crosshair, its health bar and its dialogue show the name in place of its record's ("Settler", "Raider"), as a reference's ExtraTextDisplayData does.
|
|
2613
|
+
* @param name What it is called, up to 47 bytes of UTF-8; null or an empty string gives it back its record's own name.
|
|
2614
|
+
* @returns True when sent; false when the NPC is gone.
|
|
2615
|
+
*/
|
|
2616
|
+
setName(name: string | null): boolean;
|
|
2617
|
+
|
|
2618
|
+
/**
|
|
2619
|
+
* Stops what the game does when a player activates the NPC (its greeting, its dialogue, a trade), as ObjectReference.BlockActivation does, on every player's copy: `npcActivate` is still raised, so a script answers with its own interaction, as FiveM resources do for a ped.
|
|
2620
|
+
* @param blocked True to stop the game's own activation, false to give it back.
|
|
2621
|
+
* @returns True when sent; false when the NPC is gone.
|
|
2622
|
+
*/
|
|
2623
|
+
setActivationBlocked(blocked: boolean): boolean;
|
|
2624
|
+
|
|
2625
|
+
/**
|
|
2626
|
+
* Makes the NPC unhurtable by players and NPCs, as FiveM's SetEntityInvincible does a ped: every player's copy is a ghost (Actor.SetGhost), which shots, blows and explosions pass over, and the server drops any hit still reported on it. The script's own `damage` and `kill` still go through.
|
|
2627
|
+
* @param invulnerable True to make it unhurtable, false to make it hurtable again.
|
|
2628
|
+
* @returns True when sent; false when the NPC is gone.
|
|
2629
|
+
*/
|
|
2630
|
+
setInvulnerable(invulnerable: boolean): boolean;
|
|
2631
|
+
|
|
2632
|
+
/**
|
|
2633
|
+
* Plays an idle animation on the NPC, as FiveM's TaskPlayAnim does a ped and `Player.playIdle` a player: every player's copy plays it. The idle's own conditions apply, so one meant for another skeleton, a piece of furniture or a state the NPC is not in does nothing, and the NPC's own AI may cut it short. `stopIdle` ends it.
|
|
2634
|
+
* @param idle An idle animation (IDLE) by editor ID, such as `"IdleWave"`, or form ID.
|
|
2635
|
+
* @returns True when sent; false when the NPC is dead or gone. Throws for a form no IDLE record has.
|
|
2636
|
+
*/
|
|
2637
|
+
playIdle(idle: number | string): boolean;
|
|
2638
|
+
|
|
2639
|
+
/**
|
|
2640
|
+
* Has the NPC speak, voice and subtitle, as FiveM's PlayPedAmbientSpeechNative does a ped and Papyrus ObjectReference.Say an actor: every player near it hears the same line. A topic's line is picked by the game running the NPC among those whose conditions pass for it (its voice type, its faction), and the others say that one; a topic with no line for this NPC says nothing. Most generic topics have no editor ID: give their form ID.
|
|
2641
|
+
* @param line A dialogue topic (DIAL) by form ID or editor ID, such as `0x47895`, a raider's idle chatter, or one line of a topic (INFO) by form ID.
|
|
2642
|
+
* @returns True when sent; false when the NPC is dead or gone. Throws for a form no DIAL or INFO record has.
|
|
2643
|
+
*/
|
|
2644
|
+
say(line: number | string): boolean;
|
|
2645
|
+
|
|
2646
|
+
/**
|
|
2647
|
+
* Ends the idle animation the NPC plays, on every player's copy.
|
|
2648
|
+
* @returns True when sent; false when the NPC is dead or gone.
|
|
2649
|
+
*/
|
|
2650
|
+
stopIdle(): boolean;
|
|
2651
|
+
|
|
2652
|
+
/**
|
|
2653
|
+
* Dresses the NPC, as FiveM's SetPedComponentVariation does a ped: every player's copy wears the pieces, locked, each over what the NPC's record gives it in the same body slots. It lasts while the NPC does, through respawns.
|
|
2654
|
+
* @param armors Up to 12 armor pieces or clothes (ARMO) by form ID or editor ID, such as `"Armor_Raider_Underarmor"`; null or an empty list gives it back its own clothes.
|
|
2655
|
+
* @returns True when sent; false when the NPC is gone. Throws for a piece no ARMO record has.
|
|
2656
|
+
*/
|
|
2657
|
+
setOutfit(armors: (number | string)[] | null): boolean;
|
|
2658
|
+
|
|
2659
|
+
/**
|
|
2660
|
+
* Arms the NPC, as FiveM's GiveWeaponToPed does a ped: every player's copy carries the weapon with ammunition and wears it locked, so the game that runs it fights with it and everyone sees it. It lasts while the NPC does, through respawns.
|
|
2661
|
+
* @param weapon A weapon (WEAP) by form ID or editor ID, such as `"Minigun"`; null hands the NPC back its own.
|
|
2662
|
+
* @returns True when sent; false when the NPC is gone. Throws for a form no WEAP record has.
|
|
2663
|
+
*/
|
|
2664
|
+
giveWeapon(weapon: number | string | null): boolean;
|
|
2665
|
+
|
|
2666
|
+
/**
|
|
2667
|
+
* Drops the order `attack` gave: the NPC stops fighting, as Actor.StopCombat does.
|
|
2668
|
+
* @returns True when it had one.
|
|
2669
|
+
*/
|
|
2670
|
+
stopAttacking(): boolean;
|
|
2671
|
+
|
|
1695
2672
|
/**
|
|
1696
2673
|
* Moves the NPC within its space. Left alone, it wanders back toward its placement over time.
|
|
1697
2674
|
* @param position Where to, in the NPC's own space.
|
|
@@ -1700,6 +2677,24 @@ declare global {
|
|
|
1700
2677
|
*/
|
|
1701
2678
|
teleport(position: Vector3, heading?: number): boolean;
|
|
1702
2679
|
|
|
2680
|
+
/**
|
|
2681
|
+
* The NPCs around a point or a player, nearest first, as FiveM scripts walk the ped pool or ask GetClosestPed: where a script finds the shopkeeper by a door or the raiders near a camp. Positions are the ones the simulators last reported.
|
|
2682
|
+
* @param center A point, or a player, whose position and space are then the search's.
|
|
2683
|
+
* @param radius How far from it, in game units.
|
|
2684
|
+
* @param options `space`: where a point is, the Commonwealth when left out. `limit`: how many at most, 32 by default, never more than 512. `includeDead`: count the dead too.
|
|
2685
|
+
* @returns Empty when none is in range, or the player is gone. Throws for a center that is neither, or a negative radius.
|
|
2686
|
+
*/
|
|
2687
|
+
static getInRange(center: Vector3 | Player, radius: number, options?: { space?: { worldSpace: number } | { interiorCell: number }; limit?: number; includeDead?: boolean }): Npc[];
|
|
2688
|
+
|
|
2689
|
+
/**
|
|
2690
|
+
* Makes a new NPC, as a FiveM script creates a ped: every player's game builds it, a client near it runs it with the game's own AI and the server walks it while nobody is near, as it does the placed ones. Unique, essential and quest actors are each player's own: spawn generic ones. It stays dead when killed (`npcDeath` is raised) until `respawn` puts it back where it was spawned.
|
|
2691
|
+
* @param base What to make: an NPC record (NPC_) or a leveled list of them (LVLN, rolled here), by form ID or editor ID, such as `"LCharRaider"` or `"EncRaider01"`.
|
|
2692
|
+
* @param position Where it stands, in game units.
|
|
2693
|
+
* @param options `heading` in radians around Z (0 faces +Y); `space` the worldspace or interior cell, the Commonwealth when left out.
|
|
2694
|
+
* @returns The new NPC; null when a leveled list rolled to nothing. Throws for a base that is no NPC_ or LVLN record.
|
|
2695
|
+
*/
|
|
2696
|
+
static spawn(base: number | string, position: Vector3, options?: { heading?: number; space?: { worldSpace: number } | { interiorCell: number } }): Npc | null;
|
|
2697
|
+
|
|
1703
2698
|
/**
|
|
1704
2699
|
* Every NPC the server took over.
|
|
1705
2700
|
* @returns One handle per NPC; empty when the server could not read the game's data files.
|
|
@@ -1767,15 +2762,16 @@ declare global {
|
|
|
1767
2762
|
getSpace(): PlayerSpace | null;
|
|
1768
2763
|
|
|
1769
2764
|
/**
|
|
1770
|
-
* Builds an object for everyone, as if a player had at that workbench. Nothing is checked: not the recipe, its cost nor the buildable area.
|
|
2765
|
+
* Builds an object for everyone, as if a player had at that workbench. Nothing is checked: not the recipe, its cost nor the buildable area. A wire is laid out between its two ends on every client once both are loaded, and linked into their power grid.
|
|
1771
2766
|
* @param form The base object to build.
|
|
1772
2767
|
* @param workbench The workbench reference it belongs to, placed by the data files.
|
|
1773
2768
|
* @param position Where it stands.
|
|
1774
2769
|
* @param space The worldspace, or the interior cell: exactly one of the two.
|
|
1775
2770
|
* @param angle Its rotation, radians.
|
|
2771
|
+
* @param wire For a wire (the game's workshop spline), the two objects it joins: a built object, or a placed reference's form ID, each with the connect point the wire takes on it (0 by default).
|
|
1776
2772
|
* @returns The object, or null when it could not be created.
|
|
1777
2773
|
*/
|
|
1778
|
-
static place(form: number | string, workbench: number | string, position: Vector3, space: { worldSpace?: number | string; interiorCell?: number | string }, angle?: Vector3): WorkshopItem | null;
|
|
2774
|
+
static place(form: number | string, workbench: number | string, position: Vector3, space: { worldSpace?: number | string; interiorCell?: number | string }, angle?: Vector3, wire?: { from: WorkshopItem | number | string; to: WorkshopItem | number | string; fromPoint?: number; toPoint?: number }): WorkshopItem | null;
|
|
1779
2775
|
|
|
1780
2776
|
/**
|
|
1781
2777
|
* Every object built this session.
|