@its-not-rocket-science/ananke 0.1.3 → 0.1.5
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/CHANGELOG.md +217 -177
- package/dist/src/catalog.d.ts +86 -0
- package/dist/src/catalog.js +393 -0
- package/dist/src/derive.d.ts +5 -3
- package/dist/src/derive.js +10 -8
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/sim/biome.d.ts +71 -0
- package/dist/src/sim/biome.js +61 -0
- package/dist/src/sim/context.d.ts +8 -0
- package/dist/src/sim/kernel.js +7 -1
- package/dist/src/sim/step/movement.js +13 -1
- package/dist/src/sim/thermoregulation.d.ts +3 -2
- package/dist/src/sim/thermoregulation.js +6 -4
- package/docs/versioning.md +2 -2
- package/package.json +21 -3
|
@@ -41,7 +41,7 @@ export declare function sumArmourInsulation(items: Item[]): number;
|
|
|
41
41
|
*/
|
|
42
42
|
export declare function computeNewCoreQ(coreQ: number, massReal_kg: number, // real kg (entity.attributes.morphology.mass_kg / SCALE.kg)
|
|
43
43
|
armourInsulation: number, isActive: boolean, // true if entity velocity ≥ 1 m/s
|
|
44
|
-
ambientTemp: Q, delta_s: number): Q;
|
|
44
|
+
ambientTemp: Q, delta_s: number, thermalResistanceBase?: number): Q;
|
|
45
45
|
/**
|
|
46
46
|
* Advance an entity's core temperature by `delta_s` seconds given the ambient temperature.
|
|
47
47
|
*
|
|
@@ -49,7 +49,8 @@ ambientTemp: Q, delta_s: number): Q;
|
|
|
49
49
|
* Writes the new value back to `entity.condition.coreTemp_Q` and returns it.
|
|
50
50
|
*/
|
|
51
51
|
export declare function stepCoreTemp(entity: Entity, ambientTemp: Q, // Phase 29 Q-coded temperature (same scale as coreTemp_Q)
|
|
52
|
-
delta_s: number
|
|
52
|
+
delta_s: number, // elapsed seconds
|
|
53
|
+
thermalResistanceBase?: number): Q;
|
|
53
54
|
export interface TempModifiers {
|
|
54
55
|
/** Effective multiplier on peakPower_W for action resolution. */
|
|
55
56
|
powerMul: Q;
|
|
@@ -72,7 +72,7 @@ const ACTIVE_VEL_THRESH = Math.trunc(1.0 * SCALE.mps); // 10000
|
|
|
72
72
|
*/
|
|
73
73
|
export function computeNewCoreQ(coreQ, massReal_kg, // real kg (entity.attributes.morphology.mass_kg / SCALE.kg)
|
|
74
74
|
armourInsulation, isActive, // true if entity velocity ≥ 1 m/s
|
|
75
|
-
ambientTemp, delta_s) {
|
|
75
|
+
ambientTemp, delta_s, thermalResistanceBase) {
|
|
76
76
|
if (massReal_kg <= 0)
|
|
77
77
|
return coreQ;
|
|
78
78
|
const coreC = qToC(coreQ);
|
|
@@ -80,7 +80,8 @@ ambientTemp, delta_s) {
|
|
|
80
80
|
// Metabolic heat: mass-proportional (independent of combat peak power)
|
|
81
81
|
const specificW = isActive ? ACT_SPECIFIC_W : REST_SPECIFIC_W;
|
|
82
82
|
const metabolicHeat = massReal_kg * specificW; // W
|
|
83
|
-
const
|
|
83
|
+
const baseR = thermalResistanceBase ?? 0.09;
|
|
84
|
+
const thermalResistance = baseR + armourInsulation; // °C/W
|
|
84
85
|
const thermalMass = massReal_kg * 3500; // J/°C
|
|
85
86
|
const conductiveLoss = (coreC - ambC) / thermalResistance; // W
|
|
86
87
|
const deltaTc = (metabolicHeat - conductiveLoss) * delta_s / thermalMass; // °C
|
|
@@ -95,7 +96,8 @@ ambientTemp, delta_s) {
|
|
|
95
96
|
* Writes the new value back to `entity.condition.coreTemp_Q` and returns it.
|
|
96
97
|
*/
|
|
97
98
|
export function stepCoreTemp(entity, ambientTemp, // Phase 29 Q-coded temperature (same scale as coreTemp_Q)
|
|
98
|
-
delta_s
|
|
99
|
+
delta_s, // elapsed seconds
|
|
100
|
+
thermalResistanceBase) {
|
|
99
101
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
102
|
const cond = entity.condition;
|
|
101
103
|
const coreQ = cond.coreTemp_Q ?? CORE_TEMP_NORMAL_Q;
|
|
@@ -105,7 +107,7 @@ delta_s) {
|
|
|
105
107
|
const vx = entity.velocity_mps.x;
|
|
106
108
|
const vy = entity.velocity_mps.y;
|
|
107
109
|
const vMag = Math.sqrt(vx * vx + vy * vy);
|
|
108
|
-
const newCoreQ = computeNewCoreQ(coreQ, mReal, insul, vMag >= ACTIVE_VEL_THRESH, ambientTemp, delta_s);
|
|
110
|
+
const newCoreQ = computeNewCoreQ(coreQ, mReal, insul, vMag >= ACTIVE_VEL_THRESH, ambientTemp, delta_s, thermalResistanceBase);
|
|
109
111
|
cond.coreTemp_Q = newCoreQ;
|
|
110
112
|
return newCoreQ;
|
|
111
113
|
}
|
package/docs/versioning.md
CHANGED
|
@@ -57,7 +57,7 @@ experiment results), you may also pin to a specific commit hash.
|
|
|
57
57
|
```json
|
|
58
58
|
{
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"ananke": "github:
|
|
60
|
+
"ananke": "github:its-not-rocket-science/ananke#<commit-sha>"
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
```
|
|
@@ -67,7 +67,7 @@ Replace `<commit-sha>` with the full 40-character hash you have validated.
|
|
|
67
67
|
### Git submodule
|
|
68
68
|
|
|
69
69
|
```bash
|
|
70
|
-
git submodule add https://github.com/
|
|
70
|
+
git submodule add https://github.com/its-not-rocket-science/ananke.git vendor/ananke
|
|
71
71
|
cd vendor/ananke && git checkout <commit-sha>
|
|
72
72
|
git add vendor/ananke && git commit -m "pin ananke to <commit-sha>"
|
|
73
73
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@its-not-rocket-science/ananke",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Deterministic lockstep-friendly SI-units RPG/physics core (fixed-point TS)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,6 +10,18 @@
|
|
|
10
10
|
".": {
|
|
11
11
|
"import": "./dist/src/index.js",
|
|
12
12
|
"types": "./dist/src/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./species": {
|
|
15
|
+
"import": "./dist/src/species.js",
|
|
16
|
+
"types": "./dist/src/species.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./polity": {
|
|
19
|
+
"import": "./dist/src/polity.js",
|
|
20
|
+
"types": "./dist/src/polity.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./catalog": {
|
|
23
|
+
"import": "./dist/src/catalog.js",
|
|
24
|
+
"types": "./dist/src/catalog.d.ts"
|
|
13
25
|
}
|
|
14
26
|
},
|
|
15
27
|
"files": [
|
|
@@ -32,8 +44,13 @@
|
|
|
32
44
|
"url": "https://github.com/its-not-rocket-science/ananke.git"
|
|
33
45
|
},
|
|
34
46
|
"keywords": [
|
|
35
|
-
"simulation",
|
|
36
|
-
"
|
|
47
|
+
"simulation",
|
|
48
|
+
"physics",
|
|
49
|
+
"combat",
|
|
50
|
+
"rpg",
|
|
51
|
+
"deterministic",
|
|
52
|
+
"fixed-point",
|
|
53
|
+
"game-engine"
|
|
37
54
|
],
|
|
38
55
|
"scripts": {
|
|
39
56
|
"prepublishOnly": "npm run build && npm run test:coverage",
|
|
@@ -74,6 +91,7 @@
|
|
|
74
91
|
"@types/node": "^20.0.0",
|
|
75
92
|
"@vitest/coverage-v8": "^2.1.8",
|
|
76
93
|
"eslint": "^9.39.3",
|
|
94
|
+
"fast-check": "^4.6.0",
|
|
77
95
|
"typescript": "^5.5.4",
|
|
78
96
|
"typescript-eslint": "^8.56.1",
|
|
79
97
|
"vitest": "^2.1.8"
|