From cd7570bc03ff8f7a921caacb821abdee74ce8d36 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Tue, 4 Jan 2022 10:38:47 -0600 Subject: [PATCH] Show weight ratios --- macrovision.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/macrovision.js b/macrovision.js index d37a7d85..de6c13b5 100644 --- a/macrovision.js +++ b/macrovision.js @@ -681,6 +681,15 @@ function updateInfo() { text += prevSelectedEntity.name + " looks " + math.format(apparentHeight, { precision: 3}) + " tall to " + selectedEntity.name + "\n"; + if (selectedEntity.currentView.weight && prevSelectedEntity.currentView.weight) { + const ratio = math.divide(selectedEntity.currentView.weight, prevSelectedEntity.currentView.weight) + + if (ratio > 1) { + text += selectedEntity.name + " is " + math.format(ratio, {precision: 2}) + " times heavier than " + prevSelectedEntity.name + "\n"; + } else { + text += selectedEntity.name + " is " + math.format(1/ratio, {precision: 2}) + " times lighter than " + prevSelectedEntity.name + "\n"; + } + } const capacity = selectedEntity.currentView.preyCapacity ?? selectedEntity.currentView.capacity ?? selectedEntity.currentView.volume if (capacity && prevSelectedEntity.currentView.weight) {