From 768938fae951c6d827d7a2e1d0f65354cf192e20 Mon Sep 17 00:00:00 2001 From: Jayd-Rubies <155784127+Jayd-Rubies@users.noreply.github.com> Date: Fri, 23 Jan 2026 19:07:53 -0500 Subject: [PATCH 1/2] Beta rollout of new mods --- keyBindButton.js | 44 +++++++++ weaponsRewrite.js | 233 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 277 insertions(+) create mode 100644 keyBindButton.js create mode 100644 weaponsRewrite.js diff --git a/keyBindButton.js b/keyBindButton.js new file mode 100644 index 00000000..512066e6 --- /dev/null +++ b/keyBindButton.js @@ -0,0 +1,44 @@ +async function _kBBprompt(message, defaultValue = "") { + return new Promise(resolve => { + promptInput(message, (result) => { + resolve(result); + }, "keyBindButton.js is asking you...", defaultValue); + + }) +} +async function _jaydalert(message) { + promptText(message, undefined, "Jayd:"); +} +runAfterLoad(async () => { + window.setTimeout(async () => { + _jaydalert("Warning! keyBindButton.js is in beta, expect bugs.") + },) +}) + +elements.keyBindButton = { + color: "#bebfa3", + onPlace: async (pixel) => { + pixel.thisKeyIsBinded = await _kBBprompt("Select a key to bind.",(pixel.thisKeyIsBinded||undefined)) + }, + tick: (pixel) => { + document.onkeydown = function(kb)/*keybind*/ { + if (kb.key.toLowerCase() == pixel.thisKeyIsBinded.toLowerCase()) { + pixel.charge = 1; + } + }, + document.onkeyup = function(kb)/*keybind*/ { + if (kb.key.toLowerCase() == pixel.thisKeyIsBinded.toLowerCase()) { + } + } + doDefaults(pixel); + }, + perTick: () => { + mouseSize = 1; + }, + ignore: ["flash"], + conduct: 1, + movable: false, + category:"machines", + darkText: true, + maxSize: 1 +} \ No newline at end of file diff --git a/weaponsRewrite.js b/weaponsRewrite.js new file mode 100644 index 00000000..397f519a --- /dev/null +++ b/weaponsRewrite.js @@ -0,0 +1,233 @@ +dependOn("betterSettings.js", () => { + const tabweapons = new SettingsTab("weapons.js"); + enablestartupprompt = new Setting("Startup prompt", "startup_prompt", settingType.BOOLEAN, false, defaultValue=true, "The prompt requesting you to add velocity.js, (unavailable for steam edition)"); + + tabweapons.registerSetting(enablestartupprompt); + settingsManager.registerTab(tabweapons); + + runAfterLoad(async () => { + window.setTimeout(async () => { + if (!enabledMods.includes("mods/velocity.js") && standaloneType !== "steam" && enablestartupprompt.value === true){ + _jaydalert("velocity.js is recommended for weapons.js to function in its intended way."); + } + },) +}) +},true) +async function _weaponsjsprompt(message, defaultValue = "") { + return new Promise(resolve => { + promptInput(message, (result) => { + resolve(result); + }, "weapons.js is asking you...", defaultValue); + + }) +} +async function _jaydalert(message) { + promptText(message, undefined, "Jayd:"); +} +async function _weaponsjsdir(message) { + promptDir(message, undefined, "weapons.js is asking you..."); +} + +elements.tsar_bomba = { + color: "#969696", + tick: (pixel) => { + tryMove(pixel, pixel.x, pixel.y+1) + for (var y = 1; y < 4; y++) { + if (!isEmpty(pixel.x, pixel.y + y, false)) { + explodeAt(pixel.x,pixel.y,150,"plasma") + } + } + }, + category: "weapons.js", + state: "solid", + density: 1300, + excludeRandom: true, + cooldown: defaultCooldown +}, +elements.missile_left = { + color: "#313131", + category: "weapons.js", + state: "solid", + behavior: [ + "EX:20>missile_shrapnel|XX|XX|XX|XX|XX|CR:smoke" + ], + ignore: "missile_left", + tick: function(pixel) { + var circlec = circleCoords(pixel.x, pixel.y, 3) + for (var i = 0; i < circlec.length; i++){ + var coord = circlec[i] + var x = coord.x + var y = coord.y + if (!(isEmpty(x, y, true) || (x == pixel.x && y == pixel.y) || elements[pixelMap[x][y].element].state == "gas" || pixelMap[x][y].element == "missile_left")){ + explodeAt(pixel.x,pixel.y,20,"missile_shrapnel") + } + } + for (var i=0; i<3; i++) { + tryMove(pixel, pixel.x-1, pixel.y) + } + }, + density: 1300, + excludeRandom: true, + cooldown: defaultCooldown +}, +elements.missile_right = { + color: "#313131", + category: "weapons.js", + state: "solid", + behavior: [ + "CR:smoke|XX|XX|XX|XX|XX|EX:20>missile_shrapnel" + ], + ignore: "missile_right", + tick: function(pixel) { + var circlec = circleCoords(pixel.x, pixel.y, 3) + for (var i = 0; i < circlec.length; i++){ + var coord = circlec[i] + var x = coord.x + var y = coord.y + if (!(isEmpty(x, y, true) || (x == pixel.x && y == pixel.y) || elements[pixelMap[x][y].element].state == "gas")){ + explodeAt(pixel.x,pixel.y,20,"missile_shrapnel") + } + } + for (var i=0; i<3; i++) { + tryMove(pixel, pixel.x+1, pixel.y) + } + }, + density: 1300, + excludeRandom: true, + cooldown: defaultCooldown +} +var target = [,]; +var tgt = "head"; +elements.tracking_missile = { + color: "#323232", + category: "weapons.js", + behavior: [ + "XX","XX","CR:smoke" + ], + onSelect: async () => { + var answer1 = await _weaponsjsprompt("Please input the target.",(tgt||undefined)); + if (!answer1) {return} + tgt = answer1; + }, + tick: (pixel) => { + var circlec = circleCoords(pixel.x, pixel.y, 3) + for (var i = 0; i < circlec.length; i++){ + var coord = circlec[i] + var xe = coord.x + var ye = coord.y + if (!(isEmpty(xe, ye, true) || (xe == pixel.x && ye == pixel.y) || elements[pixelMap[xe][ye].element].state == "gas" || pixelMap[xe][ye].element == "tracking_missile")){ + explodeAt(pixel.x,pixel.y,20,"missile_shrapnel") + } + } + for (var x = 1; x < width; x++) { + for (var y = 1; y < height; y++) { + if (!isEmpty(x,y)) { + if (pixelMap[x][y].element===tgt) { + target = [pixelMap[x][y].x, pixelMap[x][y].y]; + } + } + } + } + if (pixel.x != target[0] || pixel.y != target[1]) { + let {x, y} = pixel; + const empty = checkForEmptyPixels(x, y); + const [tX, tY] = target; + let bestVal = Math.sqrt(Math.pow(tX - x, 2) + Math.pow(tY - y, 2)); + let best = null; + for (const pixelPair of empty) { + const [x_, y_] = [x + pixelPair[0], y + pixelPair[1]]; + const c = Math.sqrt(Math.pow(tX - x_, 2) + Math.pow(tY - y_, 2)); + if (c < bestVal) { + bestVal = c; + best = pixelPair; + } + } + if (best) { + tryMove(pixel, x + best[0]*2, y + best[1]*2, undefined, true); + } + } + } +}, +elements.missile_shrapnel = { + color: "#979ea3", + behavior: [ + "XX|XX|XX", + "XX|EX:5 %20|XX", + "M2%20|M1%20|M2%20", + ], + burn: 90, + burnTime: 100, + density: 2000, + conduct: 1, + state: "solid", + category: "weapons.js" +}, +elements.cluster_nuke = { + color: "#323232", + category: "weapons.js", + behavior: behaviors.POWDER, + maxSize: 1, + cooldown: defaultCooldown, + tick: (pixel) => { + for (var y = 1; y < 25; y++) { + if (!isEmpty(pixel.x, pixel.y + y, false)) { + explodeAt(pixel.x,pixel.y,25,["dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","dirty_bomb","nuke",]) + } + } + } +} +// let ammo1 = 1; +// let rdir = 1; +// let ammoLoaded = ""; +// elements.railgun = { +// category: "weapons.js", +// behavior: behaviors.WALL, +// onSelect: async (pixel) => { +// var answer1 = await _weaponsjsprompt("Please input the ammo type. \n \n <1 for Armor-Piercing ammo> \n <2 for High-Explosive ammo.>",(ammo1||undefined)); +// if (!answer1) {return} +// ammo1 = answer1; +// var answer2 = await _weaponsjsdir("Please input the direction.",(rdir||undefined)); +// if (!answer2) { +// console.log(answer2) +// return} +// rdir = answer2; +// }, +// tick: async (pixel) => { +// ammoLoaded = "armor_piercing_shell"; +// if(ammo1 === 1){ +// ammoLoaded = "armor_piercing_shell" +// } +// else if (ammo1 === 2){ +// ammoLoaded = "high_explosive_shell" +// } + +// if (pixel.charge){ +// if(rdir === 1){ +// createPixel(ammoLoaded, pixel.x, pixel.y-1); +// } +// if (rdir === 2){ +// createPixel(ammoLoaded, pixel.x, pixel.y+1); +// } +// if (rdir === 3){ +// createPixel(ammoLoaded, pixel.x-1, pixel.y); +// } +// if (rdir === 4){ +// createPixel(ammoLoaded, pixel.x+1, pixel.y); +// } +// } +// doDefaults(pixel); +// }, +// color: "#c9c9c9", +// conduct: 1, +// hardness: 8, +// }, +// elements.armor_piercing_shell = { +// category: "ammunition", +// color: "#ffc954", +// hardness: 0.9, +// } +// elements.high_explosive_shell = { +// category: "ammunition", +// color: "#ffc954", +// hardness: 0.6, +// } From 80f7b2fbf0b0bbfa93b55783e70362b69897ea3f Mon Sep 17 00:00:00 2001 From: Jayd-Rubies <155784127+Jayd-Rubies@users.noreply.github.com> Date: Fri, 23 Jan 2026 19:10:09 -0500 Subject: [PATCH 2/2] Update mod-list.html --- mod-list.html | 1 + 1 file changed, 1 insertion(+) diff --git a/mod-list.html b/mod-list.html index f8bd6318..57e96c9c 100644 --- a/mod-list.html +++ b/mod-list.html @@ -304,6 +304,7 @@ subspace.jsThe Subspace Tripmine from Robloxnousernamefound war_crimes.jsTear gas and morevoidapex11 weapons.jsVariety of different weaponsJayd + weaponsRewrite.jsBETA! weapons.js is getting an overhaul, more details soon.(hopefully)Jayd Food & Cooking aChefsDream_beta.jsBeta testing for aChefsDream.jsSquareScreamYT