Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/R74nCom/sandboxels
Browse files Browse the repository at this point in the history
  • Loading branch information
slweeb committed Dec 23, 2023
2 parents 4af21b4 + d0ea0bd commit fcf1d8d
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions mods/nousersthings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1321,4 +1321,73 @@ elements.soup = {
},
elements.broth.onMix = function(pixel){
changePixel(pixel, "soup")
},
converter1Var = 0;
converter2Var = 0;
elements.converter = {
color: "#296127",
behavior: behaviors.WALL,
category: "machines",
tick: function(pixel) {
if (pixel.start === pixelTicks){
pixel.contype = converter2Var;
pixel.specialturn = converter1Var;
}
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x,y)) {
var otherPixel = pixelMap[x][y];
if ((otherPixel.element == pixel.specialturn || pixel.specialturn == "all") && !elements.converter.ignore.includes(otherPixel.element)){
changePixel(otherPixel, pixel.contype)
}
}
}
},
onSelect: function() {
var answer5 = prompt("Please input what type of element should be converted. Write \"all\" to include everything.",(converter1Var||undefined));
if (!answer5) { return }
converter1Var = answer5;
var answer6 = prompt("Please input what it should turn into.",(converter2Var||undefined));
if (!answer6) { return }
converter2Var = answer6;
},
ignore: ["converter", "wall", "ewall", "border"],
movable: false,
},
elements.blackhole_storage = {
color: "#171717",
behavior: behaviors.WALL,
category: "machines",
tick: function(pixel) {
if (!pixel.bhcontents){
pixel.bhcontents = [];
} else {
pixel.decidedcontent = pixel.bhcontents[Math.floor(Math.random()*pixel.bhcontents.length)];
}
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x,y) && (!pixel.charge && !pixel.chargeCD)) {
var otherPixel = pixelMap[x][y];
if (elements[otherPixel.element].movable == true){
pixel.bhcontents.push(otherPixel);
deletePixel(otherPixel.x, otherPixel.y);
}
} else if (pixel.charge && isEmpty(x,y) && pixel.decidedcontent){
var otherPixel = pixelMap[x][y];
pixel.decidedcontent.x = x;
pixel.decidedcontent.y = y;
delete pixel.decidedcontent.del;
otherPixel = pixel.decidedcontent;
currentPixels.push(pixel.decidedcontent);
pixel.bhcontents.splice(pixel.bhcontents.indexOf(pixel.decidedcontent), 1);
pixel.decidedcontent = pixel.bhcontents[Math.floor(Math.random()*pixel.bhcontents.length)];
}
}
},
movable: false,
conduct: 1,
}

0 comments on commit fcf1d8d

Please sign in to comment.