@adatechnology/game-fluids 0.6.14 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -277,6 +277,8 @@ interface FluidWorld {
277
277
  fill(id: string, liquid: LiquidId, liters: number, temperature?: number): number;
278
278
  /** Pour on purpose for `dt` seconds (tilts the flow out of the opening even when not tilted far). Returns litres out. */
279
279
  pour(id: string, dt: number, into?: string): number;
280
+ /** Pours up to `liters` out of an open container into a vessel this world does not hold (a dog's water bowl); returns the litres that left it. */
281
+ decant(id: string, liters: number): number;
280
282
  /** Drink `liters` (sip ~0.03 l); returns the drink event or null when empty/closed. Too hot (> 65 °C) sets `burn`. */
281
283
  /** Takes `liters` out of an open container into the mouth. `eaten`: it is the liquid packed with food, eaten with it (no drinking effects). */
282
284
  drink(id: string, liters: number, options?: {
@@ -1664,6 +1664,15 @@ var GameFluids = (() => {
1664
1664
  settle(c);
1665
1665
  return out;
1666
1666
  },
1667
+ decant(id, liters) {
1668
+ const c = containers.get(id);
1669
+ if (!c || c.closed || c.liters <= 1e-6 || !(liters > 0)) return 0;
1670
+ const amount = Math.min(liters, c.liters);
1671
+ removeLiters(c, amount);
1672
+ refreshLevel(c);
1673
+ settle(c);
1674
+ return amount;
1675
+ },
1667
1676
  drink(id, liters, options2) {
1668
1677
  const c = containers.get(id);
1669
1678
  const def = c ? defOf(c) : null;