Merge branch 'R74nCom:main' into main

This commit is contained in:
JustAGenericUsername 2024-06-21 22:09:02 -04:00 committed by GitHub
commit 71710ac267
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 261 additions and 51 deletions

View File

@ -230,6 +230,7 @@
<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>war_crimes.js</td><td>Adds tear gas & more</td><td>voidapex11</td></tr>
<!----><tr><td class="modCat" colspan="3">Food & Cooking</td></tr><!---->
<tr><td>aChefsDream.js</td><td>Adds more foods, animals, tools and many other cooking related items. Updates can be found in <a href="https://www.youtube.com/watch?v=pQFTtlNPODQ&list=PLWHqGb75vC8o7CLv-pMoVb56JL9BY9F0t">this YouTube Playlist</a></td><td>SquareScreamYT</td></tr>

View File

@ -8,8 +8,8 @@ try {
//COMMON VARIABLES ##
const whiteColor = {r: 255, g: 255, b: 255};
const blackColor = {r: 0, g: 0, b: 0};
canvas = document.getElementsByTagName("canvas")[0];
ctx = canvas.getContext("2d");
canvas = document.getElementsByTagName("canvas")?.[0];
ctx = canvas?.getContext?.("2d") ?? null;
//ESSENTIAL COMMON FUNCTIONS (CODE LIBRARY) ##
//DEBUGGING
function logAndReturn(thing) {
@ -3189,7 +3189,7 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
//supplementary functions for below
//redefine mouseRange to support even sizes
function mouseRange(mouseX,mouseY,size,shapeOverride=null) {
function mouseRange(mouseX,mouseY,size,shapeOverride=null,skipEmpties=false) {
var shape = shapeOverride ?? currentShape ?? "square";
var coords = [];
size = size || mouseSize;
@ -3214,7 +3214,9 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
// 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(skipEmpties && isEmpty(x,y,true)) {
continue
};
if((shape !== "square") && exclusionFunction?.(x,y,size,mouseX,mouseY,topLeft,bottomRight)) {
continue
};
@ -3469,6 +3471,10 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
focusGame();
};
window.onload = function() {
if(canvas == null || ctx == null) {
canvas = document.getElementsByTagName("canvas")[0];
ctx = canvas.getContext("2d") ?? null;
}
// If the browser is Firefox, set #categoryControls padding-bottom:11px;
if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
document.getElementById("categoryControls").style.paddingBottom = "11px";
@ -5158,7 +5164,7 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
else if (view === 2) { // thermal view
// set the color to pixel.temp, from hottest at -66 (294.1875) hue to coldest 265 hue, with the minimum being -273, max being 7755
var temp = pixel.temp;
temp = Math.min(Math.max(temp + 900,(settings.abszero ?? -273.15)),55530);
temp = Math.min(Math.max(temp + 900,(settings.abszero ?? -273.15)),5553000000000);
var hue,sat,lig;
sat = 100;
lig = 50;
@ -5210,10 +5216,14 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
hue = 265;
sat = scale(temp,46775,47775,40,20);
lig = 50;
} else { //55530
} else if(temp <= 55530) {
hue = scale(temp,47775,55530,265,654.1875) % 360;
sat = 20;
lig = 50;
} else {
hue = 294;
sat = 20 + (12 * Math.log10(temp / 55530));
lig = 50 + (4 * Math.log10(temp / 55530));
};
ctx.fillStyle = "hsl("+hue+","+sat+"%,"+lig+"%)";
}
@ -8544,6 +8554,81 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
var key = eLists.LED[i];
elements.malware.reactions[key] = { elem2:eLists.LED, chance:0.01 }
};
function heatNeighbors(pixel,temp,trueIfMooreFalseIfNeumann=false) {
var neighborOffsets = trueIfMooreFalseIfNeumann ? squareCoords : adjacentCoords;
var pX = pixel.x;
var pY = pixel.y;
for(var i = 0; i < neighborOffsets.length; i++) {
var offsets = neighborOffsets[i];
var newPixel = pixelMap[pX + offsets[0]]?.[pY + offsets[1]];
if(!newPixel) { continue };
newPixel["temp"] += temp;
pixelTempCheck(newPixel)
}
};
elements.amba_black_hole = {
color: "#000000",
maxColorOffset: 0,
excludeRandom: true,
tick: function(pixel) {
pixel.lastTemps ??= [];
pixel.lastTemps.push(pixel.temp);
if(pixel.lastTemps.length > 5) { pixel.lastTemps.shift() };
var biggestLastTemp = Math.max(...pixel.lastTemps);
if(pixel.temp < biggestLastTemp) { pixel.temp = biggestLastTemp };
pixel.color = "rgb(0,0,0)";
var range = (pixel.range ?? 30) * 2;
var targets = mouseRange(pixel.x,pixel.y,range,"circle",true);
for (var i = 0; i < targets.length; i++) {
var newPixel = pixelMap[targets[i][0]]?.[targets[i][1]];
if ((!newPixel) || newPixel.del) { continue };
if((newPixel.element == pixel.element) || ((newPixel.x == pixel.x) && (newPixel.y == pixel.y))) { continue };
newPixel.drag = true;
var [mX, mY] = [pixel.x, pixel.y];
var distanceComplement = (range / 2) - pyth(mX,mY,newPixel.x,newPixel.y);
var distanceProportion = 0.3 + (distanceComplement / (range / 2));
var distanceModifier = distanceProportion ** 2;
var pullCount = (4 * distanceModifier) * (commonMovableCriteria(pixel.element) ? 1 : 0.8);
var pullCountIntegerPart = Math.floor(pullCount);
var pullCountFractionalPart = pullCount % 1;
var truePullCount = Math.min(3,pullCountIntegerPart + (Math.random() < pullCountFractionalPart));
for(var j = 0; j < truePullCount; j++) {
var x = newPixel.x;
var y = newPixel.y;
var empty = checkForEmptyPixels(x, y);
let bestVal = Math.sqrt(Math.pow(mX - x, 2) + Math.pow(mY - y, 2));
let best = null;
for (const pixelPair of empty) {
const x_ = x + pixelPair[0];
const y_ = y + pixelPair[1];
const c = Math.sqrt(Math.pow(mX - x_, 2) + Math.pow(mY - y_, 2));
if (c < bestVal) {
bestVal = c;
best = pixelPair;
}
}
if (best) {
tryMove(newPixel, x + best[0], y + best[1], undefined, true);
heatNeighbors(newPixel,20);
pixel.temp += 20;
}
};
var taxicabDistance = Math.abs(newPixel.x - pixel.x) + Math.abs(newPixel.y - pixel.y);
if(taxicabDistance <= 3) {
pixel.temp += (newPixel.temp - (settings.abszero ?? 273.15));
deletePixel(newPixel.x,newPixel.y);
continue
}
}
},
state: undefined,
density: 1797.69313486e305, //about as close to Infinity as we can serializably get
category: "special",
hardness: 1
};
//ASSORTED RAINBOW VARIANTS ##
elements.concoction.reactions.diorite_gravel = {
elem1: "static", elem2: null
@ -25388,7 +25473,7 @@ Pixel size (rendering only): <input id="pixelSize"> (Use if the save looks cut o
tick: function(pixel) {
nsTick(pixel,0.7,stellarPlasmaSpreadWhitelist);
},
temp: 1e12,
temp: 1e8,
category: "special",
state: "gas",
density: 1e17,
@ -25443,11 +25528,9 @@ Pixel size (rendering only): <input id="pixelSize"> (Use if the save looks cut o
density: 10000, //i'm not doing any more research on these neutron stars because google is useless
conduct: 1,
};
elements.supernova.behavior = [
"XX|XX|XX",
"XX|EX:80>plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,molten_iron,molten_uranium,molten_lead AND CH:neutron_star,neutron_star,neutron_star,neutronium,quark_matter,void|XX",
"XX|XX|XX",
]
elements.supernova.behavior[1] = elements.supernova.behavior[1].split("|");
elements.supernova.behavior[1][1] = elements.supernova.behavior[1][1].replace("void","amba_black_hole") + ",neutron_star,neutron_star,amba_black_hole,amba_black_hole,amba_black_hole"
elements.supernova.behavior[1] = elements.supernova.behavior[1].join("|");
elements.plasma.noConduct = ["plasma_torch","stellar_plasma","liquid_stellar_plasma","liquid_degenerate_neutronium","gaseous_degenerate_neutronium","neutron_star"]; //I can't suppress the charge overlay and keep the tick color, only effective with noConduct.js but not strictly required
//Tangentially linked
elements.rainbow_sun = {

View File

@ -1,12 +1,11 @@
/* Made by: Necrotic_Phantom
/* Made by: NecroticPhantom
With help from: voidapex11 */
// For change log: "+" = addition, "-" = removal and "~" = change. L, R, U, D corresponds to LEFT, RIGHT, UP and DOWN
// "committed" means posted current version on github. It is a courtesy and important, especially if you're working on another person's mod at the same time as them, so you don't disrupt each other's work
/*
===CHANGE LOG===
Version: 1.0.0
Version: 1.0.0 (Drills.js)
@Necrotic_Phantom & @voidapex11
+ steel drill L, R, U & D
+ steel drill missile L, R, U & D
@ -15,46 +14,16 @@
+ void drill L, R, U & D
+ void drill missile L, R, U & D
+ drills.js info (drills_info) element to 'mods' category
~ changed all element colors from gray to individual colors
~ fixed steel/diamond/void drill missile L, R, U & D drilling errors
~ fixed steel/diamond/void drill R & steel/diamond/void drill missile R crashing upon border collision
~ made steel/diamond/void drill missile L, R, U & D explode upon border contact
~ committed
Version: 1.0.1
@NecroticPhantom
~ fixed steel/diamond/void drill L, R, U & D + steel/diamond/void drill missile L, R, U & D not breaking pixels with no listed hardness
*/
/* Future Plans (in approx order):
~ find error/fix all types of drill_RIGHT crashing game a few seconds after hitting border
+ reverse steel drill L, R, U & D
+ reverse diamond drill L, R, U & D
+ reverse void drill L, R, U & D
+ random steel drill
+ random steel drill missile
+ random reverse steel drill
+ random diamond drill
+ random diamond drill missile
+ random reverse diamond drill
+ random void drill
+ random void drill missile
+ random reverse void drill
+ programmable steel drill
+ programmable steel drill missile
+ programmable reverse steel drill
+ programmable diamond drill
+ programmable diamond drill missile
+ programmable reverse diamond drill
+ programmable void drill
+ programmable void drill missile
+ programmable reverse void drill
+ seeking steel drill
+ seeking steel drill missile
+ seeking reverse steel drill
+ seeking diamond drill
+ seeking diamond drill missile
+ seeking reverse diamond drill
+ seeking void drill
+ seeking void drill missile
+ seeking reverse void drill
+ ricochet drills??? */
drills_mod_desc_Colour = "#000000"
steel_drill_Colour = "#71797e"
@ -66,6 +35,14 @@ void_drill_missile_Colour = ["#262626", "#ff0000"];
behaviors.SELFDELETE = [
"XX|XX|XX",
"XX|DL|XX",
"XX|XX|XX",
];
elements.drills_info = {
color: drills_mod_desc_Colour,
name: "drills.js_info",
@ -91,6 +68,9 @@ steel_drill_function = function(pixel, dif_x, dif_y) {
if (elements[pxl.element].hardness <= 0.8) {
delete pixelMap[pixel.x+dif_x][pixel.y+dif_y];
}
else if (elements[pxl.element].hardness == undefined) {
delete pixelMap[pixel.x+dif_x][pixel.y+dif_y];
};
};
tryMove(pixel,pixel.x+dif_x,pixel.y+dif_y);
};
@ -174,6 +154,9 @@ steel_drill_missile_function = function(pixel, dif_x, dif_y) {
if (elements[pxl.element].hardness <= 0.8) {
delete pixelMap[pixel.x+dif_x][pixel.y+dif_y];
}
else if (elements[pxl.element].hardness == undefined) {
delete pixelMap[pixel.x+dif_x][pixel.y+dif_y];
};
}
else if (pixel.primed) {
pixel.die--
@ -267,6 +250,9 @@ diamond_drill_function = function(pixel, dif_x, dif_y) {
if (elements[pxl.element].hardness <= 0.99) {
delete pixelMap[pixel.x+dif_x][pixel.y+dif_y];
}
else if (elements[pxl.element].hardness == undefined) {
delete pixelMap[pixel.x+dif_x][pixel.y+dif_y];
};
};
tryMove(pixel,pixel.x+dif_x,pixel.y+dif_y);
};
@ -350,6 +336,9 @@ diamond_drill_missile_function = function(pixel, dif_x, dif_y) {
if (elements[pxl.element].hardness <= 0.99) {
delete pixelMap[pixel.x+dif_x][pixel.y+dif_y];
}
else if (elements[pxl.element].hardness == undefined) {
delete pixelMap[pixel.x+dif_x][pixel.y+dif_y];
};
}
else if (pixel.primed) {
pixel.die--
@ -443,6 +432,9 @@ void_drill_function = function(pixel, dif_x, dif_y) {
if (elements[pxl.element].hardness <= 1) {
delete pixelMap[pixel.x+dif_x][pixel.y+dif_y];
}
else if (elements[pxl.element].hardness == undefined) {
delete pixelMap[pixel.x+dif_x][pixel.y+dif_y];
};
};
tryMove(pixel,pixel.x+dif_x,pixel.y+dif_y);
};
@ -526,6 +518,9 @@ void_drill_missile_function = function(pixel, dif_x, dif_y) {
if (elements[pxl.element].hardness <= 1) {
delete pixelMap[pixel.x+dif_x][pixel.y+dif_y];
}
else if (elements[pxl.element].hardness == undefined) {
delete pixelMap[pixel.x+dif_x][pixel.y+dif_y];
};
}
else if (pixel.primed) {
pixel.die--
@ -606,4 +601,4 @@ elements.void_drill_missile_DOWN = {
conduct: 1,
state: "solid",
maxSize: 1,
}
}

131
mods/war_crimes.js Normal file
View File

@ -0,0 +1,131 @@
// feel free to add to/improve this mod
// this has bee worked on by:
// voidapex11
elements.tear_gas = {
color: "#d5dce6",
behavior: [
"XX|XX|XX",
"XX|XX|M2%2.5 AND BO",
"XX|M1%1|XX"
],
tick: function (pixel) {
for (var i = 0; i < adjacentCoords.length; i++) {
var coords = adjacentCoords[i];
var x = pixel.x + coords[0];
var y = pixel.y + coords[1];
try { // this code causes errors acationally, who knows why.
if (!isEmpty(x, y)) {
if (pixelMap[x][y].element == "tear_gas_grenade") {
var x = pixel.x - coords[0];
var y = pixel.y - coords[1];
tryMove(pixel, x, y)
}
}
} catch {} // lazy fix
}
},
category: "weapons",
temp: 20,
cooldown: 1,
reactions: {
"head": { elem2: ["head", "rotten_meat"], elem1: ["tear_gas", "tear_gas", "salt_water"], chance: 0.1, oneway: true },
"body": { elem2: "rotten_meat", chance: 0.05, oneway: true },
},
tempLow: -30,
state: "gas",
density: 0.4,
ignoreAir: true,
};
elements.tear_gas_grenade = {
color: "#65665c",
behavior: [
"XX|CR:tear_gas|XX",
"CR:tear_gas%80|EX:4>tear_gas%5|CR:tear_gas%80",
"M2|M1|M2",
],
category: "weapons",
state: "solid",
density: 7300,
conduct: 0.73,
tempHigh: 1455.5,
stateHigh: "molten_steel",
excludeRandom: true,
cooldown: 5,
nocheer: true,
};
elements.sonic_grenade = {
color: "#65665c",
tick: function (pixel) {
if (!pixel.primed) {
ground=false
num = 0
coords=lineCoords(pixel.x,pixel.y,pixel.x,pixel.y+20)
for (coord in coords) {
pxl=coords[coord]
if (!isEmpty(pxl[0],pxl[1])) {
if (num>=5) {
ground=true
break
}
if (elements[pixel.element].density>100||elements[pixel.element].hardness!==undefined) {
num++
}
} else {
num--
}
}
if (ground) {
pixel.primed=true
}
}
if ((pixel.primed||!isEmpty(pixel.x, pixel.y + 1))&&((Math.random() < 0.05) || (isEmpty(pixel.x, pixel.y + 1) && Math.random() < 0.3))) {
// if ~random chance~ or it has something below it & ~higher random chance~: explode
coords = circleCoords(pixel.x, pixel.y, 10);
for (i in coords) {
coord = coords[i]
var x = coord.x;
var y = coord.y;
if (!isEmpty(x, y, true)) {
pxl = pixelMap[x][y]
if ((typeof elements[pxl.element].density == "number")||(elements[pxl.element].hardness!==undefined)) {
if ((elements[pxl.element].density > 2000)||(elements[pxl.element].hardness!==undefined)) {
if (elements[pxl.element].breakInto&&(Math.random()>0.2||pxl.element=="glass")) {
if (Math.random()>0.4) {
deletePixel(x,y)
} else {
breakPixel(pxl);
}
pxl = pixelMap[x][y]
}
}
}
}
}
explodeAt(pixel.x, pixel.y, 3, "smoke")
deletePixel(pixel.x, pixel.y)
return
} else {
if (isEmpty(pixel.x, pixel.y + 1, true)) {
// first, try to move straight down
tryMove(pixel, pixel.x, pixel.y + 1)
} else if ((Math.random() < 0.5) && isEmpty(pixel.x + 1, pixel.y + 1, true)) {
tryMove(pixel, pixel.x + 1, pixel.y + 1)
} else if (isEmpty(pixel.x - 1, pixel.y + 1, true)) {
tryMove(pixel, pixel.x - 1, pixel.y + 1)
}
}
},
category: "weapons",
state: "solid",
density: 7300,
conduct: 0.73,
tempHigh: 1455.5,
stateHigh: "molten_steel",
excludeRandom: true,
cooldown: 5,
nocheer: true,
};