Bläddra i källkod

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 år sedan
förälder
incheckning
3ba05645cf
1 ändrade filer med 17 tillägg och 3 borttagningar
  1. +17
    -3
      macrovision.js

+ 17
- 3
macrovision.js Visa fil

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



Laddar…
Avbryt
Spara