Procházet zdrojové kódy

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
master
Fen Dweller před 4 roky
rodič
revize
3ba05645cf
1 změnil soubory, kde provedl 17 přidání a 3 odebrání
  1. +17
    -3
      macrovision.js

+ 17
- 3
macrovision.js Zobrazit soubor

@@ -593,6 +593,16 @@ function updateRatios() {
} }


text += prevSelectedEntity.name + " looks " + math.format(apparentHeight, { precision: 3}) + " tall to " + selectedEntity.name; 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; ratioInfo.innerText = text;
} else { } else {
@@ -1216,17 +1226,21 @@ function makeEntity(info, views, sizes, forms = {}) {
let base = undefined; let base = undefined;
switch(config.autoMass) { switch(config.autoMass) {
case "human": 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 break
case "quadruped at shoulder": 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 break
} }

const ratio = math.divide(view.attributes.height.base, baseHeight)
view.attributes.weight = { view.attributes.weight = {
name: "Mass", name: "Mass",
power: 3, power: 3,
type: "mass", type: "mass",
base: math.multiply(base, view.attributes.height.base)
base: math.multiply(baseMass, Math.pow(ratio, 3))
} }
} }




Načítá se…
Zrušit
Uložit