|
|
|
@@ -322,7 +322,8 @@ const config = { |
|
|
|
maxLineSize: 150, |
|
|
|
autoFit: false, |
|
|
|
drawYAxis: true, |
|
|
|
drawXAxis: false |
|
|
|
drawXAxis: false, |
|
|
|
autoFoodIntake: false |
|
|
|
} |
|
|
|
|
|
|
|
const availableEntities = { |
|
|
|
@@ -800,6 +801,15 @@ function makeEntity(info, views, sizes) { |
|
|
|
|
|
|
|
view.units = {}; |
|
|
|
|
|
|
|
if (config.autoFoodIntake && view.attributes.weight !== undefined && view.attributes.energyNeed === undefined) { |
|
|
|
view.attributes.energyNeed = { |
|
|
|
name: "Food Intake", |
|
|
|
power: 3, |
|
|
|
type: "energy", |
|
|
|
base: math.unit(2000 * view.attributes.weight.base.toNumber("lbs") / 150, "kcal") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Object.entries(view.attributes).forEach(([key, val]) => { |
|
|
|
Object.defineProperty( |
|
|
|
view, |
|
|
|
@@ -2021,6 +2031,18 @@ const settingsData = { |
|
|
|
toggleBodyClass("toggle-bottom-cover", param); |
|
|
|
} |
|
|
|
}, |
|
|
|
"auto-food-intake": { |
|
|
|
name: "Estimate Food Intake", |
|
|
|
desc: "Guess how much food creatures need, based on their mass", |
|
|
|
type: "toggle", |
|
|
|
default: false, |
|
|
|
get value() { |
|
|
|
return config.autoFoodIntake |
|
|
|
}, |
|
|
|
set value(param) { |
|
|
|
config.autoFoodIntake = param |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function getBoundingBox(entities, margin = 0.05) { |
|
|
|
|