This commit is contained in:
slweeb 2024-08-26 18:11:16 -04:00
commit 7d758fec00
29 changed files with 5254 additions and 327 deletions

View File

@ -545,5 +545,9 @@
"freeze_ray":"冷雷",
"kelp":"海帶",
"mixer":"混合機",
"grinder":"混合機"
"grinder":"混合機",
"rice":"米",
"galvanized_steel":"鍍鋅鋼",
"midas_touch":"點石成金",
"liquid_ozone":"液臭氧"
}

View File

@ -195,6 +195,7 @@
<tr><td>jaydstuff.js</td><td>Adds various chemicals and compounds</td><td>Jayd</td></tr>
<tr><td>laetium.js</td><td>Adds several fictional elements</td><td>Alice</td></tr>
<tr><td>liquid_energy.js</td><td>Adds liquid versions of the elements in the Energy category</td><td>Alice</td></tr>
<tr><td>lye.js</td><td>Adds lye</td><td>BatteRaquette58</td></tr>
<tr><td>metals.js</td><td>Adds several metals</td><td>Alice</td></tr>
<tr><td>mixture.js</td><td>Allows many chemicals to be mixed</td><td>lllllllllwith10ls</td></tr>
<tr><td>more_gold.js</td><td>Adds Green Gold</td><td>pixelegend4</td></tr>
@ -279,6 +280,7 @@
<tr><td>flowers_and_forests.js</td><td>adds trees and flowers and things to do with nature</td><td>pixelegend4 and SquareScreamYT</td></tr>
<tr><td>fwibblen.js</td><td>Adds a flying creature that turns nickel into itself, and a second creature that does the same to the first one</td><td>Alice</td></tr>
<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>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>
@ -287,6 +289,7 @@
<tr><td>nocancer2.js</td><td>Removes cancer from the game altogether. May be incompatible with other mods that spawn cancer</td><td>mollthecoder</td></tr>
<tr><td>nograssgrow.js</td><td>Prevents Grass from growing</td><td>mollthecoder</td></tr>
<tr><td>ocean.js</td><td>Adds many Marine life</td><td>SquareScreamYT</td></tr>
<tr><td>ores.js</td><td>Adds ore generation along with tools to mine them</td><td>nousernamefound</td></tr>
<tr><td>pizzasstuff.js</td><td>New animals, foods, and plants</td><td>_ilikepizza_</td></tr>
<tr><td>plants.js</td><td>Adds a wide variety of new plants and fruits</td><td>Adora</td></tr>
<tr><td>primordial_birthpool.js</td><td>A cross between Primordial Soup and Birthpool. Requires F&M</td><td>Alice</td></tr>

959
mods/Humanitize.js Normal file
View File

@ -0,0 +1,959 @@
/* mod by nekonico, do not steal without credit */
behaviors.BODY_DELETE = function(pixel) {
if (pixel.willbuildhouse == true) {
HouseBuilder = false;
}
},
window.addEventListener("load", () => {
document.getElementById("elementButton-easy_way_out")?.remove()
})
elements.easy_way_out = {
hidden: true,
color: "#00000f",
excludeRandom: true,
onPlace: function(pixel) {
deletePixel(pixel.x, pixel.y);
},
category: "special",
state: "solid",
movable: false,
},
HouseBuilder = false
elements.cultured_human = {
name: "human",
// color: ["#f5eac6","#d4c594","#a89160","#7a5733","#523018","#361e0e"],
color: ["#f3e7db","#f7ead0","#eadaba","#d7bd96","#a07e56","#825c43","#604134","#3a312a"],
category: "human",
properties: {
dead: false,
dir: 1,
panic: 0
},
onPlace: function(pixel) {
if (isEmpty(pixel.x, pixel.y+1)) {
createPixel("c_body", pixel.x, pixel.y+1);
createPixel("c_head", pixel.x, pixel.y);
var bodypixel = pixelMap[pixel.x][pixel.y+1];
}
else if (isEmpty(pixel.x, pixel.y-1)) {
createPixel("c_head", pixel.x, pixel.y-1);
pixelMap[pixel.x][pixel.y-1].color = pixel.color;
createPixel("c_body", pixel.x, pixel.y);
}
else {
deletePixel(pixel.x, pixel.y);
}
},
related: ["c_body","c_head"],
maxSize: 1,
cooldown: 10,
forceSaveColor: true,
},
elements.c_body = {
name: "body",
color: ["#069469","#047e99","#7f5fb0"],
forceSaveColor: true,
category: "human",
hidden: true,
density: 1500,
state: "solid",
conduct: .05,
temp: 37,
tempHigh: 200,
stateHigh: "cooked_meat",
tempLow: -30,
stateLow: "frozen_meat",
burn: 10,
burnTime: 250,
burnInto: "cooked_meat",
breakInto: ["blood","meat","bone"],
reactions: {
"basket": { func:function(pixel,basket){ if (pixel.basket == false) {changePixel(basket,"easy_way_out"), (pixel.basket = true);} }, chance:0.5 },
"pickaxe": { func:function(pixel,pickaxe){ if (pixel.pickaxe == false) {changePixel(pickaxe,"easy_way_out"), (pixel.pickaxe = true),(pixel.willbuildmine = true);} }, chance:0.5 },
"cancer": { elem1:"cancer", chance:0.0005 },
"poison": { attr1:{"dead":true}, chance:0.4 },
"radiation": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.4 },
"neutron": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.01 },
"fallout": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.01 },
"plague": { elem1:"plague", chance:0.05 },
"egg": { func:function(pixel,egg){
if (pixel.basket == true) {(pixel.eggcount += 1), changePixel(egg,"easy_way_out");}
else {changePixel(egg,"yolk");}
}, chance:0.5},
"flour": { func:function(pixel,flour){
if (pixel.basket == true) {(pixel.flourcount += 1), changePixel(flour,"easy_way_out");}
}, chance:0.5},
"dough": { func:function(pixel,dough){
if (pixel.basket == true) {(pixel.doughcount += 1), changePixel(dough,"easy_way_out");}
}, chance:0.5},
"meat": { func:function(pixel,meat){
if (pixel.basket == true) {(pixel.meatcount += 1), changePixel(meat,"easy_way_out");}
}, chance:0.4},
"cured_meat": { func:function(pixel,meat){
if (pixel.basket == true) {(pixel.meatcount += 2), changePixel(meat,"easy_way_out");}
}, chance:0.5},
"bread": { func:function(pixel,bread){
if (pixel.basket == true) {(pixel.breadcount += 1), changePixel(bread,"easy_way_out");}
else if (pixel.basket == false && pixel.breadcount < 1) {(pixel.breadcount = 1), changePixel(bread,"easy_way_out");}
}, chance:0.5},
"toast": { func:function(pixel,bread){
if (pixel.basket == true) {(pixel.breadcount += 2), changePixel(bread,"easy_way_out");}
else if (pixel.basket == false && pixel.breadcount < 1) {(pixel.breadcount = 1), changePixel(bread,"easy_way_out");}
}, chance:0.4},
"baked_batter": { func:function(pixel,bread){
if (pixel.basket == true) {(pixel.breadcount += 5), changePixel(bread,"easy_way_out");}
else if (pixel.basket == false && pixel.breadcount < 1) {(pixel.breadcount = 1), changePixel(bread,"easy_way_out");}
}, chance:0.4},
"crumb": { func:function(pixel,bread){
if (pixel.basket == true) {(pixel.breadcount += 0.1), changePixel(bread,"easy_way_out");}
}, chance:0.1},
"cooked_meat": { func:function(pixel,cooked_meat){
if (pixel.basket == true) {(pixel.cookedmeatcount += 1), changePixel(cooked_meat,"easy_way_out");}
else if (pixel.basket == true && pixel.cookedmeatcount < 1) {(pixel.cookedmeatcount = 1), changePixel(cooked_meat,"easy_way_out");}
}, chance:0.5},
"bead": { func:function(pixel,trinket){
if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
}, chance:0.1},
"glitter": { func:function(pixel,trinket){
if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
}, chance:0.1},
"copper_sulfate": { func:function(pixel,trinket){
if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
}, chance:0.05},
"confetti": { func:function(pixel,trinket){
if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
}, chance:0.05},
"color_sand": { func:function(pixel,trinket){
if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
}, chance:0.05},
"incense": { func:function(pixel,trinket){
if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
}, chance:0.05},
"pinecone": { func:function(pixel,trinket){
if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
}, chance:0.03},
"feather": { func:function(pixel,trinket){
if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
}, chance:0.01},
"glass_shard": { func:function(pixel,trinket){
if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
}, chance:0.01},
"porcelain_shard": { func:function(pixel,trinket){
if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
}, chance:0.01},
"flower_seed": { func:function(pixel,trinket){
if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
}, chance:0.01},
"grass_seed": { func:function(pixel,trinket){
if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
}, chance:0.05},
"petal": { func:function(pixel,trinket){
if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
}, chance:0.01},
"metal_scrap": { func:function(pixel,trinket){
if (pixel.basket == true) {(pixel.trinketscount += 1), changePixel(trinket,"easy_way_out");}
}, chance:0.01},
"housefloor1": { func:function(pixel,station){
if (pixel.woodcount > 4) {(pixel.woodcount -= 5), changePixel(station,"workbench");}
}, chance:0.01},
"housefloor2": { func:function(pixel,station){
if (pixel.rockcount > 7) {(pixel.rockcount -= 8), changePixel(station,"furnace");}
}, chance:0.01},
"workbench": { func:function(pixel,station){
if (pixel.rockcount > 2 && pixel.woodcount > 1 && pixel.hasstraw == true && pixel.pickaxe == false) {(pixel.pickaxe = true),(pixel.willbuildmine = true),(pixel.rockcount -= 2),(pixel.woodcount -= 1),(pixel.hasstraw = false);}
}, chance:0.01},
"furnace": { func:function(pixel,oven){
if (pixel.meatcount > 0) {(pixel.cookedmeatcount += 1),(pixel.meatcount -= 1);}
else if (pixel.doughcount > 0) {(pixel.breadcount += 1),(pixel.doughcount -= 1);}
}, chance:0.01},
"oven": { func:function(pixel,oven){
if (pixel.meatcount > 0) {(pixel.cookedmeatcount += 1),(pixel.meatcount -= 1);}
else if (pixel.doughcount > 0) {(pixel.breadcount += 1),(pixel.doughcount -= 1);}
}, chance:0.02},
"allpurposestation": { func:function(pixel,station){
if (pixel.rockcount > 2 && pixel.woodcount > 1 && pixel.hasstraw == true) {(pixel.pickaxe = true),(pixel.rockcount -= 2),(pixel.woodcount -= 1),(pixel.hasstraw = false);}
else if (pixel.meatcount > 0) {(pixel.cookedmeatcount += 1),(pixel.meatcount -= 1);}
else if (pixel.doughcount > 0) {(pixel.breadcount += 1),(pixel.doughcount -= 1);}
else if (pixel.eggcount > 1 && pixel.flourcount > 1) {(pixel.eggcount -= 1),(pixel.flourcount -= 1),(pixel.breadcount += 10);}
}, chance:0.1},
"loose_straw": { func:function(pixel,straw){
if (pixel.hasstraw == false) {(pixel.hasstraw = true), changePixel(straw,"easy_way_out");}
}, chance:0.01},
"water": { func:function(pixel,water){
if (pixel.flourcount > 1) {(pixel.flourcount -= 1), (pixel.doughcount += 1), changePixel(water,["easy_way_out","easy_way_out","water"]);}
}, chance:0.5},
"straw": { elem2:"loose_straw", oneway:true, chance:0.5 },
"grass": { func:function(pixel,grass){
if (pixel.hasstraw == false && grass.h == 2) {(pixel.hasstraw = true), changePixel(grass,"easy_way_out");}
}, chance:0.01},
"rock": { func:function(pixel,rock){
if (pixel.basket == true && pixel.rockcount < 3) {(pixel.rockcount += 1), changePixel(rock,"easy_way_out");}
else if (pixel.pickaxe == true && pixel.basket == true && pixel.willbuildmine == true) {changePixel(rock,"mine_hole"), (pixel.willbuildmine = false);}
}, chance:0.01},
"mine_hole": { func:function(pixel,mine){
if (pixel.pickaxe == true && pixel.basket == true) {(pixel.rockcount += 1);}
}, chance:0.01},
"grape": { func:function(pixel,grape){
if (pixel.basket == true) {(pixel.foodcount += 0.25), changePixel(grape,"easy_way_out");}
else {changePixel(grape,"juice"), grape.color = pixelColorPick(grape,"#291824");}
}, oneway:true, chance:0.05},
"cheese": { func:function(pixel,food){
if (pixel.basket == true) {(pixel.foodcount += 0.50), changePixel(food,"easy_way_out");}
}, oneway:true, chance:0.05},
"nut": { func:function(pixel,food){
if (pixel.basket == true) {(pixel.foodcount += 0.25), changePixel(food,"easy_way_out");}
}, oneway:true, chance:0.05},
"nut_meat": { func:function(pixel,food){
if (pixel.basket == true) {(pixel.foodcount += 0.25), changePixel(food,"easy_way_out");}
}, oneway:true, chance:0.05},
"baked_potato": { func:function(pixel,food){
if (pixel.basket == true) {(pixel.foodcount += 0.75), changePixel(food,"easy_way_out");}
}, oneway:true, chance:0.05},
"hard_yolk": { func:function(pixel,food){
if (pixel.basket == true) {(pixel.foodcount += 0.50), changePixel(food,"easy_way_out");}
}, oneway:true, chance:0.05},
"chocolate": { func:function(pixel,food){
if (pixel.basket == true) {(pixel.foodcount += 0.50), changePixel(food,"easy_way_out");}
}, oneway:true, chance:0.05},
"mashed_potato": { func:function(pixel,food){
if (pixel.basket == true) {(pixel.foodcount += 0.75), changePixel(food,"easy_way_out");}
}, oneway:true, chance:0.05},
"pickle": { func:function(pixel,food){
if (pixel.basket == true) {(pixel.foodcount += 0.75), changePixel(food,"easy_way_out");}
}, oneway:true, chance:0.05},
"ice_cream": { func:function(pixel,food){
if (pixel.basket == true) {(pixel.foodcount += 0.50), changePixel(food,"easy_way_out");}
}, oneway:true, chance:0.05},
"lettuce": { func:function(pixel,food){
if (pixel.basket == true) {(pixel.foodcount += 0.25), changePixel(food,"easy_way_out");}
}, oneway:true, chance:0.05},
"tomato": { func:function(pixel,food){
if (pixel.basket == true) {(pixel.foodcount += 0.50), changePixel(food,"easy_way_out");}
}, oneway:true, chance:0.05},
"potato": { func:function(pixel,food){
if (pixel.basket == true) {(pixel.foodcount += 0.50), changePixel(food,"easy_way_out");}
}, oneway:true, chance:0.05},
"popcorn": { func:function(pixel,food){
if (pixel.basket == true) {(pixel.foodcount += 0.25), changePixel(food,"easy_way_out");}
}, oneway:true, chance:0.05},
"corn": { func:function(pixel,food){
if (pixel.basket == true) {(pixel.foodcount += 0.50), changePixel(food,"easy_way_out");}
}, oneway:true, chance:0.05},
"candy": { func:function(pixel,food){
if (pixel.basket == true) {(pixel.foodcount += 0.50), changePixel(food,"easy_way_out");}
}, oneway:true, chance:0.05},
"caramel": { func:function(pixel,food){
if (pixel.basket == true) {(pixel.foodcount += 0.50), changePixel(food,"easy_way_out");}
}, oneway:true, chance:0.05},
"herb": { func:function(pixel,food){
if (pixel.basket == true) {(pixel.foodcount += 0.25), changePixel(food,"easy_way_out");}
}, oneway:true, chance:0.05},
"pumpkin_seed": { func:function(pixel,food){
if (pixel.basket == true) {(pixel.foodcount += 0.25), changePixel(food,"easy_way_out");}
}, oneway:true, chance:0.05},
"ant": { elem2:"dead_bug", chance:0.05, oneway:true },
"fly": { elem2:"dead_bug", oneway:true },
"firefly": { elem2:"dead_bug", oneway:true },
"bee": { elem2:"dead_bug", oneway:true },
"flea": { elem2:"dead_bug", oneway:true },
"termite": { elem2:"dead_bug", oneway:true },
"worm": { elem2:"slime", chance:0.05, oneway:true },
"stink_bug": { elem2:"stench", oneway:true },
"tax_bill": { elem2:null, func:(pixel,tax) => { (pixel.moneycount *= 0.75) }, chance:0.01 },
"money": { elem2:null, func:(pixel,money) => { (pixel.moneycount += 1) }, chance:0.03 },
"gold_coin": { elem2:null, func:(pixel,money) => { (pixel.moneycount += 1000) }, chance:0.04 },
"diamond": { elem2:null, func:(pixel,money) => { (pixel.moneycount += 50000) }, chance:0.05 },
"sun": { elem1:"cooked_meat" },
},
properties: {
dead: false,
dir: 1,
panic: 0,
hungry: false,
greedy: false,
basket: false,
pickaxe: false,
hasstraw: false,
willbuildhouse: false,
willbuildmine: false,
moneycount: 0,
eggcount: 0,
flourcount: 0,
doughcount: 0,
meatcount: 0,
cookedmeatcount: 0,
breadcount: 0,
foodcount: 0,
trinketscount: 0,
woodcount: 0,
rockcount: 0,
},
onDelete: behaviors.BODY_DELETE,
tick: function(pixel) {
if (tryMove(pixel, pixel.x, pixel.y+1)) { // Fall
if (!isEmpty(pixel.x, pixel.y-2, true)) { // Drag head down
var headpixel = pixelMap[pixel.x][pixel.y-2];
if (headpixel.element == "c_head") {
if (isEmpty(pixel.x, pixel.y-1)) {
movePixel(pixelMap[pixel.x][pixel.y-2], pixel.x, pixel.y-1);
}
else {
swapPixels(pixelMap[pixel.x][pixel.y-2], pixelMap[pixel.x][pixel.y-1]);
}
}
}
}
doHeat(pixel);
doBurning(pixel);
doElectricity(pixel);
if (pixel.dead) { // by nekonico
// Turn into rotten_meat if pixelTicks-dead > 500
if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) {
changePixel(pixel,"rotten_meat");
if (pixel.willbuildhouse == true) {
HouseBuilder = false;
}
}
return
}
// Find the head
if (!isEmpty(pixel.x, pixel.y-1, true) && pixelMap[pixel.x][pixel.y-1].element == "c_head") {
var head = pixelMap[pixel.x][pixel.y-1];
if (head.dead) { // If head is dead, kill body
pixel.dead = head.dead;
}
}
else { var head = null }
if (pixel.burning) {
pixel.panic += 0.1;
if (head && pixelTicks-pixel.burnStart > 240) {
pixel.color = head.color;
}
}
else if (pixel.panic > 0) {
pixel.panic -= 0.1;
}
if (isEmpty(pixel.x, pixel.y-1)) {
// create blood if decapitated 10% chance
if (Math.random() < 0.1 && !pixel.charge) {
createPixel("blood", pixel.x, pixel.y-1);
// set dead to true 15% chance
if (Math.random() < 0.15) {
pixel.dead = pixelTicks;
}
}
}
else if (head == null) { return }
else if (Math.random() < 0.1*(isEmpty(pixel.x, pixel.y+1) ? 1 : pixel.panic+1)) { // Move 10% chance
var movesToTry = [
[1*pixel.dir,0],
[1*pixel.dir,-1],
];
// While movesToTry is not empty, tryMove(pixel, x, y) with a random move, then remove it. if tryMove returns true, break.
while (movesToTry.length > 0) {
var move = movesToTry.splice(Math.floor(Math.random() * movesToTry.length), 1)[0];
if (isEmpty(pixel.x+move[0], pixel.y+move[1]-1)) {
var origx = pixel.x+move[0];
var origy = pixel.y+move[1];
if (tryMove(pixel, pixel.x+move[0], pixel.y+move[1]) && pixel.x===origx && pixel.y===origy) {
movePixel(head, head.x+move[0], head.y+move[1]);
break;
}
}
}
// 15% chance to change direction
if (Math.random() < 0.15) {
pixel.dir *= -1;
}
// homeostasis
if (pixel.temp > 37) { pixel.temp -= 1; }
else if (pixel.temp < 37) { pixel.temp += 1; }
}
if (!isEmpty(pixel.x, pixel.y+1, true) && pixel.woodcount > 15 && pixel.willbuildhouse == true) {
deletePixel(pixel.x-3, pixel.y+1); // clear any floor obstructions
deletePixel(pixel.x-2, pixel.y+1);
deletePixel(pixel.x-1, pixel.y+1);
deletePixel(pixel.x, pixel.y+1);
deletePixel(pixel.x+1, pixel.y+1);
deletePixel(pixel.x+2, pixel.y+1);
deletePixel(pixel.x+3, pixel.y+1);
createPixel("wood", pixel.x-3, pixel.y-3); // door 1
createPixel("wood", pixel.x-3, pixel.y-2);
createPixel("wood", pixel.x-3, pixel.y+1);
createPixel("wood", pixel.x-2, pixel.y-3); // roof
createPixel("wood", pixel.x-1, pixel.y-3);
createPixel("wood", pixel.x, pixel.y-3);
createPixel("wood", pixel.x+1, pixel.y-3);
createPixel("wood", pixel.x+2, pixel.y-3);
createPixel("wood", pixel.x+3, pixel.y-3); // door 2
createPixel("wood", pixel.x+3, pixel.y-2);
createPixel("wood", pixel.x+3, pixel.y+1);
createPixel("wood", pixel.x-2, pixel.y+1); // floor
createPixel("housefloor1", pixel.x-1, pixel.y+1);
createPixel("wood", pixel.x, pixel.y+1);
createPixel("housefloor2", pixel.x+1, pixel.y+1);
createPixel("wood", pixel.x+2, pixel.y+1);
pixel.willbuildhouse = false;
pixel.woodcount -= 16
}
if (pixel.moneycount > 17999) {
pixel.color = pixelColorPick(pixel,"#ffd700");
}
if (pixel.breadcount < 1 && pixel.cookedmeatcount < 1 && pixel.foodcount < 0.25 && Math.random() < 0.005) { //hunger mechanic
pixel.hungry = true
}
if (pixel.foodcount > 0 && pixel.hungry == true) {
pixel.hungry = false, pixel.foodcount -= 0.25
}
else if (pixel.breadcount > 0.9 && pixel.hungry == true) {
pixel.hungry = false, pixel.breadcount -= 1
}
else if (pixel.cookedmeatcount > 0 && pixel.hungry == true) {
pixel.hungry = false, pixel.cookedmeatcount -= 1
}
if (pixel.foodcount > 0 && Math.random() < 0.0005) {
pixel.hungry = false, pixel.foodcount -= 0.25
}
if (pixel.breadcount > 0.9 && Math.random() < 0.0005) {
pixel.hungry = false, pixel.breadcount -= 1
}
if (pixel.cookedmeatcount > 0 && Math.random() < 0.0005) {
pixel.hungry = false, pixel.cookedmeatcount -= 1
}
if (pixel.trinketscount < 1 && Math.random() < 0.001) { //trinket desire mechanic
pixel.greedy = true
}
else if (pixel.trinketscount > 1 && Math.random() < 0.01) {
pixel.greedy = false
}
if (pixel.breadcount > 1.9 && pixel.cookedmeatcount > 0 && Math.random() < 0.005 && pixel.foodcount < 5) { //make a sandwich
pixel.foodcount += 1, pixel.breadcount -= 2, pixel.cookedmeatcount -= 1
}
if (pixel.hasstraw == true && Math.random() < 0.005 && pixel.basket == false) { //make a basket
pixel.basket = true, pixel.hasstraw = false
}
if (!isEmpty(pixel.x+1, pixel.y-1, true) && pixel.basket == true && pixelMap[pixel.x+1][pixel.y-1].element == "tree_branch") { // harvest branch
var wood = pixelMap[pixel.x+1][pixel.y-1];
if (wood.element == "tree_branch") {changePixel(wood,"branchless_tree"), pixel.woodcount += 1}
}
else if (!isEmpty(pixel.x-1, pixel.y-1, true) && pixel.basket == true && pixelMap[pixel.x-1][pixel.y-1].element == "tree_branch") {
var wood = pixelMap[pixel.x-1][pixel.y-1];
if (wood.element == "tree_branch") {changePixel(wood,"branchless_tree"), pixel.woodcount += 1}
}
if (!isEmpty(pixel.x+1, pixel.y-1, true) && pixel.basket == true && pixelMap[pixel.x+1][pixel.y-1].element == "plant" && Math.random() < 0.05) { // harvest fruit
var plant = pixelMap[pixel.x+1][pixel.y-1];
if (plant.element == "plant") {pixel.foodcount += 0.25}
}
else if (!isEmpty(pixel.x-1, pixel.y-1, true) && pixel.basket == true && pixelMap[pixel.x-1][pixel.y-1].element == "plant" && Math.random() < 0.05) {
var plant = pixelMap[pixel.x-1][pixel.y-1];
if (plant.element == "plant") {pixel.foodcount += 0.25}
}
if (pixel.woodcount > 15 && Math.random() < 0.001 && HouseBuilder == false) {
pixel.willbuildhouse = true, HouseBuilder = true
}
if (!isEmpty(pixel.x-1, pixel.y, true) && pixelMap[pixel.x-1][pixel.y].element == "c_body") {
var seller = pixelMap[pixel.x-1][pixel.y];
if (seller.dead) { // If seller is dead, stop trade
var seller = null;
}
else { (seller.panic = -10), (pixel.panic = -10);
if (seller.trinketscount > 0 && pixel.greedy == true) {
seller.trinketscount -= 1, seller.moneycount += 1, pixel.moneycount -= 1, pixel.trinketscount += 1;
}
if (seller.hasstraw == true && pixel.hasstraw == false && Math.random() < 0.1) {
seller.hasstraw = false, seller.moneycount += 1, pixel.moneycount -= 1, pixel.hasstraw = true;
}
if (seller.foodcount > 0.75 && Math.random() < 0.1) {
seller.foodcount -= 1, seller.moneycount += 5, pixel.moneycount -= 5, pixel.foodcount += 1;
}
if (seller.cookedmeatcount > 0 && pixel.cookedmeatcount < 5) {
seller.cookedmeatcount -= 1, seller.moneycount += 3, pixel.moneycount -= 3, pixel.cookedmeatcount += 1;
}
if (seller.meatcount > 0 && pixel.meatcount == 0 && Math.random() > 0.1) {
seller.meatcount -= 1, seller.moneycount += 2, pixel.moneycount -= 2, pixel.meatcount += 1;
}
if (seller.breadcount > 0.9 && pixel.breadcount < 5) {
seller.breadcount -= 1, seller.moneycount += 2, pixel.moneycount -= 2, pixel.breadcount += 1;
};
(seller.panic = 0), (pixel.panic = 0)
}
}
else { var seller = null }
}
},
elements.c_head = {
name: "head",
color: ["#f3e7db","#f7ead0","#eadaba","#d7bd96","#a07e56","#825c43","#604134","#3a312a"],
forceSaveColor: true,
category: "human",
hidden: true,
density: 1080,
state: "solid",
conduct: .05,
temp: 37,
tempHigh: 200,
stateHigh: "cooked_meat",
tempLow: -30,
stateLow: "frozen_meat",
burn: 10,
burnTime: 250,
burnInto: "cooked_meat",
breakInto: ["blood","meat","bone"],
forceSaveColor: true,
reactions: {
"cancer": { elem1:"cancer", attr1:{"dead":true}, chance:0.005 },
"poison": { attr1:{"dead":true}, chance:0.4 },
"radiation": { elem1:["ash","meat","rotten_meat","cooked_meat"], color1:["#75816B","#4D6B53"], chance:0.4 },
"neutron": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.03 },
"fallout": { elem1:["ash","meat","rotten_meat","cooked_meat"], color1:["#75816B","#4D6B53"], chance:0.03 },
"plague": { elem1:["rotten_meat","rotten_meat","rotten_meat","c_head","plague",], color1:["#75816B","#4D6B53"], attr1:{"dead":true}, chance:0.05 },
"oxygen": { func:function(pixel,air){pixel.drowning -= 1}, elem2:"carbon_dioxide", chance:0.5 },
"carbon_dioxide": { func:function(pixel,air){pixel.drowning += 1}, elem2:"carbon_dioxide", chance:0.1 },
"meat": { elem2:null, chance:0.1 },
"cooked_meat": { elem2:null, chance:0.1 },
"cured_meat": { elem2:null, chance:0.1 },
"sugar": { elem2:null, chance:0.1 },
"broth": { elem2:null, chance:0.2 },
"yolk": { elem2:null, chance:0.1 },
"hard_yolk": { elem2:null, chance:0.1 },
"dough": { elem2:null, chance:0.1 },
"batter": { elem2:null, chance:0.2 },
"butter": { elem2:null, chance:0.1 },
"melted_butter": { elem2:null, chance:0.2 },
"chocolate": { elem2:null, chance:0.2 },
"melted_chocolate": { elem2:null, chance:0.3 },
"grape": { elem2:null, chance:0.1 },
"tomato": { elem2:null, chance:0.1 },
"herb": { elem2:null, chance:0.1 },
"lettuce": { elem2:null, chance:0.1 },
"corn": { elem2:null, chance:0.1 },
"popcorn": { elem2:null, chance:0.15 },
"potato": { elem2:null, chance:0.1 },
"baked_potato": { elem2:null, chance:0.15 },
"bread": { elem2:null, chance:0.1 },
"toast": { elem2:null, chance:0.1 },
"gingerbread": { elem2:null, chance:0.1 },
"baked_batter": { elem2:null, chance:0.2 },
"wheat": { elem2:null, chance:0.1 },
"candy": { elem2:null, chance:0.1 },
"yogurt": { elem2:null, chance:0.2 },
"frozen_yogurt": { elem2:null, chance:0.1 },
"ice_cream": { elem2:null, chance:0.2 },
"beans": { elem2:[null,null,null,null,null,null,null,null,"stench"], chance:0.2 },
"tea": { elem2:null, chance:0.2 },
"coffee": { elem2:null, chance:0.2 },
"milk": { elem2:null, chance:0.2 },
"cream": { elem2:null, chance:0.2 },
"soda": { elem2:null, chance:0.2 },
"chocolate_milk": { elem2:null, chance:0.2 },
"fruit_milk": { elem2:null, chance:0.2 },
"pilk": { elem2:null, chance:0.2 },
"eggnog": { elem2:null, chance:0.2 },
"juice": { elem2:null, chance:0.2 },
"cheese": { elem2:null, chance:0.1 },
"melted_cheese": { elem2:null, chance:0.2 },
"alcohol": { elem2:null, chance:0.2 },
"antidote": { elem2:null, chance:0.2 },
"honey": { elem2:null, chance:0.2 },
"caramel": { elem2:null, chance:0.2 },
"molasses": { elem2:null, chance:0.05 },
"ketchup": { elem2:null, chance:0.1 },
"pumpkin_seed": { elem2:null, chance:0.1 },
"nut": { elem2:null, chance:0.1 },
"nut_meat": { elem2:null, chance:0.1 },
"nut_butter": { elem2:null, chance:0.1 },
"nut_milk": { elem2:null, chance:0.2 },
"jelly": { elem2:null, chance:0.2 },
"mayo": { elem2:null, chance:0.2 },
"mashed_potato": { elem2:null, chance:0.2 },
"sauce": { elem2:null, chance:0.2 },
"pickle": { elem2:null, chance:0.1 },
"sun": { elem1:"cooked_meat" },
"light": { stain1:"#825043" },
"bee": { stain1:"#cc564b", chance:0.2 },
"water": { func:function(pixel,water){pixel.drowning += 1}, elem2:"bubble", attr2:{"clone":"water"}, chance:0.002 },
"salt_water": { func:function(pixel,water){pixel.drowning += 2}, elem2:"bubble", attr2:{"clone":"salt_water"}, chance:0.002 },
"sugar_water": { func:function(pixel,water){pixel.drowning += 2}, elem2:"bubble", attr2:{"clone":"sugar_water"}, chance:0.002 },
"seltzer": { func:function(pixel,water){pixel.drowning += 4}, elem2:"bubble", attr2:{"clone":["seltzer","seltzer","carbon_dioxide"]}, chance:0.002 },
"pool_water": { func:function(pixel,water){pixel.drowning += 1}, elem2:"bubble", attr2:{"clone":"pool_water"}, chance:0.002 },
"dirty_water": { func:function(pixel,water){pixel.drowning += 4}, elem2:"bubble", color2:["#0e824e","#07755a","#0c6934"], attr2:{"clone":"dirty_water"}, chance:0.003 },
"blood": { func:function(pixel,water){pixel.drowning += 5}, elem2:"bubble", color2:["#ff0000","#ee0000","#ff4040"], attr2:{"clone":"blood"}, chance:0.003 },
},
properties: {
dead: false,
drowning: 0
},
tick: function(pixel) {
doHeat(pixel);
doBurning(pixel);
doElectricity(pixel);
if (pixel.dead) {
// Turn into rotten_meat if pixelTicks-dead > 500
if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) {
changePixel(pixel,"rotten_meat");
return
}
}
// Find the body
if (!isEmpty(pixel.x, pixel.y+1, true) && pixelMap[pixel.x][pixel.y+1].element == "c_body") {
var body = pixelMap[pixel.x][pixel.y+1];
if (body.dead) { // If body is dead, kill head
pixel.dead = body.dead;
}
}
else { var body = null }
if (tryMove(pixel, pixel.x, pixel.y+1)) {
// create blood if severed 10% chance
if (isEmpty(pixel.x, pixel.y+1) && !pixel.dead && Math.random() < 0.1 && !pixel.charge) {
createPixel("blood", pixel.x, pixel.y+1);
// set dead to true 15% chance
if (Math.random() < 0.15) {
pixel.dead = pixelTicks;
}
}
}
// homeostasis
if (pixel.temp > 37) { pixel.temp -= 1; }
else if (pixel.temp < 37) { pixel.temp += 1; }
// drowning
if (pixel.drowning > 99.9) { pixel.dead = true }
}
},
elements.money = {
color: ["#85bb65","#5e8347","#65bb7d","#b2bb65","#dbffc4"],
behavior: behaviors.POWDER,
reactions: {
"water": { elem1:"cellulose", elem2:null, chance:0.01 },
"dirty_water": { elem1:"cellulose", elem2:null, chance:0.01 },
"salt_water": { elem1:"cellulose", elem2:null, chance:0.01 },
"sugar_water": { elem1:"cellulose", elem2:null, chance:0.01 },
"seltzer": { elem1:"cellulose", elem2:null },
"soda": { elem1:"cellulose", elem2:null, chance:0.01 },
"blood": { elem1:"cellulose", elem2:null, chance:0.01 },
"foam": { elem1:"cellulose", elem2:null, chance:0.01 },
"bubble": { elem1:"cellulose", elem2:null, chance:0.01 },
"oil": { elem1:"cellulose", elem2:null, chance:0.01 },
"alcohol": { elem1:"cellulose", elem2:null, chance:0.01 },
"vinegar": { elem1:"cellulose", elem2:null, chance:0.01 },
"light": { stain1:"#ebdfa7" },
"oxygen": { stain1:"#ebdfa7" }
},
tempHigh: 248,
stateHigh: ["fire","fire","fire","fire","fire","ash"],
burn: 70,
burnTime: 300,
burnInto: ["fire","fire","fire","fire","fire","ash"],
category: "human",
state: "solid",
density: 1000,
breakInto: "confetti",
breakIntoColor: ["#85bb65","#65bb7d","#b2bb65","#85bb65"]
},
elements.tax_bill = {
color: ["#f0f0f0","#f0f0f0","#f0f0f0","#f0f0f0","#f0f0f0","#ff0000","#171717",],
behavior: behaviors.POWDER,
reactions: {
"water": { elem1:"cellulose", elem2:null, chance:0.01 },
"dirty_water": { elem1:"cellulose", elem2:null, chance:0.01 },
"salt_water": { elem1:"cellulose", elem2:null, chance:0.01 },
"sugar_water": { elem1:"cellulose", elem2:null, chance:0.01 },
"seltzer": { elem1:"cellulose", elem2:null, chance:0.01 },
"soda": { elem1:"cellulose", elem2:null, chance:0.01 },
"blood": { elem1:"cellulose", elem2:null, chance:0.01 },
"foam": { elem1:"cellulose", elem2:null, chance:0.01 },
"bubble": { elem1:"cellulose", elem2:null, chance:0.1 },
"oil": { elem1:"cellulose", elem2:null, chance:0.01 },
"alcohol": { elem1:"cellulose", elem2:null, chance:0.01 },
"vinegar": { elem1:"cellulose", elem2:null, chance:0.01 },
"light": { stain1:"#ebdfa7" },
"oxygen": { stain1:"#ebdfa7" },
"money": { elem1:null, elem2:null, chance:0.5},
"gold_coin": { elem1:null, elem2:null, chance:0.4 }
},
tempHigh: 248,
stateHigh: ["fire","fire","fire","fire","fire","ash"],
burn: 70,
burnTime: 300,
burnInto: ["fire","fire","fire","fire","fire","ash"],
category: "human",
state: "solid",
density: 1100,
breakInto: "confetti",
breakIntoColor: ["#ffffff","#e6e6e6","#dbdbdb","#ffffff","#e6e6e6","#dbdbdb","#ff0000","#171717",]
},
elements.loose_straw = {
hidden: true,
color: ["#F9E3A1","#93734E","#C7AA83"],
behavior: behaviors.POWDER,
tempHigh: 380,
stateHigh: "fire",
burn: 80,
burnTime: 200,
category: "powders",
state: "solid",
density: 45
},
elements.basket = {
hidden:true,
color: ["#88665d","#bcaa99"],
behavior: behaviors.STURDYPOWDER,
tempHigh: 400,
stateHigh: "fire",
burn: 55,
burnTime: 210,
burnInto: ["smoke","smoke","smoke","smoke","ash"],
breakInto: "loose_straw",
category: "human",
state: "solid",
density: 70
},
elements.pickaxe = {
hidden:true,
color: ["#71797e","#D8B589"],
behavior: behaviors.STURDYPOWDER,
colorKey: {
"A":"#607d8b",
"H":"#91754d",
"B":"#a0522d"
},
colorPattern: [
"BBBBBB",
"BAABHB",
"BBBABB",
"BBHBAB",
"BHBBAB",
"HBBBBB"
],
reactions: {
"mine_hole": { func:function(pixel,mine){
if (isEmpty(pixel.x, pixel.y-1)) {(createPixel("rock", pixel.x, pixel.y-1));}
else if (isEmpty(pixel.x-1, pixel.y)) {(createPixel("rock", pixel.x-1, pixel.y));}
else if (isEmpty(pixel.x+1, pixel.y)) {(createPixel("rock", pixel.x+1, pixel.y));}
}, chance:0.05},
},
tempHigh: 400,
stateHigh: ["rock","rock","ash","charcoal",],
burn: 55,
burnTime: 210,
burnInto: ["rock","rock","rock","rock","ash","charcoal","charcoal","smoke"],
breakInto: ["rock","rock","wood","sawdust",],
category: "human",
state: "solid",
density: 70
},
elements.workbench = {
hidden:true,
color: ["#a0522d"],
behavior: behaviors.STURDYPOWDER,
reactions: {
"loose_straw": { elem2:"basket", chance:0.25 },
"rock": { elem2:"pickaxe", chance:0.1 },
"oven": { elem1:"allpurposestation", elem2:null, chance:0.5 },
},// by
temp:40, //neko
tempHigh: 1000, //nico
stateHigh: "magma",
category: "human",
state: "solid",
density: 2550,
hardness: 0.2,
breakInto: ["sand","gravel","charcoal","ash"]
},
elements.furnace = {
hidden:true,
color: ["#808080","#4f4f4f","#949494"],
behavior: behaviors.STURDYPOWDER,
reactions: {
"bird": { elem2:["cooked_meat","cooked_meat","feather"], chance:0.025 },
"meat": { elem2:"cooked_meat", chance:0.1 },
"yolk": { elem2:"hard_yolk", chance:0.1 },
"egg": { elem2:"hard_yolk", chance:0.1 },
"batter": { elem2:"baked_batter", chance:0.1 },
"dough": { elem2:"bread", chance:0.1 },
"bread": { elem2:"toast", chance:0.05 },
"wood": { elem2:"charcoal", chance:0.005 },
"metal_scrap": { elem1:"oven", elem2:null, chance:0.05 },
},
temp:40,
tempHigh: 1000,
stateHigh: "magma",
category: "human",
state: "solid",
density: 2550,
hardness: 0.2,
breakInto: ["sand","gravel","charcoal","ash"]
},
elements.oven = {
hidden:true,
color: ["#4f4f4f","#71797e"],
behavior: behaviors.STURDYPOWDER,
reactions: {
"workbench": { elem1:"allpurposestation", elem2:null, chance:0.5 },
"bird": { elem2:["cooked_meat","cooked_meat","feather"], chance:0.025 },
"meat": { elem2:"cooked_meat", chance:0.1 },
"yolk": { elem2:"hard_yolk", chance:0.1 },
"egg": { elem2:"hard_yolk", chance:0.1 },
"batter": { elem2:"baked_batter", chance:0.1 },
"dough": { elem2:"bread", chance:0.1 },
"bread": { elem2:"toast", chance:0.05 },
},
temp:50,
tempHigh: 1550,
stateHigh: "molten_metal_scrap",
category: "human",
state: "solid",
density: 2550,
hardness: 0.5,
breakInto: ["metal_scrap","metal_scrap","charcoal","ash"]
},
elements.allpurposestation = {
hidden:true,
name: "workshop_station",
color: ["#a0522d","#4f4f4f","#71797e"],
behavior: behaviors.STURDYPOWDER,
reactions: {
"rock": { elem2:"pickaxe", chance:0.5 },
"loose_straw": { elem2:"basket", chance:0.5 },
"meat": { elem2:"cooked_meat", chance:0.1 },
"yolk": { elem2:"hard_yolk", chance:0.1 },
"egg": { elem2:"hard_yolk", chance:0.1 },
"batter": { elem2:"baked_batter", chance:0.1 },
"dough": { elem2:"bread", chance:0.1 },
"bread": { elem2:"toast", chance:0.05 },
},
temp:40,
tempHigh: 1000,
stateHigh: "magma",
category: "human",
state: "solid",
density: 2550,
hardness: 0.2,
breakInto: ["sand","gravel","charcoal","ash"]
},
elements.branchless_tree = {
name: "wood",
color: "#a59965",
behavior: behaviors.WALL,
renderer: renderPresets.WOODCHAR,
tick: function(pixel) {
if (Math.random() < 0.02 && pixel.age > 35) {
changePixel(pixel,"tree_branch")
}
else if (pixel.age > 1000 && Math.random() < 0.05) {
changePixel(pixel,"wood");
pixel.color = pixelColorPick(pixel, pixel.wc);
}
pixel.age++;
},
properties: {
"age":0
},
tempHigh: 400,
stateHigh: ["ember","charcoal","fire","fire","fire"],
category: "solids",
burn: 5,
burnTime: 300,
burnInto: ["ember","charcoal","fire"],
state: "solid",
hardness: 0.15,
breakInto: "sawdust",
};
elements.mine_hole = {
hidden:true,
color: "#363636",
behavior: behaviors.STURDYPOWDER,
tempHigh: 950,
stateHigh: "magma",
category: "land",
state: "solid",
density: 2550,
hardness: 0.5,
breakInto: ["sand","gravel"]
},
elements.housefloor1 = {
name: "wood",
color: "#a0522d",
behavior: behaviors.WALL,
renderer: renderPresets.WOODCHAR,
tempHigh: 400,
stateHigh: ["ember","charcoal","fire","fire","fire"],
category: "solids",
burn: 5,
burnTime: 300,
burnInto: ["ember","charcoal","fire"],
state: "solid",
hardness: 0.15,
breakInto: "sawdust",
};
elements.housefloor2 = {
name: "wood",
color: "#a0522d",
behavior: behaviors.WALL,
renderer: renderPresets.WOODCHAR,
tempHigh: 400,
stateHigh: ["ember","charcoal","fire","fire","fire"],
category: "solids",
burn: 5,
burnTime: 300,
burnInto: ["ember","charcoal","fire"],
state: "solid",
hardness: 0.15,
breakInto: "sawdust",
};
elements.straw.breakInto = "loose_straw"
elements.human.name = "dummy"
elements.head.name = "brainless_head"
elements.body.name = "dumb_body"
elements.grass.properties.h = 1
elements.rotten_meat.density = 1200
/* yo, thanks for scrolling to the end. If you have any ideas to add to this mod, or wanna contact me in general, you can DM my discord account "nekonico" or just ping me in the r74n discord
peace
^ ^
(*w*) /
*/

932
mods/Random_quicksands.js Normal file
View File

@ -0,0 +1,932 @@
elements.thermoplastic = {
color: "#A0522D",
behavior: elements.slime.behavior,
viscosity: 25000,
tempHigh: 80,
stateHigh: "liquid",
tempLow: 20,
category: "solids",
state: "liquid",
density: 1200,
stain: 0.4
};
elements.oobleck = {
color: "#FF8C00",
behavior: elements.slime.behavior,
viscosity: 40000,
tempHigh: 70,
stateHigh: "liquid",
tempLow: 15,
category: "solids",
state: "liquid",
density: 1300,
stain: 0.5
};
elements.pudding = {
color: "#F5DEB3",
behavior: elements.slime.behavior,
viscosity: 20000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: -10,
category: "solids",
state: "liquid",
density: 1050,
stain: 0.3
};
elements.magma = {
color: "#FF6347",
behavior: elements.slime.behavior,
viscosity: 800000,
tempHigh: 1200,
stateHigh: "liquid",
tempLow: 800,
category: "liquids",
state: "liquid",
density: 3000,
stain: 1.0
};
elements.agar = {
color: "#F0E68C",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: 0,
category: "solids",
state: "liquid",
density: 1100,
stain: 0.2
};
elements.xanthamGum = {
color: "#F4A460",
behavior: elements.slime.behavior,
viscosity: 60000,
tempHigh: 70,
stateHigh: "liquid",
tempLow: -10,
category: "solids",
state: "liquid",
density: 1050,
stain: 0.4
};
elements.caramel = {
color: "#FFD700",
behavior: elements.slime.behavior,
viscosity: 15000,
tempHigh: 45,
stateHigh: "liquid",
tempLow: -5,
category: "solids",
state: "liquid",
density: 1200,
stain: 0.5
};
elements.molasses = {
color: "#4B0082",
behavior: elements.slime.behavior,
viscosity: 30000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1400,
stain: 0.7
};
elements.syrup = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 20000,
tempHigh: 40,
stateHigh: "liquid",
tempLow: -10,
category: "liquids",
state: "liquid",
density: 1300,
stain: 0.5
};
elements.hydrogels = {
color: "#00CED1",
behavior: elements.slime.behavior,
viscosity: 5000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: -10,
category: "solids",
state: "liquid",
density: 1000,
stain: 0.2
};
elements.silicone = {
color: "#A9A9A9",
behavior: elements.slime.behavior,
viscosity: 60000,
tempHigh: 80,
stateHigh: "liquid",
tempLow: 10,
category: "solids",
state: "liquid",
density: 1100,
stain: 0.3
};
elements.jelly = {
color: "#C71585",
behavior: elements.slime.behavior,
viscosity: 20000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: -5,
category: "solids",
state: "liquid",
density: 1050,
stain: 0.4
};
elements.spandex = {
color: "#2E8B57",
behavior: elements.slime.behavior,
viscosity: 30000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: -5,
category: "solids",
state: "liquid",
density: 950,
stain: 0.3
};
elements.polyurethane = {
color: "#B0C4DE",
behavior: elements.slime.behavior,
viscosity: 40000,
tempHigh: 70,
stateHigh: "liquid",
tempLow: 10,
category: "solids",
state: "liquid",
density: 1000,
stain: 0.4
};
elements.oobleck = {
color: "#D3D3D3",
behavior: elements.slime.behavior,
viscosity: 50000,
tempHigh: 40,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1200,
stain: 0.1
};
elements.gum = {
color: "#FF69B4",
behavior: elements.slime.behavior,
viscosity: 20000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: -10,
category: "solids",
state: "liquid",
density: 950,
stain: 0.5
};
elements.jello = {
color: "#FF4500",
behavior: elements.slime.behavior,
viscosity: 15000,
tempHigh: 40,
stateHigh: "liquid",
tempLow: -10,
category: "solids",
state: "liquid",
density: 1100,
stain: 0.3
};
elements.playDough = {
color: "#FFD700",
behavior: elements.slime.behavior,
viscosity: 30000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: -10,
category: "solids",
state: "liquid",
density: 950,
stain: 0.4
};
elements.kineticSand = {
color: "#C2B280",
behavior: elements.slime.behavior,
viscosity: 25000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: -5,
category: "solids",
state: "liquid",
density: 1200,
stain: 0.2
};
elements.sillyPutty = {
color: "#FF1493",
behavior: elements.slime.behavior,
viscosity: 100000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: -20,
category: "solids",
state: "liquid",
density: 920,
stain: 0.6
};
elements.cheese = {
color: "#FFFFE0",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 40,
stateHigh: "liquid",
tempLow: -5,
category: "solids",
state: "liquid",
density: 950,
stain: 0.2
};
elements.butter = {
color: "#FFD700",
behavior: elements.slime.behavior,
viscosity: 8000,
tempHigh: 35,
stateHigh: "liquid",
tempLow: -5,
category: "solids",
state: "liquid",
density: 910,
stain: 0.3
};
elements.clay = {
color: "#D2B48C",
behavior: elements.slime.behavior,
viscosity: 8000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: -5,
category: "solids",
state: "liquid",
density: 2000,
stain: 0.3
};
elements.resin = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 50000,
tempHigh: 70,
stateHigh: "liquid",
tempLow: 20,
category: "liquids",
state: "liquid",
density: 1100,
stain: 0.6
};
elements.slurry = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 25000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1300,
stain: 0.6
};
elements.earthPaste = {
color: "#A0522D",
behavior: elements.slime.behavior,
viscosity: 30000,
tempHigh: 40,
stateHigh: "liquid",
tempLow: -5,
category: "solids",
state: "liquid",
density: 1400,
stain: 0.7
};
elements.pasteMud = {
color: "#6A5ACD",
behavior: elements.slime.behavior,
viscosity: 20000,
tempHigh: 45,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1250,
stain: 0.5
};
elements.bog = {
color: "#3B3B3B",
behavior: elements.slime.behavior,
viscosity: 40000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: 5,
category: "solids",
state: "liquid",
density: 1350,
stain: 0.8
};
elements.slimePutty = {
color: "#00FF00",
behavior: elements.slime.behavior,
viscosity: 50000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: -10,
category: "solids",
state: "liquid",
density: 1150,
stain: 0.6
};
elements.jelliedMud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 25000,
tempHigh: 40,
stateHigh: "liquid",
tempLow: 0,
category: "solids",
state: "liquid",
density: 1200,
stain: 0.5
};
elements.fluidsand = {
color: "#DEB887",
behavior: elements.slime.behavior,
viscosity: 30000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: -5,
category: "solids",
state: "liquid",
density: 1100,
stain: 0.3
};
elements.viscousMud = {
color: "#6A5ACD",
behavior: elements.slime.behavior,
viscosity: 45000,
tempHigh: 45,
stateHigh: "liquid",
tempLow: 5,
category: "liquids",
state: "liquid",
density: 1300,
stain: 0.7
};
elements.earthySlime = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 35000,
tempHigh: 40,
stateHigh: "liquid",
tempLow: 0,
category: "solids",
state: "liquid",
density: 1250,
stain: 0.6
};
elements.liquidClay = {
color: "#D2B48C",
behavior: elements.slime.behavior,
viscosity: 20000,
tempHigh: 45,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1400,
stain: 0.5
};
elements.mudGel = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 30000,
tempHigh: 40,
stateHigh: "liquid",
tempLow: 0,
category: "solids",
state: "liquid",
density: 1200,
stain: 0.6
};
elements.earthySlurry = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 40000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: 5,
category: "liquids",
state: "liquid",
density: 1350,
stain: 0.7
};
elements.peat = {
color: "#2F4F4F",
behavior: elements.slime.behavior,
viscosity: 35000,
tempHigh: 45,
stateHigh: "liquid",
tempLow: 5,
category: "solids",
state: "liquid",
density: 1400,
stain: 0.8
};
elements.earthJelly = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 25000,
tempHigh: 40,
stateHigh: "liquid",
tempLow: 0,
category: "solids",
state: "liquid",
density: 1300,
stain: 0.6
};
elements.gelMud = {
color: "#6A5ACD",
behavior: elements.slime.behavior,
viscosity: 30000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: -5,
category: "solids",
state: "liquid",
density: 1250,
stain: 0.5
};
elements.muddyGel = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 35000,
tempHigh: 45,
stateHigh: "liquid",
tempLow: 5,
category: "solids",
state: "liquid",
density: 1300,
stain: 0.6
};
elements.thickSlime = {
color: "#2E8B57",
behavior: elements.slime.behavior,
viscosity: 70000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: 0,
category: "solids",
state: "liquid",
density: 1150,
stain: 0.7
};
elements.siliconeSlime = {
color: "#A9A9A9",
behavior: elements.slime.behavior,
viscosity: 60000,
tempHigh: 70,
stateHigh: "liquid",
tempLow: 10,
category: "solids",
state: "liquid",
density: 1100,
stain: 0.5
};
elements.thickMuddyGel = {
color: "#6A5ACD",
behavior: elements.slime.behavior,
viscosity: 50000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: -10,
category: "solids",
state: "liquid",
density: 1200,
stain: 0.6
};
elements.viscousClay = {
color: "#D2B48C",
behavior: elements.slime.behavior,
viscosity: 35000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: 0,
category: "solids",
state: "liquid",
density: 1300,
stain: 0.5
};
elements.earthPaste = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 30000,
tempHigh: 45,
stateHigh: "liquid",
tempLow: -5,
category: "solids",
state: "liquid",
density: 1400,
stain: 0.7
};
elements.muddySlurry = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 35000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: 5,
category: "liquids",
state: "liquid",
density: 1350,
stain: 0.8
};
elements.thickMud = {
color: "#6A5ACD",
behavior: elements.slime.behavior,
viscosity: 60000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: -5,
category: "solids",
state: "liquid",
density: 1400,
stain: 0.7
};
elements.clayMud = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 40000,
tempHigh: 45,
stateHigh: "liquid",
tempLow: 0,
category: "solids",
state: "liquid",
density: 1300,
stain: 0.6
};
elements.furryGoo = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 25000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: -10,
category: "solids",
state: "liquid",
density: 1100,
stain: 0.5
};
elements.augmentedSlime = {
color: "#00FF00",
behavior: elements.slime.behavior,
viscosity: 30000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: -5,
category: "solids",
state: "liquid",
density: 1000,
stain: 0.4
};
elements.activatedGoo = {
color: "#ADFF2F",
behavior: elements.slime.behavior,
viscosity: 35000,
tempHigh: 55,
stateHigh: "liquid",
tempLow: -5,
category: "solids",
state: "liquid",
density: 1050,
stain: 0.3
};
elements.moistClay = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 20000,
tempHigh: 40,
stateHigh: "liquid",
tempLow: -10,
category: "solids",
state: "liquid",
density: 1300,
stain: 0.4
};
elements.gooeyCheese = {
color: "#F5DEB3",
behavior: elements.slime.behavior,
viscosity: 25000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: -10,
category: "solids",
state: "liquid",
density: 1200,
stain: 0.4
};
elements.gooeyGlucose = {
color: "#FF6347",
behavior: elements.slime.behavior,
viscosity: 40000,
tempHigh: 45,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1300,
stain: 0.6
};
elements.softMud = {
color: "#6F4F28",
behavior: elements.slime.behavior,
viscosity: 30000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: -10,
category: "solids",
state: "liquid",
density: 1400,
stain: 0.7
};
elements.funkyFungus = {
color: "#7CFC00",
behavior: elements.slime.behavior,
viscosity: 20000,
tempHigh: 45,
stateHigh: "liquid",
tempLow: -5,
category: "solids",
state: "liquid",
density: 1000,
stain: 0.5
};
elements.smoothGel = {
color: "#00FA9A",
behavior: elements.slime.behavior,
viscosity: 30000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: -5,
category: "solids",
state: "liquid",
density: 1100,
stain: 0.3
};
elements.custard = {
color: "#F5F5DC",
behavior: elements.slime.behavior,
viscosity: 15000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: -10,
category: "solids",
state: "liquid",
density: 1050,
stain: 0.3
};
elements.thermoplastic = {
color: "#A0522D",
behavior: elements.slime.behavior,
viscosity: 25000,
tempHigh: 80,
stateHigh: "liquid",
tempLow: 20,
category: "solids",
state: "liquid",
density: 1200,
stain: 0.4
};
elements.thermoelastic = {
color: "#FF8C00",
behavior: elements.slime.behavior,
viscosity: 40000,
tempHigh: 70,
stateHigh: "liquid",
tempLow: 15,
category: "solids",
state: "liquid",
density: 1300,
stain: 0.5
};
elements.pudding = {
color: "#F5DEB3",
behavior: elements.slime.behavior,
viscosity: 20000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: -10,
category: "solids",
state: "liquid",
density: 1050,
stain: 0.3
};
elements.magma = {
color: "#FF6347",
behavior: elements.slime.behavior,
viscosity: 800000,
tempHigh: 1200,
stateHigh: "liquid",
tempLow: 800,
category: "liquids",
state: "liquid",
density: 3000,
stain: 1.0
};
elements.agar = {
color: "#F0E68C",
behavior: elements.slime.behavior,
viscosity: 10000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: 0,
category: "solids",
state: "liquid",
density: 1100,
stain: 0.2
};
elements.xanthamGum = {
color: "#F4A460",
behavior: elements.slime.behavior,
viscosity: 60000,
tempHigh: 70,
stateHigh: "liquid",
tempLow: -10,
category: "solids",
state: "liquid",
density: 1050,
stain: 0.4
};
elements.caramel = {
color: "#FFD700",
behavior: elements.slime.behavior,
viscosity: 15000,
tempHigh: 45,
stateHigh: "liquid",
tempLow: -5,
category: "solids",
state: "liquid",
density: 1200,
stain: 0.5
};
elements.molasses = {
color: "#4B0082",
behavior: elements.slime.behavior,
viscosity: 30000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: 0,
category: "liquids",
state: "liquid",
density: 1400,
stain: 0.7
};
elements.syrup = {
color: "#8B4513",
behavior: elements.slime.behavior,
viscosity: 20000,
tempHigh: 40,
stateHigh: "liquid",
tempLow: -10,
category: "liquids",
state: "liquid",
density: 1300,
stain: 0.5
};
elements.hydrogels = {
color: "#00CED1",
behavior: elements.slime.behavior,
viscosity: 5000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: -10,
category: "solids",
state: "liquid",
density: 1000,
stain: 0.2
};
elements.silicone = {
color: "#A9A9A9",
behavior: elements.slime.behavior,
viscosity: 60000,
tempHigh: 80,
stateHigh: "liquid",
tempLow: 10,
category: "solids",
state: "liquid",
density: 1100,
stain: 0.3
};
elements.jelly = {
color: "#C71585",
behavior: elements.slime.behavior,
viscosity: 20000,
tempHigh: 50,
stateHigh: "liquid",
tempLow: -5,
category: "solids",
state: "liquid",
density: 1050,
stain: 0.4
};
elements.spandex = {
color: "#2E8B57",
behavior: elements.slime.behavior,
viscosity: 30000,
tempHigh: 60,
stateHigh: "liquid",
tempLow: -5,
category: "solids",
state: "liquid",
density: 950,
stain: 0.3
};
elements.polyurethane = {
color: "#B0C4DE",
behavior: elements.slime.behavior,
viscosity: 40000,
tempHigh: 70,
stateHigh: "liquid",
tempLow: 10,
category: "solids",
state: "liquid",
density: 1000,
stain: 0.4
};

297
mods/SuperASAX_Funny_Mod.js Normal file
View File

@ -0,0 +1,297 @@
//Made by SuperASAX or SuperAAX
elements.spread_bomb = {
color: "#524c41",
behavior: [
"XX|EX:10|XX",
"XX|DL|XX",
"M2 AND CL|M1 AND EX:10|M2 AND CL",
],
category: "Super's Funny Mod",
state: "solid",
density: 1300,
excludeRandom: true,
cooldown: defaultCooldown
},
elements.random_bomb = {
color: "#524c41",
behavior: [
"XX|EX:10|XX",
"CL%10|DL%5|CL%10",
"M2 AND CL%10|M1%25 AND EX:10|M2 AND CL%10",
],
category: "Super's Funny Mod",
state: "solid",
density: 1300,
excludeRandom: true,
cooldown: defaultCooldown
},
elements.strange_spread = {
color: "#ABCDEF",
category: "Super's Funny Mod",
behavior: [
"CL%90|XX|CL%90",
"XX|EX:5%0.1|XX",
"M2 AND CL%10|M1%25|M2 AND CL%10",
],
},
elements.cheese_matter = {
color: "#fcba03",
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];
if ((Math.random() < 0.05 || coords[0]) && !isEmpty(x,y,true)) {
var elem = pixelMap[x][y].element;
if (elements.cheese_matter.ignore.indexOf(elem) === -1 && elements[elem].hardness !== 1) {
if (coords[1]) {
swapPixels(pixel,pixelMap[x][y]);
}
else {
changePixel(pixelMap[x][y],"cheese_matter");
}
}
}
}
var move1Spots = [
[pixel.x, pixel.y+1],
[pixel.x+1, pixel.y+1],
[pixel.x-1, pixel.y+1],
]
if (Math.random() < 0.1) { move1Spots.push([pixel.x-1,pixel.y]) }
if (Math.random() < 0.1) { move1Spots.push([pixel.x+1,pixel.y]) }
if (Math.random() < 0.1) { move1Spots.push([pixel.x,pixel.y-1]) }
if (Math.random() < 0.1) { move1Spots.push([pixel.x-1,pixel.y-1]) }
if (Math.random() < 0.1) { move1Spots.push([pixel.x+1,pixel.y-1]) }
for (var i = 0; i < move1Spots.length; i++) {
var j = Math.floor(Math.random()*move1Spots.length);
var coords = move1Spots[j];
if (tryMove(pixel, coords[0], coords[1])) { break; }
else { move1Spots.splice(j, 1); }
}
doDefaults(pixel);
},
reactions: {
"void": { elem1:"explosion" }
},
category: "Super's Funny Mod",
state: "solid",
density: 2000,
excludeRandom: true,
ignore: ["fire","smoke","antimatter","cheese_matter","wall","ewall","plasma","void","border","cheese"],
behavior: [
"XX|XX|XX",
"XX|CH:cheese%5|XX",
"XX|XX|XX",
],
},
elements.antiball = {
color: "#EEA537",
behavior: [
"ST|ST AND M1|ST",
"ST|XX|ST",
"ST|ST|ST",
],
state: "solid",
category: "Super's Funny Mod"
},
elements.bomb_bird = {
color: "#997457",
properties: { "phase": 2, "rising":0 },
tick: function(pixel) {
if (Math.random() < 0.00007 && isEmpty(pixel.x,pixel.y+2)) {
createPixel("spread_bomb",pixel.x,pixel.y+2);
}
var newX = pixel.x;
var newY = pixel.y;
if (pixel.phase === 1) { // Landing
newX += pixel.flipX ? -1 : 1;
newY += Math.random() < 0.5 ? 0 : 1;
if (!tryMove(pixel, newX, newY)) {
if (outOfBounds(newX, newY)) { pixel.phase = 0 }
else {
var newPixel = pixelMap[newX][newY];
if (elements[newPixel.element].state !== "solid") { pixel.phase = 3; }
else if (newPixel.element === "bomb_bird") {
pixel.phase = 3;
newPixel.phase = 3;
}
else { pixel.phase = 0; }
}
} // Stop landing
}
else if (pixel.phase === 2) { // Gliding
newX += pixel.flipX ? -1 : 1;
newY += Math.random() < 0.9 ? 0 : 1;
if (Math.random() < 0.01) { pixel.phase = 1 } // Start landing
if (!tryMove(pixel, newX, newY)) {
pixel.flipX = !pixel.flipX;
if (!outOfBounds(newX, newY) && pixelMap[newX][newY].element !== "bird") {
pixel.phase = 3;
}
}
}
else if (pixel.phase === 0) { // Standing
if (Math.random() < 0.05) { newX += pixel.flipX ? -1 : 1; }
newY ++;
if (Math.random() < 0.01) { pixel.phase = 3 } // Start rising
if (!tryMove(pixel, newX, newY)) {
if (!outOfBounds(newX, newY) && pixelMap[newX][newY].element === "bird") {
pixel.phase = 3;
pixelMap[newX][newY].phase = 3;
}
}
}
else if (pixel.phase === 3) { // Rising
newX += pixel.flipX ? -1 : 1;
newY --;
if (!tryMove(pixel, newX, newY) || (pixel.rising > 5 && Math.random() < 0.05)) { pixel.phase = 2; pixel.rising = 0; } // Start gliding
else { pixel.rising ++; }
}
doHeat(pixel);
doElectricity(pixel);
doBurning(pixel);
},
flippableX: true,
reactions: {
"head": {elem1:"explosion"},
"body": {elem1:"explosion"},
"fly": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"firefly": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL },
"bee": { elem2:null, chance:0.05, func:behaviors.FEEDPIXEL },
"worm": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"ant": { elem2:null, chance:0.025, func:behaviors.FEEDPIXEL },
"stink_bug": { elem2:"stench", chance:0.025, func:behaviors.FEEDPIXEL },
"dead_bug": { elem2:null, chance:0.04, func:behaviors.FEEDPIXEL },
"lichen": { elem2:null, chance:0.04, func:behaviors.FEEDPIXEL },
"termite": { elem2:null, chance:0.025, func:behaviors.FEEDPIXEL },
"flea": { elem2:null, chance:0.025, func:behaviors.FEEDPIXEL },
"mushroom_cap": { elem2:null, chance:0.025, func:behaviors.FEEDPIXEL },
"mushroom_gill": { elem2:null, chance:0.025, func:behaviors.FEEDPIXEL },
"seeds": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"flower_seed": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"wheat_seed": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"corn_seed": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"corn": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"potato_seed": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"grass_seed": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"crumb": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"pumpkin": { elem2:null, chance:0.025, func:behaviors.FEEDPIXEL },
"pumpkin_seed": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"rice": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"coffee_bean": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"coffee_ground": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"nut": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"nut_meat": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"nut_butter": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"jelly": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"plague": { elem1:"plague", chance:0.05 },
"oxygen": { elem2:"carbon_dioxide", chance:0.5 }
},
foodNeed: 20,
temp: 41,
tempHigh: 120,
stateHigh: "cooked_meat",
stateHighColor: "#E4CFB9",
tempLow: -18,
stateLow: "frozen_meat",
category:"Super's Funny Mod",
burn:50,
burnTime:100,
breakInto: ["feather","blood"],
state: "solid",
density: 400,
conduct: 0.5
},
elements.fillerX = {
color: "#ae4cd9",
behavior: [
"DL|CL|DL",
"CL|XX|CL",
"DL|CL|DL",
],
category:"special",
excludeRandom: true,
reactions: {
"neutron": { elem1:"lattice" },
"proton": { elem1:"vertical" },
"electric": { elem1:"horizontal" },
"positron": { elem1:"vertical" },
"plasma": { elem1:"armageddon", tempMin:500, charged:true },
},
density: 1834
},
elements.latticeX = {
color: "#cb4cd9",
behavior: [
"CL|DL|CL",
"DL|XX|DL",
"CL|DL|CL",
],
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];
if (!isEmpty(x,y,true) && pixelMap[x][y].element === "lattice") {
deletePixel(x,y)
}
}
},
reactions: {
"cold_fire": { elem1:"ice_nine", chance:0.1 },
"proton": { elem1:"filler", elem2:null, chance:0.1 },
"electric": { elem1:null, elem2:"filler", chance:0.1 },
},
category:"special",
excludeRandom: true,
movable: false,
density: 917
},
elements.mystery_thing_1 = {
color: "#EEA537",
behavior: [
"ST AND CL%10|ST AND CL%10 AND M2|ST AND CL%10",
"ST AND CL%10|DL%25 AND EX:5%1|ST AND CL%10",
"ST AND CL%10|ST AND M1|ST AND CL%10",
],
state: "solid",
category: "Super's Funny Mod",
reactions: {
"water": { elem1:"null" }
},
},
elements.mystery_thing_2 = {
color: "#abcfed",
behavior: [
"CL%10 AND CH:galvanized_steel%10|CL%10 AND CH:galvanized_steel%10|CL%10 AND CH:galvanized_steel%10",
"M2|CH:galvanized_steel%10 AND CH:spread_bomb%0.1|M2",
"CH:null%10|M1|CH:null%10",
],
category: "Super's Funny Mod",
name:"0.1 by 0.1 meter apartment"
},
elements.sandboxelizer = {
color: "#e6d577",
category: "Super's Funny Mod",
behavior: [
"CL%3 AND CH:sand%10|M2|CL%3 AND CH:sand%10",
"M2|M1|M2",
"CL%3 AND CH:sand%10|M2|CL%3 AND CH:sand%10",
],
reactions: {
"sand": { elem1:"void", chance:0.1}
}
};
//just doing some modding

123
mods/aussieAdditions.js Normal file
View File

@ -0,0 +1,123 @@
// This is the code for the Sandboxels mod AussieAdditions.
// All code was written by AussieBox, taken from free-to-use code, or taken from the example mod file found at the bottom of the modlist on the Sandboxels website (sandboxels.r74n.com).
// Please do not steal this code or any ideas from the mod and claim they are yours!
// With love, from AussieBox. :]
// (And that means no copying the file, tampering with one line, re-uploading it and claiming it as yours!)
// Oh, by the way, AA just means AussieAdditions. Any other mods are adressed by their full name, including the ".js" at the end. I just used this to make notes in the code a little shorter and simpler! Hope you understand, fellow github browser. ;]
// Log entry (all mods loaded)
// This code runs after all mods in the Sandboxels instance are loaded.
runAfterLoad(function() {
console.log("Mods loaded, Hello World!");
});
runAfterLoad(function() {
console.log("By the way, thanks for using AussieAdditions!");
});
// Log entry (when using survival.js)
// This code runs when the instance includes survival.js
if (enabledMods.includes("mods/survival.js")) {
runAfterLoad(function() {
console.log("AussieAdditions may not entirely support survival.js at the moment. I may add an option in Settings that makes the mod work with survival.js eventually, but it's probably coming in a loooong time. Still, hang tight! :]");
});
}
// Log entry (when using subspace.js)
// This code runs when the instance includes subspace.js
if (enabledMods.includes("mods/subspace.js")) {
runAfterLoad(function() {
console.log("bruh what");
});
}
// Log entry (when using sus.js)
// This code runs when the instance includes sus.js... why?
if (enabledMods.includes("mods/sus.js")) {
runAfterLoad(function() {
console.log("bro. that meme died out in 2021.");
});
}
// Add item (Red Corruption)
// This code adds the item "red_corruption"
elements.red_corruption = {
color: "#db0707",
behavior: behaviors.POWDER,
category: "corruption",
viscosity: 1,
state: "powder",
density: 100,
};
// Add item (Blue Corruption)
// This code adds the item "blue_corruption"
elements.blue_corruption = {
color: "#0404bf",
behavior: behaviors.POWDER,
category: "corruption",
viscosity: 1,
state: "powder",
density: 100,
};
// Add item (Corruption)
// This code adds the item "corruption"
elements.blue_corruption = {
color: "#4d0991",
behavior: behaviors.POWDER,
category: "corruption",
viscosity: 1,
state: "powder",
density: 100,
};
// Oh, hey! You reached the bottom of the code!
// Thanks for reviewing (or just scrolling to the bottom of) my code, I appreciate it! (Not if you did the second option.)
// Anyway, here are some dedications...
// R74N, for creating Sandboxels and keeping it up on their website, despite how much it likely costs...
// My dad, who suggested naming my first YouTube video a reference for all the coders out there by naming it "Hello World!" (He's also the reason I used the famous phrase in the "Log entry (all mods loaded)" section!)
// Me (also known as AussieBox), for coming up with ideas for this mod, writing the code for them, getting frustrated when said code didn't work, asking for help with the code, "borrowing" code from others when nobody helped me, finally getting stuff to work, and filling the massive hellhole known as "the massive amount of bugs that always occur when you write any code, no matter how small"...
// (It took me so long to make this mod, so I put myself here, deal with it. And if you can't, what are you gonna do about it? >:] *laughs in chaotic silly*)
// My friends, for not caring in the slightest about what I do out of school hours... (this is a joke, dad, i'm fine, I promise)
// The Sandboxels modding community, for creating amazing modifications for our favourite sandbox website...
// And finally... YOU! :]
// Anyway, that's all the dedications, so I'm gonna go now. Hope you enjoy the mod!
// ... and don't forget to subscribe to AussieBox. Gotta get my self promo in somewhere, don't blame me, haha ;P
// Plus, you can say that you found out about my channel in one of the dumbest ways possible. I don't think many people are going to find me because of a javascript file.
// Uh, anyway, been here too long, my bad. Bye.

View File

@ -214,6 +214,11 @@ class MenuScreen {
return this;
}
setMenuTextId(id) {
this.menuTextId = id;
return this;
}
/**
* Adds a node to the menu screen content
* @param {Node|Node[]} node Any HTML node/element or array of HTML nodes/elements
@ -262,12 +267,13 @@ class MenuScreen {
parent.style.display = "none";
const inner = document.createElement("div");
inner.className = this.innerDivClass ?? "menuScreen";
inner.id = this.innerDivId;
inner.innerHTML = `${this.showCloseButton ? `<button class="${this.closeButtonClass ?? "XButton"}" onclick="closeMenu();">${this.closeButtonText}` : ""}</button>
<span class="menuTitle"${this.titleId ? ` id="${this.titleId}"` : ""}>${this.title ?? "Menu Screen"}</span><br><br><div class="menuText">` + this.innerHtml + "</div>";
<span class="menuTitle"${this.titleId ? ` id="${this.titleId}"` : ""}>${this.title ?? "Menu Screen"}</span><br><br><div class="menuText" id="${this.menuTextId}">` + this.innerHtml + "</div>";
this.nodes.forEach(n => inner.querySelector(".menuText").appendChild(n));
parent.appendChild(inner);
document.getElementById(id).appendChild(parent);
}
}
runAfterLoadList.push(inject);
runAfterLoadList.push(inject);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,146 @@
if (!enabledMods.includes("mods/circuitcore.js")) { enabledMods.unshift("mods/circuitcore.js"); localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); window.location.reload() };
var lightmapEnabled = enabledMods.includes("mods/lightmap.js") || enabledMods.includes("mods/fast_lightmap.js");
function general_display(w, h, colorMode) { // colorMode: 0 for monochrome, 1 for 3-bit, 2 for 4-bit
return function(pixel) {
var pins = [];
// X input (expands right)
for (var i = 0; i < Math.ceil(Math.log2(w)); i++) {
pins.push([-1, (i * 2) + 1, true]);
}
// Y input (expands downward)
for (var i = 0; i < Math.ceil(Math.log2(h)); i++) {
pins.push([(i * 2) + 1, -1, true]);
}
if (colorMode === 1) { // 3-bit color
pins.push([-1, 11, true]); // Red
pins.push([-1, 13, true]); // Green
pins.push([-1, 15, true]); // Blue
} else if (colorMode === 2) { // 4-bit color
for (var i = 0; i < 4; i++) {
pins.push([-1, 11 + (i * 2), true]); // 4-bit color input
}
} else { // Monochrome
pins.push([w - 4, -1, true]);
}
// Reset pin
pins.push([w - 2, -1, true]);
// Clock input
pins.push([w, -1, true]);
initializeCircuit(pixel, pins, w + 2, h + 2, false, pixel.circuitRotation, addDisplayCallback);
var X = [];
for (var i = 0; i < Math.ceil(Math.log2(w)); i++) {
X.push(checkPin(pixel, pins, i));
}
var Y = [];
for (var i = 0; i < Math.ceil(Math.log2(h)); i++) {
Y.push(checkPin(pixel, pins, Math.ceil(Math.log2(w)) + i));
}
var color;
if (colorMode === 1) {
var red = checkPin(pixel, pins, Math.ceil(Math.log2(w)) + Math.ceil(Math.log2(h)));
var green = checkPin(pixel, pins, Math.ceil(Math.log2(w)) + Math.ceil(Math.log2(h)) + 1);
var blue = checkPin(pixel, pins, Math.ceil(Math.log2(w)) + Math.ceil(Math.log2(h)) + 2);
color = `rgb(${red ? 255 : 0}, ${green ? 255 : 0}, ${blue ? 255 : 0})`;
} else if (colorMode === 2) {
var colorIndex = 0;
for (var i = 0; i < 4; i++) {
colorIndex += checkPin(pixel, pins, Math.ceil(Math.log2(w)) + Math.ceil(Math.log2(h)) + i) ? Math.pow(2, i) : 0;
}
color = colorPalette_4bit[colorIndex];
} else {
color = checkPin(pixel, pins, Math.ceil(Math.log2(w)) + Math.ceil(Math.log2(h))) ? "rgb(16, 230, 120)" : "rgb(16, 24, 32)";
}
var reset = checkPin(pixel, pins, Math.ceil(Math.log2(w)) + Math.ceil(Math.log2(h)) + (colorMode === 1 ? 3 : (colorMode === 2 ? 4 : 1)));
var clock = checkPin(pixel, pins, Math.ceil(Math.log2(w)) + Math.ceil(Math.log2(h)) + (colorMode === 1 ? 4 : (colorMode === 2 ? 5 : 2)));
var x_pos = 0;
for (var i = 0; i < X.length; i++) {
x_pos += X[i] ? Math.pow(2, (X.length - 1) - i) : 0;
}
var y_pos = 0;
for (var i = 0; i < Y.length; i++) {
y_pos += Y[i] ? Math.pow(2, (Y.length - 1) - i) : 0;
}
if (x_pos >= w || y_pos >= h) return;
var px = pixel.x + 1 + x_pos;
var py = pixel.y + 1 + y_pos;
if (reset) {
for (var y = 1; y <= h; y++) {
for (var x = 1; x <= w; x++) {
var reset_px = pixel.x + x;
var reset_py = pixel.y + y;
if (pixelMap[reset_px] && pixelMap[reset_px][reset_py] && pixelMap[reset_px][reset_py].element == "displayPixel") {
pixelMap[reset_px][reset_py].color = "rgb(16, 24, 32)";
}
}
}
return;
}
if (clock) {
if (pixelMap[px] && pixelMap[px][py] && pixelMap[px][py].element == "displayPixel") {
pixelMap[px][py].color = color;
}
}
};
}
elements.gridDisplay = {
color: "#33FF66",
category: "logic",
maxSize: 1,
onSelect: function() {
// Prompt the user for display width, height, and color depth
var width = parseInt(prompt("Enter the display width (e.g., 16, 32, 64):", "16"));
var height = parseInt(prompt("Enter the display height (e.g., 16, 32, 64):", "16"));
var colorDepth = parseInt(prompt("Enter the color depth (1 for monochrome, 3 for 3-bit, 4 for 4-bit):", "4"));
// Set these values for the pixel
elements.gridDisplay.displayWidth = width;
elements.gridDisplay.displayHeight = height;
elements.gridDisplay.displayColorDepth = colorDepth;
},
cc_stableTick: function(pixel) {
// Get the display properties
var width = elements.gridDisplay.displayWidth || 16;
var height = elements.gridDisplay.displayHeight || 16;
var colorDepth = elements.gridDisplay.displayColorDepth || 4;
// Call general_display with the appropriate parameters
var displayFunction = general_display(width, height, colorDepth === 1 ? 0 : (colorDepth === 3 ? 1 : 2));
displayFunction(pixel);
}
};
elements.displayPixel = {
color: "#000000",
category: "logic",
state: "solid",
behavior: behaviors.WALL,
tick: function(pixel) {
if (pixel.start == pixelTicks) {
pixel.color = "rgb(16, 24, 32)";
}
// if (lightmapEnabled && pixel.color) {
// var x = Math.floor(pixel.x / lightmapScale);
// var y = Math.floor(pixel.y / lightmapScale);
// lightmap[y][x] = { color: scaleList(rgbToArray(pixel.color), 2) };
// }
}
};

View File

@ -0,0 +1,20 @@
//Made by SuperASAX or SuperAAX
elements.liquid_tnt = {
color: "#c92a2a",
behavior: behaviors.LIQUID,
behaviorOn: [
"XX|XX|XX",
"XX|EX:10|XX",
"XX|XX|XX",
],
conduct: 1,
category: "weapons",
tempLow: -50,
state: "liquid",
stateLow: "explosion",
density: 1630,
excludeRandom: true,
alias: "trinitrotoluene"
};
//Made by SuperASAX or SuperAAX

66
mods/cold_opposites.js Normal file
View File

@ -0,0 +1,66 @@
//Made by SuperASAX or SuperAAX
elements.torch = {
color: "#d68542",
behavior: [
"CR:fire%50|CR:fire|CR:fire%50",
"XX|XX|XX",
"XX|XX|XX",
],
reactions: {
"water": { elem1:"wood" },
"sugar_water": { elem1:"wood" },
"salt_water": { elem1:"wood" },
"seltzer": { elem1:"wood" },
"dirty_water": { elem1:"wood" },
"pool_water": { elem1:"wood" },
"steam": { elem1:"wood" },
"smog": { elem1:"wood" },
"rain_cloud": { elem1:"wood" },
"cloud": { elem1:"wood" },
"snow_cloud": { elem1:"wood" },
"hail_cloud": { elem1:"wood" },
"thunder_cloud": { elem1:"wood" },
"ice_nine": { elem1:"wood" }
},
temp:600,
category:"special",
breakInto: "sawdust",
tempLow: -273,
stateLow: "wood"
},
elements.cold_torch = {
color: "#d68542",
behavior: [
"CR:cold_fire%50|CR:cold_fire|CR:cold_fire%50",
"XX|CO|XX",
"XX|XX|XX",
],
temp:-273,
category:"special",
breakInto: "sawdust",
tempHigh: 0,
stateHigh: "wood"
},
elements.extinguisher= {
color: "#d6baa9",
behavior: [
"CR:eanprop|CR:eanprop|CR:eanprop",
"XX|XX|XX",
"XX|XX|XX",
],
temp:-30,
category: "machines",
conduct: 0.73
},
elements.eanprop = {
color: "#cfcfcf",
behavior: behaviors.GAS,
temp:-25,
category: "gases",
tempLow: -43,
stateLow: "cold_fire",
state: "gas",
density: 2.0098,
alias: "gas"
};

140
mods/element_UI.js Normal file
View File

@ -0,0 +1,140 @@
// element_UI.js - Redbirdly's Mod that adds an alternative square element UI
// Convert any html-valid color into RGB
function cssColorToRGB(color) {
const div = document.createElement('div');
div.style.color = color;
document.body.appendChild(div);
const computedColor = window.getComputedStyle(div).color;
document.body.removeChild(div);
const rgbValues = computedColor.match(/\d+/g).map(Number);
return rgbValues;
}
function getColorBrightness(color) {
const [r, g, b] = cssColorToRGB(color);
return (r * 299 + g * 587 + b * 114) / 1000;
}
function createButtons(elements, inputDivId, currentCategory) {
const elementControls = document.getElementById('elementControls');
const existingContainer = document.getElementById('grid-container');
if (existingContainer) {
existingContainer.remove();
}
const container = document.createElement('div');
container.id = 'grid-container';
Object.assign(container.style, {
display: 'grid',
gap: '5px',
maxHeight: '280px',
overflowY: 'hidden',
overflowX: 'auto',
scrollbarColor: 'rgba(255, 255, 255, 0.25) rgba(255, 255, 255, 0.1)',
scrollbarWidth: 'thin'
});
const buttonNames = [];
let numButtons = 0;
let numColumns = 0;
for (let index in elements) {
if (elements.hasOwnProperty(index) && elements[index].category !== "tools" && elements[index].category === currentCategory) {
const name = index.replace(/_/g, ' ');
numButtons++;
let color = 'gray';
if (elements[index].color !== undefined) {
if (typeof elements[index].color === 'string') {
color = elements[index].color;
} else if (Array.isArray(elements[index].color)) {
color = elements[index].color[0];
}
}
buttonNames.push({ name, color });
}
}
numColumns = Math.ceil(numButtons / 3);
container.style.gridTemplateColumns = `repeat(${numColumns}, 60px)`;
container.style.gridTemplateRows = 'repeat(3, 60px)';
buttonNames.forEach((buttonInfo, index) => {
const button = document.createElement('div');
button.className = 'grid-item';
button.style.backgroundColor = buttonInfo.color;
button.innerText = buttonInfo.name;
const brightness = getColorBrightness(buttonInfo.color);
button.style.color = brightness > 210 ? 'black' : 'white';
Object.assign(button.style, {
width: '60px',
height: '60px',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
fontSize: '8px',
cursor: 'pointer',
border: '4px solid transparent',
borderRadius: '0px',
textAlign: 'center',
wordWrap: 'break-word',
transition: 'background-color 0.3s, color 0.3s, border 0.3s'
});
button.addEventListener('click', function() {
document.querySelectorAll('.grid-item').forEach(btn => {
btn.classList.remove('selected');
btn.style.border = '4px solid transparent';
});
button.classList.add('selected');
button.style.border = '4px solid white';
currentElement = buttonInfo.name.replace(' ', '_');
const element = elements[currentElement];
if (element && typeof element.onSelect === 'function') {
element.onSelect();
}
});
container.appendChild(button);
});
const inputDiv = document.createElement('div');
inputDiv.id = inputDivId;
elementControls.insertAdjacentElement('afterend', container);
container.insertAdjacentElement('afterend', inputDiv);
elementControls.style.display = 'none';
}
function getCurrentCategory() {
const categoryButtons = document.querySelectorAll('[current="true"]');
if (categoryButtons.length === 0) {
return null;
}
return categoryButtons[0].id.replace("categoryButton-", "");
}
function selectCategory(category) {
if (!category) { return; }
const categoryButton = document.getElementById("categoryButton-"+category);
if (!categoryButton) { return; }
if (categoryButton.classList.contains("notify")) {
categoryButton.classList.remove("notify");
}
const categoryDiv = document.getElementById("category-"+category);
for (let i = 0; i < categoryButton.parentNode.children.length; i++) {
const e = categoryDiv.parentNode.children[i];
e.style.display = "none";
document.getElementById("categoryButton-"+e.getAttribute("category")).setAttribute("current", false);
}
categoryDiv.style.display = "block";
categoryButton.setAttribute("current", true);
createButtons(elements, 'input-div', category);
}
const initialCategory = getCurrentCategory();
if (initialCategory) {
selectCategory(initialCategory);
}
selectElement("sand");

View File

@ -1,3 +1,20 @@
/* code by nekonico aka doobienecoarc */
worldgentypes.prehistory = {
layers: [
[1.00, "grass"],
[0.10, "dirt"],
[0.02, "rock"],
[0, "basalt"],
],
decor: [
["dinosaur", 0.1, 10],
["pinecone", 0.075],
["bird", 0.025, 5],
],
baseHeight: 0.5
},
elements.fossil = {
color: ["#bbb3ae","#b4b4b4","#c0c0c0"],
behavior: [
@ -6,12 +23,12 @@ elements.fossil = {
"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},
"water": {elem1: ["wet_sand","fossil_sand"], chance: 0.00035},
"salt_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0005},
"sugar_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"seltzer": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"dirty_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"soda": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"lichen": {elem1: "dirt", chance: 0.0025},
"bone": {elem2: "fossil", chance: 0.000025},
"bone_marrow": {elem2: "marrow_fossil", chance: 0.00002},
@ -20,7 +37,7 @@ elements.fossil = {
"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}
"primordial_soup": {elem1: ["wet_sand","fossil_sand"], chance: 0.001}
},
tempHigh: 950,
stateHigh: "magma",
@ -31,10 +48,9 @@ elements.fossil = {
breakInto: ["rock","gravel","gravel","gravel","sand"],
};
elements.marrow_fossil = {
color: ["#cbb2b3","#c1a8a8","#d0b0b0"],
hidden:true,
behavior: behaviors.SUPPORTPOWDER,
elements.fossil_sand = {
color: ["#bbb3ae","#b4b4b4","#c0c0c0"],
behavior: behaviors.POWDER,
reactions: {
"water": {elem1: "wet_sand", chance: 0.00035},
"salt_water": {elem1: "wet_sand", chance: 0.0005},
@ -42,6 +58,32 @@ elements.marrow_fossil = {
"seltzer": {elem1: "wet_sand", chance: 0.0004},
"dirty_water": {elem1: "wet_sand", chance: 0.0004},
"soda": {elem1: "wet_sand", chance: 0.0004},
"bone": {elem2: "fossil", chance: 0.0000025},
"bone_marrow": {elem2: "marrow_fossil", chance: 0.000002},
"skull": {elem2: ["human_fossil","human_fossil","fossil"], chance: 0.0000025},
"wood": {elem2: "petrified_wood", chance: 0.0000015},
"tree_branch": {elem2: "petrified_wood", chance: 0.0000015},
"primordial_soup": {elem1: "wet_sand", chance: 0.001}
},
tempHigh: 1700,
stateHigh: "molten_glass",
category: "land",
state: "solid",
density: 2000,
breakInto: ["gravel","gravel","sand"],
};
elements.marrow_fossil = {
color: ["#cbb2b3","#c1a8a8","#d0b0b0"],
hidden:true,
behavior: behaviors.SUPPORTPOWDER,
reactions: {
"water": {elem1: ["wet_sand","fossil_sand"], chance: 0.00035},
"salt_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0005},
"sugar_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"seltzer": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"dirty_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"soda": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"lichen": {elem1: "dirt", chance: 0.0025},
"bone": {elem2: "fossil", chance: 0.000025},
"bone_marrow": {elem2: "marrow_fossil", chance: 0.00002},
@ -62,6 +104,10 @@ elements.marrow_fossil = {
};
elements.human_fossil = {
properties: {
dna: "human",
},
name: "fossil",
color: ["#bbb3ae","#b4b4b4","#c0c0c0"],
hidden:true,
behavior: [
@ -70,12 +116,12 @@ elements.human_fossil = {
"M2%50|M1|M2%50",
],
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},
"water": {elem1: ["wet_sand","fossil_sand"], chance: 0.00035},
"salt_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0005},
"sugar_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"seltzer": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"dirty_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"soda": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"lichen": {elem1: "dirt", chance: 0.0025},
"bone": {elem2: "fossil", chance: 0.000025},
"bone_marrow": {elem2: "marrow_fossil", chance: 0.00002},
@ -96,6 +142,10 @@ elements.human_fossil = {
};
elements.dino_fossil = {
properties: {
dna: "dinosaur",
},
name: "fossil",
color: ["#bbb3ae","#b4b4b4","#c0c0c0"],
behavior: [
"XX|XX|XX",
@ -103,12 +153,12 @@ elements.dino_fossil = {
"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},
"water": {elem1: ["wet_sand","fossil_sand"], chance: 0.00035},
"salt_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0005},
"sugar_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"seltzer": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"dirty_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"soda": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"lichen": {elem1: "dirt", chance: 0.0025},
"bone": {elem2: "fossil", chance: 0.000025},
"bone_marrow": {elem2: "marrow_fossil", chance: 0.00002},
@ -129,16 +179,19 @@ elements.dino_fossil = {
};
elements.petrified_wood = {
properties: {
dna: "sapling",
},
color: ["#4e4e3e","#464646","#52533a"],
hidden:true,
behavior: behaviors.STURDYPOWDER,
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},
"water": {elem1: ["wet_sand","fossil_sand"], chance: 0.00035},
"salt_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0005},
"sugar_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"seltzer": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"dirty_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"soda": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"lichen": {elem1: "dirt", chance: 0.0025},
"bone": {elem2: "fossil", chance: 0.000025},
"bone_marrow": {elem2: "marrow_fossil", chance: 0.00002},
@ -158,6 +211,9 @@ elements.petrified_wood = {
};
elements.skull = {
properties: {
dna: "human",
},
color: "#d9d9d9",
hidden:true,
behavior: behaviors.POWDER,
@ -189,10 +245,53 @@ elements.skull = {
state: "solid",
density: 1000,
hardness: 0.5,
breakInto: ["quicklime","bone","human_bones","bone_marrow"]
},
elements.human_bones = {
properties: {
dna: "human",
},
name: "bone",
color: "#d9d9d9",
hidden:true,
behavior: behaviors.SUPPORT,
reactions: {
"water": { elem2:"broth", tempMin:70, color2:"#d7db69" },
"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": "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,
stateHigh: "quicklime",
state: "solid",
density: 1000,
hardness: 0.5,
breakInto: ["quicklime","bone","bone","bone_marrow"]
},
elements.dino_bones = {
properties: {
dna: "dinosaur",
},
name: "bone",
color: "#d9d9d9",
hidden:true,
behavior: behaviors.SUPPORT,
@ -242,17 +341,19 @@ elements.coal = {
},
burn: 28,
burnTime: 1000,
burnInto: ["fire","fire","fire","fire","ash","carbon_dioxide"],
burnInto: ["fire","fire","fire","fire","dust","carbon_dioxide"],
tempHigh: 6000,
stateHigh: "fire",
category: "powders",
state: "solid",
density: 250,
breakInto: ["ash","ash","carbon_dioxide"],
breakInto: ["dust","ash","carbon_dioxide"],
hardness: 0.5,
},
elements.bug_amber = {
hidden:true,
name: "amber",
color: ["#ffc000","#b67f18","#c86305","#cf7a19","#e4ae3a"],
temp: 20,
tempHigh: 345,
@ -262,6 +363,11 @@ elements.bug_amber = {
},
elements.hive_amber = {
hidden:true,
properties: {
dna: "bee",
},
name: "amber",
color: "#ffc000",
temp: 20,
tempHigh: 345,
@ -271,6 +377,10 @@ elements.hive_amber = {
},
elements.dinosaur = {
hidden:true,
properties: {
dna: "dinosaur",
},
color: ["#7F2B0A","#808080","#006400"],
behavior: [
"XX|M2%5|XX",
@ -296,43 +406,157 @@ elements.dinosaur = {
"plant": { elem2: null, chance: 0.5, func: behaviors.FEEDPIXEL },
"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 },
"bone_marrow": { elem2: ["blood","blood",null], chance: 0.3, func: behaviors.FEEDPIXEL },attr1:{"dna":"snail"},
"blood": { elem2: null, chance: 0.01, func: behaviors.FEEDPIXEL },
"meat": { elem2: null, chance: 0.5, func: behaviors.FEEDPIXEL },
"cooked_meat": { elem2: null, chance: 0.4, func: behaviors.FEEDPIXEL },
"cured_meat": { elem2: null, chance: 0.4, func: behaviors.FEEDPIXEL },
"cured_meat": { elem2: null, chance: 0.1, 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 },
"ant": { elem2: [null,null,null,null,null,null,"dead_bug"], chance: 0.05, func: behaviors.FEEDPIXEL },
"worm": { elem2: [null,null,null,null,null,null,"slime"], chance: 0.05, func: behaviors.FEEDPIXEL },
"glass": { elem2: "glass_shard", chance: 0.05 },
"concrete": { elem2: "dust", chance: 0.03 },
}
},
},
elements.trilobite = {
hidden:true,
properties: {
dna: "trilobite",
},
color: "#808080",
behavior: [
"XX|M2%5|SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water,primordial_soup%05",
"XX|FX%0.5|M2%50 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water,primordial_soup%10 AND BO",
"M2%50|M1|M2%50 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water,primordial_soup%10",
],
reactions: {
"algae": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"kelp": { elem2:"water", chance:0.25 },
"plant": { elem2:null, chance:0.125, func:behaviors.FEEDPIXEL },
"fly": { elem2:null, chance:0.4, func:behaviors.FEEDPIXEL },
"firefly": { elem2:null, chance:0.6, func:behaviors.FEEDPIXEL },
"worm": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"tadpole": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"oxygen": { elem2:"carbon_dioxide", chance:0.5 },
"broth": { elem2:"water", chance:0.2, func:behaviors.FEEDPIXEL },
"slug": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"herb": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"lettuce": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"dead_plant": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"lichen": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"yeast": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"yogurt": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"tea": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"yolk": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"cell": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"crumb": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"alcohol": { elem1:"dead_bug", attr1:{"dna":"trilobite"}, chance:0.001 },
"water": { elem2:"bubble", attr2:{"clone":"water"}, chance:0.002, oneway:true },
"salt_water": { elem2:"bubble", attr2:{"clone":"salt_water"}, chance:0.002, oneway:true },
"pool_water": { elem1:"dead_bug", chance:0.001 },
"chlorine": { elem1:"dead_bug", chance:0.1 },
"vinegar": { elem1:"dead_bug", chance:0.001 },
},
foodNeed: 10,
temp: 20,
tempHigh: 150,
stateHigh: "meat",
tempLow: -20,
stateLow: ["dead_bug","frozen_meat"],
category:"life",
breakInto: ["dead_bug","blood"],
burn:25,
burnTime:250,
state: "solid",
density: 1080,
conduct: 0.2,
eggColor: ["#211316","#2C1A1D","#503734"]
},
elements.extracted_dna = {
hidden:true,
name: "artificial_egg",
color: ["#211316","#2C1A1D","#503734","#e0d3ab"],
behavior: behaviors.POWDER,
tick: function(pixel) {
if (Math.random() < 0.00025 || (pixel.dna && pixel.temp > 40 && pixel.temp < 150)) {
if (pixel.dna) {
changePixel(pixel,pixel.dna);
}
else changePixel(pixel,"cell")
}
},
innerColor: "#ffffff",
tempHigh: 1200,
stateHigh: ["steam","dna","calcium","carbon_dioxide","sulfur_gas"],
breakInto: ["yolk","yolk","dna","cell"],
category:"life",
conduct: 1,
};
elements.head.breakInto = ["blood","meat","skull"]
elements.extractor = {
name: "dna-extractor",
color: ["#d1c6be","#b5c0ad","#b9b8bc"],
behavior: behaviors.STURDYPOWDER,
reactions: {
"fossil": { elem2:"extracted_dna", chance:0.05 },
"marrow_fossil": { elem2:"extracted_dna", chance:0.06 },
"petrified_wood": { elem2:"extracted_dna", attr2:{"dna":"sapling"}, chance:0.01 },
"wood": { elem2:"extracted_dna", attr2:{"dna":"sapling"}, chance:0.05 },
"bone_marrow": { elem2:"extracted_dna", chance:0.1 },
"bone": { elem2:"extracted_dna", chance:0.1 },
"meat": { elem2:"extracted_dna", chance:0.1 },
"frozen_meat": { elem2:"extracted_dna", chance:0.1 },
"cooked_meat": { elem2:"extracted_dna", chance:0.1 },
"rotten_meat": { elem2:"extracted_dna", chance:0.05 },
"blood": { elem2:"extracted_dna", chance:0.1 },
"slime": { elem2:"extracted_dna", chance:0.05 },
"dead_bug": { elem2:"extracted_dna", chance:0.2 },
"hive_amber": { elem2:"extracted_dna", chance:0.2 },
"bug_amber": { elem2:"extracted_dna", chance:0.2 },
"dino_bones": { elem2:"extracted_dna", attr2:{"dna":"dinosaur"}, chance:0.2 },
"skull": { elem2:"extracted_dna", attr2:{"dna":"human"}, chance:0.2 },
"dino_fossil": { elem2:"extracted_dna", attr2:{"dna":"dinosaur"}, chance:0.02 },
"human_fossil": { elem2:"extracted_dna", attr2:{"dna":"human"}, chance:0.02 },
},
category:"machines",
conduct: 1,
hardness: 1,
};
elements.head.burnInto = ["ash","cooked_meat","skull"]
elements.head.breakInto = ["blood","meat","human_bones","skull"]
elements.head.stateHigh = ["cooked_meat","cooked_meat","skull"]
elements.head.burnInto = ["ash","cooked_meat","human_bones","skull","skull"]
elements.head.stateLow = ["frozen_meat","frozen_meat","skull"]
elements.head.stateHigh = ["cooked_meat","human_bones","skull","skull"]
elements.head.stateLow = ["frozen_meat","human_bones","skull","skull","skull"]
elements.body.breakInto = ["blood","meat","human_bones","bone"]
elements.body.burnInto = ["ash","cooked_meat","human_bones"]
elements.body.stateHigh = ["cooked_meat","human_bones"]
elements.body.stateLow = ["frozen_meat","human_bones","human_bones"]
elements.dead_bug.breakInto = ["calcium","calcium","calcium","quicklime"]
if (!elements.sap.reactions) { elements.sap.reactions = {} }
elements.sap.reactions.dead_bug = { elem1:"bug_amber", elem2:null, chance:0.1 };
elements.sap.reactions.hive = { elem1:null, elem2:"hive_amber", chance:0.01 };
elements.sap.reactions.ant = { elem1:"bug_amber", elem2:null, chance:0.1 };
elements.sap.reactions.fly = { elem1:"bug_amber", elem2:null, chance:0.1 };
elements.sap.reactions.flea = { elem1:"bug_amber", elem2:null, chance:0.1 };
elements.sap.reactions.termite = { elem1:"bug_amber", elem2:null, chance:0.1 };
elements.sap.reactions.worm = { elem1:"bug_amber", elem2:null, chance:0.1 };
elements.sap.reactions.bee = { elem1:"bug_amber", elem2:null, chance:0.1 };
elements.sap.reactions.firefly = { elem1:"bug_amber", elem2:null, chance:0.1 };
elements.sap.reactions.stinkbug = { elem1:"bug_amber", elem2:null, chance:0.1 };
elements.sap.reactions.slug = { elem1:"bug_amber", elem2:null, chance:0.08 };
elements.sap.reactions.snail = { elem1:"bug_amber", elem2:null, chance:0.05 };
elements.sap.reactions.hive = { elem1:null, elem2:"hive_amber", attr2:{"dna":"bee"}, chance:0.01 };
elements.sap.reactions.ant = { elem1:"bug_amber", attr1:{"dna":"ant"}, elem2:null, chance:0.1 };
elements.sap.reactions.fly = { elem1:"bug_amber", attr1:{"dna":"fly"}, elem2:null, chance:0.1 };
elements.sap.reactions.flea = { elem1:"bug_amber", attr1:{"dna":"flea"}, elem2:null, chance:0.1 };
elements.sap.reactions.termite = { elem1:"bug_amber", attr1:{"dna":"termite"}, elem2:null, chance:0.1 };
elements.sap.reactions.worm = { elem1:"bug_amber", attr1:{"dna":"worm"}, elem2:null, chance:0.1 };
elements.sap.reactions.bee = { elem1:"bug_amber", attr1:{"dna":"bee"}, elem2:null, chance:0.1 };
elements.sap.reactions.firefly = { elem1:"bug_amber", attr1:{"dna":"firefly"}, elem2:null, chance:0.1 };
elements.sap.reactions.stinkbug = { elem1:"bug_amber", attr1:{"dna":"stinkbug"}, elem2:null, chance:0.1 };
elements.sap.reactions.slug = { elem1:"bug_amber", attr1:{"dna":"slug"}, elem2:null, chance:0.08 };
elements.sap.reactions.snail = { elem1:"bug_amber", attr1:{"dna":"snail"}, elem2:null, chance:0.05 };
elements.sap.reactions.trilobite = { elem1:"bug_amber", attr1:{"dna":"trilobite"}, elem2:null, chance:0.1 };
if (!elements.bone.reactions) { elements.bone.reactions = {} }

325
mods/garn47.js Normal file
View File

@ -0,0 +1,325 @@
// mod by nekonico :3
behaviors.CAR_DELETE = function(pixel) {
if (carDieSound) { createPixel("car_explosion",pixel.x, pixel.y), carDieSound.play(); }
},
behaviors.CARFEEDPIXEL = function(pixel) {
if (!pixel.food) { pixel.food = 1, carDieSound.play(); }
else { pixel.food ++, carDieSound.play(); }
if (pixel.food > (elements[pixel.element].foodNeed||30)) {
// loop through adjacentCoords and check each pixel to lay an egg
for (var i = 0; i < adjacentCoords.length; i++) {
var x = pixel.x+adjacentCoords[i][0];
var y = pixel.y+adjacentCoords[i][1];
if (isEmpty(x, y)) {
if (elements[pixel.element].egg) {
createPixel(elements[pixel.element].egg,x,y)
}
else {
createPixel("egg",x,y)
pixelMap[x][y].animal = elements[pixel.element].baby || pixel.element;
if (elements[pixel.element].eggColor) {
pixelMap[x][y].color = pixelColorPick(pixelMap[x][y],elements[pixel.element].eggColor)
}
}
pixel.food = 0;
break;
}
}
}
},
document.onkeydown = function(ki)/*keyboard_input*/ {
//w
if (ki.keyCode == 87) {
KW = true;
//vY ++;
}
//s
if (ki.keyCode == 83) {
KS = true;
//vY ++;
}
}
document.onkeyup = function(i2)/*keyboard_input*/ {
//w
if (i2.keyCode == 87) {
garnWalkSound.pause()
KW = false
//vY = 0;
}
//s
if (i2.keyCode == 83) {
garnWalkSound.pause()
KS = false
//vY = 0;
}
}
var KA = false;
var KD = false;
var KW = false;
var KS = false;
var vX = 1;
var vY = 1;
elements.garn = {
name: "garn47",
color: "#52562B",
category: "special",
properties: {
dead: false,
dir: 1,
panic: 0
},
onPlace: function(pixel) {
if (isEmpty(pixel.x, pixel.y+1)) {
createPixel("garn_body", pixel.x, pixel.y+1);
pixel.element = "garn_head";
}
else if (isEmpty(pixel.x, pixel.y-1)) {
createPixel("garn_head", pixel.x, pixel.y-1);
pixelMap[pixel.x][pixel.y-1].color = pixel.color;
pixel.element = "garn_body";
pixel.color = pixelColorPick(pixel)
}
else {
deletePixel(pixel.x, pixel.y);
}
},
related: ["garn_body","garn_head"],
cooldown: defaultCooldown,
forceSaveColor: true,
},
elements.garn_body = {
name: "garn",
tick: function(pixel) {
if (tryMove(pixel, pixel.x, pixel.y+1)) { // Fall
if (!isEmpty(pixel.x, pixel.y-2, true)) { // Drag head down
var headpixel = pixelMap[pixel.x][pixel.y-2];
if (headpixel.element == "garn_head") {
if (isEmpty(pixel.x, pixel.y-1)) {
movePixel(pixelMap[pixel.x][pixel.y-2], pixel.x, pixel.y-1);
}
else {
swapPixels(pixelMap[pixel.x][pixel.y-2], pixelMap[pixel.x][pixel.y-1]);
}
}
}
}
/*if (vX === 3) {
vX --;
}
if (vY === 3) {
vY --;
}*/
if (KS === true && isEmpty(pixel.x-2, pixel.y-1) && isEmpty(pixel.x-2, pixel.y)) {
tryMove (pixel,pixel.x-1,pixel.y)
garnWalkSound.play();
}
if (KW === true && isEmpty(pixel.x+2, pixel.y-1) && isEmpty(pixel.x+2, pixel.y)) {
tryMove (pixel,pixel.x+1,pixel.y)
garnWalkSound.play();
}
},
category: "special",
states:"solid",
color:"#52562B",
}
elements.garn_head = {
name: "garn",
tick: function(pixel) {
/*if (vX === 3) {
vX --;
}
if (vY === 3) {
vY --;
}*/
if (KS === true && isEmpty(pixel.x-2, pixel.y+1) && isEmpty(pixel.x-2, pixel.y)) {
tryMove (pixel,pixel.x-1,pixel.y)
garnWalkSound.play();
}
if (KW === true && isEmpty(pixel.x+2, pixel.y+1) && isEmpty(pixel.x+2, pixel.y)) {
tryMove (pixel,pixel.x+1,pixel.y)
garnWalkSound.play();
}
},
category: "special",
states:"solid",
color:"#52562B",
}
elements.car = { // totally carnular
color: ["#9F8578","#A07D6A"],
behavior: [
"XX|XX|XX",
"XX|FX%0.25 AND CH:car_slide%1|XX",
"XX|M1|XX",
],
reactions: {
"meat": { elem2:null, chance:0.2, func:behaviors.CARFEEDPIXEL },
"cooked_meat": { elem2:null, chance:0.2, func:behaviors.CARFEEDPIXEL },
"": { elem2:null, chance:0.2, func:behaviors.CARFEEDPIXEL },
"meat": { elem2:null, chance:0.2, func:behaviors.CARFEEDPIXEL },
"oxygen": { elem2:"carbon_dioxide", chance:0.3 },
"uranium": { elem2:null, chance:0.1, func:behaviors.CARFEEDPIXEL },
"milk": { elem2:null, chance:0.1, func:behaviors.CARFEEDPIXEL },
},
onDelete: behaviors.CAR_DELETE,
tick: function(pixel) {
if (pixel.start === pixelTicks) {return}
if (!tryMove(pixel, pixel.x, pixel.y+1)) {
if (pixel.fall < 20) {
if (Math.random() < 0.5) {
if (!tryMove(pixel, pixel.x+1, pixel.y+1)) {
tryMove(pixel, pixel.x-1, pixel.y+1);
}
} else {
if (!tryMove(pixel, pixel.x-1, pixel.y+1)) {
tryMove(pixel, pixel.x+1, pixel.y+1);
}
}
pixel.fall = 0;
}
else if (outOfBounds(pixel.x,pixel.y+1) || (!isEmpty(pixel.x,pixel.y+1,true) && elements.egg.ignore.indexOf(pixelMap[pixel.x][pixel.y+1].element) === -1 && elements[pixelMap[pixel.x][pixel.y+1].element].state === "solid")) {
pixel.element = "car_explosion"
carDieSound.play();
}
else {pixel.fall = 0}
}
else {pixel.fall ++}
doDefaults(pixel);
},
ignore: ["paper","sponge","straw","wheat","rat","frog","pollen","clay","snow","mud","wet_sand","tinder","feather","bread","ice_cream","dough"],
innerColor: "#9F8578",
properties: { "fall":0 },
egg: "car",
foodNeed: 100,
maxSize: 1,
cooldown: 10,
temp: 20,
tempHigh: 1500,
stateHigh: "car_explosion",
category:"life",
burn:15,
burnTime:300,
state: "solid",
density: 1450,
conduct: 0.2
}
elements.car_slide = {
name: "car",
hidden: true,
color: ["#9F8578","#A07D6A"],
behavior: [
"XX|XX|XX",
"XX|FX%0.25 AND CH:car%10|M2 AND BO",
"XX|M1|XX",
],
reactions: {
"meat": { elem2:null, chance:0.2, func:behaviors.CARFEEDPIXEL },
"cooked_meat": { elem2:null, chance:0.2, func:behaviors.CARFEEDPIXEL },
"oxygen": { elem2:"carbon_dioxide", chance:0.3 },
"uranium": { elem2:null, chance:0.1, func:behaviors.CARFEEDPIXEL },
"milk": { elem2:null, chance:0.1, func:behaviors.CARFEEDPIXEL },
},
onDelete: behaviors.CAR_DELETE,
tick: function(pixel) {
if (pixel.start === pixelTicks) {return}
if (!tryMove(pixel, pixel.x, pixel.y+1)) {
if (pixel.fall < 20) {
if (Math.random() < 0.5) {
if (!tryMove(pixel, pixel.x+1, pixel.y+1)) {
tryMove(pixel, pixel.x-1, pixel.y+1);
}
} else {
if (!tryMove(pixel, pixel.x-1, pixel.y+1)) {
tryMove(pixel, pixel.x+1, pixel.y+1);
}
}
pixel.fall = 0;
}
else if (outOfBounds(pixel.x,pixel.y+1) || (!isEmpty(pixel.x,pixel.y+1,true) && elements.egg.ignore.indexOf(pixelMap[pixel.x][pixel.y+1].element) === -1 && elements[pixelMap[pixel.x][pixel.y+1].element].state === "solid")) {
pixel.element = "car_explosion"
carDieSound.play();
}
else {pixel.fall = 0}
}
else {pixel.fall ++}
doDefaults(pixel);
},
ignore: ["paper","sponge","straw","wheat","rat","frog","pollen","clay","snow","mud","wet_sand","tinder","feather","bread","ice_cream","dough"],
innerColor: "#9F8578",
properties: { "fall":0 },
egg: "car",
foodNeed: 100,
maxSize: 1,
cooldown: 10,
tempHigh: 1500,
stateHigh: "car_explosion",
category:"life",
burn:15,
burnTime:300,
state: "solid",
density: 1450,
conduct: 0.2
}
elements.car_explosion = {
name: "explosion",
color: ["#9F8578","#A07D6A"],
behavior: [
"XX|XX|XX",
"XX|EX:5>smoke,fire,smoke,fire,fire,car_shard|XX",
"XX|XX|XX",
],
temp: 300,
category: "energy",
state: "gas",
density: 1000,
excludeRandom: true,
noMix: true
},
elements.car_shard = {
name: "glass_shard",
color: ["#9F8578","#A07D6A"],
behavior: behaviors.POWDER,
reactions: {
"radiation": { elem1:"rad_shard", chance:0.33 },
"rad_steam": { elem1:"rad_shard", elem2:null, chance:0.33 },
"fallout": { elem1:"rad_shard", elem2:"radiation", chance:0.1 }
},
tempHigh: 1500,
stateHigh: "molten_glass",
category: "powders",
state: "solid",
density: 2500
},
carSound = null;
carDieSound = null;
carEatSound = null;
elements.car.onSelect = function() {
carSound = new Audio("https://static.wikia.nocookie.net/garn47/images/b/b9/Hello-its-me-car-made-with-Voicemod.mp3/revision/latest?cb=20240824212531");
carDieSound = new Audio("https://static.wikia.nocookie.net/garn47/images/3/3e/Car-scream-made-with-Voicemod.mp3/revision/latest?cb=20240824214753");
carEatSound = new Audio("https://static.wikia.nocookie.net/garn47/images/1/1e/Car-eating-made-with-Voicemod.mp3/revision/latest?cb=20240824220937");
}
elements.car.onMouseDown = function() {
if (carSound) { carSound.play(); }
}
garnSound = null;
garnWalkSound = null;
elements.garn.onSelect = function() {
garnSound = new Audio("https://static.wikia.nocookie.net/garn47/images/1/17/Garnular2.mp3/revision/latest?cb=20240614060855");
garnWalkSound = new Audio("https://static.wikia.nocookie.net/garn47/images/8/8b/Garn47-Ingame-Walking.mp3/revision/latest?cb=20240606045834");
}
elements.garn.onMouseDown = function() {
if (garnSound) { garnSound.play(); }
}
// totally garnular

View File

@ -303,43 +303,37 @@ elements.E2L_button = {
state: "solid",
category: "logic",
tick: function(pixel){
if (pixel.start === pixelTicks){
pixel.cooldown = 0;
pixel.toggleMode = 1;
}
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x,y,true)) {
if ((pixelMap[x][y].charge || pixelMap[x][y].chargeCD) && pixel.cooldown == 0){
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = adjacentCoords[i];
if ((pixelMap[x][y].charge || pixelMap[x][y].chargeCD)){
for (var j = 0; j < adjacentCoords.length; j++) {
var coord = adjacentCoords[j];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x,y,true)) {
if (pixelMap[x][y].element == "logic_wire"){
if (pixel.toggleMode == 1){
pixelMap[x][y].lstate = 2
pixelMap[x][y].color = pixelColorPick(pixel, "#ffe49c");
} else {
pixelMap[x][y].lstate = -2
pixelMap[x][y].color = pixelColorPick(pixel, "#3d4d2c");
}
}
}
}
pixel.cooldown = 5
if (pixel.toggleMode){
pixel.toggleMode = 0;
} else {
pixel.toggleMode = 1;
}
return;
}
}
}
if (pixel.cooldown){
pixel.cooldown = pixel.cooldown - 1
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = adjacentCoords[i];
var x = pixel.x+coord[0];
var y = pixel.y+coord[1];
if (!isEmpty(x,y,true)) {
if (pixelMap[x][y].element == "logic_wire" && pixelMap[x][y].lstate > 0){
pixelMap[x][y].lstate = -2
pixelMap[x][y].color = pixelColorPick(pixel, "#3d4d2c");
}
}
}
}
}

34
mods/lye.js Normal file
View File

@ -0,0 +1,34 @@
/*
MIT License
Copyright (c) 2024 BatteRaquette58 (a.k.a BatteRaquette581)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
elements.lye = {
color: "#e5cccc",
behavior: behaviors.POWDER,
category: "powders",
state: "solid",
tempHigh: 1388,
stateHigh: "caustic_potash",
}
elements.water.reactions.ash.elem2 = "lye"

View File

@ -591,7 +591,7 @@ let channelVar = "0"
elements.sculk_wifi_transmitter = {
color: "#142c47",
category: "minecraft",
behaviors: behaviors.WALL,
behavior: behaviors.WALL,
tempHigh: 250,
stateHigh: "dirt",
hoverStat: function(pixel){
@ -643,4 +643,164 @@ elements.sculk_wifi_receiver = {
tick: function(pixel){
if (!pixel.channel){pixel.channel = channelVar}
}
}
drawRectangle = function(ctx, color, x, y, width, height, xoffset, yoffset){
ctx.fillStyle = color;
ctx.fillRect(canvasCoord(x+xoffset), canvasCoord(y+yoffset), pixelSize*width, pixelSize*height)
}
autoFillDrawRectangle = function(ctx, pixel, width, height, xoffset, yoffset){
ctx.fillStyle = pixel.color;
ctx.fillRect(canvasCoord(pixel.x+xoffset), canvasCoord(pixel.y+yoffset), pixelSize*width, pixelSize*height)
}
autoFillColorRectangle = function(ctx, pixel, color, width, height, xoffset, yoffset){
ctx.fillStyle = color;
ctx.fillRect(canvasCoord(pixel.x+xoffset), canvasCoord(pixel.y+yoffset), pixelSize*width, pixelSize*height)
}
grabDistances = function(pixel){
let element = pixel.element
// first we find upper not the same
let results = {}
for (let i = 0; i < height; i++){
if (isEmpty(pixel.x, pixel.y-i, true) || pixelMap[pixel.x][pixel.y-i].element != element){
results.top = i
if (isEmpty(pixel.x, pixel.y-i, true)){
results.topelement = "air"
} else {
results.topelement = pixelMap[pixel.x][pixel.y-i].element
}
break;
}
}
// now bottom not same
for (let i = 0; i < height; i++){
if (isEmpty(pixel.x, pixel.y+i, true) || pixelMap[pixel.x][pixel.y + i].element != element){
results.bottom = i
if (isEmpty(pixel.x, pixel.y+i, true)){
results.bottomelement = "air"
} else {
results.bottomelement = pixelMap[pixel.x][pixel.y + i].element
}
break;
}
}
return results
}
elements.dripstone_spike = {
color: "#927965",
category: "minecraft",
behavior: behaviors.WALL,
tempHigh: 1810,
stateHigh: "molten_dripstone",
density: 2550,
renderer: function(pixel, ctx){
if (pixel.spikeType == 1){
autoFillDrawRectangle(ctx, pixel, 1, 1/3, 0, 0)
autoFillDrawRectangle(ctx, pixel, 2/3, 1, 1/6, 0)}
else if (pixel.spikeType == 2){
autoFillDrawRectangle(ctx, pixel, 2/3, 1, 1/6, 0)
}
else if (pixel.spikeType == 3){
autoFillDrawRectangle(ctx, pixel, 2/3, 5/6, 1/6, 0)
autoFillDrawRectangle(ctx, pixel, 0.5, 1/3, 1/3, 2/3)
}
else if (pixel.spikeType == 4){
autoFillDrawRectangle(ctx, pixel, 0.5, 1/3, 1/3, 0)
autoFillDrawRectangle(ctx, pixel, 1/3, 1/3, 1/3, 1/6)
autoFillDrawRectangle(ctx, pixel, 1/6, 0.5, 1/3, 1/3)
}
else{
drawSquare(ctx, pixel.color, pixel.x, pixel.y)
}
},
tick: function(pixel){
let distance = grabDistances(pixel);
if (distance.bottom == 1)
{pixel.spikeType = 4}
else if (distance.bottom == 2)
{pixel.spikeType = 3}
else if (distance.bottom >= 3 && distance.top > 1)
{pixel.spikeType = 2}
else
{pixel.spikeType = 1}
if (!pixel.spikeType){console.log(distance)}
if (distance.topelement == "air" && distance.top == 1){
// make the entire spike fall
let fallList = []
for (let i = 0; i < height; i++){
if (!isEmpty(pixel.x, pixel.y+i, true) && pixelMap[pixel.x][pixel.y+i].element == "dripstone_spike"){
fallList.push(pixelMap[pixel.x][pixel.y+i])
} else {break}
}
fallList = fallList.reverse();
for (let i = 0; i<fallList.length;i++){
if (!tryMove(fallList[i], fallList[i].x, fallList[i].y+1)){
deletePixel(fallList[i].x, fallList[i].y)
if(!isEmpty(fallList[i].x, fallList[i].y+1, true)){
breakPixel(pixelMap[fallList[i].x][fallList[i].y+1])
}
break;
}
}
}
}
}
elements.dripstone = {
color: "#927965",
category: "minecraft",
behavior: behaviors.WALL,
tempHigh: 1810,
stateHigh: "molten_dripstone",
density: 2550
}
elements.molten_dripstone = {
color: ['#ff7b00', '#ff8d2d', '#ff9d4a', '#ffad65', '#ffbc80'],
category: "minecraft",
behavior: behaviors.MOLTEN,
tempLow: 1800,
stateLow: "dripstone",
temp: 1850,
density: 2500,
state: "liquid",
viscosity: 2000
}
elements.obsidian = { //subject to change
color: "#06030B",
category: "minecraft",
behavior: behaviors.WALL,
tempHigh: 1750,
stateHigh: "molten_obsidian",
density: 2400,
renderer: function(pixel, ctx){
autoFillColorRectangle(ctx, pixel, "#06030B", 1, 1, 0, 0)
autoFillColorRectangle(ctx, pixel, "#000001", 0.5, 1/6, 0, 0)
autoFillColorRectangle(ctx, pixel, "#000001", 1/6, 1/6, 1/6, 5/6)
autoFillColorRectangle(ctx, pixel, "#000001", 1/6, 1/6, 5/6, 2/3)
autoFillColorRectangle(ctx, pixel, "#100C1C", 1/6, 1/6, 0, 5/6)
autoFillColorRectangle(ctx, pixel, "#100C1C", 1/3, 1/5, 1/6, 0.5)
autoFillColorRectangle(ctx, pixel, "#100C1C", 1/6, 1/3, 1/3, 1/3)
autoFillColorRectangle(ctx, pixel, "#100C1C", 1/6, 1/6, 2/3, 0)
autoFillColorRectangle(ctx, pixel, "#100C1C", 1/6, 0.5, 2/3, 0.5)
autoFillColorRectangle(ctx, pixel, "#100C1C", 1/3, 1/6, 2/3, 0.5)
autoFillColorRectangle(ctx, pixel, "#100C1C", 1/3, 1/6, 0.5, 5/6)
autoFillColorRectangle(ctx, pixel, "#271E3D", 1/6, 1/6, 0, 2/3)
autoFillColorRectangle(ctx, pixel, "#271E3D", 1/6, 1/6, 1/6, 1/3)
autoFillColorRectangle(ctx, pixel, "#271E3D", 1/6, 1/6, 0.5, 0)
autoFillColorRectangle(ctx, pixel, "#271E3D", 1/6, 1/6, 5/6, 1/3)
autoFillColorRectangle(ctx, pixel, "#271E3D", 1/6, 1/6, 1/3, 5/6)
autoFillColorRectangle(ctx, pixel, "#3B2754", 1/6, 1/6, 0, 1/3)
autoFillColorRectangle(ctx, pixel, "#3B2754", 1/6, 1/6, 1/6, 1/6)
autoFillColorRectangle(ctx, pixel, "#3B2754", 1/3, 1/6, 1/3, 2/3)
autoFillColorRectangle(ctx, pixel, "#3B2754", 1/6, 1/6, 2/3, 1/3)
autoFillColorRectangle(ctx, pixel, "#3B2754", 1/6, 1/6, 5/6, 1/6)
}
}
elements.molten_obsidian = {
color: ['#ff7700', '#df6004', '#bf4905', '#9f3404', '#802000'],
category: "minecraft",
behavior: behaviors.MOLTEN,
tempLow: 1740,
stateLow: "obsidian",
temp: 1850,
density: 2300,
viscosity: 5000
}

1
mods/mod_for_mnem.js Normal file
View File

@ -0,0 +1 @@
Object.keys(elements).forEach((element)=>{if (elements[element].category == "life") {delete elements[element]}})

View File

@ -79,7 +79,6 @@ elements.paste = {
color: "#C4AA98",
behavior: behaviors.WALL,
category: "solids",
stateHigh: ["liquid_paste"],
state: "solid",
density: 230
};
@ -90,6 +89,15 @@ elements.husk = {
reactions: {},
state: "solid"
};
elements.restored_husk = {
color: ["#E0CABB", "#CAB3A0", "#CAB3A0"],
behavior: [
"XX|CR:bless%0.03|XX",
],
category: "solids",
reactions: {},
state: "solid"
};
elements.remnant = {
color: "#3C382B",
behavior: behaviors.POWDER,
@ -104,7 +112,7 @@ elements.rot = {
"XX|XX|XX",
"XX|CR:rot%0.054|XX",
],
category: "liquids",
category: "life",
viscosity: 1,
state: "liquid",
reactions: {},
@ -124,5 +132,7 @@ elements.poop.reactions.water = { "elem1":"dried_poop", "elem2":"fly" };
elements.tar.reactions.husk = { "elem1":"rot", "elem2":"fly" };
elements.husk.reactions.molasses = { "elem1":"smoke", "elem2":"remnant" };
elements.rot.reactions.fire = { "elem1":"smoke", "elem2":"cinder" };
elements.bless.reactions.husk = { "elem1":"restored_husk", "elem2":"restored_husk" };
elements.bless.reactions.rot = { "elem1":"restored_husk", "elem2":"restored_husk" };
elements.water.reactions.rot = { "elem1":"blood", "elem2":"slag" };

179
mods/moving_pixels.js Normal file
View File

@ -0,0 +1,179 @@
// created by Rain :o 20/8 2024
elements.car = {
//color: ["#E37F6F", "#B075DF", "#4F8FEF"],
color: ["#ee70aa", "#ab33ef", "#5e6eee"],
category: "special",
density: 10000,
state: "solid",
tempHigh: 400,
stateHigh: ["steel", "molten_plastic", "glass"],
breakInto: ["steel", "plastic", "glass_shard"],
reactions: {
"water": { elem1: "rust", chance: 0.003 },
"dirty_water": { elem1: "rust", chance: 0.003 },
"salt_water": { elem1: "rust", chance: 0.006 },
"grape": { elem2: "juice", chance: 0.1, color2: "#291824" },
"tomato": { elem2: "sauce", chance: 0.1 },
"egg": { elem2: "yolk", chance: 0.1 },
"malware": {elem1: "explosion"},
},
flippableX: true,
tick: function (pixel) {
if (pixel.carFlip === undefined) {
pixel.carFlip = 1; //it's the "pixel." that gives the variable to each car instance, very important :)
}
tryMove(pixel, pixel.x, pixel.y + 1); //try to move down (fall)
if (!isEmpty(pixel.x, pixel.y + 1)) { //if it didn't work (if the car is on the ground):
if (isEmpty(pixel.x + pixel.carFlip, pixel.y + 1)) {
tryMove(pixel, pixel.x + pixel.carFlip, pixel.y + 1); // move diagonally down to avoid falling when going downhill
}
else if (isEmpty(pixel.x + pixel.carFlip, pixel.y)) {
tryMove(pixel, pixel.x + pixel.carFlip, pixel.y); //move to the side (which side is derived from current carFlip state)
} else if (isEmpty(pixel.x + pixel.carFlip, pixel.y - 1)) {
tryMove(pixel, pixel.x + pixel.carFlip, pixel.y - 1); //move diagonally up the hill
} else { //if no movement possible (like when hitting a wall):
pixel.carFlip = pixel.carFlip * -1; // Update carFlip for this car instance
}
doDefaults(pixel);
}
},
};
elements.tram = {
color: "#93E493",
conduct: 1,
category: "special",
density: 10000,
state: "solid",
tempHigh: 400,
stateHigh: ["molten_aluminum", "molten_plastic", "glass"],
breakInto: ["aluminum", "plastic", "glass_shard"],
flippableX: true,
desc: "Powered by electricity. Can hang on conductive materials for suspension railway",
reactions: {
"malware": { elem2: "electric" },
},
tick: function (pixel) {
if (pixel.tramFlip === undefined) {
pixel.tramFlip = 1; //tramFlip works like carFlip for the car
}
if (pixel.charge > 0) { //only if powered by electricity
if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 1) && !isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 2)) {
var diUpPixel = pixelMap[pixel.x + 1 * pixel.tramFlip][pixel.y - 2] //establishes the variable. Must be down here because it would crash if there is no diUpPixel
if (elements[diUpPixel.element].conduct && diUpPixel.element !== "tram") { //^ is also the reason this is a seperate if statement
tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y - 1); //move diagonally upwards if there is support
}
else {
pixel.tramFlip = pixel.tramFlip * -1;
}
}
else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y) && !isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 1)) {
var sidePixel = pixelMap[pixel.x + 1 * pixel.tramFlip][pixel.y - 1]
if (elements[sidePixel.element].conduct && sidePixel.element !== "tram") {
tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y); //move to the side if there is support
}
else {
pixel.tramFlip = pixel.tramFlip * -1;
}
}
else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y + 1) && !isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y)) {
var diDownPixel = pixelMap[pixel.x + 1 * pixel.tramFlip][pixel.y]
if (elements[diDownPixel.element].conduct && diDownPixel.element !== "tram") {
tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y + 1); //move diagonally downwards if there is support
}
else {
pixel.tramFlip = pixel.tramFlip * -1;
}
}
else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y + 1) && isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y)) {
tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y + 1); //move diagonally downwards if there isn't support
}
else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y) && isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 1)) {
tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y); //move to the side if there isn't support
}
else if (isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 1) && isEmpty(pixel.x + 1 * pixel.tramFlip, pixel.y - 2)) {
tryMove(pixel, pixel.x + 1 * pixel.tramFlip, pixel.y - 1); //move diagonally upwards if there isn't support (uphill)
}
else {
pixel.tramFlip = pixel.tramFlip * -1;
}
}
else { //if not powered
if (!isEmpty(pixel.x, pixel.y - 1)) {
var upPixel = pixelMap[pixel.x][pixel.y - 1] //looks at the properties of the pixel above
if (elements[upPixel.element].conduct > 0.1 && upPixel.element !== "tram") { //if the pixel above is conductive but not tram
//nothing happens ie it doesn't fall
}
else {
tryMove(pixel, pixel.x, pixel.y + 1); //it falls down
}
}
else {
tryMove(pixel, pixel.x, pixel.y + 1); //it falls down (same as above)
}
}
doDefaults(pixel)
},
};
elements.bouncy_ball = {
color: "#e35693",
behavior: behaviors.WALL,
tempHigh: 250,
stateHigh: ["borax", "glue"],
category: "special",
conduct: 1,
tick: function (pixel) {
if (pixel.fallDist === undefined) {
pixel.fallDist = 0;
}
if (pixel.isFalling === undefined) {
pixel.isFalling = true;
}
if (pixel.isFalling) { //main loop of a bouncy ball. Functions are defined below
falling()
} else {
rising()
}
if (pixel.charge > 0) { //will bounce on electricity (doesn't work on real bouncy balls :/)
pixel.fallDist = (pixel.fallDist + 1)
rising()
}
function falling() {
if (isEmpty(pixel.x, pixel.y + 1)) {
tryMove(pixel, pixel.x, pixel.y + 1)
pixel.fallDist += 1; //counts how many pixels the ball has fallen so far
} else { //if it touched the ground
pixel.isFalling = false; //will change the outcome of the main if statement and make ball start rising
pixel.fallDist = pixel.fallDist * 3 / 4; //dynamically decreases bounce height based on how high it is, instead of constant 1 per bounce
}
}
function rising() {
if (pixel.fallDist > 0) {
tryMove(pixel, pixel.x, pixel.y - 1)
pixel.fallDist -= 1
} else {
pixel.isFalling = true;
pixel.fallDist -= 1 //makes the ball lose 1 pixel height each bounce, useful at the end when * 3/4 only results in fractions
}
}
}
};
elements.borax.reactions.slime = { elem1: "bouncy_ball", elem2: null};

54
mods/nitroglycerin.js Normal file
View File

@ -0,0 +1,54 @@
// created by Rain :o 20/8 2024
elements.glycerol = {
color: "#eeeeee",
behavior: behaviors.LIQUID,
viscosity: 1412,
category: "liquids",
state: "liquid",
density: 1261,
tempLow: 18,
tempHigh: 290,
tick: function (pixel) {
pixel.color = "rgba(250, 250, 250, 0.7)";
},
reactions: {
},
burn: 5,
burnTime: 40,
};
elements.nitro.tempHigh = 218; //More accurate detonation temperature
elements.salt_water.tempLow = -20; //melting point depression
elements.nitro.tick = function (pixel) { // Exothermic decomposition of nitroglycerin when above 60°
if (pixel.temp > 60) {
pixel.temp += 1;
if (Math.random() > 0.999) {
var possibleElements = ["oxygen", "nitrogen", "nitrogen", "steam", "steam", "steam", "carbon_dioxide", "carbon_dioxide", "carbon_dioxide"]; //array of possibilities for changing the nitroglycerin pixel
var randomElement = possibleElements[Math.floor(Math.random() * possibleElements.length)]; //randomly selecting an element from the array
changePixel(pixel, randomElement); // Change the pixel to the randomly selected element
}
}
}
if (enabledMods.includes("mods/chem.js")) {
runAfterLoad(function () {
elements.glycerol.reactions.nitric_acid = { elem1: "nitro", chance: 0.05, temp1: 70 }; //nitric acid nitrates glycerol to make nitroglycerin
elements.nitric_acid.ignore.push("glycerol", "nitro") //added my glycerol and nitro to allow for making nitroglycerin
elements.copper.reactions.sulfuric_acid = { elem1: "copper_sulfate", elem2: null, chance: 0.1 }; //this is how you can actually make CuSO4
elements.sulfuric_acid.ignore.push("copper_sulfate")
elements.grease.reactions.sodium_hydroxide = { elem1: "soap", elem2: "null", chance: 0.04, tempMin: 40 };
elements.sodium_hydroxide.ignore.push("grease", "soap", "fat");
});
} else {
elements.glycerol.reactions.acid = { elem1: "nitro", chance: 0.05, temp1: 70 }; //if we don't have nitric acid from chem.js, "acid" is a good approximation
elements.acid.ignore.push("glycerol", "nitro")
}

View File

@ -431,7 +431,7 @@ elements.destroyable_superheater = {
category:"machines",
stateLow:["iron","copper"],
tempLow: -7,
breakInto:["metal_scrap","oxidixed_copper"],
breakInto:["metal_scrap","oxidized_copper"],
},
elements.destroyable_heater = {
color: "#881111",
@ -443,7 +443,7 @@ elements.destroyable_heater = {
category:"machines",
stateLow:["iron","copper"],
tempLow: -7,
breakInto:["metal_scrap","oxidixed_copper"],
breakInto:["metal_scrap","oxidized_copper"],
},
elements.destroyable_cooler = {
color: "#111188",
@ -455,7 +455,7 @@ elements.destroyable_cooler = {
category:"machines",
stateHigh:["iron","copper"],
tempHigh: 49,
breakInto:["metal_scrap","oxidixed_copper"],
breakInto:["metal_scrap","oxidized_copper"],
},
elements.destroyable_freezer = {
color: "#1111dd",
@ -2596,6 +2596,27 @@ elements.scuffed_circle_brush = {
}
}
}
elements.scuffed_triangle_brush = {
category: "special",
color: elements.drag.color,
excludeRandom: true,
state: "solid",
movable: false,
onSelect: function(){
var answerE = prompt("Element of the brush.",(circleElem||undefined));
if (!answerE) { return }
circleElem = mostSimilarElement(answerE);
},
tick: function(pixel){
let radius = mouseSize/2
if ((pixel.y - mousePos.y + mouseSize > 2 * (pixel.x - mousePos.x) + 0.5 * mouseSize) && (pixel.y - mousePos.y + mouseSize > -2 * (pixel.x - mousePos.x) + 0.5 * mouseSize)) {
deletePixel(pixel.x, pixel.y)
createPixel(circleElem, pixel.x, pixel.y)
} else {
deletePixel(pixel.x, pixel.y)
}
}
}
function randomIntFromInterval(min, max) { // min and max included
return Math.floor(Math.random() * (max - min + 1) + min)
}
@ -3098,6 +3119,36 @@ let pistonStart = 0
let pistonEnd = 0
let pistonDistance = 1
let pistonCooldown = 10
let pistonRepeat = 1
let pistonRepeatCooldown = 1
function pistonEmit(pixel, i){
pixel.cooldown = pixel.pistonCooldown
pixel.rcooldown = pixel.pistonRepeatCooldown
var dir = [0-squareCoords[i][0], 0-squareCoords[i][1]]
var startx = pixel.x+(dir[0]*(pixel.pistonStart+1))
var starty = pixel.y+(dir[1]*(pixel.pistonStart+1))
var magnitude = pixel.pistonEnd
var endx = startx+(magnitude*dir[0])
var endy = starty+(magnitude*dir[1])
// console.log("Direction seems to be " + dir)
var jcoords
if (pixel.pullOrPush == 1){jcoords = lineCoords(startx, starty, endx, endy, 1)}
else {jcoords = lineCoords(endx, endy, startx, starty, 1)}
// console.log(startx + " is the starting x, " + starty + " is the starting y, " + endx + " is the ending x, " + endy + " is the ending y. Result is " + jcoords)
let pCoord = jcoords[0]
for (var j = 0; j < jcoords.length; j++) {
var lcoord = jcoords[j];
var lx = lcoord[0];
var ly = lcoord[1];
if (!isEmpty(lx, ly, true)){
tryMove(pixelMap[lx][ly], pCoord[0], pCoord[1], null, true)
}
pCoord[0] = lx;
pCoord[1] = ly;
}
}
elements.specific_piston_ray_emitter = {
color: "#517597",
behavior: behaviors.WALL,
@ -3115,6 +3166,12 @@ elements.specific_piston_ray_emitter = {
pistonDistance = ans4
var ans5 = parseInt(prompt("How many ticks should it wait to be charged again?", "6"))
pistonCooldown = ans5
var ans6 = parseInt(prompt("How many times should it repeat the push/pulling?", "1"))
pistonRepeat = ans6
if (pistonRepeat != 1){
var ans7 = parseInt(prompt("How many ticks should it wait between repeats?", "1"))
pistonRepeatCooldown = ans7
}
},
tick: function(pixel){
if (pixelTicks == pixel.start){
@ -3123,8 +3180,17 @@ elements.specific_piston_ray_emitter = {
pixel.pistonEnd = pistonEnd
pixel.pistonDistance = pistonDistance
pixel.pistonCooldown = pistonCooldown
pixel.pistonRepeat = pistonRepeat
pixel.pistonRepeatCooldown = pistonRepeatCooldown
}
if (!pixel.pistonRepeat){
pixel.pistonRepeat = pistonRepeat
pixel.pistonRepeatCooldown = pistonRepeatCooldown
}
if (!pixel.cooldown){pixel.cooldown = 0}
if (!pixel.rcooldown){pixel.rcooldown = 0}
if (!pixel.repeatAmounts){pixel.repeatAmounts = 0}
if (!pixel.fakei){pixel.fakei = 0}
if (pixel.cooldown < 1){
for (var i = 0; i < adjacentCoords.length; i++) {
var coord = squareCoords[i];
@ -3132,34 +3198,21 @@ elements.specific_piston_ray_emitter = {
var y = pixel.y+coord[1];
if (!isEmpty(x,y, true)){
if (pixelMap[x][y].charge && (pixelMap[x][y].element == "wire" || pixelMap[x][y].element == "insulated_wire")){
pixel.repeatAmounts = pixel.pistonRepeat
pixel.fakei = i
for (let r = 0; r < pixel.pistonDistance; r++){
pixel.cooldown = pixel.pistonCooldown
var dir = [0-squareCoords[i][0], 0-squareCoords[i][1]]
var startx = pixel.x+(dir[0]*(pixel.pistonStart+1))
var starty = pixel.y+(dir[1]*(pixel.pistonStart+1))
var magnitude = pixel.pistonEnd
var endx = startx+(magnitude*dir[0])
var endy = starty+(magnitude*dir[1])
// console.log("Direction seems to be " + dir)
var jcoords
if (pixel.pullOrPush == 1){jcoords = lineCoords(startx, starty, endx, endy, 1)}
else {jcoords = lineCoords(endx, endy, startx, starty, 1)}
// console.log(startx + " is the starting x, " + starty + " is the starting y, " + endx + " is the ending x, " + endy + " is the ending y. Result is " + jcoords)
let pCoord = jcoords[0]
for (var j = 0; j < jcoords.length; j++) {
var lcoord = jcoords[j];
var lx = lcoord[0];
var ly = lcoord[1];
if (!isEmpty(lx, ly, true)){
tryMove(pixelMap[lx][ly], pCoord[0], pCoord[1], null, true)
}
pCoord[0] = lx;
pCoord[1] = ly;
}}
pistonEmit(pixel, i);
}
pixel.repeatAmounts--
}
}
}} else {pixel.cooldown -= 1}
}} else {pixel.cooldown --}
if (pixel.rcooldown < 1 && pixel.repeatAmounts > 0){
for (let r = 0; r < pixel.pistonDistance; r++){
pistonEmit(pixel, pixel.fakei);
}
pixel.repeatAmounts--
} else {pixel.rcooldown --}
},
insulate: true,
}
@ -3610,4 +3663,61 @@ elements.copycat_filler = {
}
}
}
}
/*
top left: canvasCoord(x), canvasCoord(y)
top right: canvasCoord(x)+pixelSize, canvasCoord(y)
bottom left: canvasCoord(x), canvasCoord(y)+pixelSize
bottom right: canvasCoord(x)+pixelSize, canvasCoord(y)+pixelSize
*/
adjacentSidesToCanvas = function(x, y, px, py){
if (x == 0 && y == -1){
return [canvasCoord(px)+(0.5*pixelSize), canvasCoord(py)]
}
else if (x == 0 && y == 1){
return [canvasCoord(px)+(0.5*pixelSize), canvasCoord(py)+pixelSize]
}
else if (x == -1 && y == 0){
return [canvasCoord(px), canvasCoord(py)+(0.5*pixelSize)]
}
else if (x == 1 && y == 0){
return [canvasCoord(px)+pixelSize, canvasCoord(py)+(0.5*pixelSize)]
}
}
drawRectangle = function(ctx, color, x, y, width, height, xoffset, yoffset){
ctx.fillStyle = color;
ctx.fillRect(canvasCoord(x+xoffset), canvasCoord(y+yoffset), pixelSize*width, pixelSize*height)
}
elements.thin_pixel = {
color: "#747474",
behavior: behaviors.WALL,
category: "special",
renderer: function(pixel, ctx){
let differentAdjacent = [];
for (let i = 0; i < adjacentCoords.length; i++) {
let x = adjacentCoords[i][0] + pixel.x;
let y = adjacentCoords[i][1] + pixel.y;
if (!isEmpty(x, y, true) && pixelMap[x][y].element == "thin_pixel") {
differentAdjacent.push(adjacentCoords[i]);
}
}
ctx.globalAlpha = 1
differentAdjacent.forEach(adj => {
let canvasadjacentCoords = adjacentSidesToCanvas(adj[0], adj[1], pixel.x, pixel.y);
// if (!canvasadjacentCoords){
// console.log(adj)
// return;
// }
//console.log(canvasadjacentCoords);
ctx.beginPath();
ctx.moveTo(canvasCoord(pixel.x)+(0.5*pixelSize), canvasCoord(pixel.y)+(0.5*pixelSize));
ctx.lineTo(canvasadjacentCoords[0], canvasadjacentCoords[1]);
ctx.strokeStyle = pixel.color;
if (pixelSize*0.24>=2){ctx.lineWidth = pixelSize*0.24}else{ctx.lineWidth = 2}
ctx.stroke();
//console.log("line")
});
ctx.fillStyle = pixel.color;
ctx.fillRect(canvasCoord(pixel.x+0.38), canvasCoord(pixel.y+0.38), pixelSize*0.24, pixelSize*0.24);
}
}

232
mods/ores.js Normal file
View File

@ -0,0 +1,232 @@
function makePerlinMap(){
return Array.from({ length: Math.pow(12, 2) }, () => Math.random() * 2 * Math.PI);
}
function perlinNoise(C, x, y) {
// Helper function to calculate dot product
function dotProduct(a, b) {
return a[0] * b[0] + a[1] * b[1];
}
// Function d
function d(index) {
return [Math.cos(C[index]), Math.sin(C[index])];
}
// Function f
function f(x, y, t) {
return x + (y - x) * (6 * t ** 5 - 15 * t ** 4 + 10 * t ** 3);
}
// Function g
function g(x, y, z, w) {
const dx = x - z;
const dy = y - w;
return dotProduct([dx, dy], d(z + w * 6 + 1));
}
// Main function h
const x0 = Math.floor(x);
const x1 = Math.ceil(x);
const y0 = Math.floor(y);
const y1 = Math.ceil(y);
const g00 = g(x, y, x0, y0);
const g10 = g(x, y, x1, y0);
const g01 = g(x, y, x0, y1);
const g11 = g(x, y, x1, y1);
const fx = f(g00, g10, x - x0);
const fy = f(g01, g11, x - x0);
return Math.sqrt(2) * f(fx, fy, y - y0);
}
function getScalingFactor(d1, d2){
return Math.min(d1, d2)/6
}
function scaledPerlinNoise(C, x, y){
let scale = getScalingFactor(width, height)
return perlinNoise(C, x/scale, y/scale)
}
if (!eLists.oreSpawnConditions){eLists.oreSpawnConditions = {}}
eLists.oreSpawnConditions = {...eLists.oreSpawnConditions, ...{
uranium: 0.67,
diamond: 0.67,
gold: 0.57,
pyrite: 0.56,
silver: 0.54,
iron: 0.47,
copper: 0.42,
charcoal: 0.42
}}
if (!eLists.oreRgb){eLists.oreRgb = {}}
eLists.oreRgb = {...eLists.oreRgb, ...{
charcoal: "rgba(54, 54, 54, ",
iron: "rgba(247, 218, 157, ",
silver: "rgba(206, 206, 206, ",
copper: "rgba(151, 80, 10, ",
gold: "rgba(255, 215, 0, ",
pyrite: "rgba(134, 119, 31, ",
diamond: "rgba(125, 214, 255, ",
uranium: "rgba(0, 100, 8, "
}}
if (!eLists.idealOreHeight){eLists.idealOreHeight = {}}
eLists.idealOreHeight = {...eLists.idealOreHeight, ...{
uranium: 0.2,
diamond: 0.06,
gold: 0.3,
pyrite: 0.34,
silver: 0.4,
iron: 0.7,
copper: 0.6,
charcoal: 0.4
}}
let oldclearall = clearAll
let oreMap = []
clearAll = function(skipworldgen){
oreMap = []
oldclearall(skipworldgen)
oreMaps = {}
for (let ore of Object.keys(eLists.oreSpawnConditions)){
oreMaps[ore] = makePerlinMap()
}
//console.log(oreMaps)
for (let x in pixelMap){
oreMap.push([]);
for (let y in pixelMap){
oreMap[x].push(false);
for (let ore in eLists.oreSpawnConditions){
if ((scaledPerlinNoise(oreMaps[ore], x, y)-((Math.abs(y-((1-eLists.idealOreHeight[ore])*height)))/(1.33*height))+0.07) > eLists.oreSpawnConditions[ore]){
oreMap[x][y] = ore
//console.log(ore + " at " + x + ", " + y)
break;
}
}
}
}
}
adjacentToCanvas = function(x, y, px, py){
if (x == 0 && y == -1){
return [[canvasCoord(px), canvasCoord(py)], [canvasCoord(px)+pixelSize, canvasCoord(py)]]
}
if (x == 0 && y == 1){
return [[canvasCoord(px), canvasCoord(py)+pixelSize], [canvasCoord(px)+pixelSize, canvasCoord(py)+pixelSize]]
}
if (x == -1 && y == 0){
return [[canvasCoord(px), canvasCoord(py)], [canvasCoord(px), canvasCoord(py)+pixelSize]]
}
if (x == 1 && y == 0){
return [[canvasCoord(px)+pixelSize, canvasCoord(py)], [canvasCoord(px)+pixelSize, canvasCoord(py)+pixelSize]]
}
}
renderEachPixel(function(pixel, ctx) {
if (currentElement == "ore_xray") {
if (Math.abs(pixel.x - mousePos.x) <= mouseSize/2 && Math.abs(pixel.y - mousePos.y) <= mouseSize/2) {
if (!oreMap[pixel.x][pixel.y]) {
drawSquare(ctx, "rgba(0, 0, 0, 0.7)", pixel.x, pixel.y, 1, 1);
} else {
drawSquare(ctx, eLists.oreRgb[oreMap[pixel.x][pixel.y]] + "0.7)", pixel.x, pixel.y, 1, 1);
let differentAdjacent = [];
for (let i = 0; i < adjacentCoords.length; i++) {
let x = adjacentCoords[i][0] + pixel.x;
let y = adjacentCoords[i][1] + pixel.y;
if (isEmpty(x, y, true)) {
differentAdjacent.push(adjacentCoords[i]);
} else {
let otherPixel = pixelMap[x][y];
if (oreMap[x][y] != oreMap[pixel.x][pixel.y] && (oreMap[x][y] == false || eLists.oreSpawnConditions[oreMap[pixel.x][pixel.y]] >= eLists.oreSpawnConditions[oreMap[x][y]])) {
differentAdjacent.push(adjacentCoords[i]);
}
}
}
differentAdjacent.forEach(adj => {
let canvasadjacentCoords = adjacentToCanvas(adj[0], adj[1], pixel.x, pixel.y);
// if (!canvasadjacentCoords){
// console.log(adj)
// return;
// }
//console.log(canvasadjacentCoords);
ctx.beginPath();
ctx.moveTo(canvasadjacentCoords[0][0], canvasadjacentCoords[0][1]);
ctx.lineTo(canvasadjacentCoords[1][0], canvasadjacentCoords[1][1]);
ctx.strokeStyle = eLists.oreRgb[oreMap[pixel.x][pixel.y]]+"1)";
ctx.lineWidth = 4;
ctx.stroke();
//console.log("line")
});
}
}
}
if (oreMap.length < 2){
clearAll();
}
});
let validGroundElements = []
for (let elementi in elements){
if (elements[elementi].category == "land"){
validGroundElements.push(elementi)
}
}
elements.pickaxe = {
category: "tools",
color: "#b0b0b0",
canPlace: false,
maxSize: 5,
tool: function(pixel){
if (oreMap[pixel.x][pixel.y].length > 0 && validGroundElements.includes(pixel.element)){
if (Math.random()>0.95){
changePixel(pixel, oreMap[pixel.x][pixel.y], false)
oreMap[pixel.x][pixel.y] = false
}
else if (Math.random() > 0.9){
deletePixel(pixel.x, pixel.y)
oreMap[pixel.x][pixel.y] = false
}
}
if (settings.limitless){elements.pickaxe.maxSize = 10000} else {elements.pickaxe.maxSize = 5}
}
}
elements.chisel = {
category: "tools",
color: "#8d8574",
canPlace: false,
maxSize: 3,
tool: function(pixel){
if (oreMap[pixel.x][pixel.y].length > 0 && validGroundElements.includes(pixel.element)){
if (Math.random()>0.95){
changePixel(pixel, oreMap[pixel.x][pixel.y], false)
oreMap[pixel.x][pixel.y] = false
}
else if (Math.random() > 0.98){
deletePixel(pixel.x, pixel.y)
oreMap[pixel.x][pixel.y] = false
}
}
if (settings.limitless){elements.chisel.maxSize = 10000} else {elements.chisel.maxSize = 3}
}
}
elements.brush = {
category: "tools",
color: "#805c2e",
canPlace: false,
maxSize: 1,
tool: function(pixel){
if (oreMap[pixel.x][pixel.y].length > 0 && validGroundElements.includes(pixel.element)){
if (Math.random()>0.985){
changePixel(pixel, oreMap[pixel.x][pixel.y], false)
oreMap[pixel.x][pixel.y] = false
}
}
if (settings.limitless){elements.brush.maxSize = 10000} else {elements.brush.maxSize = 1}
}
}
elements.ore_xray = {
category: "tools",
color: "#220f27",
canPlace: false,
maxSize: 15,
tool: function(pixel){
if (settings.limitless){elements.ore_xray.maxSize = 10000} else {elements.ore_xray.maxSize = 15}
}
}

270
mods/planet.js Normal file
View File

@ -0,0 +1,270 @@
// Define the corrected biomes with heights
var mercuryLayers = [
{ layers: ["basalt", "iron"], height: 0.6 },
{ layers: ["nickel"], height: 0.2 },
{ layers: ["iron"], height: 0.2 }
];
var venusLayers = [
{ layers: ["basalt", "limestone"], height: 0.5 },
{ layers: ["sand", "ash", "clay"], height: 0.25 },
{ layers: ["tuff"], height: 0.15 },
{ layers: ["sulfur", ["basalt", "sand"]], height: 0.1 }
];
var earthLayers = [
{ layers: ["rock", "basalt", "tuff", "limestone"], height: 0.55 },
{ layers: ["clay", "mudstone", "clay_soil"], height: 0.3 },
{ layers: [["sand", "wet_sand", "clay"], ["grass", "gravel", "dirt"]], height: 0.15 }
];
var marsLayers = [
{ layers: ["iron", "nickel"], height: 0.3 },
{ layers: ["iron", "nickel", "rust"], height: 0.15 },
{ layers: ["iron", "nickel", "rust", "rust"], height: 0.15 },
{ layers: ["rust"], height: 0.4 }
];
function tryCreateStaticPixel(pixelType, x, y) {
var staticPixelType = "static_" + pixelType;
// Check if the static version of the pixel type exists
if (!elements[staticPixelType]) {
// Create the static version of the pixel type
elements[staticPixelType] = Object.assign({}, elements[pixelType], {
behavior: behaviors.WALL,
tick: undefined
});
}
// Create the static pixel
tryCreatePixel(staticPixelType, x, y);
}
function getRandomWeightedElement(weightedList) {
// Parse the input string into an array of objects with name and weight properties
const elements = weightedList.split(',').map(item => {
const [name, weight] = item.split('%');
return { name: name.trim(), weight: parseFloat(weight) };
});
// Calculate the total weight
const totalWeight = elements.reduce((total, element) => total + element.weight, 0);
// Generate a random number between 0 and totalWeight
const randomWeight = Math.random() * totalWeight;
// Find the element corresponding to the random weight
let cumulativeWeight = 0;
for (const element of elements) {
cumulativeWeight += element.weight;
if (randomWeight < cumulativeWeight) {
return element.name;
}
}
}
// Function to load a script dynamically
function loadScript(url) {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = url;
document.head.appendChild(script);
}
function circleSimplexNoise1D(simplex, theta) {
return simplex.noise2D(Math.cos(theta * Math.PI / 180), Math.sin(theta * Math.PI / 180));
}
// Load the simplex-noise library
loadScript("https://cdnjs.cloudflare.com/ajax/libs/simplex-noise/2.4.0/simplex-noise.min.js");
function getRandomElement(layer) {
if (!layer || layer.length === 0) {
return null; // Return null or handle the error case
}
return layer[Math.floor(Math.random() * layer.length)];
}
function generatePlanet(config, x, y, radius) {
var simplex = new SimplexNoise();
var centerX = x;
var centerY = y;
var planetRadius = radius;
var cloudStartRadius = planetRadius + 7;
var cloudEndRadius = planetRadius + 14;
// Generate terrain
for (var r = 0; r <= planetRadius; r++) {
var step = 0.5;
if (r <= 50) { step = 1; }
if (r <= 20) { step = 2; }
for (var theta = 0; theta <= 360; theta += step) {
var x = Math.round(centerX + r * Math.cos(theta * Math.PI / 180));
var y = Math.round(centerY + r * Math.sin(theta * Math.PI / 180));
if (x >= 0 && x < width && y >= 0 && y < height) {
var distance = Math.sqrt(Math.pow(x - centerX, 2) + Math.pow(y - centerY, 2));
var noise = (-Math.abs(circleSimplexNoise1D(simplex, theta * 0.7)) * 0.5) + (-Math.abs(circleSimplexNoise1D(simplex, theta * 2.5)) * 0.3);
var noisyDistance = distance - (noise * planetRadius * 0.3);
if (noisyDistance <= planetRadius) {
// Determine the layer based on distance from center
var totalHeight = 0;
for (var i = 0; i < config.biomes.length; i++) {
totalHeight += config.biomes[i].height;
}
var cumulativeHeight = 0;
var chosenLayer = null;
for (var i = 0; i < config.biomes.length; i++) {
var biome = config.biomes[i];
var layerHeight = (biome.height / totalHeight) * planetRadius;
if (noisyDistance >= cumulativeHeight && noisyDistance < cumulativeHeight + layerHeight) {
chosenLayer = biome.layers;
// If chosenLayer is a list of lists, pick a sublayer based on noise
if (Array.isArray(chosenLayer) && Array.isArray(chosenLayer[0])) {
var sublayerNoise = (circleSimplexNoise1D(simplex, theta) + 1) / 2;
var sublayerIndex = Math.floor(sublayerNoise * chosenLayer.length);
if (sublayerIndex < 0) {
sublayerIndex = 0;
} else if (sublayerIndex >= chosenLayer.length) {
sublayerIndex = chosenLayer.length - 1;
}
chosenLayer = chosenLayer[sublayerIndex];
}
break;
}
cumulativeHeight += layerHeight;
}
var element = getRandomElement(chosenLayer);
if (element) {
tryCreateStaticPixel(element, x, y);
}
}
}
}
}
if (config.oceanElements) {
for (var i = centerX - planetRadius; i <= centerX + planetRadius; i++) {
for (var j = centerY - planetRadius; j <= centerY + planetRadius; j++) {
if (i >= 0 && i < width && j >= 0 && j < height) {
var distanceFromCenter = Math.sqrt(Math.pow(i - centerX, 2) + Math.pow(j - centerY, 2));
if (distanceFromCenter > planetRadius - 40 && distanceFromCenter <= planetRadius - 4) {
// Place ocean in the ring around the planet
tryCreateStaticPixel(getRandomWeightedElement(config.oceanElements), i, j);
}
}
}
}
}
if (config.cloudElements) {
for (var r = cloudStartRadius; r <= cloudEndRadius; r++) {
var step = 1;
for (var theta = 0; theta <= 360; theta += step) {
var x = Math.round(centerX + r * Math.cos(theta * Math.PI / 180));
var y = Math.round(centerY + r * Math.sin(theta * Math.PI / 180));
if (x >= 0 && x < width && y >= 0 && y < height) {
var distance = Math.sqrt(Math.pow(x - centerX, 2) + Math.pow(y - centerY, 2));
var cloudNoise = simplex.noise2D(x * 0.05, y * 0.05) + simplex.noise2D(x * 0.17, y * 0.17);
// Adjust cloud density based on distance from planet
var minCloudThreshold = 0.5 + config.cloudDensityBias; // Minimum threshold closer to the planet
var maxCloudThreshold = 0.8 + config.cloudDensityBias; // Maximum threshold further from the planet
// Interpolate threshold based on distance from planet
var t = (r - cloudStartRadius) / (cloudEndRadius - cloudStartRadius);
var threshold = minCloudThreshold + t * (maxCloudThreshold - minCloudThreshold);
if (cloudNoise > threshold) {
tryCreateStaticPixel(getRandomWeightedElement(config.cloudElements), x, y);
}
}
}
}
}
}
var mercuryConfig = {
biomes: mercuryLayers,
cloudElements: "",
cloudDensityBias: 0.0
};
var venusConfig = {
biomes: venusLayers,
cloudElements: "ammonia%70,acid_cloud%30",
cloudDensityBias: 0.2
};
var earthConfig = {
biomes: earthLayers,
oceanElements: "salt_water%80,water%20",
cloudElements: "cloud%100",
cloudDensityBias: 0.0
};
var marsConfig = {
biomes: marsLayers,
cloudElements: "",
cloudDensityBias: 0.0
};
elements.planetMercury = {
behavior: behaviors.WALL,
category: "special",
maxSize: 1,
tick: function(pixel) {
if (pixel.start === pixelTicks) {
deletePixel(pixel.x, pixel.y);
generatePlanet(mercuryConfig, pixel.x, pixel.y, 13);
}
}
};
elements.planetVenus = {
behavior: behaviors.WALL,
category: "special",
maxSize: 1,
tick: function(pixel) {
if (pixel.start === pixelTicks) {
deletePixel(pixel.x, pixel.y);
generatePlanet(venusConfig, pixel.x, pixel.y, 30);
}
}
};
elements.planetEarth = {
behavior: behaviors.WALL,
category: "special",
maxSize: 1,
tick: function(pixel) {
if (pixel.start === pixelTicks) {
deletePixel(pixel.x, pixel.y);
generatePlanet(earthConfig, pixel.x, pixel.y, 33);
}
}
};
elements.planetMars = {
behavior: behaviors.WALL,
category: "special",
maxSize: 1,
tick: function(pixel) {
if (pixel.start === pixelTicks) {
deletePixel(pixel.x, pixel.y);
generatePlanet(marsConfig, pixel.x, pixel.y, 20);
}
}
};

93
mods/plastic.js Normal file
View File

@ -0,0 +1,93 @@
// created by Rain :o 20/8 2024
elements.water_bottle = {
color: "#a8d2e3",
behavior: behaviors.STURDYPOWDER,
category: "powders",
state: "solid",
density: 800,
breakInto: ["water_everywhere", "water_everywhere", "water_everywhere", "water_everywhere", "microplastic"],
tempHigh: 250,
stateHigh: ["molten_plastic", "water_everywhere", "water_everywhere"],
};
elements.head.reactions.water_bottle = { elem2: ["plastic", "water", null, null, null], chance: 0.1 };
elements.body.reactions.water_bottle = { elem2: ["plastic", "water", null, null, null], chance: 0.1 };
elements.water_everywhere = {
color: "#8882e3",
behavior: [
"CR:water_everywhere%20 AND CR:water|CR:water_everywhere%20 AND CR:water|CR:water_everywhere%20 AND CR:water",
"CR:water_everywhere%20 AND CR:water|XX%20 AND CH:water|CR:water_everywhere%20 AND CR:water",
"CR:water_everywhere%20 AND CR:water|CR:water_everywhere%20 AND CR:water|CR:water_everywhere%20 AND CR:water",
],
category: "liquids",
state: "solid",
density: 800,
hidden: true,
};
elements.microplastic = {
color: ["#adc7c9", "#cadadb", "#6cbda8", "#62d5d4", "#b3b47b"],
behavior: [
"XX|XX|XX",
"XX|XX|XX",
"M2%25|M1%50|M2%25",
],
category: "powders",
state: "solid",
density: 700,
tempHigh: 250,
stateHigh: "molten_plastic",
reactions: {
"fish": { elem1: null, elem2: "meat", chance: 0.01 },
"glue": { elem1: "bead", elem2: null, chance: 0.03 },
},
};
elements.plastic.breakInto = "microplastic";
elements.cellulose.reactions.vinegar = { elem1: "bioplastic", elem2: null, tempMin: 40, chance: 0.1};
elements.bioplastic = {
color: "#eeeeaa",
behavior: behaviors.WALL,
category: "solids",
tempHigh: 180,
stateHigh: "molten_bioplastic",
breakInto: "bioplastic_crumbs",
alias: "Cellulose acetate",
desc: "It's biodegradable :)",
};
elements.bioplastic_crumbs = {
color: ["#dfd499", "#c0e8a0", "#dfab87"],
hidden: true,
behavior: behaviors.POWDER,
category: "powders",
tempHigh: 180,
stateHigh: "molten_bioplastic",
desc: "small pieces of cellulose acetate"
};
elements.worm.reactions.bioplastic = { elem2: ["carbon_dioxide", null, null], chance: 0.05, func: behaviors.FEEDPIXEL };
elements.worm.reactions.bioplastic_crumbs = { elem2: ["carbon_dioxide", null, null], chance: 0.05, func: behaviors.FEEDPIXEL };
elements.worm.behavior = [
"SW:dirt,sand,gravel,ash,mycelium,mud,wet_sand,clay_soil,water,salt_water,dirty_water,primordial_soup,blood,infection,color_sand,bioplastic%3|XX|SW:dirt,sand,gravel,ash,mycelium,mud,wet_sand,clay_soil,water,salt_water,dirty_water,primordial_soup,blood,infection,color_sand,bioplastic,bioplastic_crumbs%3",
"M2%10|XX|M2%10",
"SW:dirt,sand,gravel,ash,mycelium,mud,wet_sand,clay_soil,water,salt_water,dirty_water,primordial_soup,blood,infection,color_sand,bioplastic%3|M1|SW:dirt,sand,gravel,ash,mycelium,mud,wet_sand,clay_soil,water,salt_water,dirty_water,primordial_soup,blood,infection,color_sand,bioplastic,bioplastic_crumbs%3",
];
elements.cell.reactions.bioplastic = { elem2: ["carbon_dioxide", null, null], chance: 0.02, func: behaviors.FEEDPIXEL };
elements.cell.reactions.bioplastic_crumbs = { elem2: ["carbon_dioxide", null, null], chance: 0.02, func: behaviors.FEEDPIXEL };
elements.molten_bioplastic = {
color: "#ccccac",
behavior: behaviors.LIQUID,
viscosity: 300,
category: "states",
state: "liquid",
tempLow: 150,
stateLow: "bioplastic",
temp: 160,
density: 1300,
hidden: true,
};

42
mods/random_fixes.js Normal file
View File

@ -0,0 +1,42 @@
//Made by SuperASAX or SuperAAX
elements.metal_scrap = {
color: ["#b0afb4","#8c8f98","#cbcdcd","#6c6c6a","#fef9ff"],
behavior: behaviors.POWDER,
reactions: {
"rust": { elem1:null, elem2:"thermite", chance:0.1 },
},
tempHigh: 1538,
category: "powders",
density: 2720,
state: "solid",
conduct: 0.43,
hardness: 0.266,
stateHigh:"molten_metal_scrap"
},
elements.molten_metal_scrap = {
color: ["#b0afb4","#8c8f98","#cbcdcd","#6c6c6a","#fef9ff"],
behavior: behaviors.MOLTEN,
category: "liquids",
density: 2720,
state: "liquid",
temp: 1600,
conduct: 0.43,
hidden: true,
hardness: 0.266,
tempLow: 1538,
stateLow: "metal_scrap",
tick: function(pixel) {
var randomNumGot=Math.random()
if (randomNumGot < 0.15) {
changePixel(pixelMap[pixel.x][pixel.y],"molten_tin");
}
if (randomNumGot < 0.30 && randomNumGot > 0.15) {
changePixel(pixelMap[pixel.x][pixel.y],"molten_aluminum");
}
if (randomNumGot < 0.45 && randomNumGot > 0.30) {
changePixel(pixelMap[pixel.x][pixel.y],"molten_brass");
}
}
};

View File

@ -1,3 +1,5 @@
/* mod by nekonico aka doobienecoarc */
window.addEventListener("load", () => {
document.getElementById("elementButton-mask_head")?.remove()
})
@ -37,8 +39,6 @@ window.addEventListener("load", () => {
// Coding junk above this point
// also hi jonny ray
elements.SCP_008 = {
color: "#11111f",
behavior: [
@ -1116,16 +1116,16 @@ elements.shy_body = {
}
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;
pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x+3, pixel.y-1, true) && pixelMap[pixel.x+2][pixel.y-1].element == "head") {
pixel.panic += 0.1;
pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x+4, pixel.y-1, true) && pixelMap[pixel.x+4][pixel.y-1].element == "head") {
pixel.panic += 0.1;
pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x+5, pixel.y-1, true) && pixelMap[pixel.x+5][pixel.y-1].element == "head") {
pixel.panic += 0.1;
pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x+5, pixel.y-1, true) && pixelMap[pixel.x+5][pixel.y-1].element == "head") {
pixel.panic += 0.1;
@ -1139,19 +1139,31 @@ elements.shy_body = {
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 (!isEmpty(pixel.x+9, pixel.y-1, true) && pixelMap[pixel.x+9][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x+10, pixel.y-1, true) && pixelMap[pixel.x+10][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x+11, pixel.y-1, true) && pixelMap[pixel.x+11][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x+12, pixel.y-1, true) && pixelMap[pixel.x+12][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;
pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x-3, pixel.y-1, true) && pixelMap[pixel.x-3][pixel.y-1].element == "head") {
pixel.panic += 0.1;
pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x-4, pixel.y-1, true) && pixelMap[pixel.x-4][pixel.y-1].element == "head") {
pixel.panic += 0.1;
pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x-5, pixel.y-1, true) && pixelMap[pixel.x-5][pixel.y-1].element == "head") {
pixel.panic += 0.1;
pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x-5, pixel.y-1, true) && pixelMap[pixel.x-5][pixel.y-1].element == "head") {
pixel.panic += 0.1;
@ -1165,6 +1177,18 @@ elements.shy_body = {
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 (!isEmpty(pixel.x-9, pixel.y-1, true) && pixelMap[pixel.x-9][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x-10, pixel.y-1, true) && pixelMap[pixel.x-10][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x-11, pixel.y-1, true) && pixelMap[pixel.x-11][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x-12, pixel.y-1, true) && pixelMap[pixel.x-12][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
}
},
density: 1080,

View File

@ -0,0 +1,29 @@
//texture_pack_by_jayd
document.body.style.backgroundImage = 'url("https://jayd-rubies.github.io/1236951076024877107.png")';
gameDiv.style.border = "0px solid #ffffff";
function drawCursor() {
canvas.style.backgroundColor = "#00000000";
var layerCtx = canvasLayers.gui.getContext('2d');
var mouseOffset = Math.trunc(mouseSize/2);
var topLeft = [mousePos.x-mouseOffset,mousePos.y-mouseOffset];
var bottomRight = [mousePos.x+mouseOffset,mousePos.y+mouseOffset];
// Draw a square around the mouse
layerCtx.strokeStyle = "#FFFFFF80";
layerCtx.strokeRect(topLeft[0]*pixelSize,topLeft[1]*pixelSize,(bottomRight[0]-topLeft[0]+1)*pixelSize,(bottomRight[1]-topLeft[1]+1)*pixelSize);
// draw one transparent pixel in the center
if (settings.precision) {
layerCtx.fillStyle = "#ffffffc8";
layerCtx.fillRect(mousePos.x*pixelSize,mousePos.y*pixelSize,pixelSize,pixelSize);
}
if (shaping) {
if (shaping === 1) { // Draw a white line from shapeStart.x to shapeStart.y
layerCtx.beginPath();
layerCtx.strokeStyle = "#FFFFFF80";
layerCtx.lineWidth = 2;
layerCtx.moveTo(shapeStart.x*pixelSize+pixelSizeHalf, shapeStart.y*pixelSize+pixelSizeHalf);
layerCtx.lineTo(mousePos.x*pixelSize+pixelSizeHalf, mousePos.y*pixelSize+pixelSizeHalf);
layerCtx.stroke();
layerCtx.lineWidth = 1;
}
}
}

View File

@ -1,14 +1,14 @@
// RedBirdly's mod to draw lines between transmitters/receivers
// logicgates.js required
// logicgates.js or wifi.js required
let logicReceivers = [];
let logicTransmitters = [];
// let receivers = [];
// let transmitters = [];
let receivers = [];
let transmitters = [];
function updateLogicLists() {
// receivers = [];
// transmitters = [];
receivers = [];
transmitters = [];
logicReceivers = [];
logicTransmitters = [];
@ -18,11 +18,11 @@ function updateLogicLists() {
logicReceivers.push(pixel);
} else if (pixel.element === "logic_transmitter") {
logicTransmitters.push(pixel);
} /*else if (pixel.element === "receiver") {
} else if (pixel.element === "receiver") {
receivers.push(pixel);
} else if (pixel.element === "transmitter") {
transmitters.push(pixel);
}*/
}
}
}
@ -67,12 +67,21 @@ function drawLinks() {
}
}
}
// Iterate through transmitters and receivers to draw lines for linked channels
for (const transmitter of transmitters) {
for (const receiver of receivers) {
if (transmitter._channel === receiver._channel) {
ctx.beginPath();
ctx.moveTo(transmitter.x * pixelSize + pixelSizeHalf, transmitter.y * pixelSize + pixelSizeHalf);
ctx.lineTo(receiver.x * pixelSize + pixelSizeHalf, receiver.y * pixelSize + pixelSizeHalf);
ctx.strokeStyle = "RGBA(0,0,255,0.2)";
ctx.lineWidth = 2;
ctx.stroke();
}
}
}
}
var originalDrawPixels2 = drawPixels;
drawPixels = function(forceTick=false) {
originalDrawPixels2(forceTick);
updateLogicLists();
drawLinks();
};
resetInterval(tps);
renderPostPixel(updateLogicLists);
renderPostPixel(drawLinks);