From 3ba05645cfdc9dd6f9a3eb881a6403bcc625771b Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Mon, 1 Nov 2021 12:14:49 -0400 Subject: [PATCH] Fix mass estimation; add relative prey capacity Estimated mass was being scaled linearly, not cubically. The 'show ratios' option now shows how many of the second entity fit into the first entity if it has a capacity attribute --- macrovision.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/macrovision.js b/macrovision.js index 2a9078e5..814dad2f 100644 --- a/macrovision.js +++ b/macrovision.js @@ -593,6 +593,16 @@ function updateRatios() { } text += prevSelectedEntity.name + " looks " + math.format(apparentHeight, { precision: 3}) + " tall to " + selectedEntity.name; + + if (selectedEntity.currentView.capacity && prevSelectedEntity.currentView.weight) { + const containCount = math.divide(selectedEntity.currentView.capacity, math.divide(prevSelectedEntity.currentView.weight, math.unit("80kg/people"))); + + if (containCount > 0.1) { + text += "\n" + text += selectedEntity.name + " can fit " + math.format(containCount, { precision: 1 }) + " of " + prevSelectedEntity.name + " inside them" + } + + } ratioInfo.innerText = text; } else { @@ -1216,17 +1226,21 @@ function makeEntity(info, views, sizes, forms = {}) { let base = undefined; switch(config.autoMass) { case "human": - base = math.divide(math.unit(150, "lbs"), math.unit(5.917, "feet")) + baseMass = math.unit(150, "lbs") + baseHeight = math.unit(5.917, "feet") break case "quadruped at shoulder": - base = math.divide(math.unit(80, "lbs"), math.unit(30, "inches")) + baseMass = math.unit(80, "lbs") + baseHeight = math.unit(30, "inches") break } + + const ratio = math.divide(view.attributes.height.base, baseHeight) view.attributes.weight = { name: "Mass", power: 3, type: "mass", - base: math.multiply(base, view.attributes.height.base) + base: math.multiply(baseMass, Math.pow(ratio, 3)) } }