ソースを参照

Separate people-units into their own category. Add blocks as a unit

master
Fen Dweller 4年前
コミット
ccbc03d3b9
1個のファイルの変更41行の追加21行の削除
  1. +41
    -21
      macrovision.js

+ 41
- 21
macrovision.js ファイルの表示

@@ -180,6 +180,11 @@ math.createUnit("footballFields", {
definition: "57600 feet^2", definition: "57600 feet^2",
prefixes: "long" prefixes: "long"
}); });
math.createUnit("blocks", {
definition: "20000 m^2",
prefixes: "long",
aliases: ["block", "blocks"]
});


math.createUnit("peopleInRural", { math.createUnit("peopleInRural", {
definition: "0.02 miles^2" definition: "0.02 miles^2"
@@ -334,31 +339,36 @@ const defaultUnits = {
metric: "meters", metric: "meters",
customary: "feet", customary: "feet",
relative: "stories", relative: "stories",
quirky: "smoots"
quirky: "smoots",
human: "humans"
}, },
area: { area: {
metric: "meters^2", metric: "meters^2",
customary: "feet^2", customary: "feet^2",
relative: "footballFields", relative: "footballFields",
quirky: "nanoacres"
quirky: "nanoacres",
human: "peopleInCrowd"
}, },
volume: { volume: {
metric: "liters", metric: "liters",
customary: "gallons", customary: "gallons",
relative: "olympicPools", relative: "olympicPools",
volume: "barnMegaparsecs"
volume: "barnMegaparsecs",
human: "people"
}, },
mass: { mass: {
metric: "kilograms", metric: "kilograms",
customary: "lbs", customary: "lbs",
relative: "peopleMass", relative: "peopleMass",
quirky: "firkins"
quirky: "firkins",
human: "peopleMass"
}, },
energy: { energy: {
metric: "kJ", metric: "kJ",
customary: "kcal", customary: "kcal",
relative: "peopleEaten",
quirky: "donkeySeconds"
relative: "chickenNuggets",
quirky: "donkeySeconds",
human: "peopleEaten"
} }
} }


@@ -379,7 +389,6 @@ const unitChoices = {
"nauticalMiles", "nauticalMiles",
], ],
"relative": [ "relative": [
"humans",
"stories", "stories",
"buses", "buses",
"marathons", "marathons",
@@ -401,6 +410,9 @@ const unitChoices = {
"furlongs", "furlongs",
"HUs", "HUs",
"fathoms", "fathoms",
],
"human": [
"humans",
] ]
}, },
area: { area: {
@@ -415,18 +427,21 @@ const unitChoices = {
"miles^2" "miles^2"
], ],
"relative": [ "relative": [
"peopleInRural",
"peopleInManhattan",
"peopleInLooseCrowd",
"peopleInCrowd",
"peopleInDenseCrowd",
"pinHeads", "pinHeads",
"dinnerPlates", "dinnerPlates",
"footballFields"
"footballFields",
"blocks"
], ],
"quirky": [ "quirky": [
"barns", "barns",
"nanoacres" "nanoacres"
],
"human": [
"peopleInRural",
"peopleInManhattan",
"peopleInLooseCrowd",
"peopleInCrowd",
"peopleInDenseCrowd",
] ]
}, },
volume: { volume: {
@@ -443,7 +458,6 @@ const unitChoices = {
"gallons", "gallons",
], ],
"relative": [ "relative": [
"people",
"shippingContainers", "shippingContainers",
"olympicPools", "olympicPools",
"oceans", "oceans",
@@ -453,6 +467,9 @@ const unitChoices = {
], ],
"quirky": [ "quirky": [
"barnMegaparsecs" "barnMegaparsecs"
],
"human": [
"people",
] ]
}, },
mass: { mass: {
@@ -468,7 +485,6 @@ const unitChoices = {
"tons" "tons"
], ],
"relative": [ "relative": [
"peopleMass",
"cars", "cars",
"busMasses", "busMasses",
"earthMass", "earthMass",
@@ -476,6 +492,9 @@ const unitChoices = {
], ],
"quirky": [ "quirky": [
"firkins" "firkins"
],
"human": [
"peopleMass",
] ]
}, },
energy: { energy: {
@@ -489,14 +508,16 @@ const unitChoices = {
], ],
"relative": [ "relative": [
"chickenNuggets", "chickenNuggets",
],
"quirky": [
"donkeySeconds"
],
"human": [
"peopleEaten", "peopleEaten",
"villagesEaten", "villagesEaten",
"townsEaten", "townsEaten",
"citiesEaten", "citiesEaten",
"metrosEaten", "metrosEaten",
],
"quirky": [
"donkeySeconds"
] ]
} }
} }
@@ -654,7 +675,6 @@ function updateInfo() {


if (capacity && prevSelectedEntity.currentView.weight) { if (capacity && prevSelectedEntity.currentView.weight) {
const containCount = math.divide(capacity, math.divide(prevSelectedEntity.currentView.weight, math.unit("80kg/people"))); const containCount = math.divide(capacity, math.divide(prevSelectedEntity.currentView.weight, math.unit("80kg/people")));
console.log(containCount);
if (containCount > 0.1) { if (containCount > 0.1) {
text += selectedEntity.name + " can fit " + math.format(containCount, { precision: 1 }) + " of " + prevSelectedEntity.name + " inside them" + "\n" text += selectedEntity.name + " can fit " + math.format(containCount, { precision: 1 }) + " of " + prevSelectedEntity.name + " inside them" + "\n"
} }
@@ -663,7 +683,6 @@ function updateInfo() {
if (selectedEntity.currentView.energyIntake && prevSelectedEntity.currentView.energyValue) { if (selectedEntity.currentView.energyIntake && prevSelectedEntity.currentView.energyValue) {
const consumeCount = math.divide(selectedEntity.currentView.energyIntake, prevSelectedEntity.currentView.energyValue); const consumeCount = math.divide(selectedEntity.currentView.energyIntake, prevSelectedEntity.currentView.energyValue);
console.log(consumeCount);
if (consumeCount > 0.1) { if (consumeCount > 0.1) {
text += selectedEntity.name + " needs to eat " + math.format(consumeCount, { precision: 1 }) + " of " + prevSelectedEntity.name + " per day" + "\n" text += selectedEntity.name + " needs to eat " + math.format(consumeCount, { precision: 1 }) + " of " + prevSelectedEntity.name + " per day" + "\n"
} }
@@ -2919,7 +2938,8 @@ const settingsData = {
"metric", "metric",
"customary", "customary",
"relative", "relative",
"quirky"
"quirky",
"human"
], ],
get value() { get value() {
return config.units; return config.units;


読み込み中…
キャンセル
保存