Przeglądaj źródła

Add an option to estimate prey capacity

master
Fen Dweller 5 lat temu
rodzic
commit
24375737a9
1 zmienionych plików z 24 dodań i 2 usunięć
  1. +24
    -2
      macrovision.js

+ 24
- 2
macrovision.js Wyświetl plik

@@ -323,7 +323,8 @@ const config = {
autoFit: false, autoFit: false,
drawYAxis: true, drawYAxis: true,
drawXAxis: false, drawXAxis: false,
autoFoodIntake: false
autoFoodIntake: false,
autoPreyCapacity: false
} }


const availableEntities = { const availableEntities = {
@@ -810,6 +811,15 @@ function makeEntity(info, views, sizes) {
} }
} }


if (config.autoPreyCapacity && view.attributes.weight !== undefined && view.attributes.capacity === undefined) {
view.attributes.capacity = {
name: "Capacity",
power: 3,
type: "volume",
base: math.unit(0.2 * view.attributes.weight.base.toNumber("lbs") / 150, "people")
}
}

Object.entries(view.attributes).forEach(([key, val]) => { Object.entries(view.attributes).forEach(([key, val]) => {
Object.defineProperty( Object.defineProperty(
view, view,
@@ -2033,7 +2043,7 @@ const settingsData = {
}, },
"auto-food-intake": { "auto-food-intake": {
name: "Estimate Food Intake", name: "Estimate Food Intake",
desc: "Guess how much food creatures need, based on their mass",
desc: "Guess how much food creatures need, based on their mass -- 2000kcal per 150lbs",
type: "toggle", type: "toggle",
default: false, default: false,
get value() { get value() {
@@ -2042,6 +2052,18 @@ const settingsData = {
set value(param) { set value(param) {
config.autoFoodIntake = param config.autoFoodIntake = param
} }
},
"auto-prey-capacity": {
name: "Estimate Prey Capacity",
desc: "Guess how many people a creature could eat, based on its mass -- 1 person per 750lbs",
type: "toggle",
default: false,
get value() {
return config.autoPreyCapacity
},
set value(param) {
config.autoPreyCapacity = param
}
} }
} }




Ładowanie…
Anuluj
Zapisz