Merge branch 'R74nCom:main' into main

This commit is contained in:
JustAGenericUsername 2024-05-27 11:38:29 -04:00 committed by GitHub
commit 1c2096de4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 4298 additions and 123 deletions

285
fast_lightmap.js Normal file
View File

@ -0,0 +1,285 @@
// Redbirdly's Mod that adds a better light system
// this is the faster version of lightmap.js (although lower quality)
let lightmap = [];
let nextLightmap = [];
let lightmapWidth, lightmapHeight;
let pixelSizeQuarter = pixelSizeHalf / 2;
let lightmapScale = 3;
// Define RGB colors
let lightColor = [255, 223, 186];
let sunColor = [255*8, 210*8, 26*8];
let lampColor = [255*4, 223*4, 186*4];
let laserColor = [255, 0, 0];
let ledRColor = [255, 0, 0];
let ledGColor = [0, 255, 0];
let ledBColor = [0, 0, 255];
let fireColor = [255, 69, 0];
let plasmaColor = [160, 69, 255];
let coldFireColor = [0, 191, 255];
let magmaColor = [255, 140, 0];
let neonColor = [255*2, 60*2, 10*2];
function initializeLightmap(width, height) {
lightmapWidth = Math.ceil(width / lightmapScale);
lightmapHeight = Math.ceil(height / lightmapScale);
for (let y = 0; y < lightmapHeight; y++) {
lightmap[y] = [];
nextLightmap[y] = [];
for (let x = 0; x < lightmapWidth; x++) {
lightmap[y][x] = { color: [0, 0, 0] };
nextLightmap[y][x] = { color: [0, 0, 0] };
}
}
}
function deepCopy(source, target) {
for (let y = 0; y < source.length; y++) {
target[y] = [];
for (let x = 0; x < source[y].length; x++) {
target[y][x] = { ...source[y][x] };
}
}
}
function propagateLightmap() {
if (!lightmap || !lightmap[0]) { return; }
let width = lightmap[0].length;
let height = lightmap.length;
let neighbors = [
{ dx: 1, dy: 0 },
{ dx: -1, dy: 0 },
{ dx: 0, dy: 1 },
{ dx: 0, dy: -1 },
];
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
let totalColor = [0, 0, 0];
let neighborCount = 0;
neighbors.forEach(({ dx, dy }) => {
let nx = x + dx;
let ny = y + dy;
if (nx >= 0 && ny >= 0 && nx < width && ny < height) {
totalColor[0] += lightmap[ny][nx].color[0];
totalColor[1] += lightmap[ny][nx].color[1];
totalColor[2] += lightmap[ny][nx].color[2];
neighborCount++;
}
});
nextLightmap[y][x] = {
color: [
Math.min(Math.max(0, totalColor[0] / neighborCount * 0.8), 255*8),
Math.min(Math.max(0, totalColor[1] / neighborCount * 0.8), 255*8),
Math.min(Math.max(0, totalColor[2] / neighborCount * 0.8), 255*8)
]
};
}
}
deepCopy(nextLightmap, lightmap);
}
function rgbToHsv(r, g, b) {
r /= 255, g /= 255, b /= 255;
let max = Math.max(r, g, b), min = Math.min(r, g, b);
let h, s, v = max;
let d = max - min;
s = max === 0 ? 0 : d / max;
if (max === min) {
h = 0;
} else {
switch (max) {
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
case g: h = (b - r) / d + 2; break;
case b: h = (r - g) / d + 4; break;
}
h /= 6;
}
return [h, s, v];
}
function hsvToRgb(h, s, v) {
let r, g, b;
let i = Math.floor(h * 6);
let f = h * 6 - i;
let p = v * (1 - s);
let q = v * (1 - f * s);
let t = v * (1 - (1 - f) * s);
switch (i % 6) {
case 0: r = v, g = t, b = p; break;
case 1: r = q, g = v, b = p; break;
case 2: r = p, g = v, b = t; break;
case 3: r = p, g = q, b = v; break;
case 4: r = t, g = p, b = v; break;
case 5: r = v, g = p, b = q; break;
}
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
}
function renderLightmap() {
if (!canvas) { return; }
if (!lightmap || !lightmap[0]) { return; }
let context = canvas.getContext('2d');
let width = lightmap[0].length;
let height = lightmap.length;
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
let { color } = lightmap[y][x];
let [r, g, b] = color;
if (r > 0 || g > 0 || b > 0) {
let [h, s, v] = rgbToHsv(r, g, b);
let newColor = hsvToRgb(h, s, 1);
let alpha = v;
context.fillStyle = `rgba(${newColor[0]}, ${newColor[1]}, ${newColor[2]}, ${alpha*0.4})`;
context.fillRect(
x * pixelSize * lightmapScale,
y * pixelSize * lightmapScale,
pixelSize * lightmapScale,
pixelSize * lightmapScale
);
context.fillStyle = `rgba(${newColor[0]}, ${newColor[1]}, ${newColor[2]}, ${alpha * 0.25})`;
context.fillRect(
(x * pixelSize - pixelSizeHalf) * lightmapScale,
(y * pixelSize - pixelSizeHalf) * lightmapScale,
pixelSize * lightmapScale * 2,
pixelSize * lightmapScale * 2
);
}
}
}
}
elements.sun.tick = function(pixel) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: sunColor };
};
let originalLightTick = elements.light.tick;
elements.light.tick = function(pixel) {
originalLightTick(pixel);
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: lightColor };
};
let originalLiquidLightTick = elements.liquid_light.tick;
elements.liquid_light.tick = function(pixel) {
originalLiquidLightTick(pixel);
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: lightColor };
};
elements.magma.tick = function(pixel) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: fireColor };
};
elements.neon.tick = function(pixel) {
if (!pixel.charge || pixel.charge <= 0) {return;}
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: neonColor };
};
elements.light_bulb.behaviorOn = null
elements.light_bulb.tick = function(pixel) {
if (pixel.charge > 0) {pixel.lightIntensity = 10;}
if (pixel.lightIntensity > 0) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: lampColor };
}
pixel.lightIntensity -= 1;
};
elements.led_r.tick = function(pixel) {
if (pixel.charge > 0) {pixel.lightIntensity = 4;}
if (pixel.lightIntensity > 0) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: ledRColor };
}
pixel.lightIntensity -= 1;
};
elements.led_g.tick = function(pixel) {
if (pixel.charge > 0) {pixel.lightIntensity = 4;}
if (pixel.lightIntensity > 0) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: ledGColor };
}
pixel.lightIntensity -= 1;
};
elements.led_b.tick = function(pixel) {
if (pixel.charge > 0) {pixel.lightIntensity = 4;}
if (pixel.lightIntensity > 0) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: ledBColor };
}
pixel.lightIntensity -= 1;
};
let originalLaserTick = elements.laser.tick;
elements.laser.tick = function(pixel) {
originalLaserTick(pixel);
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: laserColor };
};
let originalFireTick2 = elements.fire.tick;
elements.fire.tick = function(pixel) {
originalFireTick2(pixel);
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: fireColor };
};
elements.cold_fire.tick = function(pixel) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: coldFireColor };
};
elements.plasma.tick = function(pixel) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: plasmaColor };
};
// Wait for loading
// if it loads too soon then width will be undefined
setTimeout(() => { initializeLightmap(width, height); }, 700);
// Add code to functions instead of replacing them
let originalTick = tick;
tick = function() {
originalTick();
if (!paused) {propagateLightmap();}
};
// Even after updating tick(), setInterval still uses the old tick(), reset setInterval
resetInterval(tps);
let originalDrawPixels = drawPixels;
drawPixels = function(forceTick = false) {
originalDrawPixels(forceTick);
renderLightmap();
};

285
lightmap.js Normal file
View File

@ -0,0 +1,285 @@
// Redbirdly's Mod that adds a better light system
// if the mod is too laggy, use fast_lightmap.js
let lightmap = [];
let nextLightmap = [];
let lightmapWidth, lightmapHeight;
let pixelSizeQuarter = pixelSizeHalf / 2;
let lightmapScale = 2;
// Define RGB colors
let lightColor = [255, 223, 186];
let sunColor = [255*8, 210*8, 26*8];
let lampColor = [255*4, 223*4, 186*4];
let laserColor = [255, 0, 0];
let ledRColor = [255, 0, 0];
let ledGColor = [0, 255, 0];
let ledBColor = [0, 0, 255];
let fireColor = [255, 69, 0];
let plasmaColor = [160, 69, 255];
let coldFireColor = [0, 191, 255];
let magmaColor = [255, 140, 0];
let neonColor = [255*2, 60*2, 10*2];
function initializeLightmap(width, height) {
lightmapWidth = Math.ceil(width / lightmapScale);
lightmapHeight = Math.ceil(height / lightmapScale);
for (let y = 0; y < lightmapHeight; y++) {
lightmap[y] = [];
nextLightmap[y] = [];
for (let x = 0; x < lightmapWidth; x++) {
lightmap[y][x] = { color: [0, 0, 0] };
nextLightmap[y][x] = { color: [0, 0, 0] };
}
}
}
function deepCopy(source, target) {
for (let y = 0; y < source.length; y++) {
target[y] = [];
for (let x = 0; x < source[y].length; x++) {
target[y][x] = { ...source[y][x] };
}
}
}
function propagateLightmap() {
if (!lightmap || !lightmap[0]) { return; }
let width = lightmap[0].length;
let height = lightmap.length;
let neighbors = [
{ dx: 1, dy: 0 },
{ dx: -1, dy: 0 },
{ dx: 0, dy: 1 },
{ dx: 0, dy: -1 },
];
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
let totalColor = [0, 0, 0];
let neighborCount = 0;
neighbors.forEach(({ dx, dy }) => {
let nx = x + dx;
let ny = y + dy;
if (nx >= 0 && ny >= 0 && nx < width && ny < height) {
totalColor[0] += lightmap[ny][nx].color[0];
totalColor[1] += lightmap[ny][nx].color[1];
totalColor[2] += lightmap[ny][nx].color[2];
neighborCount++;
}
});
nextLightmap[y][x] = {
color: [
Math.min(Math.max(0, totalColor[0] / neighborCount * 0.8), 255*8),
Math.min(Math.max(0, totalColor[1] / neighborCount * 0.8), 255*8),
Math.min(Math.max(0, totalColor[2] / neighborCount * 0.8), 255*8)
]
};
}
}
deepCopy(nextLightmap, lightmap);
}
function rgbToHsv(r, g, b) {
r /= 255, g /= 255, b /= 255;
let max = Math.max(r, g, b), min = Math.min(r, g, b);
let h, s, v = max;
let d = max - min;
s = max === 0 ? 0 : d / max;
if (max === min) {
h = 0;
} else {
switch (max) {
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
case g: h = (b - r) / d + 2; break;
case b: h = (r - g) / d + 4; break;
}
h /= 6;
}
return [h, s, v];
}
function hsvToRgb(h, s, v) {
let r, g, b;
let i = Math.floor(h * 6);
let f = h * 6 - i;
let p = v * (1 - s);
let q = v * (1 - f * s);
let t = v * (1 - (1 - f) * s);
switch (i % 6) {
case 0: r = v, g = t, b = p; break;
case 1: r = q, g = v, b = p; break;
case 2: r = p, g = v, b = t; break;
case 3: r = p, g = q, b = v; break;
case 4: r = t, g = p, b = v; break;
case 5: r = v, g = p, b = q; break;
}
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
}
function renderLightmap() {
if (!canvas) { return; }
if (!lightmap || !lightmap[0]) { return; }
let context = canvas.getContext('2d');
let width = lightmap[0].length;
let height = lightmap.length;
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
let { color } = lightmap[y][x];
let [r, g, b] = color;
if (r > 0 || g > 0 || b > 0) {
let [h, s, v] = rgbToHsv(r, g, b);
let newColor = hsvToRgb(h, s, 1);
let alpha = v;
context.fillStyle = `rgba(${newColor[0]}, ${newColor[1]}, ${newColor[2]}, ${alpha*0.4})`;
context.fillRect(
x * pixelSize * lightmapScale,
y * pixelSize * lightmapScale,
pixelSize * lightmapScale,
pixelSize * lightmapScale
);
context.fillStyle = `rgba(${newColor[0]}, ${newColor[1]}, ${newColor[2]}, ${alpha * 0.25})`;
context.fillRect(
(x * pixelSize - pixelSizeHalf) * lightmapScale,
(y * pixelSize - pixelSizeHalf) * lightmapScale,
pixelSize * lightmapScale * 2,
pixelSize * lightmapScale * 2
);
}
}
}
}
elements.sun.tick = function(pixel) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: sunColor };
};
let originalLightTick = elements.light.tick;
elements.light.tick = function(pixel) {
originalLightTick(pixel);
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: lightColor };
};
let originalLiquidLightTick = elements.liquid_light.tick;
elements.liquid_light.tick = function(pixel) {
originalLiquidLightTick(pixel);
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: lightColor };
};
elements.magma.tick = function(pixel) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: fireColor };
};
elements.neon.tick = function(pixel) {
if (!pixel.charge || pixel.charge <= 0) {return;}
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: neonColor };
};
elements.light_bulb.behaviorOn = null
elements.light_bulb.tick = function(pixel) {
if (pixel.charge > 0) {pixel.lightIntensity = 10;}
if (pixel.lightIntensity > 0) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: lampColor };
}
pixel.lightIntensity -= 1;
};
elements.led_r.tick = function(pixel) {
if (pixel.charge > 0) {pixel.lightIntensity = 4;}
if (pixel.lightIntensity > 0) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: ledRColor };
}
pixel.lightIntensity -= 1;
};
elements.led_g.tick = function(pixel) {
if (pixel.charge > 0) {pixel.lightIntensity = 4;}
if (pixel.lightIntensity > 0) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: ledGColor };
}
pixel.lightIntensity -= 1;
};
elements.led_b.tick = function(pixel) {
if (pixel.charge > 0) {pixel.lightIntensity = 4;}
if (pixel.lightIntensity > 0) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: ledBColor };
}
pixel.lightIntensity -= 1;
};
let originalLaserTick = elements.laser.tick;
elements.laser.tick = function(pixel) {
originalLaserTick(pixel);
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: laserColor };
};
let originalFireTick2 = elements.fire.tick;
elements.fire.tick = function(pixel) {
originalFireTick2(pixel);
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: fireColor };
};
elements.cold_fire.tick = function(pixel) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: coldFireColor };
};
elements.plasma.tick = function(pixel) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: plasmaColor };
};
// Wait for loading
// if it loads too soon then width will be undefined
setTimeout(() => { initializeLightmap(width, height); }, 700);
// Add code to functions instead of replacing them
let originalTick = tick;
tick = function() {
originalTick();
if (!paused) {propagateLightmap();}
};
// Even after updating tick(), setInterval still uses the old tick(), reset setInterval
resetInterval(tps);
let originalDrawPixels = drawPixels;
drawPixels = function(forceTick = false) {
originalDrawPixels(forceTick);
renderLightmap();
};

285
mods/fast_lightmap.js Normal file
View File

@ -0,0 +1,285 @@
// Redbirdly's Mod that adds a better light system
// this is the faster version of lightmap.js (although lower quality)
let lightmap = [];
let nextLightmap = [];
let lightmapWidth, lightmapHeight;
let pixelSizeQuarter = pixelSizeHalf / 2;
let lightmapScale = 3;
// Define RGB colors
let lightColor = [255, 223, 186];
let sunColor = [255*8, 210*8, 26*8];
let lampColor = [255*4, 223*4, 186*4];
let laserColor = [255, 0, 0];
let ledRColor = [255, 0, 0];
let ledGColor = [0, 255, 0];
let ledBColor = [0, 0, 255];
let fireColor = [255, 69, 0];
let plasmaColor = [160, 69, 255];
let coldFireColor = [0, 191, 255];
let magmaColor = [255, 140, 0];
let neonColor = [255*2, 60*2, 10*2];
function initializeLightmap(width, height) {
lightmapWidth = Math.ceil(width / lightmapScale);
lightmapHeight = Math.ceil(height / lightmapScale);
for (let y = 0; y < lightmapHeight; y++) {
lightmap[y] = [];
nextLightmap[y] = [];
for (let x = 0; x < lightmapWidth; x++) {
lightmap[y][x] = { color: [0, 0, 0] };
nextLightmap[y][x] = { color: [0, 0, 0] };
}
}
}
function deepCopy(source, target) {
for (let y = 0; y < source.length; y++) {
target[y] = [];
for (let x = 0; x < source[y].length; x++) {
target[y][x] = { ...source[y][x] };
}
}
}
function propagateLightmap() {
if (!lightmap || !lightmap[0]) { return; }
let width = lightmap[0].length;
let height = lightmap.length;
let neighbors = [
{ dx: 1, dy: 0 },
{ dx: -1, dy: 0 },
{ dx: 0, dy: 1 },
{ dx: 0, dy: -1 },
];
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
let totalColor = [0, 0, 0];
let neighborCount = 0;
neighbors.forEach(({ dx, dy }) => {
let nx = x + dx;
let ny = y + dy;
if (nx >= 0 && ny >= 0 && nx < width && ny < height) {
totalColor[0] += lightmap[ny][nx].color[0];
totalColor[1] += lightmap[ny][nx].color[1];
totalColor[2] += lightmap[ny][nx].color[2];
neighborCount++;
}
});
nextLightmap[y][x] = {
color: [
Math.min(Math.max(0, totalColor[0] / neighborCount * 0.8), 255*8),
Math.min(Math.max(0, totalColor[1] / neighborCount * 0.8), 255*8),
Math.min(Math.max(0, totalColor[2] / neighborCount * 0.8), 255*8)
]
};
}
}
deepCopy(nextLightmap, lightmap);
}
function rgbToHsv(r, g, b) {
r /= 255, g /= 255, b /= 255;
let max = Math.max(r, g, b), min = Math.min(r, g, b);
let h, s, v = max;
let d = max - min;
s = max === 0 ? 0 : d / max;
if (max === min) {
h = 0;
} else {
switch (max) {
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
case g: h = (b - r) / d + 2; break;
case b: h = (r - g) / d + 4; break;
}
h /= 6;
}
return [h, s, v];
}
function hsvToRgb(h, s, v) {
let r, g, b;
let i = Math.floor(h * 6);
let f = h * 6 - i;
let p = v * (1 - s);
let q = v * (1 - f * s);
let t = v * (1 - (1 - f) * s);
switch (i % 6) {
case 0: r = v, g = t, b = p; break;
case 1: r = q, g = v, b = p; break;
case 2: r = p, g = v, b = t; break;
case 3: r = p, g = q, b = v; break;
case 4: r = t, g = p, b = v; break;
case 5: r = v, g = p, b = q; break;
}
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
}
function renderLightmap() {
if (!canvas) { return; }
if (!lightmap || !lightmap[0]) { return; }
let context = canvas.getContext('2d');
let width = lightmap[0].length;
let height = lightmap.length;
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
let { color } = lightmap[y][x];
let [r, g, b] = color;
if (r > 0 || g > 0 || b > 0) {
let [h, s, v] = rgbToHsv(r, g, b);
let newColor = hsvToRgb(h, s, 1);
let alpha = v;
context.fillStyle = `rgba(${newColor[0]}, ${newColor[1]}, ${newColor[2]}, ${alpha*0.4})`;
context.fillRect(
x * pixelSize * lightmapScale,
y * pixelSize * lightmapScale,
pixelSize * lightmapScale,
pixelSize * lightmapScale
);
context.fillStyle = `rgba(${newColor[0]}, ${newColor[1]}, ${newColor[2]}, ${alpha * 0.25})`;
context.fillRect(
(x * pixelSize - pixelSizeHalf) * lightmapScale,
(y * pixelSize - pixelSizeHalf) * lightmapScale,
pixelSize * lightmapScale * 2,
pixelSize * lightmapScale * 2
);
}
}
}
}
elements.sun.tick = function(pixel) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: sunColor };
};
let originalLightTick = elements.light.tick;
elements.light.tick = function(pixel) {
originalLightTick(pixel);
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: lightColor };
};
let originalLiquidLightTick = elements.liquid_light.tick;
elements.liquid_light.tick = function(pixel) {
originalLiquidLightTick(pixel);
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: lightColor };
};
elements.magma.tick = function(pixel) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: fireColor };
};
elements.neon.tick = function(pixel) {
if (!pixel.charge || pixel.charge <= 0) {return;}
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: neonColor };
};
elements.light_bulb.behaviorOn = null
elements.light_bulb.tick = function(pixel) {
if (pixel.charge > 0) {pixel.lightIntensity = 10;}
if (pixel.lightIntensity > 0) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: lampColor };
}
pixel.lightIntensity -= 1;
};
elements.led_r.tick = function(pixel) {
if (pixel.charge > 0) {pixel.lightIntensity = 4;}
if (pixel.lightIntensity > 0) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: ledRColor };
}
pixel.lightIntensity -= 1;
};
elements.led_g.tick = function(pixel) {
if (pixel.charge > 0) {pixel.lightIntensity = 4;}
if (pixel.lightIntensity > 0) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: ledGColor };
}
pixel.lightIntensity -= 1;
};
elements.led_b.tick = function(pixel) {
if (pixel.charge > 0) {pixel.lightIntensity = 4;}
if (pixel.lightIntensity > 0) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: ledBColor };
}
pixel.lightIntensity -= 1;
};
let originalLaserTick = elements.laser.tick;
elements.laser.tick = function(pixel) {
originalLaserTick(pixel);
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: laserColor };
};
let originalFireTick2 = elements.fire.tick;
elements.fire.tick = function(pixel) {
originalFireTick2(pixel);
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: fireColor };
};
elements.cold_fire.tick = function(pixel) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: coldFireColor };
};
elements.plasma.tick = function(pixel) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: plasmaColor };
};
// Wait for loading
// if it loads too soon then width will be undefined
setTimeout(() => { initializeLightmap(width, height); }, 700);
// Add code to functions instead of replacing them
let originalTick = tick;
tick = function() {
originalTick();
if (!paused) {propagateLightmap();}
};
// Even after updating tick(), setInterval still uses the old tick(), reset setInterval
resetInterval(tps);
let originalDrawPixels = drawPixels;
drawPixels = function(forceTick = false) {
originalDrawPixels(forceTick);
renderLightmap();
};

View File

@ -95,6 +95,39 @@ elements.human_fossil = {
breakInto: ["rock","gravel","gravel","gravel","sand"],
};
elements.dino_fossil = {
color: ["#bbb3ae","#b4b4b4","#c0c0c0"],
behavior: [
"XX|XX|XX",
"XX|XX|XX",
"M2%75|M1|M2%75",
],
reactions: {
"water": {elem1: "wet_sand", chance: 0.00035},
"salt_water": {elem1: "wet_sand", chance: 0.0005},
"sugar_water": {elem1: "wet_sand", chance: 0.0004},
"seltzer": {elem1: "wet_sand", chance: 0.0004},
"dirty_water": {elem1: "wet_sand", chance: 0.0004},
"soda": {elem1: "wet_sand", chance: 0.0004},
"lichen": {elem1: "dirt", chance: 0.0025},
"bone": {elem2: "fossil", chance: 0.000025},
"bone_marrow": {elem2: "marrow_fossil", chance: 0.00002},
"skull": {elem2: ["human_fossil","human_fossil","fossil"], chance: 0.000025},
"wood": {elem2: "petrified_wood", chance: 0.000015},
"tree_branch": {elem2: "petrified_wood", chance: 0.000015},
"grape": {elem2: "juice", chance: 0.1, color2: "#291824"},
"wheat": {elem2: "flour"},
"primordial_soup": {elem1: "wet_sand", chance: 0.001}
},
tempHigh: 950,
stateHigh: "magma",
category: "life",
state: "solid",
density: 2600,
hardness: 0.55,
breakInto: ["rock","gravel","gravel","gravel","sand"],
};
elements.petrified_wood = {
color: ["#4e4e3e","#464646","#52533a"],
hidden:true,
@ -133,22 +166,22 @@ elements.skull = {
"salt_water": { elem2:"broth", tempMin:70, color2:"#d7db69" },
"sugar_water": { elem2:"broth", tempMin:70, color2:"#d7db69" },
"seltzer": { elem2:"broth", tempMin:70, color2:"#d7db69" },
"rock": { "elem1": "fossil", chance:0.00005 },
"sand": { "elem1": "fossil", chance:0.000035 },
"dirt": { "elem1": "fossil", chance:0.00003 },
"tuff": { "elem1": "fossil", chance:0.00005 },
"basalt": { "elem1": "fossil", chance:0.00004 },
"mudstone": { "elem1": "fossil", chance:0.00004 },
"packed_sand": { "elem1": "fossil", chance:0.00004 },
"gravel": { "elem1": "fossil", chance:0.000035 },
"clay": { "elem1": "fossil", chance:0.00003 },
"clay_soil": { "elem1": "fossil", chance:0.00003 },
"permafrost": { "elem1": "fossil", chance:0.000035 },
"mulch": { "elem1": "fossil", chance:0.00003 },
"ant_wall": { "elem1": "fossil", chance:0.00002 },
"limestone": { "elem1": "fossil", chance:0.00005 },
"quicklime": { "elem1": "fossil", chance:0.000045 },
"slaked_lime": { "elem1": "fossil", chance:0.000035 },
"rock": { "elem1": "human_fossil", chance:0.00005 },
"sand": { "elem1": "human_fossil", chance:0.000035 },
"dirt": { "elem1": "human_fossil", chance:0.00003 },
"tuff": { "elem1": "human_fossil", chance:0.00005 },
"basalt": { "elem1": "human_fossil", chance:0.00004 },
"mudstone": { "elem1": "human_fossil", chance:0.00004 },
"packed_sand": { "elem1": "human_fossil", chance:0.00004 },
"gravel": { "elem1": "human_fossil", chance:0.000035 },
"clay": { "elem1": "human_fossil", chance:0.00003 },
"clay_soil": { "elem1": "human_fossil", chance:0.00003 },
"permafrost": { "elem1": "human_fossil", chance:0.000035 },
"mulch": { "elem1": "human_fossil", chance:0.00003 },
"ant_wall": { "elem1": "human_fossil", chance:0.00002 },
"limestone": { "elem1": "human_fossil", chance:0.00005 },
"quicklime": { "elem1": "human_fossil", chance:0.000045 },
"slaked_lime": { "elem1": "human_fossil", chance:0.000035 },
},
category:"life",
tempHigh: 760,
@ -168,22 +201,22 @@ elements.dino_bones = {
"salt_water": { elem2:"broth", tempMin:70 },
"sugar_water": { elem2:"broth", tempMin:70 },
"seltzer": { elem2:"broth", tempMin:70 },
"rock": { "elem1": "fossil", chance:0.00005 },
"sand": { "elem1": "fossil", chance:0.000035 },
"dirt": { "elem1": "fossil", chance:0.00003 },
"tuff": { "elem1": "fossil", chance:0.00005 },
"basalt": { "elem1": "fossil", chance:0.00004 },
"mudstone": { "elem1": "fossil", chance:0.00004 },
"packed_sand": { "elem1": "fossil", chance:0.00004 },
"gravel": { "elem1": "fossil", chance:0.000035 },
"clay": { "elem1": "fossil", chance:0.00003 },
"clay_soil": { "elem1": "fossil", chance:0.00003 },
"permafrost": { "elem1": "fossil", chance:0.000035 },
"mulch": { "elem1": "fossil", chance:0.00003 },
"ant_wall": { "elem1": "fossil", chance:0.00002 },
"limestone": { "elem1": "fossil", chance:0.00005 },
"quicklime": { "elem1": "fossil", chance:0.000045 },
"slaked_lime": { "elem1": "fossil", chance:0.000035 },
"rock": { "elem1": "dino_fossil", chance:0.00005 },
"sand": { "elem1": "dino_fossil", chance:0.000035 },
"dirt": { "elem1": "dino_fossil", chance:0.00003 },
"tuff": { "elem1": "dino_fossil", chance:0.00005 },
"basalt": { "elem1": "dino_fossil", chance:0.00004 },
"mudstone": { "elem1": "dino_fossil", chance:0.00004 },
"packed_sand": { "elem1": "dino_fossil", chance:0.00004 },
"gravel": { "elem1": "dino_fossil", chance:0.000035 },
"clay": { "elem1": "dino_fossil", chance:0.00003 },
"clay_soil": { "elem1": "dino_fossil", chance:0.00003 },
"permafrost": { "elem1": "dino_fossil", chance:0.000035 },
"mulch": { "elem1": "dino_fossil", chance:0.00003 },
"ant_wall": { "elem1": "dino_fossil", chance:0.00002 },
"limestone": { "elem1": "dino_fossil", chance:0.00005 },
"quicklime": { "elem1": "dino_fossil", chance:0.000045 },
"slaked_lime": { "elem1": "dino_fossil", chance:0.000035 },
},
category:"life",
tempHigh: 760,
@ -220,10 +253,10 @@ elements.coal = {
},
elements.bug_amber = {
color: "#ffc000",
color: ["#ffc000","#b67f18","#c86305","#cf7a19","#e4ae3a"],
temp: 20,
tempHigh: 345,
stateHigh: ["smoke","sap","sap","calcium","sugar"],
stateHigh: ["smoke","sap","sap","dead_bug","sap"],
breakInto: [null,null,null,"dna","dna","sap","sap","sap","sap","sap","dead_bug"],
category: "solids"
},
@ -232,7 +265,7 @@ elements.hive_amber = {
color: "#ffc000",
temp: 20,
tempHigh: 345,
stateHigh: ["smoke","honey","honey","calcium","sugar"],
stateHigh: ["smoke","smoke","honey","honey","honey","dead_bug","dead_bug","sap"],
breakInto: [null,"dna","dna","honey","honey","honey","honey","honey","sap","dead_bug",null,"dna","dna","honey","honey","honey","honey","honey","sap","dead_bug","bee"],
category: "solids"
},
@ -257,11 +290,12 @@ elements.dinosaur = {
density: 1500,
conduct: 0.25,
reactions: {
"bird": { elem2: [null,null,null,null,null,"feather"], chance: 0.3, func: behaviors.FEEDPIXEL },
"bird": { elem2: [null,null,null,null,null,null,"blood","feather"], chance: 0.3, func: behaviors.FEEDPIXEL },
"head": { elem2: [null,null,null,null,null,null,null,"blood","blood","skull"], chance: 0.5, func: behaviors.FEEDPIXEL },
"body": { elem2: [null,null,null,null,null,null,"blood","blood","bone"], chance: 0.5, func: behaviors.FEEDPIXEL },
"plant": { elem2: null, chance: 0.5, func: behaviors.FEEDPIXEL },
"bone": { elem2: ["bone_marrow","blood",null], chance: 0.3, },
"bone": { elem2: ["bone_marrow","blood","quicklime",null,null,null], chance: 0.3, },
"skull": { elem2: ["bone_marrow","blood","quicklime",null,null,null], chance: 0.1, },
"bone_marrow": { elem2: ["blood","blood",null], chance: 0.3, func: behaviors.FEEDPIXEL },
"blood": { elem2: null, chance: 0.1, func: behaviors.FEEDPIXEL },
"meat": { elem2: null, chance: 0.5, func: behaviors.FEEDPIXEL },
@ -269,6 +303,10 @@ elements.dinosaur = {
"cured_meat": { elem2: null, chance: 0.4, func: behaviors.FEEDPIXEL },
"fly": { elem2: null, chance: 0.05, func: behaviors.FEEDPIXEL },
"ant": { elem2: null, chance: 0.05, func: behaviors.FEEDPIXEL },
"worm": { elem2: null, chance: 0.05, func: behaviors.FEEDPIXEL },
"wood": { elem2: "sawdust", chance: 0.04 },
"glass": { elem2: "glass_shard", chance: 0.05 },
"concrete": { elem2: "dust", chance: 0.03 },
}
};

File diff suppressed because one or more lines are too long

285
mods/lightmap.js Normal file
View File

@ -0,0 +1,285 @@
// Redbirdly's Mod that adds a better light system
// if the mod is too laggy, use fast_lightmap.js
let lightmap = [];
let nextLightmap = [];
let lightmapWidth, lightmapHeight;
let pixelSizeQuarter = pixelSizeHalf / 2;
let lightmapScale = 2;
// Define RGB colors
let lightColor = [255, 223, 186];
let sunColor = [255*8, 210*8, 26*8];
let lampColor = [255*4, 223*4, 186*4];
let laserColor = [255, 0, 0];
let ledRColor = [255, 0, 0];
let ledGColor = [0, 255, 0];
let ledBColor = [0, 0, 255];
let fireColor = [255, 69, 0];
let plasmaColor = [160, 69, 255];
let coldFireColor = [0, 191, 255];
let magmaColor = [255, 140, 0];
let neonColor = [255*2, 60*2, 10*2];
function initializeLightmap(width, height) {
lightmapWidth = Math.ceil(width / lightmapScale);
lightmapHeight = Math.ceil(height / lightmapScale);
for (let y = 0; y < lightmapHeight; y++) {
lightmap[y] = [];
nextLightmap[y] = [];
for (let x = 0; x < lightmapWidth; x++) {
lightmap[y][x] = { color: [0, 0, 0] };
nextLightmap[y][x] = { color: [0, 0, 0] };
}
}
}
function deepCopy(source, target) {
for (let y = 0; y < source.length; y++) {
target[y] = [];
for (let x = 0; x < source[y].length; x++) {
target[y][x] = { ...source[y][x] };
}
}
}
function propagateLightmap() {
if (!lightmap || !lightmap[0]) { return; }
let width = lightmap[0].length;
let height = lightmap.length;
let neighbors = [
{ dx: 1, dy: 0 },
{ dx: -1, dy: 0 },
{ dx: 0, dy: 1 },
{ dx: 0, dy: -1 },
];
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
let totalColor = [0, 0, 0];
let neighborCount = 0;
neighbors.forEach(({ dx, dy }) => {
let nx = x + dx;
let ny = y + dy;
if (nx >= 0 && ny >= 0 && nx < width && ny < height) {
totalColor[0] += lightmap[ny][nx].color[0];
totalColor[1] += lightmap[ny][nx].color[1];
totalColor[2] += lightmap[ny][nx].color[2];
neighborCount++;
}
});
nextLightmap[y][x] = {
color: [
Math.min(Math.max(0, totalColor[0] / neighborCount * 0.8), 255*8),
Math.min(Math.max(0, totalColor[1] / neighborCount * 0.8), 255*8),
Math.min(Math.max(0, totalColor[2] / neighborCount * 0.8), 255*8)
]
};
}
}
deepCopy(nextLightmap, lightmap);
}
function rgbToHsv(r, g, b) {
r /= 255, g /= 255, b /= 255;
let max = Math.max(r, g, b), min = Math.min(r, g, b);
let h, s, v = max;
let d = max - min;
s = max === 0 ? 0 : d / max;
if (max === min) {
h = 0;
} else {
switch (max) {
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
case g: h = (b - r) / d + 2; break;
case b: h = (r - g) / d + 4; break;
}
h /= 6;
}
return [h, s, v];
}
function hsvToRgb(h, s, v) {
let r, g, b;
let i = Math.floor(h * 6);
let f = h * 6 - i;
let p = v * (1 - s);
let q = v * (1 - f * s);
let t = v * (1 - (1 - f) * s);
switch (i % 6) {
case 0: r = v, g = t, b = p; break;
case 1: r = q, g = v, b = p; break;
case 2: r = p, g = v, b = t; break;
case 3: r = p, g = q, b = v; break;
case 4: r = t, g = p, b = v; break;
case 5: r = v, g = p, b = q; break;
}
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
}
function renderLightmap() {
if (!canvas) { return; }
if (!lightmap || !lightmap[0]) { return; }
let context = canvas.getContext('2d');
let width = lightmap[0].length;
let height = lightmap.length;
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
let { color } = lightmap[y][x];
let [r, g, b] = color;
if (r > 0 || g > 0 || b > 0) {
let [h, s, v] = rgbToHsv(r, g, b);
let newColor = hsvToRgb(h, s, 1);
let alpha = v;
context.fillStyle = `rgba(${newColor[0]}, ${newColor[1]}, ${newColor[2]}, ${alpha*0.4})`;
context.fillRect(
x * pixelSize * lightmapScale,
y * pixelSize * lightmapScale,
pixelSize * lightmapScale,
pixelSize * lightmapScale
);
context.fillStyle = `rgba(${newColor[0]}, ${newColor[1]}, ${newColor[2]}, ${alpha * 0.25})`;
context.fillRect(
(x * pixelSize - pixelSizeHalf) * lightmapScale,
(y * pixelSize - pixelSizeHalf) * lightmapScale,
pixelSize * lightmapScale * 2,
pixelSize * lightmapScale * 2
);
}
}
}
}
elements.sun.tick = function(pixel) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: sunColor };
};
let originalLightTick = elements.light.tick;
elements.light.tick = function(pixel) {
originalLightTick(pixel);
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: lightColor };
};
let originalLiquidLightTick = elements.liquid_light.tick;
elements.liquid_light.tick = function(pixel) {
originalLiquidLightTick(pixel);
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: lightColor };
};
elements.magma.tick = function(pixel) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: fireColor };
};
elements.neon.tick = function(pixel) {
if (!pixel.charge || pixel.charge <= 0) {return;}
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: neonColor };
};
elements.light_bulb.behaviorOn = null
elements.light_bulb.tick = function(pixel) {
if (pixel.charge > 0) {pixel.lightIntensity = 10;}
if (pixel.lightIntensity > 0) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: lampColor };
}
pixel.lightIntensity -= 1;
};
elements.led_r.tick = function(pixel) {
if (pixel.charge > 0) {pixel.lightIntensity = 4;}
if (pixel.lightIntensity > 0) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: ledRColor };
}
pixel.lightIntensity -= 1;
};
elements.led_g.tick = function(pixel) {
if (pixel.charge > 0) {pixel.lightIntensity = 4;}
if (pixel.lightIntensity > 0) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: ledGColor };
}
pixel.lightIntensity -= 1;
};
elements.led_b.tick = function(pixel) {
if (pixel.charge > 0) {pixel.lightIntensity = 4;}
if (pixel.lightIntensity > 0) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: ledBColor };
}
pixel.lightIntensity -= 1;
};
let originalLaserTick = elements.laser.tick;
elements.laser.tick = function(pixel) {
originalLaserTick(pixel);
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: laserColor };
};
let originalFireTick2 = elements.fire.tick;
elements.fire.tick = function(pixel) {
originalFireTick2(pixel);
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: fireColor };
};
elements.cold_fire.tick = function(pixel) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: coldFireColor };
};
elements.plasma.tick = function(pixel) {
let x = Math.floor(pixel.x / lightmapScale);
let y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: plasmaColor };
};
// Wait for loading
// if it loads too soon then width will be undefined
setTimeout(() => { initializeLightmap(width, height); }, 700);
// Add code to functions instead of replacing them
let originalTick = tick;
tick = function() {
originalTick();
if (!paused) {propagateLightmap();}
};
// Even after updating tick(), setInterval still uses the old tick(), reset setInterval
resetInterval(tps);
let originalDrawPixels = drawPixels;
drawPixels = function(forceTick = false) {
originalDrawPixels(forceTick);
renderLightmap();
};

2333
mods/mossstuff.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,7 @@
removeMod("pizzasstuff.js");
addMod("mossstuff.js");
reload();
elements.freeze_ray = {
color: ["#8cf9ff","#5c59ff"],
tick: function(pixel) {

View File

@ -33,21 +33,12 @@ window.addEventListener("load", () => {
})
window.addEventListener("load", () => {
document.getElementById("elementButton-mad_682")?.remove()
})
})
// Coding junk past this point
// Coding junk above this point
// also hi jonny ray
elements.anomalous_essence = {
hidden: true,
color: "#f7ead0",
behavior: behaviors.GAS,
category: "scp",
state: "gas",
density: 0.50,
};
elements.SCP_008 = {
color: "#11111f",
behavior: [
@ -58,22 +49,22 @@ elements.SCP_008 = {
reactions: {
"head": { elem1:null, elem2:"z_head" , chance:0.5 },
"body": { elem1:null, elem2:"z_body" , chance:0.5 },
"skin": { elem1:null, elem2: ["infected_skin","infected_skin","infected_meat"] , chance:0.3 },
"blood": { elem1:null, elem2:"infection" , chance:0.6 },
"meat": { elem1:null, elem2:"infected_meat" , chance:0.4 },
"rotten_meat": { elem1:null, elem2:"infected_meat" , chance:0.5 },
"frozen_meat": { elem1:null, elem2:"frozen_infected_meat" , chance:0.3 },
"skin": { elem1:null, elem2: ["infected_skin","infected_skin","infected_meat"] , chance:0.3 },
"blood": { elem1:null, elem2:"infection" , chance:0.6 },
"meat": { elem1:null, elem2:"infected_meat" , chance:0.4 },
"rotten_meat": { elem1:null, elem2:"infected_meat" , chance:0.5 },
"frozen_meat": { elem1:null, elem2:"frozen_infected_meat" , chance:0.3 },
"frog": { elem2:"SCP_008" , chance:0.5 },
"ant": { elem2:"SCP_008" , chance:0.5 },
"bee": { elem2:"SCP_008" , chance:0.5 },
"fish": { elem2:"SCP_008" , chance:0.5 },
"firefly": { elem2:"SCP_008" , chance:0.5 },
"chlorine": { elem1: [null,null,null,null,null,null,null,null,"anomalous_essence"] , chance:0.01 },
"liquid_chlorine": { elem1: [null,null,null,null,null,null,null,null,"anomalous_essence"] , chance:0.01 },
"light": { elem1: [null,null,null,null,null,null,null,null,"anomalous_essence"] , chance:0.01 },
"chlorine": { elem1: null , chance:0.01 },
"liquid_chlorine": { elem1: null , chance:0.01 },
"light": { elem1: null , chance:0.01 },
},
tempHigh: 750,
stateHigh: [null,null,null,null,null,null,null,null,"anomalous_essence"],
stateHigh: null,
tempLow: -100,
stateLow: "frozen_008",
category: "scp",
@ -85,20 +76,20 @@ elements.frozen_008 = {
color: "#242424",
behavior: [
"XX|XX|XX",
"XX|DL%0.001|X",
"XX|M1%1.0|XX",
"M2%0.001|DL%0.001|M2%0.001",
"M2%0.01|M1%1.0|M2%0.01",
],
reactions: {
"head": { elem1:null, elem2:"z_head" , chance:0.4 },
"body": { elem1:null, elem2:"z_body" , chance:0.4 },
"skin": { elem1:null, elem2:"frozen_infected_meat" , chance:0.4 },
"blood": { elem1:null, elem2:"infection" , chance:0.6 },
"meat": { elem1:null, elem2:"frozen_infected_meat" , chance:0.4 },
"rotten_meat": { elem1:null, elem2:"frozen_infected_meat" , chance:0.5 },
"frozen_meat": { elem1:null, elem2:"frozen_infected_meat" , chance:0.4 },
"chlorine": { elem1: [null,null,null,null,null,null,null,null,"anomalous_essence"] , chance:0.01 },
"liquid_chlorine": { elem1: [null,null,null,null,null,null,null,null,"anomalous_essence"] , chance:0.01 },
"light": { elem1: [null,null,null,null,null,null,null,null,"anomalous_essence"] , chance:0.01 },
"skin": { elem1:null, elem2:"frozen_infected_meat" , chance:0.4 },
"blood": { elem1:null, elem2:"infection" , chance:0.6 },
"meat": { elem1:null, elem2:"frozen_infected_meat" , chance:0.4 },
"rotten_meat": { elem1:null, elem2:"frozen_infected_meat" , chance:0.5 },
"frozen_meat": { elem1:null, elem2:"frozen_infected_meat" , chance:0.4 },
"chlorine": { elem1: null , chance:0.01 },
"liquid_chlorine": { elem1: null , chance:0.01 },
"light": { elem1: null , chance:0.01 },
},
temp: -50,
tempHigh: 0,
@ -109,12 +100,12 @@ elements.frozen_008 = {
},
elements.infected_skin = {
color: ["#11111f","#75816B","#4D6B53"],
color: ["#75816B","#4D6B53"],
singleColor: true,
behavior: [
"XX|CR:stench,stench,stench,SCP_008,fly%0.05 AND CH:meat>infected_meat%1|XX",
"CH:meat>infected_meat%1|XX|CH:meat>infected_meat%1",
"M2%1.0|M1%1.0 AND CH:meat>infected_meat%1|M2%1.0",
"XX|CR:stench,stench,stench,SCP_008,fly%0.05 AND CH:skin>infected_skin%25|XX",
"CH:skin>infected_skin%25|CH:infected_meat%0.5|CH:skin>infected_skin%25",
"M2%1|M1%1.0 AND CH:skin>infected_skin%25|M2%1",
],
tick: function(pixel) {
if (pixel.temp > 40 && Math.random() < 0.003) {
@ -140,12 +131,16 @@ elements.infected_skin = {
pixel2.color = pixelColorPick(pixel2,RGBToHex(pixel1.color.match(/\d+/g)))
if (pixel1.origColor) { pixel2.origColor = pixel1.origColor }
} },
"skin": { chance:0.01, func:function(pixel1,pixel2){
changePixel(pixel2,"infected_skin");
pixel2.color = pixelColorPick(pixel2,RGBToHex(pixel1.color.match(/\d+/g)))
if (pixel1.origColor) { pixel2.origColor = pixel1.origColor }
} },
"blood": { elem2:"infection" , chance:0.6 },
"water": { elem2:"dirty_water" },
"salt_water": { elem2:"dirty_water" , chance:0.5 },
"sugar_water": { elem2:"dirty_water" },
"seltzer": { elem2:"dirty_water" },
"meat": { elem2:"infected_meat", chance:0.5 },
"rotten_meat": { elem2:"infected_meat", chance:0.5 },
"frozen_meat": { elem2:"frozen_infected_meat", chance:0.5 },
"fly": { elem2: ["dead_bug","dead_bug","SCP_008"] , chance:0.2},
"blood": { elem2:"infection" , chance:0.6 },
"skin": { elem2:"infected_skin" , chance:0.6 },
"acid": { elem1:"infection" },
"soap": { elem1:null, elem2:null, chance:0.005 },
"light": { stain1:"#825043" },
@ -179,19 +174,21 @@ elements.infected_skin = {
elements.infected_meat = {
color: ["#b8b165","#b89765"],
behavior: [
"XX|CR:stench,stench,stench,SCP_008,fly%0.25 AND CH:rotten_meat,meat>infected_meat%1|XX",
"SP%99 AND CH:rotten_meat,meat>infected_meat%1|XX|SP%99 AND CH:rotten_meat,meat>infected_meat%1",
"XX|M1 AND CH:rotten_meat,meat>infected_meat%1|XX",
"XX|CR:stench,stench,stench,SCP_008,fly%0.25 AND CH:skin>infected_skin%1|XX",
"SP%25 AND CH:skin>infected_skin%1|XX|SP%25 AND CH:skin>infected_skin%1",
"M2%0.5|M1 AND CH:meat>infected_meat%1|M2%0.5",
],
reactions: {
"water": { elem2:"dirty_water" },
"salt_water": { elem2:"dirty_water" },
"salt_water": { elem2:"dirty_water" , chance:0.5 },
"sugar_water": { elem2:"dirty_water" },
"dirty_water": { elem2:"broth", tempMin:70, color2:"#d7db69" },
"seltzer": { elem2:"dirty_water" },
"fly": { elem1: [null,null,"SCP_008"] , elem2: ["dead_bug","dead_bug","SCP_008"] , chance:0.2},
"blood": { elem2:"infection" , chance:0.6 },
"skin": { elem2:"infected_skin" , chance:0.6 },
"meat": { elem2:"infected_meat", chance:0.5 },
"rotten_meat": { elem2:"infected_meat", chance:0.5 },
"frozen_meat": { elem2:"frozen_infected_meat", chance:0.5 },
"fly": { elem2: ["dead_bug","dead_bug","SCP_008"] , chance:0.2},
"blood": { elem2:"infection" , chance:0.6 },
"skin": { elem2:"infected_skin" , chance:0.6 },
},
tempHigh: 300,
stateHigh: ["SCP_008","ash","ammonia"],
@ -209,19 +206,22 @@ elements.infected_meat = {
},
elements.frozen_infected_meat = {
color: "#242424",
color: ["#82AEC0","#80808F","#9CAC98"],
behavior: [
"XX|CH:rotten_meat,frozen_meat>frozen_infected_meat%1|XX",
"SP%99 AND CH:rotten_meat,frozen_meat>frozen_infected_meat%1|XX|SP%99 AND CH:rotten_meat,frozen_meat>frozen_infected_meat%1",
"XX|M1 AND CH:rotten_meat,frozen_meat>frozen_infected_meat%1|XX",
"XX|XX|XX",
"SP%95|XX|SP%95",
"XX|M1 AND CH:frozen_meat,meat>frozen_infected_meat%1|XX",
],
reactions: {
"water": { elem2:"dirty_water" },
"salt_water": { elem1:"infected_meat",elem2:"dirty_water" , chance:0.5 },
"sugar_water": { elem2:"dirty_water" },
"seltzer": { elem2:"dirty_water" },
"fly": { elem2: ["dead_bug","dead_bug","SCP_008"] , chance:0.2},
"blood": { elem2:"infection" , chance:0.6 },
"meat": { elem2:"frozen_infected_meat", chance:0.5 },
"rotten_meat": { elem2:"frozen_infected_meat", chance:0.5 },
"frozen_meat": { elem2:"frozen_infected_meat", chance:0.5 },
"fly": { elem2: ["dead_bug","dead_bug","SCP_008"] , chance:0.2},
"blood": { elem2:"infection" , chance:0.6 },
},
temp: -20,
tempHigh: 10,
@ -512,7 +512,7 @@ elements.black_acid = {
tempLow: -58.88,
burn: 30,
burnTime: 10,
burnInto: ["fire","fire","fire","fire","fire","fire","fire","fire","ash","ash","fire","fire","fire","fire","ash","ash","anomalous_essence"],
burnInto: ["fire","fire","fire","fire","fire","fire","fire","fire","ash","ash","fire","fire","fire","fire","ash","ash"],
fireColor: "#111111",
state: "liquid",
density: 1105,
@ -523,14 +523,14 @@ elements.SCP_055 = {
color: "#00000f",
excludeRandom: true,
behavior: [
["XX","XX","XX"],
["XX","CH:REDACTED","XX"],
["XX","XX","XX"]
"XX","XX","XX",
"XX","CH:REDACTED","XX",
"XX","XX","XX"
],
category: "scp",
state: "solid",
tempHigh: 55055055055,
stateHigh: ["metal_scrap","metal_scrap","smoke","smoke","smoke","smoke","smoke","smoke","smoke",null,"anomalous_essence"],
stateHigh: ["metal_scrap","metal_scrap","smoke","smoke","smoke","smoke","smoke","smoke","smoke",null],
},
elements.REDACTED = {
@ -538,9 +538,9 @@ elements.REDACTED = {
color: "#00000f",
excludeRandom: true,
behavior: [
["XX","xx","XX"],
["XX","EX","XX"],
["XX","XX","XX"]
"EX|CL|EX",
"CL|EX:99999999999999999999999>REDACTED|CL",
"EX|CL|EX",
],
category: "scp",
state: "solid",
@ -579,7 +579,7 @@ elements.doc_head = {
hidden: true,
color: ["#f7ead0","#faf9f6","#e9e6db"],
category: "scp",
breakInto: ["rotten_meat","bone","bone","blood","anomalous_essence"],
breakInto: ["rotten_meat","bone","bone","blood"],
properties: {
dead: false
},
@ -635,7 +635,7 @@ elements.doc_body = {
hidden: true,
color: ["#11111f","#242424"],
category: "scp",
breakInto: ["rotten_meat","rotten_meat","bone","blood","anomalous_essence"],
breakInto: ["rotten_meat","rotten_meat","bone","blood"],
properties: {
dead: false,
dir: 1,
@ -766,7 +766,7 @@ elements.z_head = {
hidden: true,
color: ["#75816B","#4D6B53"],
category: "scp",
breakInto: ["rotten_meat","bone","bone","blood","anomalous_essence"],
breakInto: ["rotten_meat","bone","bone","blood"],
properties: {
dead: false
},
@ -823,7 +823,7 @@ elements.z_body = {
hidden: true,
color: ["#11111f","#069469","#047e99","#7f5fb0"],
category: "scp",
breakInto: ["rotten_meat","rotten_meat","bone","blood","anomalous_essence"],
breakInto: ["rotten_meat","rotten_meat","bone","blood"],
properties: {
dead: false,
dir: 1,
@ -920,7 +920,7 @@ elements.z_body = {
burnInto: "rotten_meat",
forceSaveColor: true,
reactions: {
"head": { elem2 : "z_head" , chance:1.0 },
"head": { elem2 : "z_head" , chance:1.0 },
"body": { elem2 : "z_body" , chance:1.0 },
},
},
@ -957,7 +957,8 @@ elements.shy_head = {
hidden: true,
color: ["#f7ead0","#faf9f6","#e9e6db"],
category: "scp",
breakInto: ["bone","bone","blood","bone","bone","blood","bone","bone","blood","bone","bone","blood","anomalous_essence"],
hardness: 1,
breakInto: ["rotten_meat","bone","bone","blood","bone","bone","blood","bone","bone","blood","bone","bone","blood"],
properties: {
dead: false
},
@ -1026,11 +1027,13 @@ elements.shy_body = {
hidden: true,
color: ["#f7ead0","#faf9f6","#e9e6db"],
category: "scp",
breakInto: ["bone","bone","blood","bone","bone","blood","bone","bone","blood","bone","bone","blood","anomalous_essence"],
breakInto: ["rotten_meat","bone","blood","bone","bone","blood","bone","bone","blood","bone","bone","blood"],
hardness: 1,
properties: {
dead: false,
dir: 1,
panic: 0
panic: 0,
anger: 0
},
tick: function(pixel) {
if (tryMove(pixel, pixel.x, pixel.y+1)) { // Fall
@ -1111,7 +1114,58 @@ elements.shy_body = {
if (pixel.temp > 37) { pixel.temp -= 1; }
else if (pixel.temp < 37) { pixel.temp += 1; }
}
if (pixel.dir == 1) {
if (!isEmpty(pixel.x+2, pixel.y-1, true) && pixelMap[pixel.x+2][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x+3, pixel.y-1, true) && pixelMap[pixel.x+2][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x+4, pixel.y-1, true) && pixelMap[pixel.x+4][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x+5, pixel.y-1, true) && pixelMap[pixel.x+5][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x+5, pixel.y-1, true) && pixelMap[pixel.x+5][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x+6, pixel.y-1, true) && pixelMap[pixel.x+6][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x+7, pixel.y-1, true) && pixelMap[pixel.x+7][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x+8, pixel.y-1, true) && pixelMap[pixel.x+8][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
}
else if (pixel.dir == -1) {
if (!isEmpty(pixel.x-2, pixel.y-1, true) && pixelMap[pixel.x-2][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x-3, pixel.y-1, true) && pixelMap[pixel.x-3][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x-4, pixel.y-1, true) && pixelMap[pixel.x-4][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x-5, pixel.y-1, true) && pixelMap[pixel.x-5][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x-5, pixel.y-1, true) && pixelMap[pixel.x-5][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x-6, pixel.y-1, true) && pixelMap[pixel.x-6][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x-7, pixel.y-1, true) && pixelMap[pixel.x-7][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x-8, pixel.y-1, true) && pixelMap[pixel.x-8][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
}
},
density: 1080,
state: "solid",
@ -1301,10 +1355,10 @@ elements.tickle_monster = {
conduct: .5,
temp: 20,
tempHigh: 350,
stateHigh: ["smoke","smoke","smoke","slime","anomalous_essence"],
stateHigh: ["smoke","smoke","smoke","slime"],
burn: .1,
burnTime: 300,
burnInto: ["smoke","smoke","smoke","slime","anomalous_essence"],
burnInto: ["smoke","smoke","smoke","slime"],
stain: 0.03,
},
@ -1322,8 +1376,8 @@ elements.hyper_tickle_monster = {
reactions: {
"sugar_water": { elem2 : "water" },
"dirty_water": { elem2 : "water" },
"candy": { elem2 : null },
"sugar": { elem2 : null },
"candy": { elem2 : null },
"sugar": { elem2 : null },
"sauce": { elem2 : null },
"salt": { elem2 : null },
"cheese": { elem2 : null },
@ -1350,7 +1404,7 @@ elements.hyper_tickle_monster = {
"melted_chocolate": { elem2 : null },
"alchohol": { elem2 : null },
"pilk": { elem2 : null },
"soda": { elem2 : null },
"soda": { elem2 : null },
"coffee": { elem2 : null },
"seltzer": { elem2 : null },
},
@ -1358,10 +1412,10 @@ elements.hyper_tickle_monster = {
conduct: .5,
temp: 20,
tempHigh: 350,
stateHigh: ["smoke","smoke","smoke","slime","anomalous_essence"],
stateHigh: ["smoke","smoke","smoke","slime"],
burn: .1,
burnTime: 300,
burnInto: ["smoke","smoke","smoke","slime","anomalous_essence"],
burnInto: ["smoke","smoke","smoke","slime"],
stain: 0.08,
};

View File

@ -98,6 +98,7 @@ elements.nvidia_cpu = {
"XX|SH|XX",
],
category: "tech",
temp: 25, // Starting temperature (room temperature in Celsius)
tempHigh: 1000, // Melting point for realism
stateHigh: "molten_silicon", // Assuming it melts into molten silicon
reactions: {
@ -109,8 +110,44 @@ elements.nvidia_cpu = {
breakInto: ["silicon", "metal_scrap"],
conduct: 10, // Moderate conductivity
density: 2330, // Density of silicon
tick: function(pixel) {
if (!pixel.heatTick) {
pixel.heatTick = 0;
}
pixel.heatTick++;
if (pixel.heatTick >= 300) { // 300 ticks ~ 5 seconds
pixel.temp += 2; // Increase temperature by 2 degrees Celsius
pixel.heatTick = 0; // Reset heatTick counter
}
// Check for cooling fan nearby
let cooled = false;
for (let dx = -1; dx <= 1; dx++) {
for (let dy = -1; dy <= 1; dy++) {
if (dx === 0 && dy === 0) continue;
let neighbor = pixelMap[pixel.x + dx]?.[pixel.y + dy];
if (neighbor && neighbor.element === "spinning_cooler_fan") {
cooled = true;
}
}
}
if (cooled) {
if (!pixel.coolTick) {
pixel.coolTick = 0;
}
pixel.coolTick++;
if (pixel.coolTick >= 300) { // 300 ticks ~ 5 seconds
pixel.temp -= 2; // Decrease temperature by 2 degrees Celsius
pixel.coolTick = 0; // Reset coolTick counter
}
} else {
pixel.coolTick = 0; // Reset coolTick counter if no cooler is nearby
}
},
};
elements.molten_silicon = {
color: "#ffcc99",
behavior: behaviors.LIQUID,
@ -149,3 +186,97 @@ elements.silicon = {
density: 2330,
};
elements.glowing_rainbow_led = {
color: ["#FF0000", "#FF7F00", "#FFFF00", "#00FF00", "#0000FF", "#4B0082", "#8B00FF"], // Colors of the rainbow
behavior: [
"XX|XX|XX",
"XX|SH|XX",
"XX|XX|XX",
],
category: "tech",
state: "solid",
density: 300, // Arbitrary density for LED
tempHigh: 150, // Melting point for realism
stateHigh: "molten_plastic",
reactions: {
"water": { elem1: "short_circuit", elem2: "steam" },
"salt_water": { elem1: "short_circuit", elem2: "null" },
"acid": { elem1: "corroded_led", elem2: "null" },
"poison": { elem1: "corroded_led", elem2: "null" },
},
tick: function(pixel) {
// Function to cycle through colors
if (!pixel.colorIndex) {
pixel.colorIndex = 0; // Initialize color index
}
pixel.colorIndex = (pixel.colorIndex + 1) % elements.glowing_rainbow_led.color.length;
pixel.color = elements.glowing_rainbow_led.color[pixel.colorIndex];
},
};
elements.corroded_led = {
color: "#707070",
behavior: behaviors.POWDER,
category: "tech",
tempHigh: 800,
stateHigh: "ash",
conduct: 1,
};
elements.spinning_cooler_fan = {
color: "#4a90e2", // Blue color for the fan
behavior: [
"XX|XX|XX",
"XX|XX|XX",
"XX|XX|XX",
],
category: "tech",
state: "solid",
density: 800, // Arbitrary density for the fan
tick: function(pixel) {
// Define movement pattern
if (!pixel.moveStep) {
pixel.moveStep = 0; // Initialize movement step
}
// Determine the current movement direction
let directions = [
{dx: 0, dy: -1}, // Move up
{dx: 1, dy: 0}, // Move right
{dx: 0, dy: 1}, // Move down
{dx: -1, dy: 0} // Move left
];
let move = directions[pixel.moveStep];
// Attempt to move in the current direction
let newX = pixel.x + move.dx;
let newY = pixel.y + move.dy;
if (isEmpty(newX, newY)) {
// If the next position is empty, move there
movePixel(pixel, newX, newY);
}
// Advance to the next step in the movement pattern
pixel.moveStep = (pixel.moveStep + 1) % directions.length;
},
};
function isEmpty(x, y) {
// Check if the position (x, y) is empty
if (x >= 0 && y >= 0 && x < width && y < height) {
return !pixelMap[x][y];
}
return false;
}
function movePixel(pixel, newX, newY) {
// Move the pixel to the new position
if (isEmpty(newX, newY)) {
pixelMap[pixel.x][pixel.y] = null; // Clear the current position
pixel.x = newX;
pixel.y = newY;
pixelMap[newX][newY] = pixel; // Set the new position
}
}

View File

@ -37,7 +37,7 @@ elements.fat_man = {
excludeRandom: true,
cooldown: defaultCooldown
},
elements.self_propelled_bomb = {
elements.self_propelled_bomb = {
color: "#71797E",
tick: function(pixel) {
if ((pixel.temp > 1000 || pixel.charge) && !pixel.burning) {
@ -75,6 +75,7 @@ elements.left_missile = {
"M1 AND EX:10|XX|EX:10",
"M2|EX:10|XX",
],
state: "solid",
category:"ammunition",
density: 1300,
excludeRandom: true,
@ -87,6 +88,7 @@ elements.right_missile = {
"EX:10|XX|M1 AND EX:10",
"XX|EX:10|M2",
],
state: "solid",
category:"ammunition",
density: 1300,
excludeRandom: true,
@ -99,6 +101,7 @@ elements.up_missile = {
"EX:10|XX|EX:10",
"XX|EX:10|XX",
],
state: "solid",
category:"ammunition",
density: 1300,
excludeRandom: true,
@ -167,6 +170,7 @@ elements.left_bullet = {
"M1 AND EX:5|XX|XX",
"M2|XX|XX",
],
state: "solid",
category:"ammunition",
density: 1300,
excludeRandom: true,
@ -179,6 +183,7 @@ elements.left_bullet = {
"XX|XX|M1 AND EX:5",
"XX|XX|M2",
],
state: "solid",
category:"ammunition",
density: 1300,
excludeRandom: true,
@ -239,6 +244,7 @@ elements.left_rocket = {
"M1 AND EX:10|XX|XX",
"XX|XX|XX",
],
state: "solid",
category:"ammunition",
density: 1300,
excludeRandom: true,
@ -251,6 +257,7 @@ elements.left_rocket = {
"XX|XX|M1 AND EX:10",
"XX|XX|XX",
],
state: "solid",
category:"ammunition",
density: 1300,
excludeRandom: true,
@ -609,8 +616,6 @@ elements.fast_bomb = {
for (var i=0; i<3; i++) {
if (!tryMove(pixel, pixel.x, pixel.y+1)) {
if (!isEmpty(pixel.x, pixel.y+1,true)) {
var newPixel = pixelMap[pixel.x][pixel.y+1];
if (newPixel.element === "fast_bomb") { break; }
}
}
}
@ -734,4 +739,160 @@ elements.tank_right = {
"XX|XX|M1",
"XX|M1|M1",
],
}
},
elements.realistic_missile_left = {
color: "#524c41",
category: "weapons",
state: "solid",
behavior: [
"XX|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|XX",
"EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel",
"EX:20>missile_shrapnel|EX:20>missile_shrapnel|M2 AND EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel",
"EX:20>missile_shrapnel|EX:20>missile_shrapnel|M1 AND EX:20>missile_shrapnel|XX|EX:20>missile_shrapnel|CR:smoke AND EX:20>missile_shrapnel|EX:20>missile_shrapnel",
"EX:20>missile_shrapnel|EX:20>missile_shrapnel|M2 AND EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel",
"EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel",
"XX|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|XX",
],
tick: function(pixel) {
for (var i=0; i<3; i++) {
if (!tryMove(pixel, pixel.x-1, pixel.y)) {
if (!isEmpty(pixel.x-1, pixel.y,true)) {
}
}
}
},
density: 1300,
excludeRandom: true,
cooldown: defaultCooldown
},
elements.realistic_missile_right = {
color: "#524c41",
category: "weapons",
state: "solid",
behavior: [
"XX|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|XX",
"EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel",
"EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|M2 AND EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel",
"EX:20>missile_shrapnel|CR:smoke AND EX:20>missile_shrapnel|EX:20>missile_shrapnel|XX|M1|EX:20>missile_shrapnel|EX:20>missile_shrapnel",
"EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|M2 AND EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel",
"EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel",
"XX|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|EX:20>missile_shrapnel|XX",
],
tick: function(pixel) {
for (var i=0; i<3; i++) {
if (!tryMove(pixel, pixel.x+1, pixel.y)) {
if (!isEmpty(pixel.x+1, pixel.y,true)) {
}
}
}
},
density: 1300,
excludeRandom: true,
cooldown: defaultCooldown
},
elements.missile_shrapnel = {
color: "#71797E",
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: "ammunition"
},
elements.vlms_left = {
color: "#71797E",
tick: function(pixel) {
if ((pixel.temp > 1000 || pixel.charge) && !pixel.burning) {
pixel.burning = true;
pixel.burnStart = pixelTicks;
}
if (pixel.burning) {
if (!tryMove(pixel, pixel.x, pixel.y-1)) {
// tryMove again to the top left or top right
tryMove(pixel, pixel.x+(Math.random() < 0.5 ? -1 : 1), pixel.y-1);
}
if (pixelTicks-pixel.burnStart > 50 && Math.random() < 0.1) {
explodeAt(pixel.x, 10, 4, "realistic_missile_left");
deletePixel(pixel.x,pixel.y)
}
}
else {
if (!tryMove(pixel, pixel.x, pixel.y+1)) {
// tryMove again to the bottom left or bottom right
tryMove(pixel, pixel.x+(Math.random() < 0.5 ? -1 : 1), pixel.y+1);
}
}
doDefaults(pixel);
},
burn: 90,
burnTime: 100,
density: 2000,
conduct: 1,
state: "solid",
category: "weapons"
},
elements.vlms_right = {
color: "#71797E",
tick: function(pixel) {
if ((pixel.temp > 1000 || pixel.charge) && !pixel.burning) {
pixel.burning = true;
pixel.burnStart = pixelTicks;
}
if (pixel.burning) {
if (!tryMove(pixel, pixel.x, pixel.y-1)) {
// tryMove again to the top left or top right
tryMove(pixel, pixel.x+(Math.random() < 0.5 ? -1 : 1), pixel.y-1);
}
if (pixelTicks-pixel.burnStart > 50 && Math.random() < 0.1) {
explodeAt(pixel.x, 10, 4, "realistic_missile_right");
deletePixel(pixel.x,pixel.y)
}
}
else {
if (!tryMove(pixel, pixel.x, pixel.y+1)) {
// tryMove again to the bottom left or bottom right
tryMove(pixel, pixel.x+(Math.random() < 0.5 ? -1 : 1), pixel.y+1);
}
}
doDefaults(pixel);
},
burn: 90,
burnTime: 100,
density: 2000,
conduct: 1,
state: "solid",
category: "weapons"
},
createAtXvar = 0;
createAtYvar = 0;
create1var = "";
elements.element_spawner = {
color: "#71797E",
onSelect: function() {
var answer1 = prompt("Please input the x value.",(createAtXvar||undefined));
if (!answer1) {return}
createAtXvar = parseInt(answer1);
var answer2 = prompt("Please input the y value.",(createAtYvar||undefined));
if (!answer2) {return}
createAtYvar = parseInt(answer2);
var answer3 = prompt("Please input what element should spawn.",(create1var||undefined));
if (!answer3) {return}
create1var = answer3;
},
tick: function(pixel) {
if (pixel.charge){
createPixel(create1var, createAtXvar, createAtYvar);
}
doDefaults(pixel);
},
density: 1,
conduct: 1,
state: "solid",
category: "machines"
}