Free javascript Hosting


apple.js

Uploaded on May 25 2022 15:29 by chelovekapelsin085

// Adding elements:
elements.apple = {
color: "#ff0000",
behavior: behaviors.POWDER,
category: "powders",
viscosity: 0,
state: "powder",
density: 720,
};

// Changing existing elements:
elements.water.color = "#ff0000";
elements.water.behavior = behaviors.WALL;

// Removing elements:
// Be aware, things may break
delete elements.ketchup;

// Adding behavior presets:
behaviors.SELFDELETE = [
"XX|XX|XX",
"XX|DL|XX",
"XX|XX|XX",
];

// Raw JavaScript behaviors:
behaviors.mud.tick = function(pixel) {
if (tryMove(pixel, pixel.x, pixel.y+1)) {
console.log("Moved!");
}
else {
console.log("Couldn't move!")
}
};

// Create a new tool:
elements.sand_exploder = {
color: "#ff0000",
tool: function(pixel) {
if (pixel.element == "sand") {
pixel.element = "explosion"
}
},
category: "tools",
};

// Add reactions to existing elements
if (!elements.juice.reactions) { // Include this block once
elements.juice.reactions = {} // This creates the property if it doesn't exist
}
elements.water.reactions.mayo = { "elem1":null, "elem2":"apple_juice" }

// Run after all mods are loaded, for cross-mod compatibility
runAfterLoad(function() {
// Your code here
console.log("Hello World!");
});

// Run if another mod is active
if (enabledMods.includes("apple.js")) {
runAfterLoad(function() {
// Your code here
console.log("Hello World!");
});
}

// Creating eLists:
eLists.CONDIMENT = ["ketchup","melted_cheese","mayo"];
// Adding elements to eLists:
eLists.CONDIMENT.push("honey");

Back to list