Просмотр исходного кода

Add a basic system for energy intake

master
Fen Dweller 5 лет назад
Родитель
Сommit
1faa8db1f5
4 измененных файлов: 57 добавлений и 0 удалений
  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 Просмотреть файл

@@ -171,6 +171,23 @@ math.createUnit("earthMass", {
prefixes: "long" 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 = { const defaultUnits = {
length: { length: {
metric: "meters", metric: "meters",
@@ -191,6 +208,11 @@ const defaultUnits = {
metric: "kilograms", metric: "kilograms",
customary: "lbs", customary: "lbs",
relative: "peopleMass" relative: "peopleMass"
},
energy: {
metric: "kJ",
customary: "kcal",
relative: "peopleEaten"
} }
} }


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


+ 11
- 0
presets/characters.js Просмотреть файл

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


+ 2
- 0
presets/food.js Просмотреть файл

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


+ 9
- 0
presets/objects.js Просмотреть файл

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

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


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


Загрузка…
Отмена
Сохранить