@adatechnology/game-items 0.6.1 → 0.7.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/dist/index.d.ts +27 -1
- package/dist/index.global.js +19 -0
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -997,4 +997,30 @@ declare const barScale: (spec: ConsumableSpec, state: ConsumableState) => number
|
|
|
997
997
|
/** Problems with a consumable spec, for `checkItems`. */
|
|
998
998
|
declare const consumableProblems: (spec: ConsumableSpec) => string[];
|
|
999
999
|
|
|
1000
|
-
|
|
1000
|
+
/**
|
|
1001
|
+
* Foam on a surface or an object (a soapy plate, a lathered hand, shampoo in the hair): how much of it is there, 0 (none) to 1 (covered). Scrubbing with soap or
|
|
1002
|
+
* detergent adds foam; running water takes it away in proportion to the water that runs over it, so a stronger stream rinses faster. Pure functions over a plain
|
|
1003
|
+
* state, so a sink, a shower or a body region keeps one per thing it washes and the host draws what `foamLeft` says.
|
|
1004
|
+
*/
|
|
1005
|
+
/** Foam on one thing: 0 none, 1 covered. */
|
|
1006
|
+
interface FoamState {
|
|
1007
|
+
readonly amount: number;
|
|
1008
|
+
}
|
|
1009
|
+
/** Running water over the foam: litres per second that reach it. */
|
|
1010
|
+
interface FoamRinse {
|
|
1011
|
+
readonly flowLps: number;
|
|
1012
|
+
}
|
|
1013
|
+
/** Litres of running water that rinse a full layer of foam (1) away: a soapy plate is clean after about a litre under the tap (10 s at 6 l/min). */
|
|
1014
|
+
declare const FOAM_RINSE_LITRES = 1;
|
|
1015
|
+
/** Below this the foam is gone (a film nobody sees): it snaps to 0 so a rinse ends. */
|
|
1016
|
+
declare const FOAM_GONE = 0.01;
|
|
1017
|
+
/** No foam. */
|
|
1018
|
+
declare const emptyFoam: () => FoamState;
|
|
1019
|
+
/** Foam after scrubbing in `amount` more (0..1 of a full layer); it saturates at 1. */
|
|
1020
|
+
declare const addFoam: (state: FoamState, amount: number) => FoamState;
|
|
1021
|
+
/** Foam after `dt` seconds under `water`: it loses the litres that ran over it, divided by `FOAM_RINSE_LITRES`. No water, no change. */
|
|
1022
|
+
declare const rinseFoam: (state: FoamState, water: FoamRinse, dt: number) => FoamState;
|
|
1023
|
+
/** Share of a full layer still on it, 0..1. */
|
|
1024
|
+
declare const foamLeft: (state: FoamState) => number;
|
|
1025
|
+
|
|
1026
|
+
export { ARSENAL_CATEGORIES, type AgeOptions, type AgeState, type AmmoState, type ArsenalCaliberLike, type ArsenalItemRecord, type ArsenalItemsOptions, type ArsenalLike, type ArsenalWeaponLike, type AttackKind, BODY_SLOTS, type BagOption, type CarryEntry, type CategoryDef, type ConsumableForm, type ConsumableSpec, type ConsumableState, type ConsumableUnit, type Consumption, type ContainerDef, type CraftCheck, type CraftContext, type CraftOutcome, type CraftResult, DEFAULT_RULES, DURABILITY_KINDS, type DepletionRule, type DestructionObjectState, type DoseResult, type Durability, type DurabilityKind, FOAM_GONE, FOAM_RINSE_LITRES, type FindData, type FindStack, type FindState, type FindsProvider, type FindsProviderOptions, type FindsQuery, type FoamRinse, type FoamState, type Freshness, type FreshnessEffect, HAND_USES, HAND_USE_REACH, type HandUseAction, type HandUseBody, type HandUseDef, type HandUseEvent, type HandUseKey, type HandUsePlayer, ITEM_CATEGORIES, type Inventory, type InventoryFailure, type InventoryOptions, type InventoryResult, type InventorySlot, type InventoryTotals, type ItemCategory, type ItemDef, type ItemPack, type ItemRules, type ItemStack, type ItemState, type ItemsCatalog, type ItemsOptions, type LoadLevel, type LoadState, type LootTablesQuery, type NutritionResult, type PlaceDef, type PlaceTag, type PlacedFinds, type PoolEntry, type PoolPick, RARITIES, type Rarity, type RecipeDef, type RecipeInput, type RecipeMatch, type RecipeOutput, type RecipeTool, type Rng, type StorageId, type StorageRule, type StorageRules, type TakeOptions, type TakeParams, type TakeResult, type UseContext, type UseEffectDef, type UseResult, type WornPiece, addFoam, advanceAge, aimHandUse, bagOption, barScale, blockChance, canCraft, canTake, carriedKg, chargeLevel, checkItems, consumableMassKg, consumableOf, consumableProblems, craft, createFindsProvider, createHandUse, createInventory, createItems, depletionFactor, emptyFoam, failsToStart, fitsInside, foamLeft, freshness, fullConsumable, handUseOf, isSpent, itemLitres, itemsFromArsenal, loadState, maxLoadKg, moveToStorage, pieceBlock, placeFinds, remainingShare, repairPiece, resolveUse, rinseFoam, rollByCategory, rollExplicitPool, scaleCount, shelfRatio, spawnAgeDays, spawnData, storageMultiplier, takeDose, toLootTables, wearBlocked };
|
package/dist/index.global.js
CHANGED
|
@@ -25,10 +25,13 @@ var GameItems = (() => {
|
|
|
25
25
|
BODY_SLOTS: () => BODY_SLOTS,
|
|
26
26
|
DEFAULT_RULES: () => DEFAULT_RULES,
|
|
27
27
|
DURABILITY_KINDS: () => DURABILITY_KINDS,
|
|
28
|
+
FOAM_GONE: () => FOAM_GONE,
|
|
29
|
+
FOAM_RINSE_LITRES: () => FOAM_RINSE_LITRES,
|
|
28
30
|
HAND_USES: () => HAND_USES,
|
|
29
31
|
HAND_USE_REACH: () => HAND_USE_REACH,
|
|
30
32
|
ITEM_CATEGORIES: () => ITEM_CATEGORIES,
|
|
31
33
|
RARITIES: () => RARITIES,
|
|
34
|
+
addFoam: () => addFoam,
|
|
32
35
|
advanceAge: () => advanceAge,
|
|
33
36
|
aimHandUse: () => aimHandUse,
|
|
34
37
|
bagOption: () => bagOption,
|
|
@@ -48,8 +51,10 @@ var GameItems = (() => {
|
|
|
48
51
|
createInventory: () => createInventory,
|
|
49
52
|
createItems: () => createItems,
|
|
50
53
|
depletionFactor: () => depletionFactor,
|
|
54
|
+
emptyFoam: () => emptyFoam,
|
|
51
55
|
failsToStart: () => failsToStart,
|
|
52
56
|
fitsInside: () => fitsInside,
|
|
57
|
+
foamLeft: () => foamLeft,
|
|
53
58
|
freshness: () => freshness,
|
|
54
59
|
fullConsumable: () => fullConsumable,
|
|
55
60
|
handUseOf: () => handUseOf,
|
|
@@ -64,6 +69,7 @@ var GameItems = (() => {
|
|
|
64
69
|
remainingShare: () => remainingShare,
|
|
65
70
|
repairPiece: () => repairPiece,
|
|
66
71
|
resolveUse: () => resolveUse,
|
|
72
|
+
rinseFoam: () => rinseFoam,
|
|
67
73
|
rollByCategory: () => rollByCategory,
|
|
68
74
|
rollExplicitPool: () => rollExplicitPool,
|
|
69
75
|
scaleCount: () => scaleCount,
|
|
@@ -2205,6 +2211,19 @@ ${problems.map((problem) => ` - ${problem}`).join("\n")}`);
|
|
|
2205
2211
|
}
|
|
2206
2212
|
};
|
|
2207
2213
|
};
|
|
2214
|
+
|
|
2215
|
+
// src/foam.ts
|
|
2216
|
+
var FOAM_RINSE_LITRES = 1;
|
|
2217
|
+
var FOAM_GONE = 0.01;
|
|
2218
|
+
var clampShare = (value) => Number.isFinite(value) ? Math.min(1, Math.max(0, value)) : 0;
|
|
2219
|
+
var settled = (amount) => ({ amount: amount < FOAM_GONE ? 0 : amount });
|
|
2220
|
+
var emptyFoam = () => ({ amount: 0 });
|
|
2221
|
+
var addFoam = (state, amount) => ({ amount: clampShare(state.amount + Math.max(0, amount)) });
|
|
2222
|
+
var rinseFoam = (state, water, dt) => {
|
|
2223
|
+
const litres = Math.max(0, water.flowLps) * Math.max(0, dt);
|
|
2224
|
+
return settled(clampShare(state.amount - litres / FOAM_RINSE_LITRES));
|
|
2225
|
+
};
|
|
2226
|
+
var foamLeft = (state) => clampShare(state.amount);
|
|
2208
2227
|
return __toCommonJS(index_exports);
|
|
2209
2228
|
})();
|
|
2210
2229
|
//# sourceMappingURL=index.global.js.map
|