Merge branch 'R74nCom:main' into main

This commit is contained in:
JustAGenericUsername 2024-05-20 20:59:15 -04:00 committed by GitHub
commit 508b22d0df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 1376 additions and 4209 deletions

View File

@ -120,6 +120,8 @@
"freezer":"Frierer",
"pipe":"Rohr",
"pipe_wall":"Rohrwand",
"mixer": "Mixer",
"grinder": "Mühle",
"ewall":"E-Wand",
"torch":"Fackel",
"spout":"Auslauf",
@ -173,6 +175,7 @@
"pinecone":"Tannenzapfen",
"evergreen":"Immergrün",
"cactus":"Kaktus",
"kelp": "Seetang",
"seeds":"Samen",
"grass_seed":"Grassamen",
"wheat_seed":"Weizensamen",
@ -216,6 +219,7 @@
"antimatter":"Antimaterie",
"plastic":"Plastik",
"molten_plastic":"Geschmolzenes_Plastik",
"cloth": "Stoff",
"cellulose":"Zellulose",
"wax":"Wachs",
"melted_wax":"Geschmolzener_Wachs",
@ -433,10 +437,11 @@
"bless":"Segnen",
"god_ray":"Gott_Strahl",
"heat_ray":"Hitzestrahl",
"freeze_ray": "Frierstrahl",
"pop": "Knall",
"explosion":"Explosion",
"n_explosion":"N-Explosion",
"supernova":"Supernova",
"pop":"Knall",
"cook":"Kochen",
"incinerate":"verbrennen",
"room_temp":"Zimmertemperatur",

View File

@ -120,6 +120,8 @@
"freezer": "",
"pipe": "",
"pipe_wall": "",
"mixer": "",
"grinder": "",
"ewall": "",
"torch": "",
"spout": "",
@ -173,6 +175,7 @@
"pinecone": "",
"evergreen": "",
"cactus": "",
"kelp": "",
"seeds": "",
"grass_seed": "",
"wheat_seed": "",
@ -216,6 +219,7 @@
"antimatter": "",
"plastic": "",
"molten_plastic": "",
"cloth": "",
"cellulose": "",
"wax": "",
"melted_wax": "",
@ -433,10 +437,11 @@
"bless": "",
"god_ray": "",
"heat_ray": "",
"freeze_ray": "",
"pop": "",
"explosion": "",
"n_explosion": "",
"supernova": "",
"pop": "",
"cook": "",
"incinerate": "",
"room_temp": "",

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@ function reactPixels(pixel1,pixel2) {
if (r.tempMax !== undefined && pixel1.temp > r.tempMax) {
return false;
}
if (r.charged && !pixel.charge) {
if (r.charged && !pixel1.charge) {
return false;
}
if (r.chance !== undefined && Math.random() > r.chance) {

153
mods/cursor_shapes.js Normal file
View File

@ -0,0 +1,153 @@
if(enabledMods.includes("mods/a_mod_by_alice.js")) {
logMessage("cursor_shapes.js is redundant with a_mod_by_alice.js")
} else {
currentShape = "square";
shapeOrder = ["square","circle","triangle","inverted triangle","rhombus","squircle","twinkle","slash","backslash"];
shapeExclusionConditions = {
/*"square": function(x,y,size,mouseX,mouseY,topLeft,bottomRight) {
return false
},*/
"triangle": function(x,y,size,mouseX,mouseY,topLeft,bottomRight) {
var xOffset = (x - topLeft[0]);
var yOffset = (y - topLeft[1]);
var distanceFromCenterLine;
if(size % 2 == 0) {
distanceFromCenterLine = Math.abs((size / 2) - (xOffset + 0.5))
} else {
distanceFromCenterLine = Math.abs(mouseX - x);
};
var distanceProportion = distanceFromCenterLine / size;
var hpovp = ((yOffset + (size % 2 == 0)) / size) / 2; //halvedPossiblyOffsetVerticalProportion
return distanceProportion > (hpovp + 0.01);
},
"inverted triangle": function(x,y,size,mouseX,mouseY,topLeft,bottomRight) {
var xOffset = (x - topLeft[0]);
var yOffset = (y - topLeft[1]);
var distanceFromCenterLine;
if(size % 2 == 0) {
distanceFromCenterLine = Math.abs((size / 2) - (xOffset + 0.5))
} else {
distanceFromCenterLine = Math.abs(mouseX - x);
};
var distanceProportion = distanceFromCenterLine / size;
var hpovpc = (1 - ((yOffset + (size % 2 !== 0)) / size)) / 2; //halvedPossiblyOffsetVerticalProportionComplement
return distanceProportion > (hpovpc + 0.01);
},
"rhombus": function(x,y,size,mouseX,mouseY,topLeft,bottomRight) {
var xOffset = (x - topLeft[0]);
var yOffset = (y - topLeft[1]);
var xDistanceFromCenterLine;
if(size % 2 == 0) { xDistanceFromCenterLine = Math.abs((size / 2) - (xOffset + 0.5)) } else { xDistanceFromCenterLine = Math.abs(mouseX - x) };
var yDistanceFromCenterLine;
if(size % 2 == 0) { yDistanceFromCenterLine = Math.abs((size / 2) - (yOffset + 0.5)) } else { yDistanceFromCenterLine = Math.abs(mouseY - y) };
return (xDistanceFromCenterLine + yDistanceFromCenterLine) > (size / 2) //i was just messing around, i didn't expect this to actually be the right condition :sob:
},
"squircle": function(x,y,size,mouseX,mouseY,topLeft,bottomRight) {
var xOffset = (x - topLeft[0]);
var yOffset = (y - topLeft[1]);
var xDistanceFromCenterLine;
if(size % 2 == 0) { xDistanceFromCenterLine = Math.abs((size / 2) - (xOffset + 0.5)) } else { xDistanceFromCenterLine = Math.abs(mouseX - x) };
var yDistanceFromCenterLine;
if(size % 2 == 0) { yDistanceFromCenterLine = Math.abs((size / 2) - (yOffset + 0.5)) } else { yDistanceFromCenterLine = Math.abs(mouseY - y) };
return ( (((xDistanceFromCenterLine ** 3) + (yDistanceFromCenterLine ** 3)) ** (1/3)) > (size / 2)) || ((size > 2) && (size <= 6) && ((xDistanceFromCenterLine + yDistanceFromCenterLine) == (size - 1)));
},
"twinkle": function(x,y,size,mouseX,mouseY,topLeft,bottomRight) {
var xOffset = (x - topLeft[0]);
var yOffset = (y - topLeft[1]);
var xDistanceFromCenterLine;
if(size % 2 == 0) { xDistanceFromCenterLine = Math.abs((size / 2) - (xOffset + 0.5)) } else { xDistanceFromCenterLine = Math.abs(mouseX - x) };
var yDistanceFromCenterLine;
if(size % 2 == 0) { yDistanceFromCenterLine = Math.abs((size / 2) - (yOffset + 0.5)) } else { yDistanceFromCenterLine = Math.abs(mouseY - y) };
return ((((xDistanceFromCenterLine ** (1/2)) + (yDistanceFromCenterLine ** (1/2))) ** (2)) > ((size / (size % 2 ? 2 : 1.7)))) && (xDistanceFromCenterLine > 0.5) && (yDistanceFromCenterLine > 0.5)
},
"circle": function(x,y,size,mouseX,mouseY,topLeft,bottomRight) {
var xOffset = (x - topLeft[0]);
var yOffset = (y - topLeft[1]);
var xDistanceFromCenterLine;
if(size % 2 == 0) { xDistanceFromCenterLine = Math.abs((size / 2) - (xOffset + 0.5)) } else { xDistanceFromCenterLine = Math.abs(mouseX - x) };
var yDistanceFromCenterLine;
if(size % 2 == 0) { yDistanceFromCenterLine = Math.abs((size / 2) - (yOffset + 0.5)) } else { yDistanceFromCenterLine = Math.abs(mouseY - y) };
if( (((xDistanceFromCenterLine ** 2) + (yDistanceFromCenterLine ** 2)) ** (1/2)) > (size / 2)) { return true }; //structured this way for legibility
if( ((xDistanceFromCenterLine + yDistanceFromCenterLine) == 2) && (size == 3)) { return true };
if( ((xDistanceFromCenterLine + yDistanceFromCenterLine) >= 3.5) && (size == 6)) { return true };
if( ((xDistanceFromCenterLine + yDistanceFromCenterLine) >= 4.5) && (size == 8) && !(Math.abs(xDistanceFromCenterLine) === Math.abs(yDistanceFromCenterLine))) { return true };
if( //i can't explain how these rules work, but they just do
(size % 2 == 1) &&
(size > 5) &&
((xDistanceFromCenterLine + yDistanceFromCenterLine) >= (size - 3)) &&
!(Math.abs(xDistanceFromCenterLine) === Math.abs(yDistanceFromCenterLine))
) { return true };
return false
},
"slash": function(x,y,size,mouseX,mouseY,topLeft,bottomRight) {
var xOffset = (x - topLeft[0]);
var yOffset = (y - topLeft[1]);
var yOffsetComplement = (size - 1) - yOffset;
if(xOffset == yOffsetComplement) { return false };
if(xOffset == yOffsetComplement + 1) { return false };
return true
},
"backslash": function(x,y,size,mouseX,mouseY,topLeft,bottomRight) {
var xOffset = (x - topLeft[0]);
var yOffset = (y - topLeft[1]);
if(xOffset == yOffset) { return false };
if(xOffset == yOffset + 1) { return false };
return true
}
}
function mouseRange(mouseX,mouseY,size,shapeOverride=null) {
var shape = shapeOverride ?? currentShape ?? "square";
var coords = [];
size = size || mouseSize;
if (elements[currentElement].maxSize < mouseSize) {
var mouseOffset = Math.trunc(elements[currentElement].maxSize/2);
}
else {
var mouseOffset = Math.trunc(size/2);
}
var topLeft = [mouseX-mouseOffset,mouseY-mouseOffset];
var bottomRight = [mouseX+mouseOffset,mouseY+mouseOffset];
if(size % 2 == 0) {
bottomRight[0]--;
bottomRight[1]--;
};
var exclusionFunction = shapeExclusionConditions[shape] ?? null;
if((shape !== "square") && (exclusionFunction == null)) {
logMessage(`Shape ${shape} not recognized!`)
return []
};
// Starting at the top left, go through each pixel
for (var x = topLeft[0]; x <= bottomRight[0]; x++) {
for (var y = topLeft[1]; y <= bottomRight[1]; y++) {
// If the pixel is empty, add it to coords
if((shape !== "square") && exclusionFunction?.(x,y,size,mouseX,mouseY,topLeft,bottomRight)) {
continue
};
coords.push([x,y]);
}
};
return coords
};
document.addEventListener("keydown", function(e) {
//shift+8 to change cursor shape, alt+8 to cycle backwards
if (e.keyCode == 56 && [1,2].includes(shiftDown)) {
var currentShapeIndex = shapeOrder.indexOf(currentShape);
var newIndex;
switch(shiftDown) {
default:
case 1:
newIndex = (currentShapeIndex + 1) % shapeOrder.length;
break
case 2:
newIndex = (currentShapeIndex - 1) % shapeOrder.length;
if(newIndex < 0) { newIndex = shapeOrder.length - 1 };
break
};
currentShape = shapeOrder[newIndex];
logMessage(`Current shape: ${currentShape}`)
}
})
}

View File

@ -31,7 +31,7 @@ function reactPixels(pixel1,pixel2) {
if (r.burning2 !== undefined && Boolean(pixel2.burning) !== r.burning2) {
return false;
}
if (r.charged && !pixel.charge) {
if (r.charged && !pixel1.charge) {
return false;
}
if (r.chance !== undefined && Math.random() > r.chance) {

View File

@ -42,7 +42,7 @@ function reactPixels(pixel1,pixel2) {
if (r.burning2 !== undefined && Boolean(pixel2.burning) !== r.burning2) {
return false;
}
if (r.charged && !pixel.charge) {
if (r.charged && !pixel1.charge) {
return false;
}
if (r.chance !== undefined && Math.random() > r.chance) {

32
mods/nicer_flame.js Normal file
View File

@ -0,0 +1,32 @@
// Mod that makes fire look better with dark red at the top of the flame
let topColor = 'rgb(130, 0, 0)';
let blending = 0.7;
function cssColorToRGB(color) {
console.log(color);
let rgbMatch = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
return [parseInt(rgbMatch[1]), parseInt(rgbMatch[2]), parseInt(rgbMatch[3])];
}
function blendColors(color1, color2, weight) {
const [r1, g1, b1] = cssColorToRGB(color1);
const [r2, g2, b2] = cssColorToRGB(color2);
const r = Math.round(r1 * weight + r2 * (1 - weight));
const g = Math.round(g1 * weight + g2 * (1 - weight));
const b = Math.round(b1 * weight + b2 * (1 - weight));
return `rgb(${r}, ${g}, ${b})`;
}
let originalFireTick = elements.fire.tick;
elements.fire.tick = function(pixel) {
// Call the original tick function
originalFireTick(pixel);
if (Math.random()<0.1) {
let originalColor = pixel.color;
pixel.color = blendColors(originalColor, topColor, blending);
}
};

View File

@ -89,3 +89,63 @@ elements.electrogalvanized = {
conduct: 2,
density: 7850,
};
elements.nvidia_cpu = {
color: "#76B900", // Nvidia's signature green color
behavior: [
"XX|SH|XX",
"SH|XX|SH",
"XX|SH|XX",
],
category: "tech",
tempHigh: 1000, // Melting point for realism
stateHigh: "molten_silicon", // Assuming it melts into molten silicon
reactions: {
"water": { elem1: "short_circuit", elem2: "steam" },
"salt_water": { elem1: "short_circuit", elem2: "null" },
"acid": { elem1: "corroded_cpu", elem2: "null" },
"poison": { elem1: "corroded_cpu", elem2: "null" },
},
breakInto: ["silicon", "metal_scrap"],
conduct: 10, // Moderate conductivity
density: 2330, // Density of silicon
};
elements.molten_silicon = {
color: "#ffcc99",
behavior: behaviors.LIQUID,
category: "states",
state: "liquid",
temp: 1414, // Melting point of silicon
tempLow: 1414,
stateLow: "silicon",
density: 2570,
viscosity: 100,
};
elements.short_circuit = {
color: "#ff0000",
behavior: behaviors.POWDER,
category: "energy",
temp: 100,
state: "solid",
};
elements.corroded_cpu = {
color: "#a0a0a0",
behavior: behaviors.POWDER,
category: "tech",
tempHigh: 800,
stateHigh: "ash",
conduct: 1,
};
elements.silicon = {
color: "#f0f0f0",
behavior: behaviors.SOLID,
category: "solids",
tempHigh: 1414,
stateHigh: "molten_silicon",
density: 2330,
};