Browse Source

Add a basic system for energy intake

master
Fen Dweller 4 years ago
parent
commit
1faa8db1f5
4 changed files with 57 additions and 0 deletions
  1. +35
    -0
      macrovision.js
  2. +11
    -0
      presets/characters.js
  3. +2
    -0
      presets/food.js
  4. +9
    -0
      presets/objects.js

+ 35
- 0
macrovision.js View File

@@ -171,6 +171,23 @@ math.createUnit("earthMass", {
prefixes: "long"
});

math.createUnit("kcal", {
definition: "4184 joules",
prefixes: "long"
})
math.createUnit("foodPounds", {
definition: "867 kcal",
prefixes: "long"
})
math.createUnit("foodKilograms", {
definition: "1909 kcal",
prefixes: "long"
})
math.createUnit("peopleEaten", {
definition: "125000 kcal",
prefixes: "long"
})

const defaultUnits = {
length: {
metric: "meters",
@@ -191,6 +208,11 @@ const defaultUnits = {
metric: "kilograms",
customary: "lbs",
relative: "peopleMass"
},
energy: {
metric: "kJ",
customary: "kcal",
relative: "peopleEaten"
}
}

@@ -277,6 +299,19 @@ const unitChoices = {
"earthMass",
"solarmasses"
]
},
energy: {
"metric": [
"kJ",
"foodKilograms"
],
"customary": [
"kcal",
"foodPounds"
],
"relative": [
"peopleEaten"
]
}
}
const config = {


+ 11
- 0
presets/characters.js View File

@@ -46,6 +46,15 @@ function makeCharacter(info, viewInfo, defaultSizes) {
base: value.capacity
}
}

if (value.energyNeed) {
views[key].attributes.capacity = {
name: "Food Intake",
power: 3,
type: "energy",
base: value.energyNeed
}
}
});

return createEntityMaker(info, views, defaultSizes);
@@ -15341,6 +15350,7 @@ characterMakers.push(() => makeCharacter(
anthro: {
height: math.unit(5 + 8/12, "feet"),
weight: math.unit(200, "lb"),
energyNeed: math.unit(2000, "kcal"),
name: "Anthro",
image: {
source: "./media/characters/kee/anthro.svg",
@@ -15351,6 +15361,7 @@ characterMakers.push(() => makeCharacter(
taur: {
height: math.unit(11, "feet"),
weight: math.unit(500, "lb"),
energyNeed: math.unit(5000, "kcal"),
name: "Taur",
image: {
source: "./media/characters/kee/taur.svg",


+ 2
- 0
presets/food.js View File

@@ -9,12 +9,14 @@ function makeFood() {
woman1: {
height: math.unit(5 + 7 / 12, "feet"),
mass: math.unit(140, "lbs"),
energy: math.unit(1, "peopleEaten"),
image: { source: "./media/food/humans/woman-1.svg" },
name: "Woman 1"
},
man1: {
height: math.unit(5 + 11 / 12, "feet"),
mass: math.unit(150, "lbs"),
energy: math.unit(1, "peopleEaten"),
image: { source: "./media/food/humans/man-1.svg" },
name: "Man 1"
},


+ 9
- 0
presets/objects.js View File

@@ -33,6 +33,15 @@ function makeObject(name, viewInfo) {
base: value.volume
}
}

if (value.energy) {
views[key].attributes.capacity = {
name: "Energy",
power: 3,
type: "energy",
base: value.energy
}
}
});

return makeEntity({ name: name }, views);


Loading…
Cancel
Save