liquidAmount sets the amount of generated liquids

It works like the "rockAmount" parameter in the rock mod. "?liquidAmount=100" will produce 100 randomly generated solid-liquid-gas triplets.

With both mods enabled, passing "?rockAmount=76&liquidAmount=42" will make the mods generate 76 rock-gravel pairs and 42 SLG triplets.
This commit is contained in:
Lily-129 2022-04-08 10:17:01 -04:00 committed by GitHub
parent 24b28a2f28
commit d28748376e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 1 deletions

View File

@ -1,3 +1,16 @@
urlParams = new URLSearchParams(window.location.search);
if(urlParams.get('liquidAmount') != null) { //null check
liquidAmount = urlParams.get('liquidAmount')
if(isNaN(liquidAmount) || liquidAmount === "" || liquidAmount === null) { //NaN check
liquidAmount = 10
}
liquidAmount = parseInt(liquidAmount)
liquidAmount = Math.min(10000,Math.max(liquidAmount,1))
} else {
liquidAmount = 10
}
function _randomInt(max) {
if(max >= 0) {
return Math.floor(Math.random() * (max + 1))
@ -196,7 +209,7 @@ if(logLiquids == true) {
liquidString = ""
}
for(i = 0; i < 10; i++) {
for(i = 0; i < liquidAmount; i++) {
var name = generateName();
var meltingAdjustment = avgRndToMult();
var densityAdjustment = avgRndToMult();