commit
88cf606f8c
|
|
@ -12,7 +12,6 @@ elements.argon = {
|
|||
elements.liquid_argon = {
|
||||
color: elements.neon.color,
|
||||
behavior: behaviors.LIQUID,
|
||||
colorOn: ["#c831ee","#d683eb","#7a258f"],
|
||||
category: "states",
|
||||
state: "liquid",
|
||||
tempHigh: -183.8,
|
||||
|
|
@ -20,18 +19,15 @@ elements.liquid_argon = {
|
|||
density: 1401,
|
||||
tempLow: -189.3,
|
||||
stateLow: "frozen_argon",
|
||||
conduct: 0.8
|
||||
}
|
||||
elements.frozen_argon = {
|
||||
color: elements.neon.color,
|
||||
behavior: behaviors.WALL,
|
||||
colorOn: ["#c831ee","#d683eb","#7a258f"],
|
||||
category: "states",
|
||||
state: "solid",
|
||||
tempHigh: -187.3,
|
||||
stateHigh: "liquid_argon",
|
||||
density: 1616,
|
||||
conduct: 0.8
|
||||
}
|
||||
elements.krypton = {
|
||||
color: elements.neon.color,
|
||||
|
|
@ -47,7 +43,6 @@ elements.krypton = {
|
|||
elements.liquid_krypton = {
|
||||
color: elements.neon.color,
|
||||
behavior: behaviors.LIQUID,
|
||||
colorOn: ["#c49dce","#ac8ab4","#715579"],
|
||||
category: "states",
|
||||
state: "liquid",
|
||||
tempHigh: -150.22,
|
||||
|
|
@ -55,18 +50,15 @@ elements.liquid_krypton = {
|
|||
density: 2423,
|
||||
tempLow: -157.36,
|
||||
stateLow: "frozen_krypton",
|
||||
conduct: 0.8
|
||||
}
|
||||
elements.frozen_krypton = {
|
||||
color: elements.neon.color,
|
||||
behavior: behaviors.WALL,
|
||||
colorOn: ["#c49dce","#ac8ab4","#715579"],
|
||||
category: "states",
|
||||
state: "solid",
|
||||
tempHigh: -154.36,
|
||||
stateHigh: "liquid_krypton",
|
||||
density: 2160,
|
||||
conduct: 0.8
|
||||
}
|
||||
elements.xenon = {
|
||||
color: elements.neon.color,
|
||||
|
|
@ -82,7 +74,6 @@ elements.xenon = {
|
|||
elements.liquid_xenon = {
|
||||
color: elements.neon.color,
|
||||
behavior: behaviors.LIQUID,
|
||||
colorOn: ["#627eca","#4572d3","#333cb1"],
|
||||
category: "states",
|
||||
state: "liquid",
|
||||
tempHigh: -104,
|
||||
|
|
@ -90,18 +81,15 @@ elements.liquid_xenon = {
|
|||
density: 2948,
|
||||
tempLow: -111.8,
|
||||
stateLow: "frozen_xenon",
|
||||
conduct: 0.8
|
||||
}
|
||||
elements.frozen_xenon = {
|
||||
color: elements.neon.color,
|
||||
behavior: behaviors.WALL,
|
||||
colorOn: ["#627eca","#4572d3","#333cb1"],
|
||||
category: "states",
|
||||
state: "solid",
|
||||
tempHigh: -109.8,
|
||||
stateHigh: "liquid_xenon",
|
||||
density: 3410,
|
||||
conduct: 0.8
|
||||
}
|
||||
elements.radon = {
|
||||
color: elements.neon.color,
|
||||
|
|
@ -156,7 +144,6 @@ elements.radon = {
|
|||
elements.liquid_radon = {
|
||||
color: elements.neon.color,
|
||||
behavior: behaviors.LIQUID,
|
||||
colorOn: ["#d33d83","#f7327d","#c0316d"],
|
||||
category: "states",
|
||||
state: "liquid",
|
||||
tempHigh: -58,
|
||||
|
|
@ -164,19 +151,16 @@ elements.liquid_radon = {
|
|||
density: 13,
|
||||
tempLow: -71,
|
||||
stateLow: "frozen_radon",
|
||||
conduct: 0.8,
|
||||
tick: elements.radon.tick
|
||||
}
|
||||
elements.frozen_radon = {
|
||||
color: elements.neon.color,
|
||||
behavior: behaviors.WALL,
|
||||
colorOn: ["#d33d83","#f7327d","#c0316d"],
|
||||
category: "states",
|
||||
state: "solid",
|
||||
tempHigh: -68,
|
||||
stateHigh: "liquid_radon",
|
||||
density: 16,
|
||||
conduct: 0.8,
|
||||
tick: elements.radon.tick
|
||||
}
|
||||
elements.oganesson = {
|
||||
|
|
@ -226,35 +210,4 @@ elements.oganesson = {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// lightmap.js integration function
|
||||
if (enabledMods.includes("mods/lightmap.js")){
|
||||
function nobleGasTick(pixel){
|
||||
if (pixel.charge || pixel.chargeCD){
|
||||
let color = elements[pixel.element].colorOn
|
||||
let randcolor = color[Math.floor(Math.random()*color.length)]
|
||||
let rgbcolor = hexToRGB(randcolor)
|
||||
console.log(color)
|
||||
console.log(randcolor)
|
||||
console.log(rgbcolor)
|
||||
let x = Math.floor(pixel.x / lightmapScale);
|
||||
let y = Math.floor(pixel.y / lightmapScale);
|
||||
lightmap[y][x] = { color: [rgbcolor.r, rgbcolor.g, rgbcolor.b] };
|
||||
}
|
||||
}
|
||||
let nobleGases = ["argon", "liquid_argon", "frozen_argon", "krypton", "liquid_krypton", "frozen_krypton", "xenon", "liquid_xenon", "frozen_xenon", "radon", "liquid_radon", "frozen_radon", "oganesson"]
|
||||
for (let i = 0; i < nobleGases.length; i++){
|
||||
let nobleGas = nobleGases[i]
|
||||
if (elements[nobleGas].tick){
|
||||
oldTick = elements[nobleGas].tick
|
||||
elements[nobleGas].tick = function(pixel){
|
||||
nobleGasTick(pixel)
|
||||
oldTick(pixel)
|
||||
}
|
||||
}else{
|
||||
elements[nobleGas].tick = function(pixel){
|
||||
nobleGasTick(pixel)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2249,6 +2249,21 @@ elements.gas_filter = {
|
|||
function weightedAverage(num1, num2, weight){
|
||||
return ((weight * num1)+((1-weight)*num2))
|
||||
}
|
||||
function getPixelColor(pixel){
|
||||
let rgb2;
|
||||
if(pixel.color.startsWith("#")) {
|
||||
rgb2 = pixel.color.match(/[0-9A-F]{2}/ig).map(x => parseInt(x,16));
|
||||
} else if(pixel.color.startsWith("hsl")) {
|
||||
var hsl = pixel.color.match(/\d+/g);
|
||||
hsl[0] = (hsl[0] / 360) % 360; if(hsl[0] < 0) { hsl[0]++ };
|
||||
hsl[1] = Math.max(Math.min(hsl[1] / 100,1),0);
|
||||
hsl[2] = Math.max(Math.min(hsl[2] / 100,1),0);
|
||||
rgb2 = HSLtoRGB(hsl)
|
||||
} else {
|
||||
rgb2 = pixel.color.match(/\d+/g);
|
||||
}
|
||||
return rgb2
|
||||
}
|
||||
elements.dyer = {
|
||||
customColor: true,
|
||||
color: ["#ff0000","#ff8800","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff"],
|
||||
|
|
@ -2265,7 +2280,7 @@ elements.dyer = {
|
|||
if (!(pixelMap[x][y].element == "dyer")){
|
||||
var newPixel = pixelMap[x][y];
|
||||
var rgb1 = pixel.color.match(/\d+/g);
|
||||
var rgb2 = newPixel.color.match(/\d+/g);
|
||||
var rgb2 = getPixelColor(newPixel)
|
||||
// average the colors
|
||||
var rgb = [
|
||||
weightedAverage(parseInt(rgb1[0]), parseInt(rgb2[0]), 0.2),
|
||||
|
|
@ -2702,7 +2717,7 @@ elements.healing_serum = {
|
|||
// interpolate pixel color and decidedpixel's color (if it has one!)
|
||||
if (pixel.decidedPixel){
|
||||
var color1 = pixel.color.match(/\d+/g);
|
||||
var color2 = pixel.decidedPixel.color.match(/\d+/g);
|
||||
var color2 = getPixelColor(pixel.decidedPixel)
|
||||
var ratio = pixel.wait/15
|
||||
drawSquare(ctx, `rgb(${color1[0]*ratio+color2[0]*(1-ratio)},${color1[1]*ratio+color2[1]*(1-ratio)},${color1[2]*ratio+color2[2]*(1-ratio)})`, pixel.x, pixel.y)
|
||||
}
|
||||
|
|
@ -2726,7 +2741,7 @@ elements.ray_emitter = {
|
|||
if (rayans2 == "false"){rayStoppedByWalls = false} else {rayStoppedByWalls = true}
|
||||
},
|
||||
hoverStat: function(pixel){
|
||||
return (pixel.rayElement.toUpperCase() || "unset") + ", " + (pixel.rayStoppedByWalls.toString().toUpperCase() || "unset")
|
||||
return (pixel.rayElement|| "unset").toUpperCase() + ", " + (pixel.rayStoppedByWalls || "unset").toString().toUpperCase()
|
||||
},
|
||||
tick: function(pixel){
|
||||
if (pixelTicks == pixel.start){
|
||||
|
|
@ -2789,7 +2804,7 @@ elements.ray = {
|
|||
movable: true,
|
||||
category: "special",
|
||||
hoverStat: function(pixel){
|
||||
return pixel.life.toString() || "unset"
|
||||
return (pixel.life || "unset").toString()
|
||||
},
|
||||
properties: {
|
||||
life: 10,
|
||||
|
|
@ -3793,16 +3808,17 @@ elements.pipe_transmitter = {
|
|||
pixel.channel = pipe_transmitter_channelVar;
|
||||
}
|
||||
if (pixel.channel && pixel.con){
|
||||
for (x in pixelMap){
|
||||
for (y in pixelMap[x]){
|
||||
if (!isEmpty(x, y, true)){
|
||||
if (pixelMap[x][y].element == "pipe_receiver" && pixelMap[x][y].channel == pixel.channel && !pixelMap[x][y].con){
|
||||
pixelMap[x][y].con = pixel.con;
|
||||
delete pixel.con;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
let valid = currentPixels.filter(pixel2 =>
|
||||
pixel2.element == "pipe_receiver" && pixel2.channel === pixel.channel && !(pixel2.con)
|
||||
)
|
||||
if (valid.length){
|
||||
console.log(valid)
|
||||
shuffleArray(valid);
|
||||
console.log(valid)
|
||||
pixel.con.x = valid[0].x
|
||||
pixel.con.y = valid[0].y
|
||||
pixelMap[valid[0].x][valid[0].y].con = pixel.con
|
||||
delete pixel.con
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3833,16 +3849,60 @@ elements.pipe_receiver = {
|
|||
if (pixelMap[x][y].channel == pixel.channel && !pixelMap[x][y].con){
|
||||
pixelMap[x][y].con = pixel.con;
|
||||
delete pixel.con;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
pixel.con.x = x;
|
||||
pixel.con.y = y;
|
||||
pixelMap[x][y].con = pixel.con;
|
||||
delete pixel.con;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elements.false_vacuum_decay_bomb = {
|
||||
color: "#3f0b0b",
|
||||
category: "weapons",
|
||||
behavior: behaviors.STURDYPOWDER,
|
||||
tick: function(pixel){
|
||||
if (!isEmpty(pixel.x, pixel.y+1, true)){
|
||||
changePixel(pixel, "false_vacuum")
|
||||
}
|
||||
}
|
||||
}
|
||||
elements.false_vacuum = {
|
||||
color: "#b41b1b",
|
||||
category: "special",
|
||||
hidden: true,
|
||||
tick: function(pixel){
|
||||
if (!pixel.timeAlive){
|
||||
pixel.timeAlive = 0
|
||||
}
|
||||
pixel.color = `rgb(${180/(pixel.timeAlive+2)}, ${27/(pixel.timeAlive+2)}, ${27/(pixel.timeAlive+2)})`
|
||||
if (pixel.timeAlive === 0){
|
||||
for (i = 0; i < squareCoords.length; i++){
|
||||
let x = squareCoords[i][0] + pixel.x;
|
||||
let y = squareCoords[i][1] + pixel.y;
|
||||
if (!isEmpty(x, y, true)){
|
||||
if (pixelMap[x][y].element !== "false_vacuum"){
|
||||
deletePixel(x, y)
|
||||
createPixel("false_vacuum", x, y)
|
||||
}
|
||||
} else if (isEmpty(x, y)){
|
||||
createPixel("false_vacuum", x, y)
|
||||
}
|
||||
}
|
||||
}
|
||||
pixel.timeAlive ++;
|
||||
if (pixel.timeAlive > 20){
|
||||
deletePixel(pixel.x, pixel.y)
|
||||
return
|
||||
}
|
||||
},
|
||||
movable: false,
|
||||
hardness: 1
|
||||
}
|
||||
Loading…
Reference in New Issue