mods can now work together
This commit is contained in:
parent
7919d297bc
commit
eaeb8607cb
|
|
@ -3,6 +3,9 @@
|
||||||
+ Explosives Update
|
+ Explosives Update
|
||||||
+ Machines Update
|
+ Machines Update
|
||||||
|
|
||||||
|
[Version 0.9.1]
|
||||||
|
~ Mods can now work together (e.g. having reactions with elements from other mods, stateHighs, etc.)
|
||||||
|
|
||||||
[Version 0.9 - Mod Manager Update]
|
[Version 0.9 - Mod Manager Update]
|
||||||
+ Mod Manager Menu
|
+ Mod Manager Menu
|
||||||
+ Clay Soil
|
+ Clay Soil
|
||||||
|
|
|
||||||
79
index.html
79
index.html
|
|
@ -3888,6 +3888,7 @@
|
||||||
if (argto.includes(",")) {
|
if (argto.includes(",")) {
|
||||||
var argto = argto.split(",")[Math.floor(Math.random()*argto.split(",").length)];
|
var argto = argto.split(",")[Math.floor(Math.random()*argto.split(",").length)];
|
||||||
}
|
}
|
||||||
|
if (elements[argto]) {
|
||||||
if ((newPixel.element != argto) && (argfrom == null || argfrom == newPixel.element)) {
|
if ((newPixel.element != argto) && (argfrom == null || argfrom == newPixel.element)) {
|
||||||
newPixel.element = argto;
|
newPixel.element = argto;
|
||||||
newPixel.color = pixelColorPick(newPixel);
|
newPixel.color = pixelColorPick(newPixel);
|
||||||
|
|
@ -3903,6 +3904,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//Swap
|
//Swap
|
||||||
else if (b == "SW") {
|
else if (b == "SW") {
|
||||||
if (!isEmpty(newCoords.x,newCoords.y,true)) {
|
if (!isEmpty(newCoords.x,newCoords.y,true)) {
|
||||||
|
|
@ -3926,10 +3928,12 @@
|
||||||
else if (arg.includes(",")) {
|
else if (arg.includes(",")) {
|
||||||
arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)];
|
arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)];
|
||||||
}
|
}
|
||||||
|
if (elements[arg]) {
|
||||||
createPixel(arg,newCoords.x,newCoords.y);
|
createPixel(arg,newCoords.x,newCoords.y);
|
||||||
pixelMap[newCoords.x][newCoords.y].temp = pixel.temp
|
pixelMap[newCoords.x][newCoords.y].temp = pixel.temp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Clone self
|
// Clone self
|
||||||
else if (b == "CL") {
|
else if (b == "CL") {
|
||||||
if (isEmpty(newCoords.x,newCoords.y)) {
|
if (isEmpty(newCoords.x,newCoords.y)) {
|
||||||
|
|
@ -3988,10 +3992,12 @@
|
||||||
if (arg != null && arg.includes(",")) {
|
if (arg != null && arg.includes(",")) {
|
||||||
arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)];
|
arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)];
|
||||||
}
|
}
|
||||||
|
if (elements[arg]) {
|
||||||
if (b=="LB") {leaveBehind = arg;}
|
if (b=="LB") {leaveBehind = arg;}
|
||||||
else if (b=="L1") {leaveBehind1 = arg;}
|
else if (b=="L1") {leaveBehind1 = arg;}
|
||||||
else if (b=="L2") {leaveBehind2 = arg;}
|
else if (b=="L2") {leaveBehind2 = arg;}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//Change color
|
//Change color
|
||||||
else if (b == "CC") {
|
else if (b == "CC") {
|
||||||
if (!isEmpty(newCoords.x,newCoords.y,true)) {
|
if (!isEmpty(newCoords.x,newCoords.y,true)) {
|
||||||
|
|
@ -5210,6 +5216,79 @@ for (var k = 0; k < b0.split(" AND ").length; k++) {
|
||||||
if (elements[key].behavior[1][1].includes("RT")) {
|
if (elements[key].behavior[1][1].includes("RT")) {
|
||||||
elements[key].rotatable = true;
|
elements[key].rotatable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the element has reactions, loop through each one (it is an object), if the value for elem1 or elem2 is not an element, remove that key
|
||||||
|
if (elements[key].reactions) {
|
||||||
|
for (var reaction in elements[key].reactions) {
|
||||||
|
if (!elements[elements[key].reactions[reaction].elem1]) {
|
||||||
|
delete elements[key].reactions[reaction].elem1;
|
||||||
|
}
|
||||||
|
if (!elements[elements[key].reactions[reaction].elem2]) {
|
||||||
|
delete elements[key].reactions[reaction].elem2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the element's stateHigh or stateLow is not an element, remove it and tempHigh/Low
|
||||||
|
if (elements[key].stateHigh) {
|
||||||
|
// If it's an array, do it for each item, otherwise, just do it once
|
||||||
|
if (Array.isArray(elements[key].stateHigh)) {
|
||||||
|
for (var i = 0; i < elements[key].stateHigh.length; i++) {
|
||||||
|
if (!elements[elements[key].stateHigh[i]]) {
|
||||||
|
elements[key].stateHigh.splice(i,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (elements[key].stateHigh.length == 0) {
|
||||||
|
delete elements[key].stateHigh;
|
||||||
|
delete elements[key].tempHigh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!elements[elements[key].stateHigh]) {
|
||||||
|
delete elements[key].stateHigh;
|
||||||
|
delete elements[key].tempHigh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (elements[key].stateLow) {
|
||||||
|
if (Array.isArray(elements[key].stateLow)) {
|
||||||
|
for (var i = 0; i < elements[key].stateLow.length; i++) {
|
||||||
|
if (!elements[elements[key].stateLow[i]]) {
|
||||||
|
elements[key].stateLow.splice(i,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (elements[key].stateLow.length == 0) {
|
||||||
|
delete elements[key].stateLow;
|
||||||
|
delete elements[key].tempLow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!elements[elements[key].stateLow]) {
|
||||||
|
delete elements[key].stateLow;
|
||||||
|
delete elements[key].tempLow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// same for burnInto
|
||||||
|
if (elements[key].burnInto) {
|
||||||
|
if (Array.isArray(elements[key].burnInto)) {
|
||||||
|
for (var i = 0; i < elements[key].burnInto.length; i++) {
|
||||||
|
if (!elements[elements[key].burnInto[i]]) {
|
||||||
|
delete elements[key].burnInto[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (elements[key].burnInto.length == 0) {
|
||||||
|
delete elements[key].burnInto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!elements[elements[key].burnInto]) {
|
||||||
|
delete elements[key].burnInto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// While the mouse is down, run mouseDown()
|
// While the mouse is down, run mouseDown()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue