This commit is contained in:
slweeb 2025-01-04 13:10:04 -05:00
commit 1fb0f79fb0
6 changed files with 996 additions and 418 deletions

View File

@ -217,6 +217,7 @@
<tr><td>the_ground.js</td><td>Adds several rock types, worldgen settings, and gemstones</td><td>Alice</td></tr>
<!----><tr><td class="modCat" colspan="3">Machines & Technology</td></tr><!---->
<tr><td>circuitcore.js</td><td>An extension to logicgates.js that adds advanced circuits. <a href="https://redbirdly.github.io/circuitcore_tutorial.html" target="_blank">Documentation</a>.</td><td>RedBirdly</td></tr>
<tr><td>clone_liquid.js</td><td>Adds a liquid form of cloner</td><td>Alice</td></tr>
<tr><td>colored_lightbulbs.js</td><td>Adds a light bulb that can be painted.</td><td>guzzo86, ggod</td></tr>
<tr><td>combustion.js</td><td>Adds components necessary for combustion engines</td><td>uptzik</td></tr>
@ -293,6 +294,7 @@
<tr><td>human_edit.js</td><td>Improvements to humans</td><td>Alice</td></tr>
<tr><td>Humanitize.js</td><td>Makes humans cultured and able to craft, mine, build houses, trade, and much more.</td><td>Nekonico</td></tr>
<tr><td>kopalstuff.js</td><td>Adds creatures, spirits, DNA, foods, and more</td><td>DaviStudios</td></tr>
<tr><td>lizard_mod.js</td><td>Adds lizards to sandboxels.</td><td>RedBirdly</td></tr>
<tr><td>lost_souls.js</td><td>Adds souls and related elements, the mod can also be found <a href="https://github.com/HACKERPRO908/lost_souls.js">on Github</a></td><td>pixelegend4, SquareScreamYT, salmonfishy</td></tr>
<tr><td>miscible_psoup_and_birthpool.js</td><td>Makes Primordial Soup and Birthpool mix instead of the birthpool settling to the bottom. Will be deprecated upon the release of Magical Menagerie</td><td>Alice</td></tr>
<tr><td>mobs.js</td><td>Adds Creepers, Zombies, and Skeletons</td><td>Alice</td></tr>
@ -347,6 +349,7 @@
<!----><tr><td class="modCat" colspan="3">Visual Effects</td></tr><!---->
<tr><td>acid_and_shapes.js</td><td>Weird visual effects. Enable in Settings</td><td>Alice</td></tr>
<tr><td>customBackground.js</td><td>Set your background to an image link</td><td>Jayd</td></tr>
<tr><td>fractals.js</td><td>Adds an element and tools to render fractals in game</td><td>nousernamefound</td></tr>
<tr><td>heatglow.js</td><td>Red glowing effect for hot metals</td><td>nousernamefound</td></tr>
<tr><td>invisible_dye.js</td><td>Adds elements like Dye and Spray Paint that take the color of the background</td><td>Alice</td></tr>
<tr><td>invisible_wall.js</td><td>Adds an element like Wall that takes the color of the background</td><td>Alice</td></tr>

View File

@ -11,7 +11,7 @@ elements.change_count = {
if (!cans) { return }
if (cans == "skin"){settings.randomcount = 10000; settings.skineasteregg = true; settings.sandeasteregg = false; saveSettings(); alert("skin"); return}
if (cans == "sand"){settings.randomcount = 10000; settings.skineasteregg = false; settings.sandeasteregg = true; saveSettings(); alert("sand"); return}
if (cans > 2000000){alert("You have put too big of a number! This would surely crash your browser or eat up all your RAM! Element count will remain unchanged."); return}
if (cans > 100000){alert("You have put too big of a number! This would surely crash your browser or eat up all your RAM! Element count will remain unchanged."); return}
if (cans < 1 && (parseInt(cans) > -1) ){alert("You have either put a decimal or zero. Why? Element count will remain unchanged."); return}
if (isNaN(parseInt(cans))){alert("Apparently your input isnt even a number. Try again. Element count will remain unchanged."); return}
settings.randomcount = parseInt(cans)
@ -24,7 +24,7 @@ elements.change_count = {
var choosebehaviors = behaviors
delete choosebehaviors.KILLPIXEL2
delete choosebehaviors.KILLPIXEL1
if (!settings.randomcount || settings.randomcount > 50000){settings.randomcount = 10000; saveSettings()}
if (!settings.randomcount || settings.randomcount > 100000){settings.randomcount = 10000; saveSettings()}
var color = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "a", "b", "c", "d", "e","f"]
var states = ["solid", "liquid", "gas"]
var essentialelements = ["molten_gallium", "gallium", "gallium_gas", "change_count"]

File diff suppressed because it is too large Load Diff

156
mods/fractals.js Normal file
View File

@ -0,0 +1,156 @@
let jmax = 2
let jmin = -2
let offsetx = 0
let offsety = 0
let mode = `mandelbrot`
preCalculatedGrid = []
runEveryTick(function(){
preCalculatedGrid = []
for (let x = 0; x < pixelMap.length; x++){
preCalculatedGrid.push([])
for (let y = 0; y < pixelMap[x].length; y++){
preCalculatedGrid[x].push({
x: x,
y: y,
iteration: 100,
})
}
}
for (let ix = 0; ix < preCalculatedGrid.length; ix++){
for (let iy = 0; iy < preCalculatedGrid[ix].length; iy++){
const range = jmax - jmin;
const scale = range / Math.min(width, height);
let x = (ix - width / 2) * scale + offsetx;
let y = (iy - height / 2) * scale + offsety;
let iteration = 0;
if (mode == `mandelbrot`){
let zx = 0;
let zy = 0;
let c = {x: x, y: y};
while (zx * zx + zy * zy < 4 && iteration < 100) {
let xtemp = zx * zx - zy * zy + c.x;
zy = 2 * zx * zy + c.y;
zx = xtemp;
iteration++;
}}
else { // burning ship
let zx = 0;
let zy = 0;
let c = {x: x, y: y};
while (zx * zx + zy * zy < 4 && iteration < 100) {
let xtemp = zx * zx - zy * zy + c.x;
zy = Math.abs(2 * zx * zy) + c.y;
zx = Math.abs(xtemp);
iteration++;
}
}
preCalculatedGrid[ix][iy].iteration = iteration
}
}
})
elements.mandelbrot = {
color: "#000000",
behavior: behaviors.WALL,
category: "mandelbrot tools",
onSelect: function(){
jmax = parseFloat(prompt("How far would you like it to extend in each direction?"))||2
jmin = -jmax
offsetx = parseFloat(prompt("How far would you like it to be offset in the x direction?"))||0
offsety = parseFloat(prompt("How far would you like it to be offset in the y direction?"))||0
mode = prompt("Mandelbrot or burning ship?")
},
tick: function(pixel){
// first, map canvas coord to a range of -2 to 2, but dont scale it, using width, height, and pixel.x and pixel.y
/*
const range = jmax - jmin;
const scale = range / Math.min(width, height);
const x = (pixel.x - width / 2) * scale + offsetx;
const y = -(pixel.y - height / 2) * scale + offsety;
let iteration = 0;
if (mode == `mandelbrot`){
let zx = 0;
let zy = 0;
let c = {x: x, y: y};
while (zx * zx + zy * zy < 4 && iteration < 100) {
let xtemp = zx * zx - zy * zy + c.x;
zy = 2 * zx * zy + c.y;
zx = xtemp;
iteration++;
}}
else { // burning ship
let zx = 0;
let zy = 0;
let c = {x: x, y: y};
while (zx * zx + zy * zy < 4 && iteration < 100) {
let xtemp = zx * zx - zy * zy + c.x;
zy = Math.abs(2 * zx * zy) + c.y;
zx = Math.abs(xtemp);
iteration++;
}
}
*/
iteration = preCalculatedGrid[pixel.x][pixel.y].iteration
if (iteration >= 99.5) {
pixel.color = "rgb(255, 255, 255)"
} else {
pixel.color = `rgb(0, ${67.3684*Math.pow(1.01578, iteration)-67.3684}, ${67.3684*Math.pow(1.01578, iteration)-67.3684})`
//console.log(iteration)
}
}
}
elements.mandelbrot_zoom_in = {
color: elements.heater.color,
category: "mandelbrot tools",
canPlace: false,
tool: function(){},
onSelect: function(){
jmax *= 0.95
jmin = -jmax
}
}
elements.mandelbrot_zoom_out = {
color: elements.cooler.color,
category: "mandelbrot tools",
canPlace: false,
tool: function(){},
onSelect: function(){
jmax *= 1.05
jmin = -jmax
}
}
elements.mandelbrot_move_left = {
color: elements.grape.color,
category: "mandelbrot tools",
canPlace: false,
tool: function(){},
onSelect: function(){
offsetx -= 0.05*jmax
}
}
elements.mandelbrot_move_right = {
color: elements.tomato.color,
category: "mandelbrot tools",
canPlace: false,
tool: function(){},
onSelect: function(){
offsetx += 0.05*jmax
}
}
elements.mandelbrot_move_up = {
color: elements.mix.color,
category: "mandelbrot tools",
canPlace: false,
tool: function(){},
onSelect: function(){
offsety += 0.05*jmax
}
}
elements.mandelbrot_move_down = {
color: elements.drag.color,
category: "mandelbrot tools",
canPlace: false,
tool: function(){},
onSelect: function(){
offsety -= 0.05*jmax
}
}

29
mods/lattice_filler.js Normal file
View File

@ -0,0 +1,29 @@
elements.lattice_filler = {
behavior: [
"XX|CL|XX",
"CL|DL|CL",
"XX|CL|XX",
],
category: "special",
state: "solid",
density: 1834,
color: "#ff266e",
reactions: {
"lightning": {elem1: "destructive_lattice_filler", elem2: null}
}
};
elements.destructive_lattice_filler = {
behavior: [
"DL|CL|DL",
"CL|DL|CL",
"DL|CL|DL",
],
category: "special",
state: "solid",
density: 1834,
color: "#ff0037",
hidden: true,
};
elements.filler.reactions.laser = { "elem1":"lattice_filler", "elem2": "lattice_filler" }

View File

@ -358,14 +358,14 @@ elements.destroyable_pipe = {
var y = pixel.y+coord[1];
if (!isEmpty(x,y,true)) {
var newPixel = pixelMap[x][y];
if (newPixel.element === "destroyable_pipe" || newPixel.element === "bridge_pipe") {
if (newPixel.element === "destroyable_pipe" || newPixel.element === "bridge_pipe" || newPixel.element === "pipe_transmitter") {
var nextStage;
switch (pixel.stage) {
case 2: nextStage = 4; break; //green
case 3: nextStage = 2; break; //red
case 4: nextStage = 3; break; //blue
}
if (pixel.con && !newPixel.con && newPixel.stage === nextStage) { //transfer to adjacent pipe
if (pixel.con && !newPixel.con && (newPixel.stage === nextStage || newPixel.element === "pipe_transmitter")) { //transfer to adjacent pipe
newPixel.con = pixel.con;
newPixel.con.x = newPixel.x;
newPixel.con.y = newPixel.y;
@ -669,14 +669,14 @@ elements.e_pipe = {
var y = pixel.y+coord[1];
if (!isEmpty(x,y,true)) {
var newPixel = pixelMap[x][y];
if (newPixel.element === "e_pipe" || newPixel.element === "bridge_pipe") {
if (newPixel.element === "e_pipe" || newPixel.element === "bridge_pipe" || newPixel.element === "pipe_transmitter") {
var nextStage;
switch (pixel.stage) {
case 2: nextStage = 4; break; //green
case 3: nextStage = 2; break; //red
case 4: nextStage = 3; break; //blue
}
if (pixel.con && !newPixel.con && newPixel.stage === nextStage && (pixel.charge || pixel.chargeCD)) { //transfer to adjacent pipe
if (pixel.con && !newPixel.con && (newPixel.stage === nextStage || newPixel.element === "pipe_transmitter") && (pixel.charge || pixel.chargeCD)) { //transfer to adjacent pipe
newPixel.con = pixel.con;
newPixel.con.x = newPixel.x;
newPixel.con.y = newPixel.y;
@ -787,14 +787,14 @@ elements.destroyable_e_pipe = {
var y = pixel.y+coord[1];
if (!isEmpty(x,y,true)) {
var newPixel = pixelMap[x][y];
if (newPixel.element === "destroyable_e_pipe" || newPixel.element === "bridge_pipe") {
if (newPixel.element === "destroyable_e_pipe" || newPixel.element === "bridge_pipe" || newPixel.element === "pipe_transmitter") {
var nextStage;
switch (pixel.stage) {
case 2: nextStage = 4; break; //green
case 3: nextStage = 2; break; //red
case 4: nextStage = 3; break; //blue
}
if (pixel.con && !newPixel.con && newPixel.stage === nextStage && (pixel.charge || pixel.chargeCD)) { //transfer to adjacent pipe
if (pixel.con && !newPixel.con && (newPixel.stage === nextStage || newPixel.element === "pipe_transmitter") && (pixel.charge || pixel.chargeCD)) { //transfer to adjacent pipe
newPixel.con = pixel.con;
newPixel.con.x = newPixel.x;
newPixel.con.y = newPixel.y;
@ -914,14 +914,14 @@ elements.channel_pipe = {
var y = pixel.y+coord[1];
if (!isEmpty(x,y,true)) {
var newPixel = pixelMap[x][y];
if ((newPixel.element === "channel_pipe" && pixelMap[x][y].channel == pixel.channel || newPixel.element === "bridge_pipe")) {
if ((newPixel.element === "channel_pipe" && pixelMap[x][y].channel == pixel.channel || newPixel.element === "bridge_pipe" || (newPixel.element === "pipe_transmitter" && pixelMap[x][y].channel == pixel.channel))) {
var nextStage;
switch (pixel.stage) {
case 2: nextStage = 4; break; //green
case 3: nextStage = 2; break; //red
case 4: nextStage = 3; break; //blue
}
if (pixel.con && !newPixel.con && newPixel.stage === nextStage) { //transfer to adjacent pipe
if (pixel.con && !newPixel.con && (newPixel.stage === nextStage || newPixel.element === "pipe_transmitter")) { //transfer to adjacent pipe
newPixel.con = pixel.con;
newPixel.con.x = newPixel.x;
newPixel.con.y = newPixel.y;
@ -1037,14 +1037,14 @@ elements.destroyable_channel_pipe = {
var y = pixel.y+coord[1];
if (!isEmpty(x,y,true)) {
var newPixel = pixelMap[x][y];
if ((newPixel.element === "destroyable_channel_pipe" && pixelMap[x][y].channel == pixel.channel) || newPixel.element === "bridge_pipe") {
if ((newPixel.element === "destroyable_channel_pipe" && pixelMap[x][y].channel == pixel.channel) || newPixel.element === "bridge_pipe" || (newPixel.element === "pipe_transmitter" && pixelMap[x][y].channel == pixel.channel)) {
var nextStage;
switch (pixel.stage) {
case 2: nextStage = 4; break; //green
case 3: nextStage = 2; break; //red
case 4: nextStage = 3; break; //blue
}
if (pixel.con && !newPixel.con && newPixel.stage === nextStage) { //transfer to adjacent pipe
if (pixel.con && !newPixel.con && (newPixel.stage === nextStage || newPixel.element === "pipe_transmitter")) { //transfer to adjacent pipe
newPixel.con = pixel.con;
newPixel.con.x = newPixel.x;
newPixel.con.y = newPixel.y;
@ -1097,7 +1097,7 @@ elements.destroyable_channel_pipe = {
movable: false,
canContain: true,
},
listPipes = ["pipe", "destroyable_pipe", "destroyable_e_pipe","channel_pipe","destroyable_channel_pipe","bridge_pipe","e_pipe"];
listPipes = ["pipe", "destroyable_pipe", "destroyable_e_pipe","channel_pipe","destroyable_channel_pipe","bridge_pipe","e_pipe","pipe_transmitter"];
elements.bridge_pipe = {
color: "#414c4f",
onSelect: function() {
@ -1161,7 +1161,7 @@ elements.bridge_pipe = {
case 3: nextStage = 2; break; //red
case 4: nextStage = 3; break; //blue
}
if (pixel.con && !newPixel.con && newPixel.stage === nextStage) { //transfer to adjacent pipe
if (pixel.con && !newPixel.con && (newPixel.stage === nextStage || newPixel.element === "pipe_transmitter")) { //transfer to adjacent pipe
newPixel.con = pixel.con;
newPixel.con.x = newPixel.x;
newPixel.con.y = newPixel.y;
@ -1266,14 +1266,14 @@ elements.pipe.tick = function(pixel) {
var y = pixel.y+coord[1];
if (!isEmpty(x,y,true)) {
var newPixel = pixelMap[x][y];
if (newPixel.element === "pipe" || newPixel.element === "bridge_pipe") {
if (newPixel.element === "pipe" || newPixel.element === "bridge_pipe" || newPixel.element === "pipe_transmitter") {
var nextStage;
switch (pixel.stage) {
case 2: nextStage = 4; break; //green
case 3: nextStage = 2; break; //red
case 4: nextStage = 3; break; //blue
}
if (pixel.con && !newPixel.con && newPixel.stage === nextStage) { //transfer to adjacent pipe
if (pixel.con && !newPixel.con && (newPixel.stage === nextStage || newPixel.element === "pipe_transmitter")) { //transfer to adjacent pipe
newPixel.con = pixel.con;
newPixel.con.x = newPixel.x;
newPixel.con.y = newPixel.y;
@ -3104,6 +3104,7 @@ elements.piston_ray_emitter = {
var lx = lcoord[0];
var ly = lcoord[1];
if (!isEmpty(lx, ly, true)){
if (pixelMap[lx][ly].element == "insulator"){break;}
tryMove(pixelMap[lx][ly], pCoord[0], pCoord[1], null, true)
}
pCoord[0] = lx;
@ -3758,4 +3759,72 @@ elements.hotter_sensor = {
}
}
}
}
let pipe_transmitter_channelVar = 0;
elements.pipe_transmitter = {
color: "#6e6250",
category: "machines",
movable: false,
canContain: true,
insulate: true,
onSelect: () => {
let newChannel = prompt("Enter the channel of this pipe transmitter. It will not work if you do multiple while paused.", pipe_transmitter_channelVar);
pipe_transmitter_channelVar = newChannel;
},
tick: (pixel) => {
if (!pixel.channel){
pixel.channel = pipe_transmitter_channelVar;
}
if (pixel.channel && pixel.con){
for (x in pixelMap){
for (y in pixelMap[x]){
if (!isEmpty(x, y, true)){
if (pixelMap[x][y].element == "pipe_receiver" && pixelMap[x][y].channel == pixel.channel){
pixelMap[x][y].con = pixel.con;
delete pixel.con;
}
}
}
}
}
}
}
let pipe_receiver_channelVar = 0;
elements.pipe_receiver = {
color: "#4d4b63",
category: "machines",
movable: false,
canContain: true,
insulate: true,
onSelect: () => {
let newChannel = prompt("Enter the channel of this pipe receiver. It will not work if you do multiple while paused.", pipe_receiver_channelVar);
pipe_receiver_channelVar = newChannel;
},
tick: (pixel) => {
if (!pixel.channel){
pixel.channel = pipe_receiver_channelVar;
}
if (pixel.channel && pixel.con){
// just scan neighbors for elements on the pipe list; transfer con to them. if its a type of channel pipe, also check if channel matches
for (i = 0; i < squareCoords.length; i++){
let x = squareCoords[i][0] + pixel.x;
let y = squareCoords[i][1] + pixel.y;
if (!isEmpty(x, y, true)){
if (listPipes.includes(pixelMap[x][y].element)){
if (["channel_pipe", "destroyable_channel_pipe"].includes(pixelMap[x][y].element)){
if (pixelMap[x][y].channel == pixel.channel){
pixelMap[x][y].con = pixel.con;
delete pixel.con;
}
} else {
pixel.con.x = x;
pixel.con.y = y;
pixelMap[x][y].con = pixel.con;
delete pixel.con;
}
}
}
}
}
}
}