This commit is contained in:
Laetitia (O-01-67) 2022-12-18 13:43:22 -05:00 committed by GitHub
parent 3e0bfdff6a
commit 58e8439e12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 4 deletions

View File

@ -1,7 +1,8 @@
var modName = "mods/random_rocks.js";
var onTryMoveIntoMod = "mods/onTryMoveInto.js";
var libraryMod = "mods/code_library.js";
if(enabledMods.includes(libraryMod)) {
if(enabledMods.includes(onTryMoveIntoMod) && enabledMods.includes(libraryMod)) {
elements.solid_rock = {
color: ["#808080","#4f4f4f","#949494"],
behavior: behaviors.WALL,
@ -46,7 +47,6 @@ if(enabledMods.includes(libraryMod)) {
state: "solid",
density: 1250,
breakInto: "corrupt_rock",
reactions: elements.corrupt_land.reactions,
tick: function(pixel) {
var randomNeighborOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)];
var rfX = pixel.x+randomNeighborOffset[0];
@ -61,9 +61,14 @@ if(enabledMods.includes(libraryMod)) {
};
},
};
runAfterLoad(function() {
elements.corrupt_solid_rock.reactions = elements.corrupt_land.reactions;
});
}
} else {
alert(`The ${libraryMod} mod is required and has been automatically inserted (reload for this to take effect).`)
enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod)
if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) };
if(!enabledMods.includes(onTryMoveIntoMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,onTryMoveIntoMod) };
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert(`The "${libraryMod}" and "${onTryMoveIntoMod}" mods are all required; any missing mods in this list have been automatically inserted (reload for this to take effect).`)
};