diff --git a/game.js b/game.js index 9237f70..f9b171e 100644 --- a/game.js +++ b/game.js @@ -1558,9 +1558,9 @@ let macro = } if (this.maleParts) { if (this.hasSheath && this.arousal < 75) { - line = "Your " + this.describeDick + " cock is hidden away in your bulging sheath, with two " + mass(macro.ballMass, unit, true) + ", " + length(macro.ballDiameter, unit, true) + "-wide balls hanging beneath."; + line = "Your " + this.describeDick + " cock is hidden away in your bulging sheath, with two " + mass(macro.ballMass, unit, true) + ", " + length(macro.ballDiameter, unit, true) + " wide balls hanging beneath."; } else { - line = "Your " + this.describeDick + " cock hangs from your hips, with two " + mass(macro.ballMass, unit, true) + ", " + length(macro.ballDiameter, unit, true) + "-wide balls hanging beneath."; + line = "Your " + this.describeDick + " cock hangs from your hips, with two " + mass(macro.ballMass, unit, true) + ", " + length(macro.ballDiameter, unit, true) + " wide balls hanging beneath."; } result.push(line); result.push(macro.balls.description); @@ -1573,7 +1573,7 @@ let macro = } if (this.hasBreasts) { - line = "You have two " + length(this.breastDiameter, unit, true) + "-wide breasts that weigh " + mass(macro.breastMass, unit) + " apiece."; + line = "You have two " + length(this.breastDiameter, unit, true) + " wide breasts that weigh " + mass(macro.breastMass, unit) + " apiece."; if (this.lactationEnabled) { line += " They slosh with " + volume(this.milkStorage.amount, unit, false) + " of creamy milk."; @@ -1628,7 +1628,7 @@ let macro = }, get describeTail() { - return (this.tailCount > 1 ? this.tailCount + " " : "") + length(this.tailLength, unit, true) + "-long " + this.tailType; + return (this.tailCount > 1 ? this.tailCount + " " : "") + length(this.tailLength, unit, true) + " long " + this.tailType; }, get describeDick() { @@ -1716,12 +1716,14 @@ function toggle_auto(e) function toggle_units(e) { switch(unit) { - case "metric": unit = "customary"; break; - case "customary": unit = "approx"; break; + case "metric": unit = "SI"; break; + case "SI": unit = "customary"; break; + case "customary": unit = "US"; break; + case "US": unit = "approx"; break; case "approx": unit = "metric"; break; } - e.target.innerText = "Units: " + unit.charAt(0).toUpperCase() + unit.slice(1); + e.target.innerText = "Units:\n" + unit.charAt(0).toUpperCase() + unit.slice(1); update(); } @@ -1729,11 +1731,13 @@ function toggle_units(e) function toggle_units_options(e) { switch(unit) { - case "metric": unit = "customary"; break; - case "customary": unit = "metric"; break; + case "metric": unit = "SI"; break; + case "SI": unit = "customary"; break; + case "customary": unit = "US"; break; + case "US": unit = "metric"; break; } - e.target.innerText = "Units: " + unit.charAt(0).toUpperCase() + unit.slice(1); + e.target.innerText = "Units:\n" + unit.charAt(0).toUpperCase() + unit.slice(1); updateAllPreviews(); } @@ -4908,6 +4912,8 @@ function startGame(e) { document.getElementById("edge").style.display = "none"; } + document.getElementById("button-option-toggle_units").innerText = "Units:\n" + unit.charAt(0).toUpperCase() + unit.slice(1); //sets units button to display selected unit on start + if (macro.victimsHuman) { // eh this is ok things["Person"] = Human; @@ -4930,6 +4936,7 @@ function startGame(e) { document.getElementById("actions-body").style.display = 'flex'; document.getElementById("stat-container").style.display = 'flex'; + window.scroll(0,0); } diff --git a/units.js b/units.js index 60a5b63..d2cac8c 100644 --- a/units.js +++ b/units.js @@ -128,7 +128,9 @@ function number_prefix(value) { function mass(kg, type="metric", singular=false) { switch(type) { case "metric": return metricMass(kg, singular); + case "SI": return metricSymMass(kg, singular); case "customary": return customaryMass(kg, singular); + case "US": return customarySymMass(kg, singular); case "approx": return approxMass(kg, singular); } } @@ -136,7 +138,9 @@ function mass(kg, type="metric", singular=false) { function length(m, type="metric", singular=false) { switch(type) { case "metric": return metricLength(m, singular); + case "SI": return metricSymLength(m, singular); case "customary": return customaryLength(m, singular); + case "US": return customarySymLength(m, singular); case "approx": return approxLength(m, singular); } } @@ -144,7 +148,9 @@ function length(m, type="metric", singular=false) { function area(m2, type="metric", singular=false) { switch(type) { case "metric": return metricArea(m2, singular); + case "SI": return metricSymArea(m2, singular); case "customary": return customaryArea(m2, singular); + case "US": return customarySymArea(m2, singular); case "approx": return approxArea(m2, singular); } } @@ -152,7 +158,9 @@ function area(m2, type="metric", singular=false) { function volume(m3, type="metric", singular=false) { switch(type) { case "metric": return metricVolume(m3, singular); + case "SI": return metricSymVolume(m3, singular); case "customary": return customaryVolume(m3, singular); + case "US": return customarySymVolume(m3, singular); case "approx": return approxVolume(m3, singular); } } @@ -182,6 +190,31 @@ function metricMass(kg, singular=false) { } } +function metricSymMass(kg, singular=false) { + if (kg < 1/1000) { + let mass = round(kg * 1e6,0); + return mass + " mg"; + } else if (kg < 1) { + let mass = round(kg * 1000,0); + return mass + " g"; + } else if (kg < 5000) { + let mass = round(kg,0); + return mass + " kg"; + } else if (kg < 5000000) { + let mass = round(kg / 1000,1); + return mass + " t"; + } else if (kg < 5000000000) { + let mass = round(kg / 1000000,1); + return mass + " kt"; + } else if (kg < 5000000000000) { + let mass = round(kg / 1000000000,1); + return mass + " mt"; + } else { + let mass = round(kg / 1000000000000,1); + return mass + " gt"; + } +} + function customaryMass(kg, singular=false) { let lbs = kg * 2.2; @@ -197,6 +230,21 @@ function customaryMass(kg, singular=false) { } } +function customarySymMass(kg, singular=false) { + let lbs = kg * 2.2; + + if (lbs < 1) { + let mass = round(lbs * 16,0); + return mass + " oz"; + } else if (lbs < 2000) { + let mass = round(lbs,0); + return mass + (singular || mass == 1 ? " lb" : " lbs"); + } else { + let mass = round(lbs / 2000,1); + return mass + (singular || mass == 1 ? " ton" : " tons"); + } +} + function approxMass(kg, singular=false) { if (kg < 4500) { let mass = round(kg/1000,2); @@ -250,6 +298,22 @@ function metricLength(m, singular=false) { } } +function metricSymLength(m, singular=false) { + if (m < 1/100) { + let length = round(m * 1000,2); + return length + " mm"; + } else if (m < 1) { + let length = round(m * 100,0); + return length + " cm"; + } else if (m < 500) { + let length = round(m,2); + return length + " m"; + } else { + let length = round(m / 1000,1); + return length + " km"; + } +} + function customaryLength(m, singular=false) { let ft = m * 3.28084; @@ -266,6 +330,22 @@ function customaryLength(m, singular=false) { } } +function customarySymLength(m, singular=false) { + let ft = m * 3.28084; + + if (ft < 1) { + let length = round(ft * 12,0); + return length + "\""; + } else if (ft < 5280) { + let end = customarySymLength((ft - Math.floor(ft))/3.28084, singular); + let length = Math.floor(ft); + return length + "'" + " " + end; + } else { + let length = round(ft/5280,1); + return length + " mi"; + } +} + function approxLength(m, singular=false) { if (m < 25) { let length = round(m/1.9,1); @@ -313,6 +393,19 @@ function metricArea(m2, singular=false) { } } +function metricSymArea(m2, singular=false) { + if (m2 < 1/10) { + let area = round(m2 * 10000,2); + return area + " cm" + "2".sup(); + } else if (m2 < 100000) { + let area = round(m2,2); + return area + " m" + "2".sup(); + } else { + let area = round(m2 / 1e6,2); + return area + " km" + "2".sup(); + } +} + function customaryArea(m2, singular=false) { let ft2 = m2 * 3.28084 * 3.28084; @@ -328,6 +421,19 @@ function customaryArea(m2, singular=false) { } } +function customarySymArea(m2, singular=false) { + if (m2 < 1/10) { + let area = round(m2 * 10000,2); + return area + " in" + "2".sup(); + } else if (m2 < 100000) { + let area = round(m2,2); + return area + " ft" + "2".sup(); + } else { + let area = round(m2 / 1e6,2); + return area + " mi" + "2".sup(); + } +} + function metricVolume(m3, singular=false) { if (m3 < 1/1000) { let volume = round(m3*1e6, 0); @@ -347,6 +453,25 @@ function metricVolume(m3, singular=false) { } } +function metricSymVolume(m3, singular=false) { + if (m3 < 1/1000) { + let volume = round(m3*1e6, 0); + return volume + " mL"; + } else if (m3 < 1) { + let volume = round(m3*1000, 1); + return volume + " L"; + } else if (m3 < 1000000) { + let volume = round(m3, 0); + return volume + " m" + "3".sup(); + } else if (m3 < 1e12){ + let volume = round(m3/1e9, 3); + return volume + " km" + "3".sup(); + } else { + let volume = round(m3/1e9, 0); + return volume + " km" + "3".sup(); + } +} + function customaryVolume(m3, singular=false) { let gallons = m3 * 264.172; if (gallons < 1/16) { @@ -370,6 +495,29 @@ function customaryVolume(m3, singular=false) { } } +function customarySymVolume(m3, singular=false) { + let gallons = m3 * 264.172; + if (gallons < 1/16) { + let volume = round(gallons*128,0); + return volume + " fl oz"; + } else if (gallons < 1/4) { + let volume = round(gallons*16,1); + return volume + (singular || volume == 1 ? " cp" : " cps"); + } else if (gallons < 1/2) { + let volume = round(gallons*8,1); + return volume + " pt"; + } else if (gallons < 1) { + let volume = round(gallons*4,1); + return volume + " qt"; + } else if (gallons < 100) { + let volume = round(gallons,1); + return volume + " g"; + } else { + let volume = round(gallons,0); + return volume + " g"; + } +} + function approxVolume(m3, singular=false) { if (m3 < 2/10000) { let volume = round(m3*4e5,0);