texturepack.js

This commit is contained in:
JustAGenericUsername 2024-05-05 15:49:10 -04:00
parent 5b911e59e7
commit 25477dd861
2 changed files with 102 additions and 0 deletions

View File

@ -74,6 +74,14 @@ if (Math.abs(settings.randomcount) == settings.randomcount){
}else(elements["element_"+i].desc += (" or " + reaction)) }else(elements["element_"+i].desc += (" or " + reaction))
} }
} }
for (var reaction in elements["element_" + i].reactions){
if (elements[elements["element_"+i].reactions[reaction].elem1].category == "tools" || elements[elements["element_"+i].reactions[reaction].elem2].category == "tools"){
console.log(i + " makes a tool...? when it touches " + reaction)
if (!elements["element_"+i].desc){
elements["element_" + i].desc = "This breaks the laws of physics if it touches " + reaction
}else(elements["element_"+i].desc += (" or " + reaction))
}
}
} }
} else { } else {
for (var i = 1; i <= settings.randomcount; i++){ for (var i = 1; i <= settings.randomcount; i++){

94
mods/texturepack.js Normal file
View File

@ -0,0 +1,94 @@
if (!settings.texturepack){
settings.texturepack = {}
saveSettings()
}
elements.clear_textures = {
color: "#dd0000",
onSelect: function(){
var sure = prompt("Are you sure you wanna reset all texture data? Type \"yes\". Also, refresh once you've done this for the changes to apply!", "no");
if (sure == "yes"){
settings.texturepack = {}
saveSettings()
}
},
canPlace: false,
category: "texture tools"
}
var addSave = null
elements.add_texture = {
color: elements.rainbow.color,
category: "texture tools",
canPlace: false,
onSelect: function(){
var whoelement = prompt("What element would you like to change the texture of? Type no if this was a mistake.", (addSave||"no"))
if (whoelement != "no"){
addSave = whoelement
var replacehm = prompt("Would you like to overwrite all textures or add? 1 for overwrite, 2 for add.", 2)
var colortodo = prompt("Hex code, please! Also, refresh once you've done this for the changes to apply!", "#ff0000")
if (replacehm == 1){
if (!replacehm || !colortodo){return}
if (!settings.texturepack[whoelement]){settings.texturepack[whoelement] = []}
settings.texturepack[whoelement] = [colortodo]
elements[whoelement].color = settings.texturepack[whoelement]
saveSettings()
} else {
if (!replacehm || !colortodo){return}
if (!settings.texturepack[whoelement]){settings.texturepack[whoelement] = []}
settings.texturepack[whoelement].push(colortodo)
elements[whoelement].color = settings.texturepack[whoelement]
saveSettings()
}
}
}
}
elements.remove_a_texture = {
color: elements.void.color,
category: "texture tools",
canPlace: false,
onSelect: function(){
var whoelement = prompt("What element would you like to change the texture of? Type no if this was a mistake.", "no")
if (whoelement != "no"){
var replacehm = prompt("Would you like to delete all textures of the element or just one? Type 1 for all, 2 for just one.", 2)
var colortodo = prompt(("Ignore this if you chose 1. Index of the color you wanna delete. For reference, here are the current colors:" + settings.texturepack[whoelement]), 0)
if (replacehm == 1){
delete settings.texturepack[whoelement]
saveSettings()
} else {
delete settings.texturepack[whoelement][colortodo]
elements[whoelement].color = settings.texturepack[whoelement]
saveSettings()
}
}
}
}
elements.list_all_textures = {
color: elements.mix.color,
category: "texture tools",
canPlace: false,
onSelect: function(){
var whoelement = prompt("What element would you like to see the textures of?")
alert(whoelement + " has the following textures: " + settings.texturepack[whoelement])
}
}
elements.texture_pack_share_or_load = {
color: elements.image.color,
category: "texture tools",
canPlace: false,
onSelect: function(){
var whichSL = prompt("Would you like to copy the texture pack to your clipboard or load it from your clipboard? Type 1 for copy, 2 for load.", 1)
if (whichSL == 1){
var text = JSON.stringify(settings.texturepack)
alert(text)
} else {
var text = prompt("Paste your texture pack here. It should be in the format of a JSON object.")
if (text){
settings.texturepack = JSON.parse(text)
saveSettings()
}
}
}
}
if (settings.texturepack){
for (var elementi in settings.texturepack){
elements[elementi].color = settings.texturepack[elementi]
}}