From c9ce3b6c9a753b27570a2c8ecf50cb24d63461f4 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Sun, 10 Oct 2021 20:16:21 -0400 Subject: [PATCH] Add an option to estimate caloric value for a creature --- macrovision.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/macrovision.js b/macrovision.js index 3f56f4b4..37b60da4 100644 --- a/macrovision.js +++ b/macrovision.js @@ -1199,6 +1199,15 @@ function makeEntity(info, views, sizes, forms = {}) { } } + if (config.autoCaloricValue && view.attributes.weight !== undefined && view.attributes.energyWorth === undefined) { + view.attributes.energyNeed = { + name: "Caloric Value", + power: 3, + type: "energy", + base: math.unit(860 * view.attributes.weight.base.toNumber("lbs"), "kcal") + } + } + if (config.autoPreyCapacity !== "none" && view.attributes.weight !== undefined && view.attributes.capacity === undefined) { view.attributes.capacity = { name: "Capacity", @@ -2772,6 +2781,18 @@ const settingsData = { config.autoFoodIntake = param } }, + "auto-caloric-value": { + name: "Estimate Caloric Value", + desc: "Guess how much food a creature is worth -- 860kcal per pound", + type: "toggle", + default: false, + get value() { + return config.autoCaloricValue + }, + set value(param) { + config.autoCaloricValue = param + } + }, "auto-prey-capacity": { name: "Estimate Prey Capacity", desc: "Guess how much prey creatures can hold, based on their mass",