diff --git a/mods/hidden_ground.js b/mods/hidden_ground.js new file mode 100644 index 00000000..94b8534e --- /dev/null +++ b/mods/hidden_ground.js @@ -0,0 +1,40 @@ +// Hidden Ground v1.0 +// Author: Melecie + +runAfterLoad(function() { + if (enabledMods.includes("mods/the_ground.js")) { + let regexRocks = /(granite)|(rhyolite)|(pumice)|(obsidian)|(dacite)|(dacidian)|(andesite)|(diorite)|(scoria)|(andesidian)|(gabbro)|(basalt)|(basalidian)|(peridotite)|(komatiite)|(komatidian)/ + let regexType = /(_gravel)|(_sand)|(_dust)|(_shard)|(hot_)/ + let toHide = ["dry_permafrost", "hot_sand", "hot_dirt", "hot_rock", "hot_rock_wall", "hot_gravel", "hot_limestone", "hot_calcium_carbonate_dust", "sandy_water", "clay_water", "dry_clay_loam"] + + // hides all elements part of both rocks and type + // false positives *can* be hit because this doesn't check if it comes from The Ground (it can't), but ideally none given how specific it is + for (elem in elements) { + if (regexRocks.test(elem)) { + // move wall to solids to not make land too big + if (/_wall/.test(elem)) { + elements[elem].category = "solids" + } + // hide the rest + if (regexType.test(elem)) { + elements[elem].hidden = true; + } + } + } + + // manual hiding + for (elem in toHide) { + elements[toHide[elem]].hidden = true; + } + + // while i'm here, might as well fix Sandstone's color + elements.sandstone.color = "#dbbe80"; + } + + else { + enabledMods.splice(enabledMods.indexOf("mods/hidden_ground.js"), 1); + localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); + alert("Hidden Ground: This mod requires The Ground mod. Removing mod and reloading."); + window.location.reload(); + } +}) \ No newline at end of file