Merge branch 'R74nCom:main' into main

This commit is contained in:
SquareScreamYT 2024-05-19 14:12:41 +08:00 committed by GitHub
commit 5a07da6811
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 799 additions and 298 deletions

View File

@ -412,7 +412,7 @@
"gold_coin":"Pièce d'or",
"rust":"Rouille",
"oxidized_copper":"Cuivre oxydé",
"alga":"Algue",
"alga":"Mélange d'aluminium et de gallium",
"metal_scrap":"Ferraille",
"glass_shard":"Éclat de verre",
"rad_shard":"Éclat de rayonnement",
@ -523,21 +523,26 @@
"molten_potassium_salt":"Sel de potassium fondu",
"molten_sodium_acetate":"Acétate de sodium fondu",
"frozen_nitro":"Nitro congelé",
"cured_meat": "",
"nut_oil": "",
"grease": "",
"fat": "",
"potassium": "",
"molten_potassium": "",
"magnesium": "",
"molten_magnesium": "",
"sandstorm": "",
"caustic_potash": "",
"antibomb": "",
"tornado": "",
"earthquake": "",
"tsunami": "",
"blaster": "",
"propane_ice": "",
"molten_caustic_potash": ""
}
"cured_meat": "Charcuterie",
"nut_oil": "huile de noix",
"grease": "Graisse",
"fat": "gras",
"potassium": "Potassium",
"molten_potassium": "Potassium fondu",
"magnesium": "Magnésium",
"molten_magnesium": "Magnésium fondu",
"sandstorm": "Tempête de sable",
"caustic_potash": "Potasse caustique",
"antibomb": "Antibombe",
"tornado": "Tornade",
"earthquake": "Tremblement de terre",
"tsunami": "Tsunami",
"blaster": "Blaster",
"propane_ice": "Glace au propane",
"molten_caustic_potash": "Potasse caustique fondu",
"mixer": "Les mixer",
"grinder": "le broyeur",
"cloth": "le tissu",
"kelp": "varech",
"freeze_ray": "Ray gelée"
}

View File

@ -540,5 +540,10 @@
"tsunami": "Sóng thần",
"blaster": "Tia nổ",
"propane_ice": "Propan đóng băng",
"molten_caustic_potash": "Kali hiđroxit nóng chảy"
"molten_caustic_potash": "Kali hiđroxit nóng chảy",
"cloth": "Vải",
"kelp": "Tảo bẹ",
"grinder": "Máy nghiền",
"mixer": "Máy trộn",
"freeze_ray": "Tia làm lạnh"
}

View File

@ -9,12 +9,14 @@ elements.change_count = {
onSelect: function() {
var cans = prompt("Please input how many elements you would like to be generared each time.", 10000);
if (!cans) { return }
if (cans == "skin"){settings.randomcount = 10000; settings.skineasteregg = true; saveSettings(); alert("skin"); return}
if (cans == "skin"){settings.randomcount = 10000; settings.skineasteregg = true; settings.sandeasteregg = false; saveSettings(); alert("skin"); return}
if (cans == "sand"){settings.randomcount = 10000; settings.skineasteregg = false; settings.sandeasteregg = true; saveSettings(); alert("sand"); return}
if (cans > 2000000){alert("You have put too big of a number! This would surely crash your browser or eat up all your RAM! Element count will remain unchanged."); return}
if (cans < 1 && (parseInt(cans) > -1) ){alert("You have either put a decimal or zero. Why? Element count will remain unchanged."); return}
if (isNaN(parseInt(cans))){alert("Apparently your input isnt even a number. Try again. Element count will remain unchanged."); return}
settings.randomcount = parseInt(cans)
settings.skineasteregg = false;
settings.sandeasteregg = false;
saveSettings()
},
category: "random"
@ -26,6 +28,7 @@ if (!settings.randomcount){settings.randomcount = 10000; saveSettings()}
var color = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "a", "b", "c", "d", "e","f"]
var states = ["solid", "liquid", "gas"]
var essentialelements = ["molten_gallium", "gallium", "gallium_gas", "change_count"]
var sandelements = ["erase", "sand", "change_count"]
var total = 0
var dangerouselements = ["supernova", "n_explosion", "pn_explosion", "armageddon", "nuke", "h_bomb"]
function randomIntFromInterval(min, max) { // min and max included
@ -35,7 +38,7 @@ var randomProperty = function (obj) {
var keys = Object.keys(obj);
return obj[keys[ keys.length* Math.random() << 0]];
};
if (Math.abs(settings.randomcount) == settings.randomcount){
if (Math.abs(settings.randomcount) == settings.randomcount && !settings.sandeasteregg){
if (!settings.skineasteregg){
for (var i = 1; i <= settings.randomcount; i++){
var canHeat = Math.random() < 0.2
@ -98,7 +101,7 @@ if (Math.abs(settings.randomcount) == settings.randomcount){
}
}
}
} else {
} else if (!(settings.sandeasteregg)) {
window.addEventListener('load', function() {
elementslist = []
for (elementi in elements){
@ -125,4 +128,38 @@ document.getElementById("extraInfo").querySelectorAll("small")[1].replaceChildre
}
}
})
} else {
runAfterAutogen(
function(){
for (elementi in elements){
elements[elementi].category = "sand"
}
}
)
window.addEventListener('load', function() {
elementslist = []
for (elementi in elements){
elementslist.push(elementi)
}
var eLen = elementslist.length
const p = document.createElement("p");
p.innerText = `v${currentversion}` +3 +` elements, with 0 hidden`;
document.getElementById("extraInfo").querySelectorAll("small")[1].replaceChildren(p);
if (Math.abs(settings.randomcount) > elementslist.length){
console.log("mode 1")
for (var elementi in elements){
if(!sandelements.includes(elementi)){
document.getElementById("elementButton-" + elementi)?.remove()
console.log(elementi)
}
}
} else for (var i = 1; i <= eLen; i++){
var elementi = elementslist[Math.floor(Math.random()*elementslist.length)]
if(!(sandelements.includes(elementi))){
elementslist.splice(elementslist.indexOf(elementi), 1)
document.getElementById("elementButton-" + elementi)?.remove()
console.log(elementi)
}
}
})
}

File diff suppressed because it is too large Load Diff

View File

@ -69,7 +69,7 @@ elements.name_settings = {
settings.funnyname.customName = true
settings.funnyname.customNameString = customName
saveSettings()
}
} else {settings.funnyname.customName = false}
}
}
runAfterAutogen(

View File

@ -308,7 +308,9 @@ elements.technetium = {
elements.destroyable_pipe = {
color: "#414c4f",
onSelect: function() {
logMessage("Draw a pipe, wait for walls to appear, then erase the exit hole.");
if(!enabledMods.contains("mods/nousersthings.js")){
logMessage("credit to nousersthings.js for this element")
}
},
tick: function(pixel) {
if (!pixel.stage && pixelTicks-pixel.start > 60) {
@ -2782,7 +2784,8 @@ elements.ray = {
return pixel.life || "unset"
},
properties: {
life: 10
life: 10,
maxLife: 10,
},
tick: function(pixel){
if (pixel.rColor){
@ -2791,8 +2794,8 @@ elements.ray = {
pixel.rgb = [255,255,255]
}
pixel.life -= 1
if (pixel.life < 10){
pixel.color = "rgba("+pixel.rgb[0]+","+pixel.rgb[1]+","+pixel.rgb[2]+","+(pixel.life/10)+")"
if (pixel.life < pixel.maxLife){
pixel.color = "rgba("+pixel.rgb[0]+","+pixel.rgb[1]+","+pixel.rgb[2]+","+(pixel.life/pixel.maxLife)+")"
} else {pixel.color = "rgba("+pixel.rgb[0]+","+pixel.rgb[1]+","+pixel.rgb[2]+",1)"}
if (pixel.life <= 0){
deletePixel(pixel.x, pixel.y)
@ -2810,6 +2813,8 @@ var specificRayStart = 0
var specificRayEnd = 20
var specificRayAngle = 0
var stopAtElement = "wall"
var rayLife = 10
var rainbowMode = "no"
elements.specific_ray_emitter = {
color: "#e73e63",
behavior: behaviors.WALL,
@ -2836,6 +2841,16 @@ elements.specific_ray_emitter = {
var rayans6 = prompt("What element should the ray stop at?", (stopAtElement||"wall"));
if (!rayans6) { return }
stopAtElement = mostSimilarElement(rayans6)
let rayans7
if (rayans == "ray"){ rayans7 = prompt("How long should the ray stay on screen in ticks?", (rayLife||10));}
if (!rayans7) { return }
if (isNaN(parseFloat(rayans7))){
rayLife = 10
} else {
rayLife = rayans7
}
var rayans8 = prompt("Would you like rainbow mode to be enabled? Type yes or no.", (rainbowMode||"no"));
if (rayans8 == "yes"){rainbowMode = true} else {rainbowMode = false}
},
hoverStat: function(pixel){
return (pixel.rayElement.toUpperCase() || "unset") + ", " + (pixel.rayStoppedByWalls.toString().toUpperCase() || "unset") + ", " + (pixel.specificRayStart || "unset") + ", " + (pixel.specificRayEnd || "unset") + ", " + (pixel.specificRayAngle || "unset")
@ -2848,7 +2863,26 @@ elements.specific_ray_emitter = {
pixel.specificRayEnd = specificRayEnd
pixel.specificRayAngle = specificRayAngle
pixel.stopAtElement = stopAtElement
pixel.life = rayLife
pixel.rainbowMode = rainbowMode
}
if (pixel.rainbowMode){
pixel.specificRayAngle ++
pixel.rgb = pixel.color.match(/\d+/g);
pixel.rgb[0] = parseInt(pixel.rgb[0])
pixel.rgb[1] = parseInt(pixel.rgb[1])
pixel.rgb[2] = parseInt(pixel.rgb[2])
console.log(pixel.rgb)
var hsvResult = RGBtoHSV(pixel.rgb[0], pixel.rgb[1], pixel.rgb[2]);
pixel.tHue = hsvResult.h;
var rgbResult = HSVtoRGB(pixel.tHue + (1/360), 1, 1);
console.log(rgbResult)
const hexR = rgbResult.r.toString(16).padStart(2, '0');
const hexG = rgbResult.g.toString(16).padStart(2, '0');
const hexB = rgbResult.b.toString(16).padStart(2, '0');
const hexCode = `#${hexR}${hexG}${hexB}`;
console.log(hexCode)
pixel.color = pixelColorPick(pixel, hexCode)}
for (var i = 0; i < squareCoords.length; i++) {
var coord = squareCoords[i];
var x = pixel.x+coord[0];
@ -2859,22 +2893,22 @@ elements.specific_ray_emitter = {
var dir = [0-squareCoords[i][0], 0-squareCoords[i][1]]
let startx, starty, endx, endy, magnitude
if (pixel.specificRayAngle == "nah"){
startx = pixel.x+(dir[0]*specificRayStart)
starty = pixel.y+(dir[1]*specificRayStart)
magnitude = specificRayEnd
startx = pixel.x+(dir[0]*pixel.specificRayStart)
starty = pixel.y+(dir[1]*pixel.specificRayStart)
magnitude = pixel.specificRayEnd
endx = startx+(magnitude*dir[0])
endy = starty+(magnitude*dir[1])
} else {
let angleInRadians = pixel.specificRayAngle * Math.PI / 180;
console.log("Angle in radians is " + angleInRadians)
//console.log("Angle in radians is " + angleInRadians)
dir = [(Math.cos(angleInRadians)), (Math.sin(angleInRadians))]
startx = pixel.x+Math.round((dir[0]*specificRayStart))
starty = pixel.y+Math.round((dir[1]*specificRayStart))
magnitude = specificRayEnd
startx = pixel.x+Math.round((dir[0]*pixel.specificRayStart))
starty = pixel.y+Math.round((dir[1]*pixel.specificRayStart))
magnitude = pixel.specificRayEnd
endx = startx+Math.round((magnitude*dir[0]))
endy = starty+Math.round((magnitude*dir[1]))
}
console.log("Direction seems to be " + dir)
//console.log("Direction seems to be " + dir)
var jcoords = lineCoords(startx, starty, endx, endy, 1)
//console.log(startx + " is the starting x, " + starty + " is the starting y, " + endx + " is the ending x, " + endy + " is the ending y. Result is " + jcoords)
for (var j = 0; j < jcoords.length; j++) {
@ -2888,13 +2922,16 @@ elements.specific_ray_emitter = {
if (pixel.rayElement == "ray"){
pixelMap[lx][ly].rColor = pixel.color
pixelMap[lx][ly].color = pixel.color
pixelMap[lx][ly].life = pixel.life
pixelMap[lx][ly].maxLife = pixel.life
}
} else if (!isEmpty(lx, ly, true)){
if ((pixelMap[lx][ly].element != pixel.rayElement && pixel.rayStoppedByWalls) || pixelMap[lx][ly].element == pixel.stopAtElement){
break;
} else if (pixelMap[lx][ly].element == "ray" && pixel.rayElement == "ray"){
pixelMap[lx][ly].rColor = pixel.color
pixelMap[lx][ly].life = 10
pixelMap[lx][ly].life = pixel.life
pixelMap[lx][ly].maxLife = pixel.life
pixelMap[lx][ly].color = pixel.color
}
}