Merge branch 'R74nCom:main' into main
This commit is contained in:
commit
046632988a
|
|
@ -16704,10 +16704,10 @@ Cancer, Landmine, Grenade, Smoke Grenade">?</span>
|
|||
<option value="pt_br">Português (Brasil)</option>
|
||||
<option value="vi">Tiếng Việt</option>
|
||||
<option value="zh_hant">繁體中文</option>
|
||||
<option value="zh_cn">简体中文</option>
|
||||
<optgroup label="Incomplete">
|
||||
<option value="es">Español</option>
|
||||
<option value="ru">Русский Язык</option>
|
||||
<option value="zh_cn">简体中文</option>
|
||||
</optgroup>
|
||||
</select></p>
|
||||
<p>Try our NEW GAME: <a href="https://R74n.com/cook/" target="_blank">Infinite Chef</a></p>
|
||||
|
|
|
|||
1063
lang/zh_cn.json
1063
lang/zh_cn.json
File diff suppressed because it is too large
Load Diff
|
|
@ -225,6 +225,7 @@
|
|||
<tr><td>more_breaking.js</td><td>Allows for breaking more elements in explosions</td><td>Alice</td></tr>
|
||||
<tr><td>rays.js</td><td>Adds more Ray types</td><td>Alice</td></tr>
|
||||
<tr><td>rays++.js</td><td>Adds a couple more rays</td><td>uptzik</td></tr>
|
||||
<tr><td>subspace.js</td><td>Adds the Subspace Tripmine from Roblox</td><td>nousernamefound</td></tr>
|
||||
<tr><td>weapons.js</td><td>Adds varieties of different weapons </td><td>Jayd</td></tr>
|
||||
|
||||
<!----><tr><td class="modCat" colspan="3">Food & Cooking</td></tr><!---->
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
//aircrafts
|
||||
elements.bomb.ignore = ["super_bomber_left","super_bomber_right"],
|
||||
elements.fast_bullet_left = {
|
||||
color: "#4c4e42",
|
||||
behavior: [
|
||||
|
|
@ -222,4 +223,38 @@ elements.bomber_right = {
|
|||
burnInto: "metal_scrap",
|
||||
breakInto: "metal_scrap",
|
||||
conduct: 1
|
||||
},
|
||||
elements.super_bomber_left = {
|
||||
color: "#000000",
|
||||
category: "aircrafts",
|
||||
behavior: [
|
||||
"XX|XX|XX",
|
||||
"M1%3 AND EX:7>fire,fire,fire,metal_scrap|XX|XX",
|
||||
"M1 AND EX:7>fire,fire,fire,metal_scrap|XX|XX",
|
||||
"M1%3 AND CR:bomb|CR:bomb|CR:smoke%10 AND CR:bomb",
|
||||
"CR:bomb|CR:bomb|CR:bomb",
|
||||
],
|
||||
ignore: "bomb",
|
||||
burnTime: 1000,
|
||||
burn: 40,
|
||||
burnInto: "metal_scrap",
|
||||
breakInto: "metal_scrap",
|
||||
conduct: 1
|
||||
},
|
||||
elements.super_bomber_right = {
|
||||
color: "#000000",
|
||||
category: "aircrafts",
|
||||
behavior: [
|
||||
"XX|XX|XX",
|
||||
"XX|XX|M1%3 AND EX:7>fire,fire,fire,metal_scrap",
|
||||
"XX|XX|M1 AND EX:7>fire,fire,fire,metal_scrap",
|
||||
"CR:smoke%10 AND CR:bomb|CR:bomb|M1%3 AND CR:bomb",
|
||||
"CR:bomb|CR:bomb|CR:bomb",
|
||||
],
|
||||
ignore: "bomb",
|
||||
burnTime: 1000,
|
||||
burn: 40,
|
||||
burnInto: "metal_scrap",
|
||||
breakInto: "metal_scrap",
|
||||
conduct: 1
|
||||
}
|
||||
|
|
@ -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();
|
||||
};
|
||||
|
|
@ -1,3 +1,169 @@
|
|||
function getImportantLetters(input) { // entirely chadgbd i just told it what algoritm to make
|
||||
const isVowel = char => 'AEIOU'.includes(char);
|
||||
const isConsonant = char => /^[BCDFGHJKLMNPQRSTVWXYZ]$/.test(char);
|
||||
|
||||
const removeDuplicates = str => {
|
||||
let seen = new Set();
|
||||
return str.split('').filter(char => {
|
||||
if (seen.has(char)) {
|
||||
return false;
|
||||
} else {
|
||||
seen.add(char);
|
||||
return true;
|
||||
}
|
||||
}).join('');
|
||||
};
|
||||
|
||||
const words = input.replace(/[^a-zA-Z0-9\s_]/g, '').replace(/_/g, ' ').toUpperCase().split(/\s+/);
|
||||
|
||||
if (input.length <= 4) {
|
||||
return input.toUpperCase();
|
||||
} else if (words.length === 1) {
|
||||
const word = removeDuplicates(words[0]);
|
||||
let result = '';
|
||||
let consonantCount = 0;
|
||||
let vowelFound = false;
|
||||
|
||||
for (let char of word) {
|
||||
if (isVowel(char) && !vowelFound) {
|
||||
result += char;
|
||||
vowelFound = true;
|
||||
} else if (isConsonant(char) && consonantCount < 3) {
|
||||
result += char;
|
||||
consonantCount++;
|
||||
}
|
||||
if (result.length === 4) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result.padEnd(4, result[result.length - 1] || '');
|
||||
} else if (words.length === 2) {
|
||||
const firstWord = words[0];
|
||||
const secondWord = words[1];
|
||||
let result = '';
|
||||
|
||||
if (isNaN(firstWord) && !isNaN(secondWord)) {
|
||||
const word = removeDuplicates(firstWord);
|
||||
let consonantCount = 0;
|
||||
let vowelFound = false;
|
||||
|
||||
for (let char of word) {
|
||||
if (isVowel(char) && !vowelFound) {
|
||||
result += char;
|
||||
vowelFound = true;
|
||||
} else if (isConsonant(char) && consonantCount < 2) {
|
||||
result += char;
|
||||
consonantCount++;
|
||||
}
|
||||
if (result.length === 3) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
result = result.padEnd(3, result[result.length - 1] || '') + secondWord;
|
||||
} else if (!isNaN(firstWord) && isNaN(secondWord)) {
|
||||
const word = removeDuplicates(secondWord);
|
||||
let consonantCount = 0;
|
||||
let vowelFound = false;
|
||||
|
||||
for (let char of word) {
|
||||
if (isVowel(char) && !vowelFound) {
|
||||
result += char;
|
||||
vowelFound = true;
|
||||
} else if (isConsonant(char) && consonantCount < 2) {
|
||||
result += char;
|
||||
consonantCount++;
|
||||
}
|
||||
if (result.length === 3) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
result = result.padEnd(3, result[result.length - 1] || '') + firstWord;
|
||||
} else {
|
||||
result = firstWord[0];
|
||||
let consonants = [];
|
||||
let vowels = [];
|
||||
let allChars = [];
|
||||
|
||||
for (let char of secondWord) {
|
||||
allChars.push(char);
|
||||
if (isConsonant(char)) {
|
||||
consonants.push(char);
|
||||
} else if (isVowel(char)) {
|
||||
vowels.push(char);
|
||||
}
|
||||
}
|
||||
|
||||
if (consonants.length >= 3) {
|
||||
let consonantCount = 0;
|
||||
for (let char of allChars) {
|
||||
if (isConsonant(char) && consonantCount < 3) {
|
||||
result += char;
|
||||
consonantCount++;
|
||||
}
|
||||
if (result.length === 4) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (consonants.length === 2) {
|
||||
let consonantCount = 0;
|
||||
let vowelCount = 0;
|
||||
for (let char of allChars) {
|
||||
if (isConsonant(char) && consonantCount < 2) {
|
||||
result += char;
|
||||
consonantCount++;
|
||||
} else if (isVowel(char) && vowelCount < 1) {
|
||||
result += char;
|
||||
vowelCount++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let consonantCount = 0;
|
||||
let vowelCount = 0;
|
||||
for (let char of allChars) {
|
||||
if (isConsonant(char) && consonantCount < 1) {
|
||||
result += char;
|
||||
consonantCount++;
|
||||
} else if (isVowel(char) && vowelCount < 2) {
|
||||
result += char;
|
||||
vowelCount++;
|
||||
}
|
||||
if (result.length === 4) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result = result.padEnd(4, result[result.length - 1] || '');
|
||||
}
|
||||
|
||||
return result;
|
||||
} else if (words.length === 3) {
|
||||
const firstWord = words[0];
|
||||
const secondWord = words[1];
|
||||
const thirdWord = words[2];
|
||||
let result = firstWord[0] + secondWord[0];
|
||||
let consonantCount = 0;
|
||||
let vowelFound = false;
|
||||
|
||||
for (let char of thirdWord) {
|
||||
if (isVowel(char) && !vowelFound) {
|
||||
result += char;
|
||||
vowelFound = true;
|
||||
} else if (isConsonant(char) && consonantCount < 1) {
|
||||
result += char;
|
||||
consonantCount++;
|
||||
}
|
||||
if (result.length === 4) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result.padEnd(4, result[result.length - 1] || '');
|
||||
} else {
|
||||
return words.map(word => word[0]).join('').slice(0, 4);
|
||||
}
|
||||
}
|
||||
function swapObjectValues(obj) {
|
||||
const keys = Object.keys(obj);
|
||||
while (keys.length > 1) {
|
||||
|
|
@ -50,12 +216,15 @@ elements.name_settings = {
|
|||
if (doNameSwapping == "yes"){settings.funnyname.doNameSwapping = true} else {settings.funnyname.doNameSwapping = false}
|
||||
var doLetterSwapping = prompt("Would you like to swap the letters in the names? Type yes or no.", "no")
|
||||
if (doLetterSwapping == "yes"){settings.funnyname.doLetterSwapping = true} else {settings.funnyname.doLetterSwapping = false}
|
||||
var condenseToFour = prompt("Would you like to condense the names to 4 letters? Also known as TPT-ify. Type yes or no.", "no")
|
||||
if (condenseToFour == "yes"){settings.funnyname.condenseToFour = true} else {settings.funnyname.condenseToFour = false}
|
||||
var doNameRates = prompt("Would you like to make the names a rating? If yes, this will set all others to no (it is incompatible.) Type yes or no.", "no")
|
||||
if (doNameRates == "yes"){
|
||||
settings.funnyname.doNameRates = true
|
||||
settings.funnyname.doNameSwapping = false
|
||||
settings.funnyname.doVowelSwapping = false
|
||||
settings.funnyname.doLetterSwapping = false
|
||||
settings.funnyname.condenseToFour = false
|
||||
} else {settings.funnyname.doNameRates = false}
|
||||
saveSettings()
|
||||
var allNamesString = prompt("Would you like to set all names to a custom string? This will set all others to no. Type yes or no.", "no")
|
||||
|
|
@ -64,6 +233,7 @@ elements.name_settings = {
|
|||
settings.funnyname.doNameSwapping = false
|
||||
settings.funnyname.doVowelSwapping = false
|
||||
settings.funnyname.doLetterSwapping = false
|
||||
settings.funnyname.condenseToFour = false
|
||||
settings.funnyname.doNameRates = false
|
||||
customName = prompt("What would you like to set the names to?", "")
|
||||
settings.funnyname.customName = true
|
||||
|
|
@ -138,5 +308,13 @@ runAfterAutogen(
|
|||
}
|
||||
}
|
||||
}
|
||||
if (settings.funnyname.condenseToFour){
|
||||
for (let elementname in elements){
|
||||
if (elementname != "name_settings"){
|
||||
let newelementname = getImportantLetters((elements[elementname].name)||elementname)
|
||||
elements[elementname].name = newelementname
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
@ -377,7 +377,6 @@ elements.left_push = {
|
|||
breakPixel(p);
|
||||
}
|
||||
}
|
||||
if (p.del || !elements[p.element].movable) { return }
|
||||
tryMove(p,p.x-1,p.y);
|
||||
}
|
||||
})
|
||||
|
|
@ -413,7 +412,6 @@ elements.right_push = {
|
|||
breakPixel(p);
|
||||
}
|
||||
}
|
||||
if (p.del || !elements[p.element].movable) { return }
|
||||
tryMove(p,p.x+1,p.y);
|
||||
}
|
||||
})
|
||||
|
|
@ -449,7 +447,6 @@ elements.up_push = {
|
|||
breakPixel(p);
|
||||
}
|
||||
}
|
||||
if (p.del || !elements[p.element].movable) { return }
|
||||
tryMove(p,p.x,p.y-1);
|
||||
}
|
||||
})
|
||||
|
|
@ -485,7 +482,6 @@ elements.down_push = {
|
|||
breakPixel(p);
|
||||
}
|
||||
}
|
||||
if (p.del || !elements[p.element].movable) { return }
|
||||
tryMove(p,p.x,p.y+1);
|
||||
}
|
||||
})
|
||||
|
|
@ -501,6 +497,168 @@ elements.down_push = {
|
|||
state: "solid",
|
||||
density: 100000000,
|
||||
excludeRandom: true,
|
||||
},
|
||||
elements.leftquake = {
|
||||
color: ["#bda791","#997756","#613d19"],
|
||||
tick: function(pixel) {
|
||||
if (pixel.stage) {
|
||||
var coords = circleCoords(pixel.x,pixel.y,pixel.stage);
|
||||
if (pixel.stage >= pixel.mag) {
|
||||
deletePixel(pixel.x,pixel.y);
|
||||
return;
|
||||
}
|
||||
coords.forEach(function(coord){
|
||||
var x = coord.x;
|
||||
var y = coord.y;
|
||||
if (!isEmpty(x,y,true)) {
|
||||
var p = pixelMap[x][y];
|
||||
if (p.element === "leftquake") {
|
||||
if (pixel !== p) {
|
||||
pixel.mag += 3;
|
||||
deletePixel(p.x,p.y);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (elements[p.element].breakInto) {
|
||||
if (Math.random() < (elements[p.element].hardness || 1) * 0.25) {
|
||||
breakPixel(p);
|
||||
}
|
||||
}
|
||||
if (p.del || !elements[p.element].movable) { return }
|
||||
tryMove(p,p.x+1,p.y);
|
||||
}
|
||||
})
|
||||
pixel.stage++;
|
||||
}
|
||||
else if (!tryMove(pixel,pixel.x-1,pixel.y)) {
|
||||
// random 10 to 20
|
||||
pixel.mag = Math.floor(Math.random() * 10) + 20;
|
||||
pixel.stage = 1;
|
||||
}
|
||||
},
|
||||
category: "weapons",
|
||||
state: "solid",
|
||||
density: 100000000,
|
||||
maxSize: 1,
|
||||
cooldown: defaultCooldown,
|
||||
excludeRandom: true,
|
||||
},
|
||||
elements.rightquake = {
|
||||
color: ["#bda791","#997756","#613d19"],
|
||||
tick: function(pixel) {
|
||||
if (pixel.stage) {
|
||||
var coords = circleCoords(pixel.x,pixel.y,pixel.stage);
|
||||
if (pixel.stage >= pixel.mag) {
|
||||
deletePixel(pixel.x,pixel.y);
|
||||
return;
|
||||
}
|
||||
coords.forEach(function(coord){
|
||||
var x = coord.x;
|
||||
var y = coord.y;
|
||||
if (!isEmpty(x,y,true)) {
|
||||
var p = pixelMap[x][y];
|
||||
if (p.element === "rightquake") {
|
||||
if (pixel !== p) {
|
||||
pixel.mag += 3;
|
||||
deletePixel(p.x,p.y);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (elements[p.element].breakInto) {
|
||||
if (Math.random() < (elements[p.element].hardness || 1) * 0.25) {
|
||||
breakPixel(p);
|
||||
}
|
||||
}
|
||||
if (p.del || !elements[p.element].movable) { return }
|
||||
tryMove(p,p.x-1,p.y);
|
||||
}
|
||||
})
|
||||
pixel.stage++;
|
||||
}
|
||||
else if (!tryMove(pixel,pixel.x+1,pixel.y)) {
|
||||
// random 10 to 20
|
||||
pixel.mag = Math.floor(Math.random() * 10) + 20;
|
||||
pixel.stage = 1;
|
||||
}
|
||||
},
|
||||
category: "weapons",
|
||||
state: "solid",
|
||||
density: 100000000,
|
||||
maxSize: 1,
|
||||
cooldown: defaultCooldown,
|
||||
excludeRandom: true,
|
||||
},
|
||||
elements.upquake = {
|
||||
color: ["#bda791","#997756","#613d19"],
|
||||
tick: function(pixel) {
|
||||
if (pixel.stage) {
|
||||
var coords = circleCoords(pixel.x,pixel.y,pixel.stage);
|
||||
if (pixel.stage >= pixel.mag) {
|
||||
deletePixel(pixel.x,pixel.y);
|
||||
return;
|
||||
}
|
||||
coords.forEach(function(coord){
|
||||
var x = coord.x;
|
||||
var y = coord.y;
|
||||
if (!isEmpty(x,y,true)) {
|
||||
var p = pixelMap[x][y];
|
||||
if (p.element === "upquake") {
|
||||
if (pixel !== p) {
|
||||
pixel.mag += 3;
|
||||
deletePixel(p.x,p.y);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (elements[p.element].breakInto) {
|
||||
if (Math.random() < (elements[p.element].hardness || 1) * 0.25) {
|
||||
breakPixel(p);
|
||||
}
|
||||
}
|
||||
if (p.del || !elements[p.element].movable) { return }
|
||||
tryMove(p,p.x,p.y+1);
|
||||
}
|
||||
})
|
||||
pixel.stage++;
|
||||
}
|
||||
else if (!tryMove(pixel,pixel.x,pixel.y-1)) {
|
||||
// random 10 to 20
|
||||
pixel.mag = Math.floor(Math.random() * 10) + 20;
|
||||
pixel.stage = 1;
|
||||
}
|
||||
},
|
||||
category: "weapons",
|
||||
state: "solid",
|
||||
density: 100000000,
|
||||
maxSize: 1,
|
||||
cooldown: defaultCooldown,
|
||||
excludeRandom: true,
|
||||
},
|
||||
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"
|
||||
//hello nouser if you are reading this:
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -2999,7 +2999,7 @@ elements.insulated_wire = {
|
|||
}
|
||||
elements.insulated_wire.desc = "Insulated wire. Only conducts to other insulated wires. Pairs with ray emitters to not make diagonal rays."
|
||||
elements.e_pipe.desc = "Electric pipe. Only passes elements while charged."
|
||||
elements.destructible_e_pipe.desc = elements.e_pipe.desc
|
||||
elements.destroyable_e_pipe.desc = elements.e_pipe.desc
|
||||
elements.channel_pipe.desc = "Channel pipe. Only passes elements to pipes of the same channel."
|
||||
elements.bridge_pipe.desc = "Bridge pipe. Can pass and receive from any other type of pipe."
|
||||
elements.ray_emitter.desc = "Emits a ray of the specified element in the opposite direction it was shocked from."
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
removeMod("pizzasstuff.js");
|
||||
addMod("mossstuff.js");
|
||||
reload();
|
||||
|
||||
elements.freeze_ray = {
|
||||
color: ["#8cf9ff","#5c59ff"],
|
||||
tick: function(pixel) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
function playSubspace(file) {
|
||||
var audio = new Audio("https://JustAGenericUsername.github.io/" + file + ".mp3");
|
||||
audio.play();
|
||||
}
|
||||
elements.subspace_trimpine = {
|
||||
color: "#2e2430",
|
||||
behavior: behaviors.STURDYPOWDER,
|
||||
maxSize: 1,
|
||||
cooldown: defaultCooldown,
|
||||
density: 1500,
|
||||
category: "weapons",
|
||||
state: "solid",
|
||||
properties:{
|
||||
counter: 0
|
||||
},
|
||||
tick: function(pixel){
|
||||
if (pixel.counter == 0){
|
||||
playSubspace("subspaceplace")
|
||||
}
|
||||
if (!pixel.rgb){pixel.rgb = pixel.color.match(/\d+/g);}
|
||||
if (pixel.counter >= 90 && pixel.counter < 121){
|
||||
if (!pixel.a){pixel.a = 1}
|
||||
pixel.a -= 0.05
|
||||
pixel.color = "rgba(" + pixel.rgb[0] + "," + pixel.rgb[1] + "," + pixel.rgb[2] + "," + pixel.a + ")"
|
||||
}
|
||||
if (pixel.counter >= 121){
|
||||
if (!isEmpty(pixel.x, pixel.y-1, true)){
|
||||
let oldx = pixel.x
|
||||
let oldy = pixel.y
|
||||
explodeAt(pixel.x, pixel.y, 20)
|
||||
playSubspace("subspaceboom")
|
||||
deletePixel(pixel.x, pixel.y)
|
||||
var coords = circleCoords(oldx, oldy, 25)
|
||||
for (var i = 0; i < coords.length; i++){
|
||||
var x = coords[i].x
|
||||
var y = coords[i].y
|
||||
if (!isEmpty(x, y, true)){
|
||||
var newPixel = pixelMap[x][y]
|
||||
newPixel.color = pixelColorPick(pixel, "#FF00FF")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pixel.counter ++
|
||||
}
|
||||
}
|
||||
219
mods/weapons.js
219
mods/weapons.js
|
|
@ -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) {
|
||||
|
|
@ -740,17 +740,17 @@ elements.tank_right = {
|
|||
"XX|M1|M1",
|
||||
],
|
||||
},
|
||||
elements.realistic_missle_left = {
|
||||
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|XX|XX|XX|XX|XX|EX:20>missile_shrapnel",
|
||||
"EX:20>missile_shrapnel|XX|M2|XX|XX|XX|EX:20>missile_shrapnel",
|
||||
"EX:20>missile_shrapnel|XX|M1|XX|XX|CR:smoke|EX:20>missile_shrapnel",
|
||||
"EX:20>missile_shrapnel|XX|M2|XX|XX|XX|EX:20>missile_shrapnel",
|
||||
"EX:20>missile_shrapnel|XX|XX|XX|XX|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|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) {
|
||||
|
|
@ -765,17 +765,17 @@ elements.realistic_missle_left = {
|
|||
excludeRandom: true,
|
||||
cooldown: defaultCooldown
|
||||
},
|
||||
elements.realistic_missle_right = {
|
||||
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|XX|XX|XX|XX|XX|EX:20>missile_shrapnel",
|
||||
"EX:20>missile_shrapnel|XX|XX|XX|M2|XX|EX:20>missile_shrapnel",
|
||||
"EX:20>missile_shrapnel|CR:smoke|XX|XX|M1|XX|EX:20>missile_shrapnel",
|
||||
"EX:20>missile_shrapnel|XX|XX|XX|M2|XX|EX:20>missile_shrapnel",
|
||||
"EX:20>missile_shrapnel|XX|XX|XX|XX|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|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) {
|
||||
|
|
@ -803,4 +803,197 @@ elements.realistic_missle_right = {
|
|||
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"
|
||||
},
|
||||
elements.railgun_beam_left = {
|
||||
color: ["#ff0000","#ff5e00"],
|
||||
tick: function(pixel) {
|
||||
var y = pixel.y;
|
||||
for (var x = pixel.x; x < width; x--) {
|
||||
if (outOfBounds(x, y)) {
|
||||
break;
|
||||
}
|
||||
if (isEmpty(x, y)) {
|
||||
createPixel("railgun_ammo_left", x, y);
|
||||
pixelMap[x][y].temp = 3500;
|
||||
}
|
||||
else {
|
||||
if (elements[pixelMap[x][y].element].isGas) { continue }
|
||||
if (elements[pixelMap[x][y].element].id === elements.railgun_beam_left.id) { break }
|
||||
pixelMap[x][y].temp += 100;
|
||||
pixelTempCheck(pixelMap[x][y]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
deletePixel(pixel.x, pixel.y);
|
||||
},
|
||||
temp: 3500,
|
||||
category: "ammunition",
|
||||
state: "gas",
|
||||
density: 1,
|
||||
excludeRandom: true,
|
||||
noMix: true
|
||||
},
|
||||
elements.railgun_beam_right = {
|
||||
color: ["#ff0000","#ff5e00"],
|
||||
tick: function(pixel) {
|
||||
var y = pixel.y;
|
||||
for (var x = pixel.x; x < width; x++) {
|
||||
if (outOfBounds(x, y)) {
|
||||
break;
|
||||
}
|
||||
if (isEmpty(x, y)) {
|
||||
createPixel("railgun_ammo_right", x, y);
|
||||
pixelMap[x][y].temp = 3500;
|
||||
}
|
||||
else {
|
||||
if (elements[pixelMap[x][y].element].isGas) { continue }
|
||||
if (elements[pixelMap[x][y].element].id === elements.railgun_beam_right.id) { break }
|
||||
pixelMap[x][y].temp += 100;
|
||||
pixelTempCheck(pixelMap[x][y]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
deletePixel(pixel.x, pixel.y);
|
||||
},
|
||||
temp: 3500,
|
||||
category: "ammunition",
|
||||
state: "gas",
|
||||
density: 1,
|
||||
excludeRandom: true,
|
||||
noMix: true
|
||||
},
|
||||
elements.railgun_ammo_left = {
|
||||
color: ["#ff0000","#ff5e00"],
|
||||
category: "ammunition",
|
||||
state: "solid",
|
||||
density: 1300,
|
||||
tick: function(pixel) {
|
||||
explodeAt(pixel.x, pixel.y, 10)
|
||||
doHeat(pixel);
|
||||
},
|
||||
},
|
||||
elements.railgun_ammo_right = {
|
||||
color: ["#ff0000","#ff5e00"],
|
||||
category: "ammunition",
|
||||
state: "solid",
|
||||
density: 1300,
|
||||
tick: function(pixel) {
|
||||
explodeAt(pixel.x, pixel.y, 10)
|
||||
doHeat(pixel);
|
||||
},
|
||||
},
|
||||
elements.railgun_left = {
|
||||
category: "weapons",
|
||||
behavior: behaviors.WALL,
|
||||
behaviorOn: [
|
||||
"XX|XX|XX",
|
||||
"CR:railgun_beam_left|XX|XX",
|
||||
"XX|XX|XX",
|
||||
],
|
||||
color: "#71797E",
|
||||
conduct: 1,
|
||||
hardness: 1,
|
||||
},
|
||||
elements.railgun_right = {
|
||||
category: "weapons",
|
||||
behavior: behaviors.WALL,
|
||||
behaviorOn: [
|
||||
"XX|XX|XX",
|
||||
"XX|XX|CR:railgun_beam_right",
|
||||
"XX|XX|XX",
|
||||
],
|
||||
color: "#71797E",
|
||||
conduct: 1,
|
||||
hardness: 1,
|
||||
}
|
||||
Loading…
Reference in New Issue