@adatechnology/game-vfx 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -1
- package/dist/index.d.ts +396 -6
- package/dist/index.global.js +785 -15
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +785 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -62,7 +62,9 @@ material, a place and a turn inside a group, a scale ramp, growth, drag, gravity
|
|
|
62
62
|
the order of the gallery's `Particles`. `play` can also take the thing's whole turn (`orientation`, a unit quaternion, pitch and roll included, instead of the turn
|
|
63
63
|
about the vertical axis `direction` gives) and named numbers (`values`, read with `variable(name)`). `VIEWMODEL_EFFECTS` use all three: the first-person muzzle flash
|
|
64
64
|
(`viewmodel_muzzle_flash`: an open cone, four small cones and a core for 55 ms, a light that holds, six spheres of smoke), `weapon_smoke_puff`, `launcher_backblast` and
|
|
65
|
-
`flame_jet`, written in the weapon's own axes (x along the barrel) with the Arsenal gallery's numbers and the order it drew them in.
|
|
65
|
+
`flame_jet`, written in the weapon's own axes (x along the barrel) with the Arsenal gallery's numbers and the order it drew them in. With `track` (a function
|
|
66
|
+
answering where the thing is now, asked every frame) an effect rides on the thing it belongs to: its grouped pieces and its light keep their place on it (a muzzle
|
|
67
|
+
flash stays on the muzzle the view turns), and the smoke it throws stays in the air; `world.follow()` puts them where the thing is after the frame moved it.
|
|
66
68
|
|
|
67
69
|
`vfx.burst(kind, point, normal, count, speed?)` and `vfx.spawn(kind, point, velocity)` are the **sprite kinds** that destruction, fluids and weapons share
|
|
68
70
|
(debris, sparks, ash, steam, drips, leaks...: `data/sprite-kinds.json`, `patchSpriteKinds`), with `onLand(owner, ...)` to hear where a drop touched the ground.
|
|
@@ -77,6 +79,27 @@ is the recipes plus these, what a world plays by default. Texts of every recipe
|
|
|
77
79
|
`vehicle_leak` is the page's pool and drips without the fire and the explosion (`FUEL_LEAK_ONLY`: the same `decal` and `emit` steps); `vehicle_leak_ignited` is the whole sequence (the spark, the fire running along
|
|
78
80
|
the pool to the tank and the blast at 7.2 s), played when the leak catches fire.
|
|
79
81
|
|
|
82
|
+
## Water: rounds and blasts on water
|
|
83
|
+
|
|
84
|
+
`createWaterEffects({ levelAt, limits, seed })` draws what a round or a charge does to water, renderer-free (`createWaterEffectsLayer` of game-vfx-three draws it).
|
|
85
|
+
|
|
86
|
+
- `shot({ point, direction, profile, speed, depth })`: the splash of a class of round where it meets the surface. The classes are data
|
|
87
|
+
(`WATER_SHOT_PROFILES`, `patchWaterShotProfiles`): `rimfire`, `pistol`, `magnum`, `rifle` (5.56, 7.62x39: a tall thin spout, many fast drops),
|
|
88
|
+
`battle_rifle`, `sniper` (.338, .50: a tall wide column, a wide ring), `buckshot` (a small spout and a lot of shallow foam per pellet), `birdshot`,
|
|
89
|
+
`slug`, `arrow`, `fragment` and `object` (a thrown thing falling in). `WATER_SHOT_BY_CALIBER` gives the class of every calibre of `game-weapons`;
|
|
90
|
+
`waterShotClassOf` classes an unknown round by mass and speed. A round below `ricochetBelowDeg` skips off (`plan.ricochet`: the new direction and
|
|
91
|
+
the share of speed kept) with a low spout leaning its way; a steeper one throws a column, a crown of drops, rings and foam, and leaves a trail of
|
|
92
|
+
bubbles that stops where it is spent (`slowing`: metres to lose 1/e of its speed) or at the bed.
|
|
93
|
+
- `blast({ point, level, depth, explosive | tnt, kind })`: a charge by Hopkinson scaling (lengths go with the cube root of the TNT): the tallest column
|
|
94
|
+
a little under the surface, a lower one and the fireball at the surface, a dome of white water and a boil of bubbles deep under (`plan.underwater`:
|
|
95
|
+
no fireball), only the shock ring and spray high over it (`airburst`); a shallow pool cannot throw a full column. Every blast sends a fast shock
|
|
96
|
+
ring, three wave crests, a rain of drops that falls back and rings where it lands, mist and a slick of foam; a fragmentation charge at the surface
|
|
97
|
+
peppers the water around. `WATER_BLASTS` (TNT and kind of each explosive of `game-weapons`) and `WATER_BLAST_KINDS` (`brisance`, column width,
|
|
98
|
+
fragments, mist) are the data.
|
|
99
|
+
- `waveAt(x, z)`: the height and the push (m/s) of the waves there, for what floats and for a body standing in the water.
|
|
100
|
+
- Every record has a life and every pool a limit (`WATER_LIMITS`, `limits`); far from the camera (`setCamera`, `LOD_GAME`) fewer drops and bubbles
|
|
101
|
+
are made. `levelAt` keeps rings, foam and waves inside the water (they stop at the shore) and rings only the drops that fall back on water.
|
|
102
|
+
|
|
80
103
|
## Closed spaces (a shut car keeps the smoke out)
|
|
81
104
|
|
|
82
105
|
`world.enclose(id, { center, halfSize, orientation, openings, leak })` declares a closed space: a turned box the smoke, dust, steam and gas do not
|
package/dist/index.d.ts
CHANGED
|
@@ -851,6 +851,22 @@ interface WorkshopContext {
|
|
|
851
851
|
readonly confiner?: Confiner;
|
|
852
852
|
}
|
|
853
853
|
|
|
854
|
+
/** A unit quaternion `[x, y, z, w]`. */
|
|
855
|
+
type Quaternion = readonly [number, number, number, number];
|
|
856
|
+
/**
|
|
857
|
+
* The live pose of the thing an effect belongs to (the muzzle of a gun in the hands), moved by whoever plays the effect while it lives: the pieces drawn in
|
|
858
|
+
* its own axes (the cones of a muzzle flash) and its lights ride on it, and what is thrown free (smoke) stays in the world.
|
|
859
|
+
*/
|
|
860
|
+
interface Carrier {
|
|
861
|
+
origin: Vec3Tuple;
|
|
862
|
+
orientation: Quaternion | undefined;
|
|
863
|
+
}
|
|
864
|
+
/** What a piece keeps to ride on a carrier: the carrier and where the piece sits in the recipe's space (from the recipe's anchor). */
|
|
865
|
+
interface Carried {
|
|
866
|
+
readonly carrier: Carrier;
|
|
867
|
+
readonly local: Vec3Tuple;
|
|
868
|
+
}
|
|
869
|
+
|
|
854
870
|
interface DebrisPiece {
|
|
855
871
|
on: boolean;
|
|
856
872
|
x: number;
|
|
@@ -966,8 +982,6 @@ declare class RainField {
|
|
|
966
982
|
private set;
|
|
967
983
|
}
|
|
968
984
|
|
|
969
|
-
/** A unit quaternion `[x, y, z, w]`. */
|
|
970
|
-
type Quaternion = readonly [number, number, number, number];
|
|
971
985
|
/** One solid particle as the pool keeps it; a renderer draws it from these fields and never changes them. */
|
|
972
986
|
interface MeshParticle {
|
|
973
987
|
/** Grows by one for every particle ever spawned: a renderer knows a new one by it. */
|
|
@@ -984,7 +998,7 @@ interface MeshParticle {
|
|
|
984
998
|
x: number;
|
|
985
999
|
y: number;
|
|
986
1000
|
z: number;
|
|
987
|
-
|
|
1001
|
+
frame: Quaternion;
|
|
988
1002
|
readonly at: Vec3Tuple;
|
|
989
1003
|
rx: number;
|
|
990
1004
|
ry: number;
|
|
@@ -1003,6 +1017,10 @@ interface MeshParticle {
|
|
|
1003
1017
|
readonly ramp: readonly [number, number] | undefined;
|
|
1004
1018
|
readonly fade: boolean;
|
|
1005
1019
|
readonly startOpacity: number;
|
|
1020
|
+
/** A piece of a group that rides on the effect's carrier (a muzzle flash on the gun in the hands): its own roll in the group, and how far it moved from its place on the carrier. */
|
|
1021
|
+
readonly carried: Carried | undefined;
|
|
1022
|
+
readonly roll: Quaternion | undefined;
|
|
1023
|
+
readonly drift: [number, number, number];
|
|
1006
1024
|
}
|
|
1007
1025
|
/**
|
|
1008
1026
|
* The solids of the Workshop's recipes: the gallery's `Particles` (thrown with a velocity and a spin, slowed, lifted by a negative gravity, grown and faded) without
|
|
@@ -1014,9 +1032,15 @@ declare class MeshPool {
|
|
|
1014
1032
|
private serial;
|
|
1015
1033
|
constructor(capacity?: number);
|
|
1016
1034
|
get count(): number;
|
|
1017
|
-
spawn(options: MeshSpawn, frame?: Quaternion): MeshParticle;
|
|
1035
|
+
spawn(options: MeshSpawn, frame?: Quaternion, carried?: Carried): MeshParticle;
|
|
1018
1036
|
update(dt: number): void;
|
|
1019
1037
|
clear(): void;
|
|
1038
|
+
/** Puts every carried piece where its carrier is now (after the frame moved the thing it belongs to). */
|
|
1039
|
+
follow(): void;
|
|
1040
|
+
/** A carried piece: how far its own velocity took it, then its place on the carrier. */
|
|
1041
|
+
private ride;
|
|
1042
|
+
/** A carried piece's place on the carrier now plus its drift, turned with the carrier. */
|
|
1043
|
+
private place;
|
|
1020
1044
|
}
|
|
1021
1045
|
|
|
1022
1046
|
interface DecalFromSprite {
|
|
@@ -1125,6 +1149,8 @@ interface FlashLight {
|
|
|
1125
1149
|
intensity: number;
|
|
1126
1150
|
/** Holds `peak` until `duration` is over. */
|
|
1127
1151
|
steady: boolean;
|
|
1152
|
+
/** Rides on the effect's carrier while it burns (a muzzle flash on the gun in the hands). */
|
|
1153
|
+
carried?: Carried | undefined;
|
|
1128
1154
|
}
|
|
1129
1155
|
interface FireLightSlot {
|
|
1130
1156
|
x: number;
|
|
@@ -1140,8 +1166,10 @@ declare class FlashLightPool {
|
|
|
1140
1166
|
private next;
|
|
1141
1167
|
constructor(context: WorkshopContext);
|
|
1142
1168
|
get lit(): number;
|
|
1143
|
-
flash(point: Vec3Tuple, color: number, intensity: number, duration: number, distance?: number, force?: boolean | 'boom', steady?: boolean):
|
|
1169
|
+
flash(point: Vec3Tuple, color: number, intensity: number, duration: number, distance?: number, force?: boolean | 'boom', steady?: boolean): FlashLight | undefined;
|
|
1144
1170
|
clear(): void;
|
|
1171
|
+
/** Puts every carried light that burns where its carrier is now. */
|
|
1172
|
+
follow(): void;
|
|
1145
1173
|
update(dt: number): void;
|
|
1146
1174
|
}
|
|
1147
1175
|
|
|
@@ -1176,6 +1204,8 @@ interface Placement {
|
|
|
1176
1204
|
readonly anchor: Vec3Tuple;
|
|
1177
1205
|
readonly yaw: number;
|
|
1178
1206
|
readonly orientation?: Quaternion;
|
|
1207
|
+
/** The live pose the effect rides on while it lives (`origin` and `orientation` move with it): its grouped pieces and its lights follow it. */
|
|
1208
|
+
readonly carrier?: Carrier;
|
|
1179
1209
|
}
|
|
1180
1210
|
interface WorkshopOptions {
|
|
1181
1211
|
readonly random: RandomStream;
|
|
@@ -1216,6 +1246,8 @@ declare class WorkshopEngine {
|
|
|
1216
1246
|
scaled(count: number): number;
|
|
1217
1247
|
/** A point of the recipe's space in the world (`undefined` placement: as is). */
|
|
1218
1248
|
place(point: Vec3Tuple): Vec3Tuple;
|
|
1249
|
+
/** A point of the recipe's space from the anchor, turned by the placement's yaw when it has no orientation (the carrier turns the rest). */
|
|
1250
|
+
private local;
|
|
1219
1251
|
/** A direction or velocity of the recipe's space in the world. */
|
|
1220
1252
|
turn(vector: Vec3Tuple): Vec3Tuple;
|
|
1221
1253
|
private placed;
|
|
@@ -1464,6 +1496,11 @@ interface Behavior {
|
|
|
1464
1496
|
update(host: BehaviorHost, dt: number, elapsed: number): void;
|
|
1465
1497
|
}
|
|
1466
1498
|
|
|
1499
|
+
/** Where the thing an effect belongs to is now (a muzzle), asked every frame the effect lives; `null` leaves the effect where it was last put. */
|
|
1500
|
+
type EffectTrack = () => {
|
|
1501
|
+
readonly point: Vec3Tuple;
|
|
1502
|
+
readonly orientation?: readonly [number, number, number, number];
|
|
1503
|
+
} | null;
|
|
1467
1504
|
interface PlayOptions {
|
|
1468
1505
|
/** Which way the effect points in the world (the muzzle's barrel, the spray of a jet). */
|
|
1469
1506
|
readonly direction?: Vec3Tuple;
|
|
@@ -1479,6 +1516,11 @@ interface PlayOptions {
|
|
|
1479
1516
|
readonly values?: Readonly<Record<string, number>>;
|
|
1480
1517
|
/** Moves with a thing: the effect sits at its position plus the point it was played at. */
|
|
1481
1518
|
readonly follow?: Follow;
|
|
1519
|
+
/**
|
|
1520
|
+
* Rides on the thing it belongs to while it lives (the muzzle of a gun in the hands, which the view turns and the kick moves): the effect's grouped pieces (the
|
|
1521
|
+
* flash's cones) and its lights keep their place on it, and what it throws free (smoke) is thrown from where the thing is and stays in the world.
|
|
1522
|
+
*/
|
|
1523
|
+
readonly track?: EffectTrack;
|
|
1482
1524
|
/** Stops after this many seconds (default: the recipe's loop). */
|
|
1483
1525
|
readonly seconds?: number;
|
|
1484
1526
|
}
|
|
@@ -1499,6 +1541,8 @@ interface EffectPlayer {
|
|
|
1499
1541
|
stop(handle: number): void;
|
|
1500
1542
|
/** Runs the timers and ticks of every live effect (the engine's pools are aged by its owner). */
|
|
1501
1543
|
update(dt: number): void;
|
|
1544
|
+
/** Moves the carrier of every tracked effect to where its thing is now (after the frame moved it); the engine's `follow` then puts the carried pieces there. True when one is live. */
|
|
1545
|
+
retrack(): boolean;
|
|
1502
1546
|
clear(): void;
|
|
1503
1547
|
readonly active: number;
|
|
1504
1548
|
has(id: string): boolean;
|
|
@@ -1742,6 +1786,11 @@ interface VfxWorld {
|
|
|
1742
1786
|
* (`workshop()`); `null` when the id is unknown. Returns a handle for `stop`.
|
|
1743
1787
|
*/
|
|
1744
1788
|
play(id: string, point: Vec3Like, options?: PlayOptions): number | null;
|
|
1789
|
+
/**
|
|
1790
|
+
* Puts what rides on a thing (an effect played with `track`: a muzzle flash) where the thing is now. `update` does it as it steps; call this too after the frame moved
|
|
1791
|
+
* the things (the gun posed, the view turned) and before drawing, so the flash is drawn on the muzzle of this frame and not of the last. True when something rides.
|
|
1792
|
+
*/
|
|
1793
|
+
follow(): boolean;
|
|
1745
1794
|
/** The Workshop's pools (sprites, streaks, debris, decals, rings, lights, screen): what the renderer draws for `play`. Made on first use. */
|
|
1746
1795
|
workshop(): WorkshopEngine;
|
|
1747
1796
|
/** The Workshop engine if something already made it (`play`, `workshop()`); never creates it. */
|
|
@@ -1989,4 +2038,345 @@ declare const SMOKE_COLORS: {
|
|
|
1989
2038
|
readonly gas: Rgb;
|
|
1990
2039
|
};
|
|
1991
2040
|
|
|
1992
|
-
|
|
2041
|
+
/** A point or a vector as plain numbers, metres (y up). */
|
|
2042
|
+
type WaterVec3 = readonly [number, number, number];
|
|
2043
|
+
/** How one class of round meets the water, for a round that enters straight down at `speed`. Numbers are metres, seconds and metres per second. */
|
|
2044
|
+
interface WaterShotProfile {
|
|
2045
|
+
/** Speed the numbers are for: a slower round throws less, a faster one a little more. */
|
|
2046
|
+
readonly speed: number;
|
|
2047
|
+
/** Height of the column of water a round entering straight down throws up. */
|
|
2048
|
+
readonly columnHeight: number;
|
|
2049
|
+
/** Radius of that column at its foot. */
|
|
2050
|
+
readonly columnRadius: number;
|
|
2051
|
+
/** Drops of the crown thrown out around the column. */
|
|
2052
|
+
readonly drops: number;
|
|
2053
|
+
/** Speed the crown's drops leave at, slowest and fastest. */
|
|
2054
|
+
readonly dropSpeed: readonly [number, number];
|
|
2055
|
+
/** Radius of one drop. */
|
|
2056
|
+
readonly dropSize: number;
|
|
2057
|
+
/** Radius the widest ring reaches before it is gone. */
|
|
2058
|
+
readonly ringRadius: number;
|
|
2059
|
+
/** Rings that follow one another out from the point. */
|
|
2060
|
+
readonly rings: number;
|
|
2061
|
+
/** Seconds a ring lives. */
|
|
2062
|
+
readonly ringLife: number;
|
|
2063
|
+
/** Radius of the patch of foam left at the point. */
|
|
2064
|
+
readonly foamRadius: number;
|
|
2065
|
+
/** Seconds the foam lasts. */
|
|
2066
|
+
readonly foamLife: number;
|
|
2067
|
+
/** Metres of water the round crosses to lose 1/e of its speed (a rifle bullet yaws and breaks up within a few tens of centimetres). */
|
|
2068
|
+
readonly slowing: number;
|
|
2069
|
+
/** Bubbles left per metre of the trail under the water. */
|
|
2070
|
+
readonly bubblesPerMetre: number;
|
|
2071
|
+
/** Below this angle to the surface, in degrees, the round skips off the water instead of going in. */
|
|
2072
|
+
readonly ricochetBelowDeg: number;
|
|
2073
|
+
}
|
|
2074
|
+
/** The ids of `WATER_SHOT_PROFILES`; a host may add its own (`patchWaterShotProfiles`). */
|
|
2075
|
+
type WaterShotClass = 'rimfire' | 'pistol' | 'magnum' | 'rifle' | 'battle_rifle' | 'sniper' | 'buckshot' | 'birdshot' | 'slug' | 'arrow' | 'fragment' | 'object';
|
|
2076
|
+
/** How a kind of charge works on water. */
|
|
2077
|
+
interface WaterBlastKind {
|
|
2078
|
+
/** Share of the charge that acts on the water like a high explosive: 1 for a high explosive, little for a gas or fuel that only burns fast. */
|
|
2079
|
+
readonly brisance: number;
|
|
2080
|
+
/** Width of the column against a high explosive's (a shaped charge throws a narrow jet). */
|
|
2081
|
+
readonly columnWidth: number;
|
|
2082
|
+
/** Fragments that pepper the water around a charge that bursts at or over the surface. */
|
|
2083
|
+
readonly fragments: number;
|
|
2084
|
+
/** Steam and spray against a high explosive's (a fuel fire boils a lot of water into mist). */
|
|
2085
|
+
readonly mist: number;
|
|
2086
|
+
/** The fireball still shows under the water (never for a real charge; a host may want it). */
|
|
2087
|
+
readonly fireballUnderwater: boolean;
|
|
2088
|
+
}
|
|
2089
|
+
/** The kinds of `WATER_BLAST_KINDS`, as `@adatechnology/game-weapons` names them. */
|
|
2090
|
+
type WaterBlastKindId = 'blast' | 'fragmentation' | 'shaped_charge' | 'fuel' | 'flash' | 'directional' | 'incendiary';
|
|
2091
|
+
/** One explosive of the table: its TNT equivalent in kilograms and its kind. */
|
|
2092
|
+
interface WaterBlastCharge {
|
|
2093
|
+
readonly tnt: number;
|
|
2094
|
+
readonly kind: string;
|
|
2095
|
+
}
|
|
2096
|
+
/** A round meeting the water. */
|
|
2097
|
+
interface WaterShotParams {
|
|
2098
|
+
/** Where the round meets the surface. */
|
|
2099
|
+
readonly point: WaterVec3;
|
|
2100
|
+
/** Unit vector the round travels along. */
|
|
2101
|
+
readonly direction: WaterVec3;
|
|
2102
|
+
/** The class of round (`WATER_SHOT_PROFILES` id) or a profile of its own. */
|
|
2103
|
+
readonly profile: string | WaterShotProfile;
|
|
2104
|
+
/** Speed of the round at the surface; the profile's own when left out. */
|
|
2105
|
+
readonly speed?: number;
|
|
2106
|
+
/** Metres of water under the point (the trail stops at the bed). Default 2. */
|
|
2107
|
+
readonly depth?: number;
|
|
2108
|
+
}
|
|
2109
|
+
/** A charge going off in or over the water. */
|
|
2110
|
+
interface WaterBlastParams {
|
|
2111
|
+
/** The centre of the burst. */
|
|
2112
|
+
readonly point: WaterVec3;
|
|
2113
|
+
/** Height of the water surface over the point. */
|
|
2114
|
+
readonly level: number;
|
|
2115
|
+
/** Metres of water from the bed to the surface there. */
|
|
2116
|
+
readonly depth: number;
|
|
2117
|
+
/** Id of an explosive of `WATER_BLASTS`; `tnt` and `kind` win over it. */
|
|
2118
|
+
readonly explosive?: string;
|
|
2119
|
+
/** Kilograms of TNT equivalent. */
|
|
2120
|
+
readonly tnt?: number;
|
|
2121
|
+
/** Kind of charge (`WATER_BLAST_KINDS` id). Default `blast`. */
|
|
2122
|
+
readonly kind?: string;
|
|
2123
|
+
}
|
|
2124
|
+
/** What a round did at the water, as `planWaterShot` worked it out. */
|
|
2125
|
+
interface WaterShotPlan {
|
|
2126
|
+
readonly profile: WaterShotProfile;
|
|
2127
|
+
/** Degrees between the round's path and the surface. */
|
|
2128
|
+
readonly angleDeg: number;
|
|
2129
|
+
/** The round skipped off: its new direction and the share of its speed it kept. */
|
|
2130
|
+
readonly ricochet: {
|
|
2131
|
+
readonly direction: WaterVec3;
|
|
2132
|
+
readonly speedShare: number;
|
|
2133
|
+
} | null;
|
|
2134
|
+
readonly columnHeight: number;
|
|
2135
|
+
readonly columnRadius: number;
|
|
2136
|
+
/** Horizontal lean of the column, metres of top offset per metre of height. */
|
|
2137
|
+
readonly tilt: readonly [number, number];
|
|
2138
|
+
readonly drops: number;
|
|
2139
|
+
readonly ringRadius: number;
|
|
2140
|
+
readonly rings: number;
|
|
2141
|
+
readonly foamRadius: number;
|
|
2142
|
+
/** Where the round stopped under the water, or met the bed. */
|
|
2143
|
+
readonly trailEnd: WaterVec3;
|
|
2144
|
+
readonly trailLength: number;
|
|
2145
|
+
/** The round reached the bed with this speed (0 when it stopped in the water or skipped off). */
|
|
2146
|
+
readonly bedSpeed: number;
|
|
2147
|
+
}
|
|
2148
|
+
/** What a charge did at the water, as `planWaterBlast` worked it out. */
|
|
2149
|
+
interface WaterBlastPlan {
|
|
2150
|
+
readonly tnt: number;
|
|
2151
|
+
readonly kind: WaterBlastKind;
|
|
2152
|
+
/** Metres under the surface the charge went off (negative over it). */
|
|
2153
|
+
readonly burstDepth: number;
|
|
2154
|
+
/** The charge went off under the water: no fireball, the water takes the blast. */
|
|
2155
|
+
readonly underwater: boolean;
|
|
2156
|
+
/** The burst was too high over the water to throw any: only the shock ring and the spray. */
|
|
2157
|
+
readonly airburst: boolean;
|
|
2158
|
+
readonly columnHeight: number;
|
|
2159
|
+
readonly columnRadius: number;
|
|
2160
|
+
/** Radius of the dome of white water a burst under the surface lifts (0 over it). */
|
|
2161
|
+
readonly domeRadius: number;
|
|
2162
|
+
readonly domeHeight: number;
|
|
2163
|
+
readonly shockRadius: number;
|
|
2164
|
+
readonly waveAmplitude: number;
|
|
2165
|
+
readonly waveSpeed: number;
|
|
2166
|
+
readonly drops: number;
|
|
2167
|
+
readonly mist: number;
|
|
2168
|
+
readonly fragments: number;
|
|
2169
|
+
readonly foamRadius: number;
|
|
2170
|
+
readonly bubbles: number;
|
|
2171
|
+
}
|
|
2172
|
+
/** Upper bound of each pool: past it the oldest record goes. */
|
|
2173
|
+
interface WaterEffectsLimits {
|
|
2174
|
+
readonly drops: number;
|
|
2175
|
+
readonly rings: number;
|
|
2176
|
+
readonly foam: number;
|
|
2177
|
+
readonly columns: number;
|
|
2178
|
+
readonly bubbles: number;
|
|
2179
|
+
readonly mist: number;
|
|
2180
|
+
readonly waves: number;
|
|
2181
|
+
}
|
|
2182
|
+
/** The water's response at a point to the waves going through it. */
|
|
2183
|
+
interface WaterWaveSample {
|
|
2184
|
+
/** Metres the surface stands over its level. */
|
|
2185
|
+
readonly height: number;
|
|
2186
|
+
/** Metres per second a floating body there is pushed with, along x and z. */
|
|
2187
|
+
readonly push: readonly [number, number];
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
/** A drop thrown out of the water: it flies under gravity and, where it falls back on water, leaves a small ring. */
|
|
2191
|
+
interface WaterDrop {
|
|
2192
|
+
x: number;
|
|
2193
|
+
y: number;
|
|
2194
|
+
z: number;
|
|
2195
|
+
vx: number;
|
|
2196
|
+
vy: number;
|
|
2197
|
+
vz: number;
|
|
2198
|
+
size: number;
|
|
2199
|
+
age: number;
|
|
2200
|
+
life: number;
|
|
2201
|
+
/** The surface it was thrown from: it is gone once it falls back under it. */
|
|
2202
|
+
level: number;
|
|
2203
|
+
}
|
|
2204
|
+
/** A ring on the surface. `kind` 0: a ripple that slows as it spreads; 1: the fast shock ring of a blast; 2: a wave crest going out at its speed. */
|
|
2205
|
+
interface WaterRing {
|
|
2206
|
+
x: number;
|
|
2207
|
+
y: number;
|
|
2208
|
+
z: number;
|
|
2209
|
+
kind: 0 | 1 | 2;
|
|
2210
|
+
radius: number;
|
|
2211
|
+
startRadius: number;
|
|
2212
|
+
maxRadius: number;
|
|
2213
|
+
/** Seconds before it shows. */
|
|
2214
|
+
delay: number;
|
|
2215
|
+
age: number;
|
|
2216
|
+
life: number;
|
|
2217
|
+
/** Opacity it starts with. */
|
|
2218
|
+
strength: number;
|
|
2219
|
+
/** Opacity now, 0 while it waits. */
|
|
2220
|
+
alpha: number;
|
|
2221
|
+
}
|
|
2222
|
+
/** A patch of white foam on the surface. */
|
|
2223
|
+
interface WaterFoam {
|
|
2224
|
+
x: number;
|
|
2225
|
+
y: number;
|
|
2226
|
+
z: number;
|
|
2227
|
+
radius: number;
|
|
2228
|
+
startRadius: number;
|
|
2229
|
+
maxRadius: number;
|
|
2230
|
+
age: number;
|
|
2231
|
+
life: number;
|
|
2232
|
+
alpha: number;
|
|
2233
|
+
}
|
|
2234
|
+
/** A column of water thrown up (`dome` false: it rises, holds and falls back) or the dome a burst under the surface lifts. */
|
|
2235
|
+
interface WaterColumn {
|
|
2236
|
+
x: number;
|
|
2237
|
+
y: number;
|
|
2238
|
+
z: number;
|
|
2239
|
+
dome: boolean;
|
|
2240
|
+
peak: number;
|
|
2241
|
+
baseRadius: number;
|
|
2242
|
+
/** Top offset per metre of height, along x and z. */
|
|
2243
|
+
tiltX: number;
|
|
2244
|
+
tiltZ: number;
|
|
2245
|
+
rise: number;
|
|
2246
|
+
delay: number;
|
|
2247
|
+
age: number;
|
|
2248
|
+
life: number;
|
|
2249
|
+
height: number;
|
|
2250
|
+
radius: number;
|
|
2251
|
+
alpha: number;
|
|
2252
|
+
}
|
|
2253
|
+
/** A bubble rising under the water: the trail of a round, the boil of a burst. */
|
|
2254
|
+
interface WaterBubble {
|
|
2255
|
+
x: number;
|
|
2256
|
+
y: number;
|
|
2257
|
+
z: number;
|
|
2258
|
+
size: number;
|
|
2259
|
+
rise: number;
|
|
2260
|
+
delay: number;
|
|
2261
|
+
age: number;
|
|
2262
|
+
life: number;
|
|
2263
|
+
level: number;
|
|
2264
|
+
alpha: number;
|
|
2265
|
+
}
|
|
2266
|
+
/** A puff of spray and steam over the water. */
|
|
2267
|
+
interface WaterMist {
|
|
2268
|
+
x: number;
|
|
2269
|
+
y: number;
|
|
2270
|
+
z: number;
|
|
2271
|
+
vx: number;
|
|
2272
|
+
vy: number;
|
|
2273
|
+
vz: number;
|
|
2274
|
+
size: number;
|
|
2275
|
+
age: number;
|
|
2276
|
+
life: number;
|
|
2277
|
+
alpha: number;
|
|
2278
|
+
}
|
|
2279
|
+
/** A wave going out from a blast: it lifts and pushes what floats where its crest passes. */
|
|
2280
|
+
interface WaterWave {
|
|
2281
|
+
x: number;
|
|
2282
|
+
z: number;
|
|
2283
|
+
speed: number;
|
|
2284
|
+
amplitude: number;
|
|
2285
|
+
width: number;
|
|
2286
|
+
/** Metres it can go before the shore. */
|
|
2287
|
+
reach: number;
|
|
2288
|
+
delay: number;
|
|
2289
|
+
age: number;
|
|
2290
|
+
life: number;
|
|
2291
|
+
}
|
|
2292
|
+
/** The default limits: enough for a rifle on full auto and a few blasts at once in the same pond. */
|
|
2293
|
+
declare const WATER_LIMITS: WaterEffectsLimits;
|
|
2294
|
+
|
|
2295
|
+
interface WaterEffectsOptions {
|
|
2296
|
+
readonly seed?: number;
|
|
2297
|
+
/** Upper bound of each pool (the default `WATER_LIMITS`). */
|
|
2298
|
+
readonly limits?: Partial<WaterEffectsLimits>;
|
|
2299
|
+
/** The water surface at (x, z), or null where there is none: rings, foam and waves stop at the shore, and only drops falling on water ring. */
|
|
2300
|
+
readonly levelAt?: (x: number, z: number) => number | null;
|
|
2301
|
+
/** Distance bands for fewer drops and bubbles far from the camera (default `LOD_GAME`). */
|
|
2302
|
+
readonly lod?: LodBands;
|
|
2303
|
+
/** The shot profiles by class (default `WATER_SHOT_PROFILES`; `patchWaterShotProfiles` to change them). */
|
|
2304
|
+
readonly profiles?: Readonly<Record<string, WaterShotProfile>>;
|
|
2305
|
+
}
|
|
2306
|
+
interface WaterEffectsStats {
|
|
2307
|
+
readonly drops: number;
|
|
2308
|
+
readonly rings: number;
|
|
2309
|
+
readonly foam: number;
|
|
2310
|
+
readonly columns: number;
|
|
2311
|
+
readonly bubbles: number;
|
|
2312
|
+
readonly mist: number;
|
|
2313
|
+
readonly waves: number;
|
|
2314
|
+
}
|
|
2315
|
+
/** Splashes of rounds and blasts on water, renderer-free: plain pools a renderer draws (`createWaterEffectsLayer` of game-vfx-three). */
|
|
2316
|
+
interface WaterEffects {
|
|
2317
|
+
/** A round meets the water at `point`. */
|
|
2318
|
+
shot(params: WaterShotParams): WaterShotPlan;
|
|
2319
|
+
/** A charge goes off in or over the water. */
|
|
2320
|
+
blast(params: WaterBlastParams): WaterBlastPlan;
|
|
2321
|
+
update(dt: number): void;
|
|
2322
|
+
setCamera(position: WaterVec3): void;
|
|
2323
|
+
/** The waves going through (x, z): how high they lift the surface and how hard they push what floats there. */
|
|
2324
|
+
waveAt(x: number, z: number): WaterWaveSample;
|
|
2325
|
+
readonly drops: readonly WaterDrop[];
|
|
2326
|
+
readonly rings: readonly WaterRing[];
|
|
2327
|
+
readonly foam: readonly WaterFoam[];
|
|
2328
|
+
readonly columns: readonly WaterColumn[];
|
|
2329
|
+
readonly bubbles: readonly WaterBubble[];
|
|
2330
|
+
readonly mist: readonly WaterMist[];
|
|
2331
|
+
readonly waves: readonly WaterWave[];
|
|
2332
|
+
readonly limits: WaterEffectsLimits;
|
|
2333
|
+
stats(): WaterEffectsStats;
|
|
2334
|
+
clear(): void;
|
|
2335
|
+
}
|
|
2336
|
+
declare function createWaterEffects(options?: WaterEffectsOptions): WaterEffects;
|
|
2337
|
+
|
|
2338
|
+
/** What a round does as it meets the water: the size of the splash for its class, angle and speed, a skip off a grazing surface, the trail under. */
|
|
2339
|
+
declare function planWaterShot(params: WaterShotParams, random: RandomStream, table?: Readonly<Record<string, WaterShotProfile>>): WaterShotPlan;
|
|
2340
|
+
/** The charge and kind a host names, from its own numbers or the table. */
|
|
2341
|
+
declare function resolveWaterBlast(params: WaterBlastParams): {
|
|
2342
|
+
tnt: number;
|
|
2343
|
+
kind: WaterBlastKind;
|
|
2344
|
+
};
|
|
2345
|
+
/**
|
|
2346
|
+
* What a charge does to the water, by Hopkinson scaling (lengths go with the cube root of the charge): a burst a little under the surface throws the
|
|
2347
|
+
* tallest column; at the surface a lower one and a ring of spray; deep under, the water holds it down to a dome of white water and a boil of bubbles;
|
|
2348
|
+
* high over it, only the shock ring and the spray. A shallow pool has not the water to throw a full column.
|
|
2349
|
+
*/
|
|
2350
|
+
declare function planWaterBlast(params: WaterBlastParams): WaterBlastPlan;
|
|
2351
|
+
|
|
2352
|
+
/**
|
|
2353
|
+
* How each class of round meets water, entering straight down at its usual speed. A rifle bullet throws a tall thin spout and yaws and breaks up
|
|
2354
|
+
* within a few tens of centimetres; a pistol round a short one and goes on longer; a heavy rifle (.338, .50) a tall wide column; a buckshot pellet a
|
|
2355
|
+
* small spout and a lot of shallow foam; an arrow slips in with little splash and goes far.
|
|
2356
|
+
*/
|
|
2357
|
+
declare const WATER_SHOT_PROFILES: Readonly<Record<WaterShotClass, WaterShotProfile>>;
|
|
2358
|
+
/** The class of round of each calibre of `@adatechnology/game-weapons` (its `calibers.json` ids). A calibre not here is classed by `waterShotClassOf`. */
|
|
2359
|
+
declare const WATER_SHOT_BY_CALIBER: Readonly<Record<string, WaterShotClass>>;
|
|
2360
|
+
/** What is known of a round that has no calibre in the table: its mass in grams, speed in m/s and diameter in millimetres. */
|
|
2361
|
+
interface WaterRound {
|
|
2362
|
+
readonly grams: number;
|
|
2363
|
+
readonly speed: number;
|
|
2364
|
+
readonly diameter?: number;
|
|
2365
|
+
/** One of several pellets of a shell. */
|
|
2366
|
+
readonly pellet?: boolean;
|
|
2367
|
+
}
|
|
2368
|
+
/** The class of a round from what it weighs and how fast it goes, for a calibre the table does not know. */
|
|
2369
|
+
declare function waterShotClassOf(round: WaterRound): WaterShotClass;
|
|
2370
|
+
/**
|
|
2371
|
+
* How each kind of charge works on water. A high explosive throws the water; a shaped charge a narrow jet; a fragmentation charge over the surface
|
|
2372
|
+
* also peppers it with fragments; a gas or fuel deflagration mostly boils it into steam.
|
|
2373
|
+
*/
|
|
2374
|
+
declare const WATER_BLAST_KINDS: Readonly<Record<WaterBlastKindId, WaterBlastKind>>;
|
|
2375
|
+
/** The explosives of `@adatechnology/game-weapons` (`explosives.json`): TNT equivalent in kilograms and kind. */
|
|
2376
|
+
declare const WATER_BLASTS: Readonly<Record<string, WaterBlastCharge>>;
|
|
2377
|
+
/** The profile a host asks for by class id, or the profile it gives; an unknown id falls back to `pistol`. */
|
|
2378
|
+
declare function resolveWaterShotProfile(profile: string | WaterShotProfile, table?: Readonly<Record<string, WaterShotProfile>>): WaterShotProfile;
|
|
2379
|
+
/** Changes a profile table without touching the kit's: `null` removes an entry, a partial entry is merged over the old one. */
|
|
2380
|
+
declare function patchWaterShotProfiles(base: Readonly<Record<string, WaterShotProfile>>, changes: Readonly<Record<string, Partial<WaterShotProfile> | null>>): Record<string, WaterShotProfile>;
|
|
2381
|
+
|
|
2382
|
+
export { AREA_CAP_GAME, type AreaCap, type AreaCapTracker, type Behavior, type BehaviorHost, type BlastLight, type BloodMark, type Carrier, type Chunk, type ConfineResult, type Confiner, type CueRequest, type DebrisSpawn, type Decal, type DecalOptions, type DirtMark, EVENT_BUDGET, EVENT_EFFECTS, EVENT_EFFECTS_MAP, EXPLOSIONS, EXPLOSION_ALIASES, EffectCamera, type EffectDef, EffectInstance, type EffectPlayer, type EffectPlayerOptions, EffectRunner, type EffectRunnerOptions, type EffectStep, type EffectTexts, type EffectTrack, type EffectView, Enclosures, type ExplosionCall, type ExplosionDef, type ExplosionOptions, type Fire, type FireLight, type FireOptions, type FireSpec, type Follow, GAME_EFFECTS, type GameEvent, type Glow, type GroundField, type GroundFieldOptions, type InstanceDeps, type InstanceSetup, type KindPoolHost, LOD_GAME, LOD_LAB, type LandListener, type LensBlob, type LightGlow, type LightPool, type LodBands, type Mark, type MarkEvent, type MarkStore, type MeshParticle, MeshPool, type MeshShape, type MeshSpawn, type MushroomSpec, type MutableVec3, OrderedPool, PROFILES, type Placement, type PlayOptions, type PostProcess, type Puddle, type Puff, type Quaternion, RAIN_CAPACITY, RainField, type RandomStream, type Rgb, type Ring, type RockMark, SCRAPE_LIMIT, SMOKE_COLORS, SPRITE_KINDS, type Schedule, type ScorchMark, type ScrapeMark, type ScreenState, type SheetLabels, type Shock, type Spark, type SpriteGround, type SpriteKind, type SpriteKindDef, SpriteKindPool, SpriteKindSystem, type SpriteKindSystemOptions, type SpriteSpawn, type SpriteSpawnOptions, type SpriteSystem, VFX_LAYERS, VIEWMODEL_EFFECTS, type Vec3Like, type Vec3Tuple, type VfxEnclosure, type VfxEnclosureBox, type VfxLayer, type VfxLocale, type VfxOptions, type VfxPoolsView, type VfxProfile, type VfxProfileName, type VfxSideRequest, type VfxStats, type VfxStrings, type VfxTrace, type VfxWorld, WATER_BLASTS, WATER_BLAST_KINDS, WATER_LIMITS, WATER_SHOT_BY_CALIBER, WATER_SHOT_PROFILES, WORKSHOP_BEHAVIORS, WORKSHOP_EFFECTS, WORKSHOP_PUDDLES, type WaterBlastCharge, type WaterBlastKind, type WaterBlastKindId, type WaterBlastParams, type WaterBlastPlan, type WaterBubble, type WaterColumn, type WaterDrop, type WaterEffects, type WaterEffectsLimits, type WaterEffectsOptions, type WaterEffectsStats, type WaterFoam, type WaterMist, type WaterRing, type WaterRound, type WaterShotClass, type WaterShotParams, type WaterShotPlan, type WaterShotProfile, type WaterVec3, type WaterWave, type WaterWaveSample, type WorkshopContext, WorkshopEngine, type WorkshopOptions, type WorkshopTrace, colorOfChunk, composeExplosion, createAreaCap, createEffectPlayer, createGroundField, createSchedule, createScreenState, createVfx, createWaterEffects, createWorkshopBehaviors, effectForEvent, estimateCost, hexToLinearRgb, hexToRgb, inPuddle, lcg, lehmer, locales, lodScale, patchEffects, patchExplosions, patchSpriteKinds, patchWaterShotProfiles, planWaterBlast, planWaterShot, resolveStrings, resolveWaterBlast, resolveWaterShotProfile, slideAlong, streamFor, updateScreen, waterShotClassOf, workshopGround };
|