@adatechnology/game-fluids 0.6.7 → 0.6.9
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 +3 -3
- package/dist/index.d.ts +5 -0
- package/dist/index.global.js +79 -2
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +79 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,8 +8,8 @@ Engine-agnostic liquids for games, with no renderer. It knows nothing about any
|
|
|
8
8
|
- **Streams**: the jet leaving a lip or a hole. Ballistic, it ends on the first surface it hits (planes with half extents) or on the ground.
|
|
9
9
|
- **Stains**: grow from a flow front (16 radial samples, never a perfect disc), run downhill, soak into porous surfaces, dry from the edge in and
|
|
10
10
|
either vanish or leave a permanent mark (coffee, blood, oil).
|
|
11
|
-
- **
|
|
12
|
-
old_blood, bile, sap, acid, paint, bleach, honey. Each one has its own colour, viscosity, drying time, gloss and drink effects (`caffeine`, `alcohol`, `poison`,
|
|
11
|
+
- **23 built-in liquids** (`LIQUIDS`): water, coffee, tea, milk, soda, juice, beer, wine, spirits, fuel, diesel, motor_oil, cooking_oil, blood,
|
|
12
|
+
old_blood, bile, sap, acid, paint, bleach, sewage, honey, mud. Each one has its own colour, viscosity, drying time, gloss and drink effects (`caffeine`, `alcohol`, `poison`,
|
|
13
13
|
`disgust`).
|
|
14
14
|
- **Item uses** (`ITEM_USES`): scripted `sip`, `drink`, `chug`, `pour`, `pour_out`, `open` and `close`, as pure keyframe data plus a player.
|
|
15
15
|
- Deterministic from a seed (no `Math.random`), so a LAN host can run it and send events. `serialize()` / `load()` round trip the whole world.
|
|
@@ -169,7 +169,7 @@ film.setWeather({ rain: 1 }) // drying stops, spread x1.5 (a no-op until game-we
|
|
|
169
169
|
| Export | What it is |
|
|
170
170
|
|---|---|
|
|
171
171
|
| `createFluids(options?)` | Creates a `FluidWorld`. Options: `liquids`, `locale`, `seed`, `ambientC`, `gravity`, `groundAt(x, z)`, `mergeDistance`, `maxStains`, `onEvent` |
|
|
172
|
-
| `LIQUIDS` | The
|
|
172
|
+
| `LIQUIDS` | The 23 built-in `LiquidDef`s (`id`, `color`, `opacity`, `stainColor`, `viscosity`, `density`, `dryTime`, `leavesMark`, `gloss`, `drink`...) |
|
|
173
173
|
| `ITEM_USES` | The built-in `ItemUseDef`s |
|
|
174
174
|
| `createItemUse(world, containerId, def, getHandTransform?)` | Returns an `ItemUsePlayer` (`pose()`, `update(dt)`, `cancel()`, `time`, `done`) |
|
|
175
175
|
| `createFilm(options)`, `createFilmLcg(seed)`, `PADRAO_LAYOUT`, `WORKSHOP_LAYOUT`, `layoutFromSurfaces`, `createFoldedLayout`, `FILM_PROFILES`, `filmProfileOf` | The running film (see above) |
|
package/dist/index.d.ts
CHANGED
|
@@ -264,6 +264,11 @@ interface FluidWorld {
|
|
|
264
264
|
rotation?: Quat;
|
|
265
265
|
}): string;
|
|
266
266
|
removeContainer(id: string): void;
|
|
267
|
+
/**
|
|
268
|
+
* The vessel broke (shot through, smashed, melted): it holds nothing any more, so all its liquid falls from where it is, with the vessel's velocity, and lands
|
|
269
|
+
* on what is under it (a top, the floor) as one splash; the container is gone. Unknown ids are ignored.
|
|
270
|
+
*/
|
|
271
|
+
shatter(id: string): void;
|
|
267
272
|
/** Keep in sync with the object that carries it (tilt decides spilling and the surface plane; velocity makes it slosh). */
|
|
268
273
|
setTransform(id: string, position: Vec3, rotation: Quat, velocity?: Vec3): void;
|
|
269
274
|
open(id: string): void;
|
package/dist/index.global.js
CHANGED
|
@@ -452,6 +452,28 @@ var GameFluids = (() => {
|
|
|
452
452
|
"corrosive"
|
|
453
453
|
]
|
|
454
454
|
},
|
|
455
|
+
{
|
|
456
|
+
id: "sewage",
|
|
457
|
+
color: 5921582,
|
|
458
|
+
opacity: 0.92,
|
|
459
|
+
stainColor: 3093273,
|
|
460
|
+
viscosity: 4,
|
|
461
|
+
density: 1010,
|
|
462
|
+
dryTime: 1800,
|
|
463
|
+
gloss: 0.8,
|
|
464
|
+
leavesMark: true,
|
|
465
|
+
drink: {
|
|
466
|
+
thirst: 0,
|
|
467
|
+
effects: [
|
|
468
|
+
"disgust",
|
|
469
|
+
"poison"
|
|
470
|
+
]
|
|
471
|
+
},
|
|
472
|
+
tags: [
|
|
473
|
+
"organic",
|
|
474
|
+
"waste"
|
|
475
|
+
]
|
|
476
|
+
},
|
|
455
477
|
{
|
|
456
478
|
id: "honey",
|
|
457
479
|
color: 14193162,
|
|
@@ -483,6 +505,46 @@ var GameFluids = (() => {
|
|
|
483
505
|
tags: [
|
|
484
506
|
"dirty"
|
|
485
507
|
]
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
id: "coolant",
|
|
511
|
+
color: 3455050,
|
|
512
|
+
opacity: 0.7,
|
|
513
|
+
stainColor: 2783796,
|
|
514
|
+
viscosity: 4,
|
|
515
|
+
density: 1070,
|
|
516
|
+
dryTime: 1200,
|
|
517
|
+
gloss: 0.85,
|
|
518
|
+
leavesMark: true,
|
|
519
|
+
drink: {
|
|
520
|
+
thirst: 0,
|
|
521
|
+
effects: [
|
|
522
|
+
"poison"
|
|
523
|
+
]
|
|
524
|
+
},
|
|
525
|
+
tags: [
|
|
526
|
+
"coolant"
|
|
527
|
+
]
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
id: "brake_fluid",
|
|
531
|
+
color: 13145646,
|
|
532
|
+
opacity: 0.8,
|
|
533
|
+
stainColor: 9069600,
|
|
534
|
+
viscosity: 8,
|
|
535
|
+
density: 1050,
|
|
536
|
+
dryTime: 3600,
|
|
537
|
+
gloss: 0.9,
|
|
538
|
+
leavesMark: true,
|
|
539
|
+
drink: {
|
|
540
|
+
thirst: 0,
|
|
541
|
+
effects: [
|
|
542
|
+
"poison"
|
|
543
|
+
]
|
|
544
|
+
},
|
|
545
|
+
tags: [
|
|
546
|
+
"brake_fluid"
|
|
547
|
+
]
|
|
486
548
|
}
|
|
487
549
|
];
|
|
488
550
|
|
|
@@ -634,8 +696,11 @@ var GameFluids = (() => {
|
|
|
634
696
|
acid: "acid",
|
|
635
697
|
paint: "paint",
|
|
636
698
|
bleach: "bleach",
|
|
699
|
+
sewage: "sewage",
|
|
637
700
|
honey: "honey",
|
|
638
|
-
mud: "mud"
|
|
701
|
+
mud: "mud",
|
|
702
|
+
coolant: "coolant",
|
|
703
|
+
brake_fluid: "brake fluid"
|
|
639
704
|
},
|
|
640
705
|
events: {
|
|
641
706
|
fill: "filled",
|
|
@@ -677,8 +742,11 @@ var GameFluids = (() => {
|
|
|
677
742
|
acid: "\xE1cido",
|
|
678
743
|
paint: "tinta",
|
|
679
744
|
bleach: "\xE1gua sanit\xE1ria",
|
|
745
|
+
sewage: "esgoto",
|
|
680
746
|
honey: "mel",
|
|
681
|
-
mud: "lama"
|
|
747
|
+
mud: "lama",
|
|
748
|
+
coolant: "l\xEDquido de arrefecimento",
|
|
749
|
+
brake_fluid: "fluido de freio"
|
|
682
750
|
},
|
|
683
751
|
events: {
|
|
684
752
|
fill: "encheu",
|
|
@@ -1527,6 +1595,15 @@ var GameFluids = (() => {
|
|
|
1527
1595
|
for (const key of Object.keys(c.streams)) endStreamKey(c, key);
|
|
1528
1596
|
containers.delete(id);
|
|
1529
1597
|
},
|
|
1598
|
+
shatter(id) {
|
|
1599
|
+
const c = containers.get(id);
|
|
1600
|
+
if (!c) return;
|
|
1601
|
+
const liquid = c.liquid;
|
|
1602
|
+
const liters = c.liters;
|
|
1603
|
+
const at = add(c.position, scale(c.normal, c.liters > 0 ? c.d : 0));
|
|
1604
|
+
world.removeContainer(id);
|
|
1605
|
+
if (liquid && liters > 0) world.splash(liquid, at, liters, c.velocity);
|
|
1606
|
+
},
|
|
1530
1607
|
setTransform(id, position, rotation, velocity) {
|
|
1531
1608
|
const c = containers.get(id);
|
|
1532
1609
|
if (!c) return;
|