Add files via upload
This commit is contained in:
parent
5082c23afd
commit
150ff5e1ef
|
|
@ -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};
|
||||
|
|
@ -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")
|
||||
}
|
||||
|
|
@ -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,
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue