From 50ae470d6962c89937be33b92d7c576413176332 Mon Sep 17 00:00:00 2001 From: sb <155691462+stefanblox@users.noreply.github.com> Date: Sat, 24 Feb 2024 13:20:24 -0300 Subject: [PATCH] sbstuff 2.8.1 something new in special category... --- mods/sbstuff.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/mods/sbstuff.js b/mods/sbstuff.js index 3f924ecd..f768af8e 100644 --- a/mods/sbstuff.js +++ b/mods/sbstuff.js @@ -1779,6 +1779,35 @@ elements.glitch = { movable: false }; +elements.sound = { + color: ["#1464b4","#aeeb82"], + currentSound: null, + onSelect: function() { + var file = document.createElement("input"); + file.type = "file"; + file.accept = "audio/*"; + file.onchange = function() { + setTimeout(function(){ + var reader = new FileReader(); + reader.onload = function(e) { + if (elements.sound.currentSound) { + elements.sound.currentSound.pause(); + } + elements.sound.currentSound = new Audio(); + elements.sound.currentSound.src = e.target.result; + elements.sound.currentSound.play(); + file.value = ""; + } + reader.readAsDataURL(file.files[0]); + },500); + } + file.click(); + }, + onUnselect: function() {}, + tool: function() {}, + category: "special", +}; + elements.incinerate.category = "tools", elements.cook.category = "tools", elements.room_temp.category = "tools",