diff --git a/mod-list.html b/mod-list.html index fe276e5f..45c8f386 100644 --- a/mod-list.html +++ b/mod-list.html @@ -151,6 +151,7 @@ save_loading.jsAdds the ability to save and load scenes from files (See the info page of the element)Alice selective_paint.jsAdds a tool to paint only selected elementsSquareScreamYT stripe_paint.jsAdds a tool to paint with stripesAlice +texturepack.jsAdds tools that let you create and share custom texture packsnousernamefound the_ground.jsAdds several rock types, worldgen settings, and gemstonesAlice Science & Chemistry diff --git a/mods/10kelements.js b/mods/10kelements.js index 957d4088..711a4ea6 100644 --- a/mods/10kelements.js +++ b/mods/10kelements.js @@ -74,6 +74,14 @@ if (Math.abs(settings.randomcount) == settings.randomcount){ }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 { for (var i = 1; i <= settings.randomcount; i++){ diff --git a/mods/colorLED.js b/mods/colorLED.js new file mode 100644 index 00000000..ec3a4622 --- /dev/null +++ b/mods/colorLED.js @@ -0,0 +1,38 @@ +elements.led = { + behavior: behaviors.WALL, + reactions: { + "light": {"charge1":1}, + "liquid_light": {"charge1":1}, + }, + color: "#666666", + colorOn: "#ffffff", + category: "machines", + tempHigh: 1500, + stateHigh: ["molten_glass","molten_glass","molten_glass","molten_gallium"], + conduct: 1, + breakInto: "glass_shard", + tick: (pixel) => { + if (pixel.start == pixelTicks) { + pixel.normalColor = pixel.color; + pixel.chargeColor = `rgb(${pixel.color.replace(/[rgb\(\)]/g, "").split(",").map(a => parseInt(a.trim()) + 120).join(", ")})`; + } + if (pixel.color != pixel.normalColor && !pixel.charge && !pixel.chargeCD) { + pixel.normalColor = pixel.color; + pixel.chargeColor = `rgb(${pixel.color.replace(/[rgb\(\)]/g, "").split(",").map(a => parseInt(a.trim()) + 120).join(", ")})`; + } + if (pixel.charge) { + pixel.color = pixel.chargeColor; + } else { + pixel.color = pixel.normalColor; + } + } +} + +pixelColorPick = (function() { + const oldPixelColorPick = pixelColorPick; + + return function(pixel, customColor = null) { + if (pixel.element == "led" && pixel.color && !customColor) return pixel.color; + return oldPixelColorPick.apply(this, arguments); + } +})() \ No newline at end of file diff --git a/mods/scp.js b/mods/scp.js index a6eb71dc..4792e6f4 100644 --- a/mods/scp.js +++ b/mods/scp.js @@ -428,7 +428,7 @@ elements.plague_doctor = { createPixel("doc_head", pixel.x, pixel.y-1); pixelMap[pixel.x][pixel.y-1].color = pixel.color; pixel.element = "doc_body"; - pixelMap[pixel.x][pixel.y].color = ["#11111f","#242424"]; + pixel.color = pixelColorPick(pixel) } else { deletePixel(pixel.x, pixel.y); diff --git a/mods/texturepack.js b/mods/texturepack.js new file mode 100644 index 00000000..fdb9de06 --- /dev/null +++ b/mods/texturepack.js @@ -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] +}} \ No newline at end of file