yea
This commit is contained in:
parent
7d3a2fa25a
commit
014c88cb58
|
|
@ -1575,8 +1575,6 @@ elements.blackhole_storage = {
|
||||||
tick: function(pixel) {
|
tick: function(pixel) {
|
||||||
if (!pixel.bhcontents){
|
if (!pixel.bhcontents){
|
||||||
pixel.bhcontents = [];
|
pixel.bhcontents = [];
|
||||||
} else {
|
|
||||||
pixel.decidedcontent = pixel.bhcontents[Math.floor(Math.random()*pixel.bhcontents.length)];
|
|
||||||
}
|
}
|
||||||
for (var i = 0; i < squareCoords.length; i++) {
|
for (var i = 0; i < squareCoords.length; i++) {
|
||||||
var coord = squareCoords[i];
|
var coord = squareCoords[i];
|
||||||
|
|
@ -1588,15 +1586,15 @@ elements.blackhole_storage = {
|
||||||
pixel.bhcontents.push(otherPixel);
|
pixel.bhcontents.push(otherPixel);
|
||||||
deletePixel(otherPixel.x, otherPixel.y);
|
deletePixel(otherPixel.x, otherPixel.y);
|
||||||
}
|
}
|
||||||
} else if (pixel.charge && isEmpty(x,y) && pixel.decidedcontent){
|
} else if (pixel.charge && isEmpty(x,y) && pixel.bhcontents.length){
|
||||||
var otherPixel = pixelMap[x][y];
|
let randomindex = Math.floor(Math.random()*pixel.bhcontents.length);
|
||||||
pixel.decidedcontent.x = x;
|
let releasedPixel = pixel.bhcontents[randomindex]
|
||||||
pixel.decidedcontent.y = y;
|
pixel.bhcontents.splice(randomindex, 1)
|
||||||
delete pixel.decidedcontent.del;
|
delete releasedPixel.del
|
||||||
otherPixel = pixel.decidedcontent;
|
releasedPixel.x = x
|
||||||
currentPixels.push(pixel.decidedcontent);
|
releasedPixel.y = y
|
||||||
pixel.bhcontents.splice(pixel.bhcontents.indexOf(pixel.decidedcontent), 1);
|
pixelMap[x][y] = releasedPixel
|
||||||
pixel.decidedcontent = pixel.bhcontents[Math.floor(Math.random()*pixel.bhcontents.length)];
|
currentPixels.push(releasedPixel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -3906,3 +3904,26 @@ elements.false_vacuum = {
|
||||||
movable: false,
|
movable: false,
|
||||||
hardness: 1
|
hardness: 1
|
||||||
}
|
}
|
||||||
|
let signInput = "Hello World!";
|
||||||
|
elements.sign = {
|
||||||
|
color: "#FFFFFF",
|
||||||
|
darkText: true,
|
||||||
|
category: "special",
|
||||||
|
onSelect: function(){
|
||||||
|
let signi = prompt("What text should the sign display?", signInput||"Hello World!")
|
||||||
|
signInput = signi;
|
||||||
|
},
|
||||||
|
renderer: function(pixel, ctx){
|
||||||
|
if (!pixel.sign){pixel.sign = signInput}
|
||||||
|
},
|
||||||
|
movable: false
|
||||||
|
}
|
||||||
|
renderPostPixel(function(ctx){
|
||||||
|
for (pixel of currentPixels){
|
||||||
|
if (pixel.element == "sign" && pixel.sign){
|
||||||
|
ctx.font = `12pt PressStart2P`
|
||||||
|
ctx.fillStyle = pixel.color;
|
||||||
|
ctx.fillText(pixel.sign, canvasCoord(pixel.x), canvasCoord(pixel.y))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
Loading…
Reference in New Issue