瀏覽代碼

Add an option to automatically estimate food intake

master
Fen Dweller 5 年之前
父節點
當前提交
a75d521821
共有 1 個檔案被更改,包括 23 行新增1 行删除
  1. +23
    -1
      macrovision.js

+ 23
- 1
macrovision.js 查看文件

@@ -322,7 +322,8 @@ const config = {
maxLineSize: 150, maxLineSize: 150,
autoFit: false, autoFit: false,
drawYAxis: true, drawYAxis: true,
drawXAxis: false
drawXAxis: false,
autoFoodIntake: false
} }


const availableEntities = { const availableEntities = {
@@ -800,6 +801,15 @@ function makeEntity(info, views, sizes) {


view.units = {}; 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.entries(view.attributes).forEach(([key, val]) => {
Object.defineProperty( Object.defineProperty(
view, view,
@@ -2021,6 +2031,18 @@ const settingsData = {
toggleBodyClass("toggle-bottom-cover", param); 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) { function getBoundingBox(entities, margin = 0.05) {


Loading…
取消
儲存