Merge pull request #610 from SquareScreamYT/main
This commit is contained in:
commit
a77b79c2b6
|
|
@ -18,7 +18,37 @@ function getRGB(rgb){
|
||||||
let rgb2 = rgb.replace(")", "").replace("rgb(", "").replace(/,/g, "r").split("r")
|
let rgb2 = rgb.replace(")", "").replace("rgb(", "").replace(/,/g, "r").split("r")
|
||||||
return { r: parseInt(rgb2[0]), g: parseInt(rgb2[1]), b: parseInt(rgb2[2]) };
|
return { r: parseInt(rgb2[0]), g: parseInt(rgb2[1]), b: parseInt(rgb2[2]) };
|
||||||
}
|
}
|
||||||
|
function findMostFrequent(arr) {
|
||||||
|
let freqMap = {};
|
||||||
|
|
||||||
|
if (arr) {
|
||||||
|
if (arr.length === 0) {
|
||||||
|
return "water";
|
||||||
|
} else if (arr.length === 1) {
|
||||||
|
return arr[0]
|
||||||
|
} else {
|
||||||
|
arr.forEach(item => {
|
||||||
|
if(!freqMap[item]) {
|
||||||
|
freqMap[item] = 0;
|
||||||
|
}
|
||||||
|
freqMap[item]++;
|
||||||
|
});
|
||||||
|
|
||||||
|
let max = 0;
|
||||||
|
let mostFrequent = [];
|
||||||
|
|
||||||
|
for (let item in freqMap) {
|
||||||
|
if (freqMap[item] > max) {
|
||||||
|
max = freqMap[item];
|
||||||
|
mostFrequent = [item];
|
||||||
|
} else if (freqMap[item] === max) {
|
||||||
|
mostFrequent.push(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mostFrequent.join(', ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
behaviors.STURDYPOWDER2 = [
|
behaviors.STURDYPOWDER2 = [
|
||||||
"XX|XX|XX",
|
"XX|XX|XX",
|
||||||
"XX|XX|XX",
|
"XX|XX|XX",
|
||||||
|
|
@ -39,25 +69,21 @@ elements.knife = {
|
||||||
//changePixel(pixel, cutInto)
|
//changePixel(pixel, cutInto)
|
||||||
if (shiftDown) {
|
if (shiftDown) {
|
||||||
if (Math.random() < 0.5) {
|
if (Math.random() < 0.5) {
|
||||||
changePixel(pixel, cutInto)
|
|
||||||
var cutIntoEmit = elements[pixel.element].cutIntoEmit;
|
|
||||||
if (!cutIntoEmit) { return };
|
|
||||||
if(cutIntoEmit instanceof Array) { cutIntoEmit = cutIntoEmit[Math.floor(Math.random() * cutIntoEmit.length)] };
|
|
||||||
var thiselement = pixel.element;
|
var thiselement = pixel.element;
|
||||||
if (elements[thiselement].cutIntoEmit && Math.random() < 0.7 && isEmpty(pixel.x,pixel.y-1)) {
|
changePixel(pixel, cutInto)
|
||||||
createPixel(elements[thiselement].cutIntoEmit,pixel.x,pixel.y-1);
|
pixelTempCheck(pixel);
|
||||||
|
if (elements[thiselement].cutIntoColor) {
|
||||||
|
pixel.color = pixelColorPick(pixel, elements[thiselement].cutIntoColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!shiftDown) {
|
else if (!shiftDown) {
|
||||||
if (Math.random() < 0.1) {
|
if (Math.random() < 0.1) {
|
||||||
changePixel(pixel, cutInto)
|
|
||||||
var cutIntoEmit = elements[pixel.element].cutIntoEmit;
|
|
||||||
if (!cutIntoEmit) { return };
|
|
||||||
if(cutIntoEmit instanceof Array) { cutIntoEmit = cutIntoEmit[Math.floor(Math.random() * cutIntoEmit.length)] };
|
|
||||||
var thiselement = pixel.element;
|
var thiselement = pixel.element;
|
||||||
if (elements[thiselement].cutIntoEmit && Math.random() < 0.4 && isEmpty(pixel.x,pixel.y-1)) {
|
changePixel(pixel, cutInto)
|
||||||
createPixel(elements[thiselement].cutIntoEmit,pixel.x,pixel.y-1);
|
pixelTempCheck(pixel);
|
||||||
|
if (elements[thiselement].cutIntoColor) {
|
||||||
|
pixel.color = pixelColorPick(pixel, elements[thiselement].cutIntoColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -422,6 +448,10 @@ elements.soup = {
|
||||||
if (Math.random() < 0.5) { deletePixel(ingredient.x, ingredient.y); }
|
if (Math.random() < 0.5) { deletePixel(ingredient.x, ingredient.y); }
|
||||||
else {
|
else {
|
||||||
ingredient.color = pixelColorPick(ingredient, hex);
|
ingredient.color = pixelColorPick(ingredient, hex);
|
||||||
|
if (!ingredient.elemlist){
|
||||||
|
ingredient.elemlist = [];
|
||||||
|
}
|
||||||
|
ingredient.elemlist.push(soup.elemlist[Math.floor(Math.random() * soup.elemlist.length)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -439,6 +469,13 @@ elements.soup = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
hoverStat: function(soup, ingredient) {
|
||||||
|
if (findMostFrequent(soup.elemlist) == undefined) {
|
||||||
|
return "Ingredients:None"
|
||||||
|
} else {
|
||||||
|
return "Ingredients:"+findMostFrequent(soup.elemlist)
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!elements.broth.reactions) elements.broth.reactions = {};
|
if (!elements.broth.reactions) elements.broth.reactions = {};
|
||||||
|
|
@ -6586,6 +6623,7 @@ elements.durian = {
|
||||||
cutInto: "cut_durian",
|
cutInto: "cut_durian",
|
||||||
state: "solid",
|
state: "solid",
|
||||||
density: 1050,
|
density: 1050,
|
||||||
|
breakInto: "durian_juice"
|
||||||
}
|
}
|
||||||
|
|
||||||
elements.cut_durian = {
|
elements.cut_durian = {
|
||||||
|
|
@ -6601,6 +6639,7 @@ elements.cut_durian = {
|
||||||
hidden: true,
|
hidden: true,
|
||||||
freezeDryInto: "freeze_dried_fruits",
|
freezeDryInto: "freeze_dried_fruits",
|
||||||
freezeDryIntoColor: "#a19f3b",
|
freezeDryIntoColor: "#a19f3b",
|
||||||
|
breakInto: "durian_juice"
|
||||||
}
|
}
|
||||||
|
|
||||||
elements.durian_seed = {
|
elements.durian_seed = {
|
||||||
|
|
@ -6649,6 +6688,32 @@ elements.durian_seed = {
|
||||||
"XX|M1|XX",
|
"XX|M1|XX",
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
elements.durian_juice = {
|
||||||
|
color: "#ebe06e",
|
||||||
|
onMix: function(pixel) {
|
||||||
|
if (shiftDown) {
|
||||||
|
if (Math.random() < 0.2) {
|
||||||
|
changePixel(pixel,"juice")
|
||||||
|
pixel.color = pixelColorPick(pixel,"#ebe06e")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behavior: behaviors.LIQUID,
|
||||||
|
category: "liquids",
|
||||||
|
tempHigh: 100,
|
||||||
|
stateHigh: ["steam","sugar"],
|
||||||
|
burn: 70,
|
||||||
|
burnTime: 300,
|
||||||
|
burnInto: ["steam", "smoke"],
|
||||||
|
state: "liquid",
|
||||||
|
density: 825,
|
||||||
|
hidden: true,
|
||||||
|
temp: 30,
|
||||||
|
hidden: true,
|
||||||
|
tempLow: 0,
|
||||||
|
};
|
||||||
|
eLists.JUICEMIXABLE.push("durian_juice");
|
||||||
elements.egg_white = {
|
elements.egg_white = {
|
||||||
color: "#edece8",
|
color: "#edece8",
|
||||||
behavior: behaviors.LIQUID,
|
behavior: behaviors.LIQUID,
|
||||||
|
|
@ -7613,6 +7678,7 @@ elements.unripe_rambutan = {
|
||||||
cutInto: "cut_rambutan",
|
cutInto: "cut_rambutan",
|
||||||
state: "solid",
|
state: "solid",
|
||||||
density: 1050,
|
density: 1050,
|
||||||
|
breakInto: "rambutan_juice"
|
||||||
}
|
}
|
||||||
|
|
||||||
elements.rambutan = {
|
elements.rambutan = {
|
||||||
|
|
@ -7626,7 +7692,7 @@ elements.rambutan = {
|
||||||
state: "solid",
|
state: "solid",
|
||||||
density: 1050,
|
density: 1050,
|
||||||
cutInto: "cut_rambutan",
|
cutInto: "cut_rambutan",
|
||||||
hidden: true,
|
breakInto: "rambutan_juice"
|
||||||
}
|
}
|
||||||
|
|
||||||
elements.cut_rambutan = {
|
elements.cut_rambutan = {
|
||||||
|
|
@ -7642,6 +7708,7 @@ elements.cut_rambutan = {
|
||||||
hidden: true,
|
hidden: true,
|
||||||
freezeDryInto: "freeze_dried_fruits",
|
freezeDryInto: "freeze_dried_fruits",
|
||||||
freezeDryIntoColor: "#a19f3b",
|
freezeDryIntoColor: "#a19f3b",
|
||||||
|
breakInto: "rambutan_juice"
|
||||||
}
|
}
|
||||||
|
|
||||||
elements.rambutan_seed = {
|
elements.rambutan_seed = {
|
||||||
|
|
@ -7691,6 +7758,32 @@ elements.rambutan_seed = {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
elements.rambutan_juice = {
|
||||||
|
color: "#f7f4cb",
|
||||||
|
onMix: function(pixel) {
|
||||||
|
if (shiftDown) {
|
||||||
|
if (Math.random() < 0.2) {
|
||||||
|
changePixel(pixel,"juice")
|
||||||
|
pixel.color = pixelColorPick(pixel,"#f7f4cb")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
behavior: behaviors.LIQUID,
|
||||||
|
category: "liquids",
|
||||||
|
tempHigh: 100,
|
||||||
|
stateHigh: ["steam","sugar"],
|
||||||
|
burn: 70,
|
||||||
|
burnTime: 300,
|
||||||
|
burnInto: ["steam", "smoke"],
|
||||||
|
state: "liquid",
|
||||||
|
density: 825,
|
||||||
|
hidden: true,
|
||||||
|
temp: 30,
|
||||||
|
hidden: true,
|
||||||
|
tempLow: 0,
|
||||||
|
};
|
||||||
|
eLists.JUICEMIXABLE.push("rambutan_juice");
|
||||||
|
|
||||||
elements.barbecued_shrimp = {
|
elements.barbecued_shrimp = {
|
||||||
color:["#bf743b", "#b57026","#8f5e29","#a87b11"],
|
color:["#bf743b", "#b57026","#8f5e29","#a87b11"],
|
||||||
behavior: behaviors.STURDYPOWDER,
|
behavior: behaviors.STURDYPOWDER,
|
||||||
|
|
@ -7829,6 +7922,26 @@ elements.raisin = {
|
||||||
isFood: true
|
isFood: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elements.fruit_slush = {
|
||||||
|
color: "#ed93a4",
|
||||||
|
behavior: behaviors.LIQUID,
|
||||||
|
reactions: {
|
||||||
|
"dirt": { elem1: null, elem2: "mud" },
|
||||||
|
"sand": { elem1: null, elem2: "wet_sand" },
|
||||||
|
"uranium": { elem1:"dirty_water", chance:0.25 },
|
||||||
|
},
|
||||||
|
temp: -5,
|
||||||
|
tempHigh: 18,
|
||||||
|
tempLow: -20,
|
||||||
|
stateLow: "juice_ice",
|
||||||
|
stateHigh: "juice",
|
||||||
|
category: "food",
|
||||||
|
state: "liquid",
|
||||||
|
density: 95,
|
||||||
|
viscosity: 100,
|
||||||
|
hidden: true
|
||||||
|
}
|
||||||
|
|
||||||
// things to mix: juice, water, seltzer, sugar water, soda, juice, milk, cream,
|
// things to mix: juice, water, seltzer, sugar water, soda, juice, milk, cream,
|
||||||
// juice, milk, chocolate milk, fruit milk, eggnog, nut milk, alcohol, wine, tea,
|
// juice, milk, chocolate milk, fruit milk, eggnog, nut milk, alcohol, wine, tea,
|
||||||
// tea, coffee, honey, caramel, vanilla essence, peppermint tea, sugar, yogurt,
|
// tea, coffee, honey, caramel, vanilla essence, peppermint tea, sugar, yogurt,
|
||||||
|
|
@ -7836,9 +7949,9 @@ elements.raisin = {
|
||||||
|
|
||||||
// juice mixing
|
// juice mixing
|
||||||
for (let juicei = 0; juicei < eLists.JUICEMIXABLE.length; juicei++) {
|
for (let juicei = 0; juicei < eLists.JUICEMIXABLE.length; juicei++) {
|
||||||
|
elem = eLists.JUICEMIXABLE[juicei];
|
||||||
// juice with juice
|
// juice with juice
|
||||||
for (let juicej = 0; juicej < eLists.JUICEMIXABLE.length; juicej++) {
|
for (let juicej = 0; juicej < eLists.JUICEMIXABLE.length; juicej++) {
|
||||||
elem = eLists.JUICEMIXABLE[juicei];
|
|
||||||
elem2 = eLists.JUICEMIXABLE[juicej];
|
elem2 = eLists.JUICEMIXABLE[juicej];
|
||||||
if (elem != elem2) {
|
if (elem != elem2) {
|
||||||
if (!elements[elem].reactions) { chance:1, elements[elem].reactions = {} }
|
if (!elements[elem].reactions) { chance:1, elements[elem].reactions = {} }
|
||||||
|
|
@ -7909,6 +8022,19 @@ for (let juicei = 0; juicei < eLists.JUICEMIXABLE.length; juicei++) {
|
||||||
pixel2.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`;
|
pixel2.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`;
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iceelem = elem+"_ice"
|
||||||
|
// ice slush
|
||||||
|
elements[elem].stateLowColorMultiplier = 1.2;
|
||||||
|
elements[elem].tempLow = 10;
|
||||||
|
elements.fruit_slush.stateHighColorMultiplier = 0.83333333333;
|
||||||
|
elements.fruit_slush.stateLowColorMultiplier = 1.2;
|
||||||
|
elements.juice_ice.stateHighColorMultiplier = 0.83333333333;
|
||||||
|
elements.juice_ice.stateHigh = "fruit_slush"
|
||||||
|
elements.juice_ice.tempHigh = -20
|
||||||
|
elements[iceelem].stateHigh = "fruit_slush"
|
||||||
|
elements[iceelem].tempHigh = -20
|
||||||
|
|
||||||
// fruit milk with milk
|
// fruit milk with milk
|
||||||
elements.fruit_milk.reactions.milk = { chance:1, func: function(pixel1, pixel2){
|
elements.fruit_milk.reactions.milk = { chance:1, func: function(pixel1, pixel2){
|
||||||
let newrgb = interpolateRgb(getRGB(pixel1.color), getRGB(pixel2.color), 0.2);
|
let newrgb = interpolateRgb(getRGB(pixel1.color), getRGB(pixel2.color), 0.2);
|
||||||
|
|
@ -7982,3 +8108,25 @@ elements.fruit_milk.reactions.fruit_milk = { chance:1, func: function(pixel1, pi
|
||||||
pixel2.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`;
|
pixel2.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// fruit milk onMix
|
||||||
|
elements.fruit_milk.onMix = function(pixel){
|
||||||
|
let num = Math.floor(Math.random() * 4);
|
||||||
|
let x = pixel.x + adjacentCoords[num][0];
|
||||||
|
let y = pixel.y + adjacentCoords[num][1];
|
||||||
|
if(!isEmpty(x,y) && !outOfBounds(x,y)){
|
||||||
|
let pixel2 = pixelMap[x][y];
|
||||||
|
if(pixel.color != pixel2.color && pixel2.element == "fruit_milk"){
|
||||||
|
let condition;
|
||||||
|
if(shiftDown == 0){
|
||||||
|
condition = (Math.floor(Math.random() * 2) == 1);
|
||||||
|
} else {
|
||||||
|
condition = true;
|
||||||
|
}
|
||||||
|
if(condition){
|
||||||
|
let newrgb = interpolateRgb(getRGB(pixel.color), getRGB(pixel2.color), 0.5);
|
||||||
|
pixel.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`;
|
||||||
|
pixel2.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue