Merge pull request #1205 from Cube14yt/main

Bugfix + steam support
This commit is contained in:
slweeb 2025-08-11 15:42:56 -04:00 committed by GitHub
commit 3a0589bd6a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 106 additions and 68 deletions

View File

@ -3,12 +3,18 @@
/*
V3
🛠 Tools: RGB LED, Dice, Custom Bomb
🌱 Life: Pineapple Plants (seed, stem, fruit)
Hazards: Lithium Battery, Lithium, Rubidium, Asbestos
🪨 Minerals: Chalk, Chalk Powder, Lapis Lazuli
💡 Light: UV Light, Phosphor, Neon Tube
🎮 Extras: Realistic Ball
Tools: RGB LED, Dice, Custom Bomb
Life: Pineapple Plants (seed, stem, fruit)
Hazards: Lithium Battery, Lithium, Rubidium, Asbestos
Minerals: Chalk, Chalk Powder, Lapis Lazuli
Light: UV Light, Phosphor, Neon Tube
Extras: Realistic Ball
V3.1
Bug Fixes
Chalk powder, Wet chalk poeder, and Obsidian shard can now be glued back as intended.
Dog can now be smashed correctly.
Steam support with promptInput() instead of prompt()
*/
@ -346,6 +352,9 @@ elements.obsidian_shard = {
stateHigh: "magma",
state: "solid",
density: 2500,
reactions: {
"glue": { elem1: "obsidian", elem2: null }
}
}
elements.cardboard = {
@ -640,23 +649,34 @@ elements.circle = {
category: "special",
state: "solid",
onSelect: function () {
let ans1 = Number(prompt("Select the radius you want your circle to be:"));
let ans2 = prompt("Now give the element your circle should be made of:");
// Validate radius
if (Number.isInteger(ans1) && ans1 > 0) {
circleRad = ans1;
} else {
logMessage("Invalid radius, using default/last size: " + circleRad);
}
// Validate element
let similar = mostSimilarElement(ans2);
if (similar && elements[similar]) {
circleElem = similar;
} else {
logMessage("Invalid element, using default/last element: " + circleElem);
}
promptInput(
"Select the radius you want your circle to be:",
function (input1) {
let ans1 = Number(input1)
if (Number.isInteger(ans1) && ans1 > 0) {
circleRad = ans1
} else {
circleRad = 7
logMessage("Invalid radius, using default size: " + circleRad);
}
promptInput(
"Select the element you want your circle to be:",
function (ans2) {
let similar = mostSimilarElement(ans2);
if (similar && elements[similar]) {
circleElem = similar;
} else {
circleElem = "wood"
logMessage("Invalid element, using default element: " + circleElem);
}
},
"Element prompt",
"wood"
);
},
"Radius prompt",
"7"
);
},
onPlace: function (pixel) {
drawCircle(pixel.x, pixel.y, circleRad, circleElem);
@ -683,7 +703,7 @@ let b = randomIntInRange(0, 255);
elements.rgb_led = {
buttonColor: ["#ff0000", "#ff8800", "#ffff00", "#00ff00", "#00ffff", "#0000ff", "#ff00ff"],
behavior: behaviors.WALL,
desc: "Input The red green and blue value (not exceeding 255) and get the color of",
desc: "Input the red, green, and blue value (not exceeding 255) and get the color.",
renderer: renderPresets.LED,
conduct: 1,
state: "solid",
@ -696,35 +716,43 @@ elements.rgb_led = {
category: "machines",
tempHigh: 1500,
stateHigh: ["molten_glass", "molten_glass", "molten_glass", "molten_gallium"],
onSelect: () => {
var r_inp = parseInt(prompt("Enter red value (0-255):"));
var g_inp = parseInt(prompt("Enter green value (0-255):"));
var b_inp = parseInt(prompt("Enter blue value (0-255):"));
promptInput("Enter red value (0-255):", function (r_inp) {
r_inp = parseInt(r_inp);
if (r_inp > 255 || r_inp < 0 || isNaN(r_inp)) {
logMessage("Red value is invalid, using default/last red value: " + r);
} else {
r = r_inp;
}
if (r_inp > 255 || r_inp < 0 || isNaN(r_inp)) {
logMessage("Red value is invalid, using default/last red value: " + r);
} else {
r = r_inp;
}
promptInput("Enter green value (0-255):", function (g_inp) {
g_inp = parseInt(g_inp);
if (g_inp > 255 || g_inp < 0 || isNaN(g_inp)) {
logMessage("Green value is invalid, using default/last green value: " + g);
} else {
g = g_inp;
}
if (g_inp > 255 || g_inp < 0 || isNaN(g_inp)) {
logMessage("Green value is invalid, using default/last green value: " + g);
} else {
g = g_inp;
}
if (b_inp > 255 || b_inp < 0 || isNaN(b_inp)) {
logMessage("Blue value is invalid, using default/last blue value: " + b);
} else {
b = b_inp;
}
promptInput("Enter blue value (0-255):", function (b_inp) {
b_inp = parseInt(b_inp);
if (b_inp > 255 || b_inp < 0 || isNaN(b_inp)) {
logMessage("Blue value is invalid, using default/last blue value: " + b);
} else {
b = b_inp;
}
}, "Blue Value", b); // optional default input
}, "Green Value", g);
}, "Red Value", r);
},
onPlace: (pixel) => {
var ledColor = RGBToHex({ r: r, g: g, b: b });
pixel.color = ledColor;
}
};
runAfterReset(() => {
r = 100;
g = 100;
@ -906,7 +934,6 @@ elements.chalk_powder = {
behavior: behaviors.POWDER,
stain: 0.25,
category: "powders",
breakInto: "chalk_powder",
tempHigh: 1000,
stateHigh: "molten_chalk",
density: 2700,
@ -918,7 +945,8 @@ elements.chalk_powder = {
"sugar_water": { elem1: "wet_chalk_powder", elem2: null, chance: 0.5 },
"pool_water": { elem1: "wet_chalk_powder", elem2: null, chance: 0.5 },
"primordial_soup": { elem1: "wet_chalk_powder", elem2: null, chance: 0.5 },
"nut_milk": { elem1: "wet_chalk_powder", elem2: null, chance: 0.5 }
"nut_milk": { elem1: "wet_chalk_powder", elem2: null, chance: 0.5 },
"glue": { elem1: "chalk", elem2: null }
},
state: "solid"
}
@ -949,7 +977,10 @@ elements.wet_chalk_powder = {
onStateHigh: (pixel) => {
releaseElement(pixel, "steam")
},
state: "solid"
state: "solid",
reactions: {
"glue": { elem1: "chalk", elem2: null }
}
}
elements.lapis_lazuli = {
@ -1188,19 +1219,25 @@ elements.custom_bomb = {
cooldown: defaultCooldown,
behavior: behaviors.STURDYPOWDER,
onSelect: function () {
input = prompt("Input the element you want your bomb to explode into", "fire")
pr1 = mostSimilarElement(input)
if (elements[pr1]) {
if (pr1 === "custom_bomb") {
explodeElem = 'fire'
logMessage("Element cannot explode to itself. Using default: fire")
}
else { explodeElem = pr1 }
}
else {
explodeElem = 'fire'
logMessage("Invalid element. Using default: fire")
}
promptInput(
"Input the element you want your bomb to explode into",
function (input) {
pr1 = mostSimilarElement(input)
if (elements[pr1]) {
if (pr1 === "custom_bomb") {
explodeElem = 'fire'
logMessage("Element cannot explode to itself. Using default: fire")
}
else { explodeElem = pr1 }
}
else {
explodeElem = 'fire'
logMessage("Invalid element. Using default: fire")
}
},
"Element prompt",
"fire"
)
},
tick: function (pixel) {
let belowPixel = getPixel(pixel.x, pixel.y + 1);
@ -1401,16 +1438,17 @@ elements.dog = {
burn: 30,
burnTime: 50,
burnInto: ["cooked_meat", "smoke"],
breakInto: ["meat", "blood"],
reactions: {
"meat": {elem2:null, chance:0.5, func:behaviors.FEEDPIXEL },
"egg": {elem2:null, chance:0.5, func:behaviors.FEEDPIXEL },
"yolk": {elem2:null, chance:0.5, func:behaviors.FEEDPIXEL },
"cheese": {elem2:null, chance:0.5, func:behaviors.FEEDPIXEL },
"cooked_meat": {elem2:null, chance:0.5, func:behaviors.FEEDPIXEL },
"chocolate": {elem2:null, chance: 0.2, func:behaviors.FEEDPIXEL, elem1: "rotten_meat"},
"grape": {elem2:null, chance: 0.2, func:behaviors.FEEDPIXEL, elem1: "rotten_meat"},
"rat": {elem2:null, chance: 0.3, func:behaviors.FEEDPIXEL },
"nut_butter": {elem2:null, chance: 0.5, func:behaviors.FEEDPIXEL },
"meat": { elem2: null, chance: 0.5, func: behaviors.FEEDPIXEL },
"egg": { elem2: null, chance: 0.5, func: behaviors.FEEDPIXEL },
"yolk": { elem2: null, chance: 0.5, func: behaviors.FEEDPIXEL },
"cheese": { elem2: null, chance: 0.5, func: behaviors.FEEDPIXEL },
"cooked_meat": { elem2: null, chance: 0.5, func: behaviors.FEEDPIXEL },
"chocolate": { elem2: null, chance: 0.2, func: behaviors.FEEDPIXEL, elem1: "rotten_meat" },
"grape": { elem2: null, chance: 0.2, func: behaviors.FEEDPIXEL, elem1: "rotten_meat" },
"rat": { elem2: null, chance: 0.3, func: behaviors.FEEDPIXEL },
"nut_butter": { elem2: null, chance: 0.5, func: behaviors.FEEDPIXEL },
},
egg: "dog",
}