Selaa lähdekoodia

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 4 vuotta sitten
vanhempi
commit
3ba05645cf
1 muutettua tiedostoa jossa 17 lisäystä ja 3 poistoa
  1. +17
    -3
      macrovision.js

+ 17
- 3
macrovision.js Näytä tiedosto

@@ -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))
}
}



Loading…
Peruuta
Tallenna