This commit is contained in:
slweeb 2025-02-25 11:26:02 -05:00
commit 7abcb9e4d8
14 changed files with 809 additions and 5116 deletions

View File

@ -1,19 +1,6 @@
if(typeof(urlParams) === "undefined") {
urlParams = new URLSearchParams(window.location.search);
};
if(urlParams.get('loadTheModList') !== null || urlParams.get('ltml') !== null) { //if the variable exists at all
loadTheModList = true
} else { //if it doesn't (and it returns null)
loadTheModList = false
}
if(loadTheModList) {
enabledMods = ["mods/code_library.js","mods/adjustablepixelsize.js","mods/boiling_rock.js","mods/chalcopyrite.js","mods/clone_liquid.js","mods/conveyance.js","mods/CrashTestDummy.js","mods/delete_all_of_element.js","mods/evenmoretemptools.js","mods/extra_element_info.js","mods/fantastic_creatures.js","mods/fey_and_more.js","mods/glenn_gases.js","mods/iocalfaeus_clones.js","mods/grav_mudstones.js","mods/icb.js","mods/iean.js","mods/ketchup_mod.js","mods/laetium.js","mods/liquid_energy.js","mods/minecraft.js","mods/minesweeper.js","mods/more_breaking.js","mods/moreliquids.js","mods/moretools.js","mods/move_tools.js","mods/nested_for_reaction_example.js","mods/Neutronium Mod.js","mods/portal.js","mods/pushers.js","mods/rainbow_tests.js","mods/random_elems.js","mods/random_liquids.js","mods/random_rocks.js","mods/randomness.js","mods/randomness_but_tick.js","mods/randomness_but_tool.js","mods/slag_fix.js","mods/some_tf_liquids.js","mods/structure_test.js","mods/test.js","mods/ticking_temp_stuff.js","mods/time.js","mods/toothpaste.js","mods/troll.js","mods/unhide.js","mods/worldgen_test.js","mods/page_color.js","mods/color_tools.js","mods/invisible_wall.js","mods/replace_all.js","mods/bacteria_mod.js","mods/controllable_pixel_test.js","mods/fire_slime.js","mods/bioooze.js","mods/color_tools.js","mods/cells.js","mods/triggerable_random_powders.js","mods/replace.js","mods/change.js","mods/prompt.js","mods/miscible_psoup_and_birthpool.js","mods/primordial_birthpool.js","mods/liquid_void.js","mods/solid_rock.js","mods/invisible_dye.js","mods/alcohol.js","mods/a_bundle_of_tests.js","mods/paint_event.js","mods/amogus.js","mods/chem.js","mods/clf3.js","mods/roseyiede.js","mods/state_voids.js","mods/the_ground.js","mods/lone_urea.js","mods/fwibblen.js","mods/prop and prompt variables.js","mods/prop.js","mods/x_dependent_change_test.js","mods/alkahest.js","mods/tool_pixel_behavior.js","mods/onTryMoveInto.js","mods/human_edit.js","mods/runAfterAutogen and onload restructure.js","mods/changeTempReactionParameter.js","mods/metals.js","mods/explodeAtPlus.js","mods/note_block.js","mods/wirelike_test.js","mods/no_random_grbs.js","mods/bananas.js","mods/cpt_alt.js","mods/fire_mod.js","mods/test_4.js","mods/save_loading.js","mods/apioforms_pre.js","mods/fill_script.js","mods/funny elements 2022-11-15.js","mods/haseulite.js","mods/neutronium_compressor.js","mods/mobs.js","mods/stripe_paint.js","mods/velvet.txt","mods/switches.js","mods/noConduct.js","mods/changePixelDebug.js","mods/no_gas_sticking.js","mods/conduit.js","mods/ray_cloner.js","mods/date_test.js","mods/velocity.js","mods/maxColorOffset.js","mods/gradient_background_support.js","mods/life_eater.js","mods/planet_cracker.js","mods/generative_mods.js","mods/generator_prompt.js","mods/place_all_elements.js"];
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert("Mod list loaded. Refresh the page without the loadTheModList query parameter.");
console.log("Mod list loaded. Refresh the page without the loadTheModList query parameter.");
};
if(typeof(pyth) === "undefined") { //has to be in here due to the role in loading the mod list
function pyth(xA,yA,xB,yB) {
var a = Math.abs(xB - xA);

View File

@ -48,7 +48,7 @@ viewInfo[6] = { // Speed View
viewInfo[7] = { // Illness View
name: "ill",
pixel: function(pixel,ctx) {
if ((elements[pixel.element].id === elements.cyanide_gas.id || elements[pixel.element].id === elements.poison_gas.id || elements[pixel.element].id === elements.poison.id || elements[pixel.element].id === elements.cyanide.id || elements[pixel.element].id === elements.infected_vessel.id || elements[pixel.element].id === elements.infection.id || elements[pixel.element].id === elements.cancer.id || elements[pixel.element].id === elements.plague.id || elements[pixel.element].id === elements.rotten_meat.id) || (elements[pixel.element].isBio === true && ((pixel.speed < -5 || pixel.oxygen < 250 || pixel.nutrition < 250) || pixel.poisoned === true || pixel.sick === true || pixel.alcoholic === true)) || ((elements[pixel.element].id === elements.digested_material.id || elements[pixel.element].id === elements.gaseous_material.id) && ((pixel.speed < 0 || pixel.nutrition < 5) || pixel.poisoned === true) && (pixel.immune !== true || !pixel.immune))) {
if ((elements[pixel.element].id === elements.cyanide_gas.id || elements[pixel.element].id === elements.poison_gas.id || elements[pixel.element].id === elements.poison.id || elements[pixel.element].id === elements.cyanide.id || elements[pixel.element].id === elements.infected_vessel.id || elements[pixel.element].id === elements.infection.id || elements[pixel.element].id === elements.cancer.id || elements[pixel.element].id === elements.plague.id || elements[pixel.element].id === elements.rotten_meat.id) || (elements[pixel.element].isBio === true && ((pixel.speed < -5 || pixel.oxygen < 250 || pixel.nutrition < 250) || pixel.ibupCount > 0 || pixel.poisoned === true || pixel.sick === true || pixel.alcoholic === true)) || ((elements[pixel.element].id === elements.digested_material.id || elements[pixel.element].id === elements.gaseous_material.id) && ((pixel.speed < 0 || pixel.nutrition < 5) || pixel.poisoned === true) && (pixel.immune !== true || !pixel.immune))) {
var a = (settings.textures !== 0) ? pixel.alpha : undefined;
if (((elements[pixel.element].isGas && elements[pixel.element].glow !== false) || elements[pixel.element].glow || pixel.glow) && pixel.glow !== false) {
drawPlus(ctx,pixel.color,pixel.x,pixel.y,undefined,a)
@ -66,6 +66,8 @@ viewInfo[7] = { // Illness View
}
}
var ibuprofenTime = pixelTicks
renderPresets.FLESHBURN = function(pixel,ctx) {
drawDefault(ctx,pixel);
if (!viewInfo[view].colorEffects || !pixel.char) { return }
@ -180,10 +182,16 @@ behaviorRules.ADB = function() {
},
doBioNorm = function(pixel) {
if ((Math.random() > 0.92 && pixel.nutrition > 0 && pixel.oxygen > 0) || (Math.random() < (pixel.fentDepri / 100) && pixel.fenAddict === true && pixel.nutrition > 0 && pixel.oxygen > 0) || (Math.random() < (pixel.alcoDepri / 100) && pixel.alcoholic === true && pixel.nutrition > 0 && pixel.oxygen > 0) || (Math.random() > 0.60 && pixel.sick === true && pixel.nutrition > 0 && pixel.oxygen > 0) || (Math.random() > 0.5 && pixel.poisoned === true && pixel.nutrition > 0 && pixel.oxygen > 0) || (pixel.burning === true && pixel.nutrition > 0 && pixel.oxygen > 0) || (pixel.temp > 53 && pixel.nutrition > 0 && pixel.oxygen > 0) || (pixel.temp < -10 && pixel.nutrition > 0 && pixel.oxygen > 0) || Math.random() > 0.85 && Math.random() < (pixel.burnt / 100)) {
if ((Math.random() > 0.92 && pixel.nutrition > 0 && pixel.oxygen > 0) || (Math.random() < (pixel.ibupCount / 20) && pixel.ibupCount > 3 && pixel.nutrition > 0 && pixel.oxygen > 0) || (Math.random() < (pixel.fentDepri / 100) && pixel.fenAddict === true && pixel.nutrition > 0 && pixel.oxygen > 0) || (Math.random() < (pixel.alcoDepri / 100) && pixel.alcoholic === true && pixel.nutrition > 0 && pixel.oxygen > 0) || (Math.random() > 0.60 && pixel.sick === true && pixel.nutrition > 0 && pixel.oxygen > 0) || (Math.random() > 0.5 && pixel.poisoned === true && pixel.nutrition > 0 && pixel.oxygen > 0) || (pixel.burning === true && pixel.nutrition > 0 && pixel.oxygen > 0) || (pixel.temp > 53 && pixel.nutrition > 0 && pixel.oxygen > 0) || (pixel.temp < -10 && pixel.nutrition > 0 && pixel.oxygen > 0) || Math.random() > 0.85 && Math.random() < (pixel.burnt / 100)) {
pixel.nutrition -= 0.5
pixel.oxygen--
}
if (pixel.temp > 42 && pixel.ibupCount > 1) {
pixel.temp -= 5
}
else if (pixel.temp > 37 && pixel.ibupCount > 0) {
pixel.temp--
}
if (Math.random() > 0.5 && (pixel.nutrition < 1 || pixel.oxygen < 1 || pixel.speed < -100)) {
if (elements[pixel.element].isMultiDie === true) {
if (pixel.temp > 95) {
@ -251,6 +259,10 @@ if (pixel.poisonImmune === true && pixel.poisoned != false) {
if ((pixel.poisonImmune === true || pixel.immune === true) && pixel.sick != false) {
pixel.sick = false
}
if (ibuprofenTime < pixelTicks - 1000 && (pixel.ibup || pixel.ibupCount > 0)) {
pixel.ibup = false
pixel.ibupCount = false
}
if ((pixel.temp > 124.55 || pixel.burning) && Math.random() > 0.5) {
if (!pixel.burnt) { pixel.burnt = 1 }
else { pixel.burnt ++ }
@ -315,6 +327,19 @@ if (!isEmpty(pixel.x, pixel.y-1, true)) {
if (hitPixel.immune != true && pixel.immune == true && Math.random() > 0.75) {
hitPixel.immune = true
}
if (hitPixel.ibupCount != 0 && hitPixel.ibup != true && pixel.ibup === true && Math.random() < 0.75) {
hitPixel.ibup = true
if (!hitPixel.ibupCount) {
hitPixel.ibupCount = 1
}
else {
hitPixel.ibupCount += 1
}
ibuprofenTime = pixelTicks
}
if (hitPixel.ibupCount < pixel.ibupCount && Math.random() > 0.995) {
hitPixel.ibupCount += 1
}
if (hitPixel.burnt > 0 && (!pixel.burnt || pixel.burnt < hitPixel.burnt && pixel.burnt < 51) && Math.random() > 0.8) {
hitPixel.burnt--
}
@ -384,6 +409,19 @@ if (!isEmpty(pixel.x, pixel.y+1, true)) {
if (hitPixel.immune != true && pixel.immune == true && Math.random() > 0.75) {
hitPixel.immune = true
}
if (hitPixel.ibupCount != 0 && hitPixel.ibup != true && pixel.ibup === true && Math.random() < 0.75) {
hitPixel.ibup = true
if (!hitPixel.ibupCount) {
hitPixel.ibupCount = 1
}
else {
hitPixel.ibupCount += 1
}
ibuprofenTime = pixelTicks
}
if (hitPixel.ibupCount < pixel.ibupCount && Math.random() > 0.995) {
hitPixel.ibupCount += 1
}
if (hitPixel.burnt > 0 && (!pixel.burnt || pixel.burnt < hitPixel.burnt && pixel.burnt < 51) && Math.random() > 0.8) {
hitPixel.burnt--
}
@ -453,6 +491,19 @@ if (!isEmpty(pixel.x-1, pixel.y, true)) {
if (hitPixel.immune != true && pixel.immune == true && Math.random() > 0.75) {
hitPixel.immune = true
}
if (hitPixel.ibupCount != 0 && hitPixel.ibup != true && pixel.ibup === true && Math.random() < 0.75) {
hitPixel.ibup = true
if (!hitPixel.ibupCount) {
hitPixel.ibupCount = 1
}
else {
hitPixel.ibupCount += 1
}
ibuprofenTime = pixelTicks
}
if (hitPixel.ibupCount < pixel.ibupCount && Math.random() > 0.995) {
hitPixel.ibupCount += 1
}
if (hitPixel.burnt > 0 && (!pixel.burnt || pixel.burnt < hitPixel.burnt && pixel.burnt < 51) && Math.random() > 0.8) {
hitPixel.burnt--
}
@ -522,6 +573,19 @@ if (!isEmpty(pixel.x+1, pixel.y, true)) {
if (hitPixel.immune != true && pixel.immune == true && Math.random() > 0.75) {
hitPixel.immune = true
}
if (hitPixel.ibupCount != 0 && hitPixel.ibup != true && pixel.ibup === true && Math.random() < 0.75) {
hitPixel.ibup = true
if (!hitPixel.ibupCount) {
hitPixel.ibupCount = 1
}
else {
hitPixel.ibupCount += 1
}
ibuprofenTime = pixelTicks
}
if (hitPixel.ibupCount < pixel.ibupCount && Math.random() > 0.995) {
hitPixel.ibupCount += 1
}
if (hitPixel.burnt > 0 && (!pixel.burnt || pixel.burnt < hitPixel.burnt && pixel.burnt < 51) && Math.random() > 0.8) {
hitPixel.burnt--
}
@ -551,6 +615,14 @@ if ((Math.random() > (elements[pixel.element].ageRate) && pixel.nutrition > 0 &&
pixel.nutrition -= 0.5
pixel.oxygen--
}
if (pixel.temp > 42 && pixel.ibupCount > 0) {
pixel.temp -= 5
pixel.ibupCount--
}
else if (pixel.temp > 37 && pixel.ibupCount > 0) {
pixel.temp--
pixel.ibupCount--
}
if (Math.random() > 0.5 && (pixel.nutrition < 1 || pixel.oxygen < 1 || pixel.speed < -100)) {
if (pixel.poisoned === true || pixel.sick === true) {
changePixel(pixel,"infection")
@ -583,6 +655,10 @@ if (pixel.poisonImmune === true && pixel.poisoned != false) {
if ((pixel.poisonImmune === true || pixel.immune === true) && pixel.sick != false) {
pixel.sick = false
}
if (ibuprofenTime < pixelTicks - 1000 && (pixel.ibup || pixel.ibupCount > 0)) {
pixel.ibup = false
pixel.ibupCount = false
}
if ((pixel.temp > 124.55 || pixel.burning) && Math.random() > 0.5) {
if (!pixel.burnt) { pixel.burnt = 1 }
else { pixel.burnt ++ }
@ -651,6 +727,19 @@ if (!isEmpty(pixel.x, pixel.y-1, true)) {
if (hitPixel.immune != true && pixel.immune == true && Math.random() > 0.75) {
hitPixel.immune = true
}
if (hitPixel.ibupCount != 0 && hitPixel.ibup != true && pixel.ibup === true && Math.random() < 0.75) {
hitPixel.ibup = true
if (!hitPixel.ibupCount) {
hitPixel.ibupCount = 1
}
else {
hitPixel.ibupCount += 1
}
ibuprofenTime = pixelTicks
}
if (hitPixel.ibupCount < pixel.ibupCount && Math.random() > 0.995) {
hitPixel.ibupCount += 1
}
if (hitPixel.burnt > 0 && (!pixel.burnt || pixel.burnt < hitPixel.burnt && pixel.burnt < 51) && Math.random() > 0.8) {
hitPixel.burnt--
}
@ -734,6 +823,19 @@ if (!isEmpty(pixel.x, pixel.y+1, true)) {
if (hitPixel.immune != true && pixel.immune == true && Math.random() > 0.75) {
hitPixel.immune = true
}
if (hitPixel.ibupCount != 0 && hitPixel.ibup != true && pixel.ibup === true && Math.random() < 0.75) {
hitPixel.ibup = true
if (!hitPixel.ibupCount) {
hitPixel.ibupCount = 1
}
else {
hitPixel.ibupCount += 1
}
ibuprofenTime = pixelTicks
}
if (hitPixel.ibupCount < pixel.ibupCount && Math.random() > 0.995) {
hitPixel.ibupCount += 1
}
if (hitPixel.burnt > 0 && (!pixel.burnt || pixel.burnt < hitPixel.burnt && pixel.burnt < 51) && Math.random() > 0.8) {
hitPixel.burnt--
}
@ -817,6 +919,19 @@ if (!isEmpty(pixel.x-1, pixel.y, true)) {
if (hitPixel.immune != true && pixel.immune == true && Math.random() > 0.75) {
hitPixel.immune = true
}
if (hitPixel.ibupCount != 0 && hitPixel.ibup != true && pixel.ibup === true && Math.random() < 0.75) {
hitPixel.ibup = true
if (!hitPixel.ibupCount) {
hitPixel.ibupCount = 1
}
else {
hitPixel.ibupCount += 1
}
ibuprofenTime = pixelTicks
}
if (hitPixel.ibupCount < pixel.ibupCount && Math.random() > 0.995) {
hitPixel.ibupCount += 1
}
if (hitPixel.burnt > 0 && (!pixel.burnt || pixel.burnt < hitPixel.burnt && pixel.burnt < 51) && Math.random() > 0.8) {
hitPixel.burnt--
}
@ -900,6 +1015,19 @@ if (!isEmpty(pixel.x+1, pixel.y, true)) {
if (hitPixel.immune != true && pixel.immune == true && Math.random() > 0.75) {
hitPixel.immune = true
}
if (hitPixel.ibupCount != 0 && hitPixel.ibup != true && pixel.ibup === true && Math.random() < 0.75) {
hitPixel.ibup = true
if (!hitPixel.ibupCount) {
hitPixel.ibupCount = 1
}
else {
hitPixel.ibupCount += 1
}
ibuprofenTime = pixelTicks
}
if (hitPixel.ibupCount < pixel.ibupCount && Math.random() > 0.995) {
hitPixel.ibupCount += 1
}
if (hitPixel.burnt > 0 && (!pixel.burnt || pixel.burnt < hitPixel.burnt && pixel.burnt < 51) && Math.random() > 0.8) {
hitPixel.burnt--
}
@ -933,6 +1061,14 @@ if ((Math.random() > 0.995 && pixel.nutrition > 0 && pixel.oxygen > 0) || (Math.
pixel.nutrition -= 0.5
pixel.oxygen--
}
if (pixel.temp > 42 && pixel.ibupCount > 0) {
pixel.temp -= 5
pixel.ibupCount--
}
else if (pixel.temp > 37 && pixel.ibupCount > 0) {
pixel.temp--
pixel.ibupCount--
}
if (Math.random() > 0.5 && (pixel.nutrition < 1 || pixel.oxygen < 1 || pixel.speed < -100)) {
if (elements[pixel.element].isMultiDie === true) {
if (pixel.temp > 95) {
@ -993,6 +1129,10 @@ if (pixel.poisonImmune === true && pixel.poisoned != false) {
if ((pixel.poisonImmune === true || pixel.immune === true) && pixel.sick != false) {
pixel.sick = false
}
if (ibuprofenTime < pixelTicks - 1000 && (pixel.ibup || pixel.ibupCount > 0)) {
pixel.ibup = false
pixel.ibupCount = false
}
if ((pixel.temp > 124.55 || pixel.burning) && Math.random() > 0.5) {
if (!pixel.burnt) { pixel.burnt = 1 }
else { pixel.burnt ++ }
@ -1061,6 +1201,19 @@ if (!isEmpty(pixel.x, pixel.y-1, true)) {
if (hitPixel.immune != true && pixel.immune == true && Math.random() > 0.75) {
hitPixel.immune = true
}
if (hitPixel.ibupCount != 0 && hitPixel.ibup != true && pixel.ibup === true && Math.random() < 0.75) {
hitPixel.ibup = true
if (!hitPixel.ibupCount) {
hitPixel.ibupCount = 1
}
else {
hitPixel.ibupCount += 1
}
ibuprofenTime = pixelTicks
}
if (hitPixel.ibupCount < pixel.ibupCount && Math.random() > 0.995) {
hitPixel.ibupCount += 1
}
if (hitPixel.burnt > 0 && (!pixel.burnt || pixel.burnt < hitPixel.burnt && pixel.burnt < 51) && Math.random() > 0.8) {
hitPixel.burnt--
}
@ -1126,6 +1279,19 @@ if (!isEmpty(pixel.x, pixel.y+1, true)) {
if (hitPixel.immune != true && pixel.immune == true && Math.random() > 0.75) {
hitPixel.immune = true
}
if (hitPixel.ibupCount != 0 && hitPixel.ibup != true && pixel.ibup === true && Math.random() < 0.75) {
hitPixel.ibup = true
if (!hitPixel.ibupCount) {
hitPixel.ibupCount = 1
}
else {
hitPixel.ibupCount += 1
}
ibuprofenTime = pixelTicks
}
if (hitPixel.ibupCount < pixel.ibupCount && Math.random() > 0.995) {
hitPixel.ibupCount += 1
}
if (hitPixel.burnt > 0 && (!pixel.burnt || pixel.burnt < hitPixel.burnt && pixel.burnt < 51) && Math.random() > 0.8) {
hitPixel.burnt--
}
@ -1191,6 +1357,19 @@ if (!isEmpty(pixel.x-1, pixel.y, true)) {
if (hitPixel.immune != true && pixel.immune == true && Math.random() > 0.75) {
hitPixel.immune = true
}
if (hitPixel.ibupCount != 0 && hitPixel.ibup != true && pixel.ibup === true && Math.random() < 0.75) {
hitPixel.ibup = true
if (!hitPixel.ibupCount) {
hitPixel.ibupCount = 1
}
else {
hitPixel.ibupCount += 1
}
ibuprofenTime = pixelTicks
}
if (hitPixel.ibupCount < pixel.ibupCount && Math.random() > 0.995) {
hitPixel.ibupCount += 1
}
if (hitPixel.burnt > 0 && (!pixel.burnt || pixel.burnt < hitPixel.burnt && pixel.burnt < 51) && Math.random() > 0.8) {
hitPixel.burnt--
}
@ -1256,6 +1435,19 @@ if (!isEmpty(pixel.x+1, pixel.y, true)) {
if (hitPixel.immune != true && pixel.immune == true && Math.random() > 0.75) {
hitPixel.immune = true
}
if (hitPixel.ibupCount != 0 && hitPixel.ibup != true && pixel.ibup === true && Math.random() < 0.75) {
hitPixel.ibup = true
if (!hitPixel.ibupCount) {
hitPixel.ibupCount = 1
}
else {
hitPixel.ibupCount += 1
}
ibuprofenTime = pixelTicks
}
if (hitPixel.ibupCount < pixel.ibupCount && Math.random() > 0.995) {
hitPixel.ibupCount += 1
}
if (hitPixel.burnt > 0 && (!pixel.burnt || pixel.burnt < hitPixel.burnt && pixel.burnt < 51) && Math.random() > 0.8) {
hitPixel.burnt--
}
@ -4008,6 +4200,21 @@ elements.intestines = {
pixel.fentDepri = 0
}
}
if (hitPixel.ibup === true) {
ibuprofenTime = pixelTicks
if (pixel.ibup !== true) {
pixel.ibup = true
if (!pixel.ibupCount) {
pixel.ibupCount = 1
}
else {
pixel.ibupCount += 1
}
}
else {
pixel.ibupCount ++
}
}
if (hitPixel.poisonImmune === true && Math.random() > 0.5) {
pixel.poisoned = false
pixel.sick = false
@ -4050,6 +4257,21 @@ elements.intestines = {
pixel.fentDepri = 0
}
}
if (hitPixel.ibup === true) {
ibuprofenTime = pixelTicks
if (pixel.ibup !== true) {
pixel.ibup = true
if (!pixel.ibupCount) {
pixel.ibupCount = 1
}
else {
pixel.ibupCount += 1
}
}
else {
pixel.ibupCount ++
}
}
if (hitPixel.alcoholic === true && Math.random() > 0.95) {
pixel.alcoholic = true
pixel.alcoTime = pixelTicks
@ -4105,6 +4327,21 @@ elements.intestines = {
pixel.fentDepri = 0
}
}
if (hitPixel.ibup === true) {
ibuprofenTime = pixelTicks
if (pixel.ibup !== true) {
pixel.ibup = true
if (!pixel.ibupCount) {
pixel.ibupCount = 1
}
else {
pixel.ibupCount += 1
}
}
else {
pixel.ibupCount ++
}
}
if (hitPixel.alcoholic === true && Math.random() > 0.95) {
pixel.alcoholic = true
pixel.alcoTime = pixelTicks
@ -4152,6 +4389,21 @@ elements.intestines = {
pixel.fentDepri = 0
}
}
if (hitPixel.ibup === true) {
ibuprofenTime = pixelTicks
if (pixel.ibup !== true) {
pixel.ibup = true
if (!pixel.ibupCount) {
pixel.ibupCount = 1
}
else {
pixel.ibupCount += 1
}
}
else {
pixel.ibupCount ++
}
}
if (hitPixel.alcoholic === true && Math.random() > 0.95) {
pixel.alcoholic = true
pixel.alcoTime = pixelTicks
@ -4207,6 +4459,21 @@ elements.intestines = {
pixel.fentDepri = 0
}
}
if (hitPixel.ibup === true) {
ibuprofenTime = pixelTicks
if (pixel.ibup !== true) {
pixel.ibup = true
if (!pixel.ibupCount) {
pixel.ibupCount = 1
}
else {
pixel.ibupCount += 1
}
}
else {
pixel.ibupCount ++
}
}
if (hitPixel.alcoholic === true && Math.random() > 0.95) {
pixel.alcoholic = true
pixel.alcoTime = pixelTicks
@ -4252,6 +4519,21 @@ elements.intestines = {
pixel.fentDepri = 0
}
}
if (hitPixel.ibup === true) {
ibuprofenTime = pixelTicks
if (pixel.ibup !== true) {
pixel.ibup = true
if (!pixel.ibupCount) {
pixel.ibupCount = 1
}
else {
pixel.ibupCount += 1
}
}
else {
pixel.ibupCount ++
}
}
if (hitPixel.alcoholic === true && Math.random() > 0.95) {
pixel.alcoholic = true
pixel.alcoTime = pixelTicks
@ -4307,6 +4589,21 @@ elements.intestines = {
pixel.fentDepri = 0
}
}
if (hitPixel.ibup === true) {
ibuprofenTime = pixelTicks
if (pixel.ibup !== true) {
pixel.ibup = true
if (!pixel.ibupCount) {
pixel.ibupCount = 1
}
else {
pixel.ibupCount += 1
}
}
else {
pixel.ibupCount ++
}
}
if (hitPixel.alcoholic === true && Math.random() > 0.95) {
pixel.alcoholic = true
pixel.alcoTime = pixelTicks
@ -4354,6 +4651,21 @@ elements.intestines = {
pixel.fentDepri = 0
}
}
if (hitPixel.ibup === true) {
ibuprofenTime = pixelTicks
if (pixel.ibup !== true) {
pixel.ibup = true
if (!pixel.ibupCount) {
pixel.ibupCount = 1
}
else {
pixel.ibupCount += 1
}
}
else {
pixel.ibupCount ++
}
}
if (hitPixel.alcoholic === true && Math.random() > 0.95) {
pixel.alcoholic = true
pixel.alcoTime = pixelTicks
@ -6004,6 +6316,7 @@ elements.stomach_acid = {
"plague": { elem2:"gaseous_material", attr2:{"nutrition":-15, "speed":-10, "sick":true}, chance:0.02 },
"glue": { elem2:"gaseous_material", attr2:{"nutrition":-10, "speed":-10}, chance:0.02 },
"fentanyl": { elem2:"gaseous_material", attr2:{"nutrition":-50, "speed":-20, "fent":true}, chance:0.01 },
"ibuprofen": { elem2:"gaseous_material", attr2:{"nutrition":1, "speed":1, "ibup":true}, chance:0.02 },
},
category: "nutrition",
tempHigh: 110,
@ -7652,6 +7965,7 @@ elements.drain_health = {
},
canPlace: false,
category: "tools",
desc: "Secret tool. Steal your enemies life!"
}
elements.death_ray = {
@ -7711,7 +8025,7 @@ elements.death_ray = {
state: "gas",
density: 1,
excludeRandom: true,
noMix: true
noMix: true,
},
elements.toilet = {
@ -7743,15 +8057,33 @@ elements.toilet = {
},
canPlace: true,
hidden: true,
desc: "Secret tool. Steal your enemies life!"
}
elements.ibuprofen = {
category: "medicine",
color: ["#c34a35","#c34a35","#c34a35","#ef866d","#993a2f","#993a2f","#c34a35","#c34a35","#c34a35"],
state: "solid",
behavior: behaviors.POWDER,
tempHigh: 147,
density: 980,
stateHigh: ["oxygen","smoke","fire","ash","ash","dust","carbon_dioxide","oxygen","smoke","fire","ash","ash","dust","carbon_dioxide","oxygen","smoke","fire","ash","ash","dust","carbon_dioxide","sugar"],
desc: "Helps with fevers, don't take more than 3 a day!"
}
elements.fentanyl = {
category: "medicine",
color: "#d5edf3",
color: ["#d5edf3","#BFD3E5"],
state: "solid",
behavior: behaviors.POWDER,
tempHigh: 87.5,
reactions: {
"water": { elem1:null, elem2:"dirty_water", chance:0.05 },
"salt_water": { elem1:null, elem2:"dirty_water", chance:0.03 },
"sugar_water": { elem1:null, elem2:"dirty_water", chance:0.03 },
"seltzer": { elem1:null, elem2:"dirty_water", chance:0.04 },
},
tempHigh: 137.5,
density: 1025,
stateHigh: ["carbon_dioxide","smoke","smoke","smoke","fire","ash","ash","dust","carbon_dioxide"],
}
if (!elements.cancer.reactions) { elements.cancer.reactions = {} }

View File

@ -12,35 +12,35 @@ cc_settingsTab.registerSettings("OverHeating", cc_setting1);
settingsManager.registerTab(cc_settingsTab);
var colorPalette_4bit = [
"#101820", "#37175F", "#5F1717", "#6F175F",
"#005F00", "#1563BF", "#7F401A", "#525252",
"#8F8F8F", "#EE8822", "#FF3027", "#FF47FF",
"#58E618", "#27FFDF", "#FFFF27", "#FFFFFF"
"#101820", "#37175F", "#5F1717", "#6F175F",
"#005F00", "#1563BF", "#7F401A", "#525252",
"#8F8F8F", "#EE8822", "#FF3027", "#FF47FF",
"#58E618", "#27FFDF", "#FFFF27", "#FFFFFF"
];
function hueLerp(value) {
// Clamp the value between -50 and 400
if (value < -50) value = -50;
if (value > 400) value = 400;
// Clamp the value between -50 and 400
if (value < -50) value = -50;
if (value > 400) value = 400;
let r, g, b;
let r, g, b;
if (value <= 300) {
// Interpolate between blue and red
let t = (value + 50) / 350; // Normalize value from -50 to 300 to a 0-1 range
r = Math.round(255 * t);
g = 0;
b = Math.round(255 * (1 - t));
} else {
// Interpolate between red and white
let t = (value - 300) / 100; // Normalize value from 300 to 400 to a 0-1 range
r = 255;
g = Math.round(255 * t);
b = Math.round(255 * t);
}
if (value <= 300) {
// Interpolate between blue and red
let t = (value + 50) / 350; // Normalize value from -50 to 300 to a 0-1 range
r = Math.round(255 * t);
g = 0;
b = Math.round(255 * (1 - t));
} else {
// Interpolate between red and white
let t = (value - 300) / 100; // Normalize value from 300 to 400 to a 0-1 range
r = 255;
g = Math.round(255 * t);
b = Math.round(255 * t);
}
// Convert RGB values to a hex string
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1).toUpperCase();
// Convert RGB values to a hex string
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1).toUpperCase();
}
function cc_rgbToArray(colorString) {
@ -76,7 +76,7 @@ function cc_rgbToArray(colorString) {
}
function cc_arrayToRgbString(rgbArray) {
return `rgb(${rgbArray.join(', ')})`;
return `rgb(${rgbArray.join(', ')})`;
}
function cc_scaleList(numbers, scale) {
@ -220,58 +220,58 @@ function setPin(pixel, pins, index, value, rotation=pixel.circuitRotation) {
// Circuits
elements.four_bit_selector_circuit = {
cc_stableTick: function(pixel) {
var pins = [
// First 4-bit input (A)
[-1, -2, true], // A0
[-3, -2, true], // A1
[-5, -2, true], // A2
[-7, -2, true], // A3
cc_stableTick: function(pixel) {
var pins = [
// First 4-bit input (A)
[-7, -2, true], // A0
[-5, -2, true], // A1
[-3, -2, true], // A2
[-1, -2, true], // A3
// Second 4-bit input (B)
[7, -2, true], // B0
[5, -2, true], // B1
[3, -2, true], // B2
[1, -2, true], // B3
// Second 4-bit input (B)
[1, -2, true], // B0
[3, -2, true], // B1
[5, -2, true], // B2
[7, -2, true], // B3
// Selection pin (Sel)
[9, 0, true], // Selection (Sel)
// Selection pin (Sel)
[9, 0, true], // Selection (Sel)
// Output (O)
[-3, 2, false], // O0 (centered)
[-1, 2, false], // O1 (centered)
[1, 2, false], // O2 (centered)
[3, 2, false], // O3 (centered)
];
// Output (O)
[-3, 2, false], // O0 (centered)
[-1, 2, false], // O1 (centered)
[1, 2, false], // O2 (centered)
[3, 2, false], // O3 (centered)
];
initializeCircuit(pixel, pins, 17, 3);
initializeCircuit(pixel, pins, 17, 3);
// Read inputs
var A = [
checkPin(pixel, pins, 0),
checkPin(pixel, pins, 1),
checkPin(pixel, pins, 2),
checkPin(pixel, pins, 3)
];
// Read inputs
var A = [
checkPin(pixel, pins, 0),
checkPin(pixel, pins, 1),
checkPin(pixel, pins, 2),
checkPin(pixel, pins, 3)
];
var B = [
checkPin(pixel, pins, 4),
checkPin(pixel, pins, 5),
checkPin(pixel, pins, 6),
checkPin(pixel, pins, 7)
];
var B = [
checkPin(pixel, pins, 4),
checkPin(pixel, pins, 5),
checkPin(pixel, pins, 6),
checkPin(pixel, pins, 7)
];
var Sel = checkPin(pixel, pins, 8); // Selection pin
var Sel = checkPin(pixel, pins, 8); // Selection pin
// Select between A and B based on Sel
var output = Sel ? B : A;
// Select between A and B based on Sel
var output = Sel ? B : A;
// Output the selected 4-bit value
setPin(pixel, pins, 9, output[0]); // O0
setPin(pixel, pins, 10, output[1]); // O1
setPin(pixel, pins, 11, output[2]); // O2
setPin(pixel, pins, 12, output[3]); // O3
}
// Output the selected 4-bit value
setPin(pixel, pins, 9, output[0]); // O0
setPin(pixel, pins, 10, output[1]); // O1
setPin(pixel, pins, 11, output[2]); // O2
setPin(pixel, pins, 12, output[3]); // O3
}
};
elements.four_bit_enabler_circuit = {
@ -404,13 +404,13 @@ elements.four_bit_randomizer_circuit = {
var tempVar = 0;
elements.temperature_sensor = {
behavior: behaviors.WALL,
behavior: behaviors.WALL,
onSelect: function() {
var answertemp = Number(prompt("Set your target temperature:",(tempVar||undefined)));
if (!answertemp) { return }
var answertemp = Number(prompt("Set your target temperature:",(tempVar||undefined)));
if (!answertemp) { return }
tempVar = answertemp;
},
hoverStat: function(pixel) {
},
hoverStat: function(pixel) {
return `TargetTmp: {pixel.targetTemp}`;
},
cc_stableTick: function(pixel) {
@ -1335,67 +1335,67 @@ elements.four_bit_adder_circuit = {
};
elements.four_bit_subtractor_circuit = {
cc_stableTick: function(pixel) {
var pins = [
// First 4-bit number (A)
[-1, -2, true], // A3
[-3, -2, true], // A2
[-5, -2, true], // A1
[-7, -2, true], // A0
cc_stableTick: function(pixel) {
var pins = [
// First 4-bit number (A)
[-1, -2, true], // A3
[-3, -2, true], // A2
[-5, -2, true], // A1
[-7, -2, true], // A0
// Second 4-bit number (B)
[7, -2, true], // B3
[5, -2, true], // B2
[3, -2, true], // B1
[1, -2, true], // B0
// Second 4-bit number (B)
[7, -2, true], // B3
[5, -2, true], // B2
[3, -2, true], // B1
[1, -2, true], // B0
// Borrow-in (B_in)
[9, 0, true], // Borrow-in (B_in)
// Borrow-in (B_in)
[9, 0, true], // Borrow-in (B_in)
// Output difference (D)
[-1, 2, false], // D3
[-3, 2, false], // D2
[-5, 2, false], // D1
[-7, 2, false], // D0
[1, 2, false], // Borrow Out (B4)
];
// Output difference (D)
[-1, 2, false], // D3
[-3, 2, false], // D2
[-5, 2, false], // D1
[-7, 2, false], // D0
[1, 2, false], // Borrow Out (B4)
];
initializeCircuit(pixel, pins, 17, 3);
initializeCircuit(pixel, pins, 17, 3);
// Read inputs
var A = [
checkPin(pixel, pins, 0),
checkPin(pixel, pins, 1),
checkPin(pixel, pins, 2),
checkPin(pixel, pins, 3)
];
// Read inputs
var A = [
checkPin(pixel, pins, 0),
checkPin(pixel, pins, 1),
checkPin(pixel, pins, 2),
checkPin(pixel, pins, 3)
];
var B = [
checkPin(pixel, pins, 4),
checkPin(pixel, pins, 5),
checkPin(pixel, pins, 6),
checkPin(pixel, pins, 7)
];
var B = [
checkPin(pixel, pins, 4),
checkPin(pixel, pins, 5),
checkPin(pixel, pins, 6),
checkPin(pixel, pins, 7)
];
var B_in = checkPin(pixel, pins, 8); // Borrow-in
var B_in = checkPin(pixel, pins, 8); // Borrow-in
// Calculate the difference and borrow
var difference = [];
var borrow = B_in;
// Calculate the difference and borrow
var difference = [];
var borrow = B_in;
for (var i = 0; i < 4; i++) {
var bitDifference = A[i] - B[i] - borrow;
difference[i] = (bitDifference + 2) % 2; // Current bit difference
borrow = bitDifference < 0 ? 1 : 0; // Borrow for next bit
}
for (var i = 0; i < 4; i++) {
var bitDifference = A[i] - B[i] - borrow;
difference[i] = (bitDifference + 2) % 2; // Current bit difference
borrow = bitDifference < 0 ? 1 : 0; // Borrow for next bit
}
// Output the difference
setPin(pixel, pins, 9, difference[0]); // D0
setPin(pixel, pins, 10, difference[1]); // D1
setPin(pixel, pins, 11, difference[2]); // D2
setPin(pixel, pins, 12, difference[3]); // D3
setPin(pixel, pins, 13, borrow); // Borrow Out (B4)
}
// Output the difference
setPin(pixel, pins, 9, difference[0]); // D0
setPin(pixel, pins, 10, difference[1]); // D1
setPin(pixel, pins, 11, difference[2]); // D2
setPin(pixel, pins, 12, difference[3]); // D3
setPin(pixel, pins, 13, borrow); // Borrow Out (B4)
}
};
function general_clock(speed, s2) {
@ -1930,7 +1930,7 @@ document.addEventListener('keydown', function(event) {
}
});
function drawCircuitExtras() {
function drawCircuitExtras(ctx) {
if (elements[currentElement].isCircuitCore && elements[currentElement].previewSize) {
var circuitWidth = elements[currentElement].previewSize[0];
var circuitHeight = elements[currentElement].previewSize[1];
@ -1983,7 +1983,7 @@ function runLogicTick() {
}
function stabilizeLogicGates() {
var logicgatesElements = ["output","logic_wire","not_gate","and_gate","xor_gate","or_gate","nand_gate","nor_gate","nxor_gate","E2L_lever","E2L_button","L2E_constant","logic_transmitter","logic_receiver","logic_shock","logic_unshock"]
var logicgatesElements = ["output","logic_wire","not_gate","and_gate","xor_gate","or_gate","nand_gate","nor_gate","nxor_gate","E2L_lever","E2L_button","L2E_constant","logic_shock","logic_unshock"]
for (var i = 0;i < logicgatesElements.length;i++) {
elements[logicgatesElements[i]].cc_stableTick = elements[logicgatesElements[i]].tick;

View File

@ -1,70 +1,91 @@
// Clouds.js
if (!enabledMods.includes("mods/betterSettings.js")) { enabledMods.unshift("mods/betterSettings.js"); localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); window.location.reload() };
var clouds_settingsTab = new SettingsTab("Clouds");
var cloud_count_setting = new Setting("Cloud count", "cloud_count", settingType.NUMBER, false, defaultValue=40);
clouds_settingsTab.registerSettings("Real time", cloud_count_setting);
settingsManager.registerTab(clouds_settingsTab);
// Biased random
function randomGaussian(A, B, biasFactor=2) {
let u = Math.random();
let v = Math.random();
let num = Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v);
let u = Math.random();
let v = Math.random();
let num = Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v);
let mean = (A + B) / 2;
let stdDev = (B - A) / biasFactor;
let mean = (A + B) / 2;
let stdDev = (B - A) / biasFactor;
let result = mean + num * stdDev;
let result = mean + num * stdDev;
return Math.min(Math.max(result, A), B);
return Math.min(Math.max(result, A), B);
}
// Spawn clouds
var clouds = [];
setTimeout(() => {
for (var i = 0;i < 50;i++) {
var w = (Math.random() * 11) + 6;
var h = (Math.random() * 7) + 3;
function randomBetween(A, B) {
return Math.random() * (B - A) + A;
}
// Higher clouds = faster
var y = randomGaussian(0, height * 0.75, 5);
var speedFactor = (1 - (y / (height * 0.75)));
function initClouds(amount) {
for (let i = 0; i < amount; i++) {
var w = randomBetween(6, 17);
var h = randomBetween(4, 10);
var x = randomBetween(0, width - w);
var y = randomGaussian(0, height * 0.75, 4);
clouds.push({
x: Math.random() * (width - w),
y: y,
w: w,
h: h,
dx: ((Math.random() - 0.5) * 0.05) * (0.5 + speedFactor * 2), // Velocity
color: Math.random() > 0.5 ? "255,255,255" : "210,210,190",
blur: Math.random() * 3 + 1
});
// Higher clouds move faster
var speedBoost = 1 - (y / (height * 0.75));
var speed = ((Math.random() - 0.5) * 0.05) * (0.5 + speedBoost * 2);
var color = Math.random() > 0.5 ? "255,255,255" : "210,210,190";
var blur = Math.max(Math.min(1 / (Math.abs(speed) * 48), 4), 0); // For parallax
// Pre-render the cloud
var offCanvas = document.createElement("canvas");
var margin = blur;
offCanvas.width = w * pixelSize + 2 * margin;
offCanvas.height = h * pixelSize + 2 * margin;
var offCtx = offCanvas.getContext("2d");
var gradient = offCtx.createLinearGradient(0, margin, 0, h * pixelSize + margin);
gradient.addColorStop(0, `RGBA(${color},0.12)`);
gradient.addColorStop(1, `RGBA(${color},0.24)`);
offCtx.filter = `blur(${blur}px)`;
offCtx.fillStyle = gradient;
offCtx.fillRect(margin, margin, w * pixelSize, h * pixelSize);
clouds.push({ x, y, w, h, speed, color, blur, image: offCanvas, margin });
}
}, 600);
}
function renderClouds(ctx) {
ctx.strokeStyle = "transparent";
ctx.globalAlpha = Math.min(pixelTicks * 0.02,1);
// Fade in
ctx.globalAlpha = Math.min(pixelTicks * 0.02, 1);
for (var i = 0;i < clouds.length;i++) {
for (var i = 0; i < clouds.length; i++) {
var cloud = clouds[i];
var gradient = ctx.createLinearGradient(
cloud.x * pixelSize, cloud.y * pixelSize,
cloud.x * pixelSize, (cloud.y + cloud.h) * pixelSize
ctx.drawImage(
cloud.image,
cloud.x * pixelSize - cloud.margin,
cloud.y * pixelSize - cloud.margin
);
gradient.addColorStop(0, `RGBA(${cloud.color},0.1)`);
gradient.addColorStop(1, `RGBA(${cloud.color},0.2)`);
ctx.filter = `blur(${cloud.blur}px)`;
ctx.fillStyle = gradient;
ctx.fillRect(cloud.x * pixelSize, cloud.y * pixelSize, cloud.w * pixelSize, cloud.h * pixelSize);
ctx.filter = "none";
}
}
function updateClouds() {
if (paused) {return;}
if (paused) { return; }
for (var i = 0;i < clouds.length;i++) {
if (cloud_count_setting.value != clouds.length) {
clouds = [];
initClouds(cloud_count_setting.value);
return;
}
for (var i = 0; i < clouds.length; i++) {
var cloud = clouds[i];
cloud.x += cloud.dx;
cloud.x += cloud.speed;
// Wrap around
if (cloud.x > width) {
@ -75,5 +96,11 @@ function updateClouds() {
}
}
// Hooks
renderPrePixel(renderClouds);
runEveryTick(updateClouds);
var clouds = [];
runAfterReset(() => {
initClouds(cloud_count_setting.value);
});

View File

@ -2,9 +2,9 @@ elements.delete_all_of_element = {
name: "delete all of element",
color: ["#a7a7a7", "#a7a7a7", "#a7a7a7", "#a7a7a7", "#000000", "#000000", "#000000", "#000000"],
tool: function(pixel) {
for (var i = 1; i < width; i++) {
for (var j = 1; j < height; j++) {
if (!isEmpty(i,j)) {
for (var i = 0; i <= width; i++) {
for (var j = 0; j <= height; j++) {
if (!isEmpty(i,j,true)) {
if(pixelMap[i][j].element == pixel.element) {
deletePixel(i,j)
}

View File

@ -927,9 +927,6 @@ whenAvailable(["eLists","explodeAtPlus","urlParams","runAfterAutogen","mobsLoade
if(enabledMods.includes("mods/chem.js")) {
amalgamatedBombFire += ",FOOF".repeat(8);
};
if(enabledMods.includes("mods/the_ground.js")) {
amalgamatedBombFire += ",liquid_irradium".repeat(7);
};
if(enabledMods.includes("mods/bioooze.js")) {
amalgamatedBombFire += ",bioooze".repeat(8);
};
@ -1187,49 +1184,6 @@ whenAvailable(["eLists","explodeAtPlus","urlParams","runAfterAutogen","mobsLoade
cooldown: defaultCooldown
};
if(enabledMods.includes("mods/the_ground.js")) { //uses things from that but not worth requiring for the whole mod
elements.star_bomb = {
color: "#fffbb5",
properties: {
radius: 50, //just so people can edit it per pixel to be stupidly high
},
tick: function(pixel) {
var starFire = "stellar_plasma,stellar_plasma,stellar_plasma,liquid_stellar_plasma,liquid_stellar_plasma,plasma,plasma";
var starSmoke = "light,light,radiation";
doDefaults(pixel);
if(!isEmpty(pixel.x,pixel.y-1,true)) { //[0][1] EX (ignore bounds)
var newPixel = pixelMap[pixel.x][pixel.y-1];
newPixel.temp += 10000000; //[0][1] HT:10000000
var newElement = newPixel.element;
var newInfo = elements[newElement];
if(newInfo.state !== "gas" && newElement !== pixel.element) {
explodeAtPlus(pixel.x,pixel.y,pixel.radius,starFire,starSmoke,starbombHeat,starbombHeat,false);
};
};
if(!isEmpty(pixel.x,pixel.y+1,true)) { //[2][1] EX (don't ignore bounds, non-bound case)
var newPixel = pixelMap[pixel.x][pixel.y+1];
newPixel.temp += 10000000;
var newElement = newPixel.element;
var newInfo = elements[newElement];
if(newInfo.state !== "gas" && newElement !== pixel.element) {
explodeAtPlus(pixel.x,pixel.y,pixel.radius,starFire,starSmoke,starbombHeat,starbombHeat,false);
};
};
if(outOfBounds(pixel.x,pixel.y+1)) { //[2][1] EX (don't ignore bounds, bound case)
explodeAtPlus(pixel.x,pixel.y,pixel.radius,starFire,starSmoke,starbombHeat,starbombHeat,false);
};
if(!tryMove(pixel,pixel.x,pixel.y+1)) { //behaviors.POWDER
Math.random() < 0.5 ? tryMove(pixel,pixel.x-1,pixel.y+1) : tryMove(pixel,pixel.x+1,pixel.y+1);
};
},
category: "weapons",
state: "solid",
density: 3.663e33,
excludeRandom: true,
cooldown: defaultCooldown
};
};
//Fairies
elements.acid_fairy = {

View File

@ -1,5 +1,4 @@
// Redbirdly's Mod that adds a better light system
// if the mod is too laggy, use fast_lightmap.js
if (!enabledMods.includes("mods/betterSettings.js")) { enabledMods.unshift("mods/betterSettings.js"); localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); window.location.reload() };
var lightmap = [];
var nextLightmap = [];
@ -9,12 +8,15 @@ var lightSourceBoost = 2;
var pixelSizeQuarter = pixelSizeHalf / 2;
var falloff = 0.8;
// Define RGB colors
var coldFireColor = [0, 191, 255];
var fireflyColor = [240, 255, 70];
var radColor = [75, 100, 30];
var strangeMatterColor = [220 * 0.3, 255 * 0.3, 210 * 0.3];
var sparkColors = [[255, 210, 120], [255, 140, 10]];
// BetterSettings.js integration
var lightmap_settingsTab = new SettingsTab("Lightmap");
var resolution_setting = new Setting("Resolution (higher number = lower quality)", "resolution", settingType.NUMBER, false, defaultValue=2);
lightmap_settingsTab.registerSettings("Resolution", resolution_setting);
settingsManager.registerTab(lightmap_settingsTab);
function getRandomElement(arr) {
return arr[Math.floor(Math.random() * arr.length)];
@ -22,35 +24,34 @@ function getRandomElement(arr) {
if (!rgbToArray) {
function rgbToArray(colorString) {
if (typeof colorString !== 'string') {
console.error('Invalid colorString:', colorString);
if (typeof colorString !== "string") {
console.error("Invalid colorString:", colorString);
return null;
}
if (colorString.startsWith('rgb')) {
return colorString.slice(4, -1).split(',').map(val => parseInt(val.trim()));
} else if (colorString.startsWith('#')) {
if (colorString.startsWith("rgb")) {
return colorString
.slice(4, -1)
.split(",")
.map(val => parseInt(val.trim()));
} else if (colorString.startsWith("#")) {
let hex = colorString.slice(1);
// Handle shorthand hex (e.g., #03F)
if (hex.length === 3) {
hex = hex.split('').map(char => char + char).join('');
hex = hex
.split("")
.map(char => char + char)
.join("");
}
if (hex.length !== 6) {
console.error('Invalid hex color:', colorString);
console.error("Invalid hex color:", colorString);
return null;
}
const r = parseInt(hex.slice(0, 2), 16);
const g = parseInt(hex.slice(2, 4), 16);
const b = parseInt(hex.slice(4, 6), 16);
var r = parseInt(hex.slice(0, 2), 16);
var g = parseInt(hex.slice(2, 4), 16);
var b = parseInt(hex.slice(4, 6), 16);
return [r, g, b];
} else {
console.error('Invalid color format:', colorString);
return null;
}
console.error("Invalid color format:", colorString);
return null;
}
}
@ -59,19 +60,20 @@ function scaleList(numbers, scale) {
}
function initializeLightmap(_width, _height) {
const lightmapWidth = Math.ceil(_width / lightmapScale);
const lightmapHeight = Math.ceil(_height / lightmapScale);
lightmapWidth = Math.ceil(_width / lightmapScale) + 1;
lightmapHeight = Math.ceil(_height / lightmapScale) + 1;
const createLightmapArray = (width, height) =>
Array.from({ length: height }, () =>
Array.from({ length: width }, () => ({ color: [0, 0, 0] }))
);
function createLightmapArray(width_, height_) {
return Array.from({ length: height_ }, () =>
Array.from({ length: width_ }, () => ({ color: [0, 0, 0] }))
);
}
const newLightmap = createLightmapArray(lightmapWidth, lightmapHeight);
const newNextLightmap = createLightmapArray(lightmapWidth, lightmapHeight);
var newLightmap = createLightmapArray(lightmapWidth, lightmapHeight);
var newNextLightmap = createLightmapArray(lightmapWidth, lightmapHeight);
lightmap = newLightmap;
nextLightmap = newNextLightmap;
lightmap = newLightmap;
nextLightmap = newNextLightmap;
}
function deepCopy(source, target) {
@ -88,12 +90,11 @@ function propagateLightmap() {
var width = lightmap[0].length;
var height = lightmap.length;
var neighbors = [
{ dx: 1, dy: 0 },
{ dx: -1, dy: 0 },
{ dx: 0, dy: 1 },
{ dx: 0, dy: -1 },
{ dx: 0, dy: -1 }
];
for (var y = 0; y < height; y++) {
@ -114,9 +115,9 @@ function propagateLightmap() {
nextLightmap[y][x] = {
color: [
Math.min(Math.max(0, totalColor[0] / neighborCount * falloff), 255 * 8),
Math.min(Math.max(0, totalColor[1] / neighborCount * falloff), 255 * 8),
Math.min(Math.max(0, totalColor[2] / neighborCount * falloff), 255 * 8)
Math.min(Math.max(0, (totalColor[0] / neighborCount) * falloff), 255 * 8),
Math.min(Math.max(0, (totalColor[1] / neighborCount) * falloff), 255 * 8),
Math.min(Math.max(0, (totalColor[2] / neighborCount) * falloff), 255 * 8)
]
};
}
@ -126,67 +127,96 @@ function propagateLightmap() {
}
function rgbToHsv(r, g, b) {
r /= 255; g /= 255; b /= 255;
var max = Math.max(r, g, b), min = Math.min(r, g, b);
var h, s, v = max;
r /= 255;
g /= 255;
b /= 255;
var max = Math.max(r, g, b);
var min = Math.min(r, g, b);
var h, s;
var v = max;
var d = max - min;
s = max === 0 ? 0 : d / max;
if (max === min) {
h = 0;
} else {
switch (max) {
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
case g: h = (b - r) / d + 2; break;
case b: h = (r - g) / d + 4; break;
case r:
h = (g - b) / d + (g < b ? 6 : 0);
break;
case g:
h = (b - r) / d + 2;
break;
case b:
h = (r - g) / d + 4;
break;
}
h /= 6;
}
return [h, s, v];
}
function hsvToRgb(h, s, v) {
var r, g, b;
var i = Math.floor(h * 6);
var f = h * 6 - i;
var p = v * (1 - s);
var q = v * (1 - f * s);
var t = v * (1 - (1 - f) * s);
var r, g, b;
switch (i % 6) {
case 0: r = v; g = t; b = p; break;
case 1: r = q; g = v; b = p; break;
case 2: r = p; g = v; b = t; break;
case 3: r = p; g = q; b = v; break;
case 4: r = t; g = p; b = v; break;
case 5: r = v; g = p; b = q; break;
case 0:
r = v;
g = t;
b = p;
break;
case 1:
r = q;
g = v;
b = p;
break;
case 2:
r = p;
g = v;
b = t;
break;
case 3:
r = p;
g = q;
b = v;
break;
case 4:
r = t;
g = p;
b = v;
break;
case 5:
r = v;
g = p;
b = q;
break;
}
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
}
function renderLightmapPrePixel(ctx) {
if (!lightmap || !lightmap[0]) return;
if (!lightmap || !lightmap[0]) return;
var _width = lightmap[0].length;
var _height = lightmap.length;
var _width = lightmap[0].length;
var _height = lightmap.length;
for (var y = 0; y < _height; y++) {
for (var x = 0; x < _width; x++) {
var color = lightmap[y][x].color;
var r = color[0];
var g = color[1];
var b = color[2];
for (var y = 0; y < _height; y++) {
for (var x = 0; x < _width; x++) {
var { color } = lightmap[y][x];
var [r, g, b] = color;
if (r > 16 || g > 16 || b > 16) {
var hsv = rgbToHsv(r, g, b);
var newColor = hsvToRgb(hsv[0], hsv[1], 1);
var alpha = hsv[2];
if (r > 16 || g > 16 || b > 16) {
var [h, s, v] = rgbToHsv(r, g, b);
var newColor = hsvToRgb(h, s, 1);
var alpha = v;
ctx.globalAlpha = 1.0;
ctx.fillStyle = `rgba(${newColor[0]}, ${newColor[1]}, ${newColor[2]}, ${alpha * 0.4})`;
ctx.globalAlpha = 1.0;
ctx.fillStyle = `rgba(${newColor[0]}, ${newColor[1]}, ${newColor[2]}, ${alpha * 0.4})`;
ctx.fillRect(
x * pixelSize * lightmapScale,
y * pixelSize * lightmapScale,
@ -201,27 +231,39 @@ function renderLightmapPrePixel(ctx) {
pixelSize * lightmapScale * 2,
pixelSize * lightmapScale * 2
);
}
}
}
}
}
}
}
// Register the function to run before each pixel is rendered
// Main loop
renderPrePixel(function(ctx) {
if (!paused) {propagateLightmap();}
renderLightmapPrePixel(ctx);
// Reset lightmap if resolution changed
if (resolution_setting.value != lightmapScale) {
lightmapScale = resolution_setting.value;
initializeLightmap(width, height);
return;
}
if (!paused) {
propagateLightmap();
}
renderLightmapPrePixel(ctx);
});
function glowItsOwnColor(pixel) {
if (!pixel.color) {return;}
if (!pixel.color) return;
var x = Math.floor(pixel.x / lightmapScale);
var y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: scaleList(rgbToArray(pixel.color), lightSourceBoost) };
try {
lightmap[y][x] = { color: scaleList(rgbToArray(pixel.color), lightSourceBoost) };
} catch (e) {
console.log(e, pixel, pixel.color, rgbToArray(pixel.color), x, y)
}
}
function glowItsOwnColorIfPowered(pixel) {
if (!pixel.charge || pixel.charge <= 0) {return;}
if (!pixel.charge || pixel.charge <= 0) return;
if (!pixel.color) return;
var x = Math.floor(pixel.x / lightmapScale);
var y = Math.floor(pixel.y / lightmapScale);
@ -229,7 +271,7 @@ function glowItsOwnColorIfPowered(pixel) {
}
function glowColor(pixel, color) {
if (!color) {return;}
if (!color) return;
var x = Math.floor(pixel.x / lightmapScale);
var y = Math.floor(pixel.y / lightmapScale);
lightmap[y][x] = { color: scaleList(color, lightSourceBoost) };
@ -241,7 +283,6 @@ function glowRadiationColor(pixel) {
lightmap[y][x] = { color: scaleList(radColor, lightSourceBoost) };
}
// Define element tick functions
var originalStrangeMatterTick = elements.strange_matter.tick;
elements.strange_matter.tick = function(pixel) {
originalStrangeMatterTick(pixel);
@ -266,9 +307,9 @@ elements.laser.tick = function(pixel) {
glowColor(pixel, scaleList(rgbToArray(pixel.color), 0.5));
};
var originalFireTick2 = elements.fire.tick;
var originalFireTick3 = elements.fire.tick;
elements.fire.tick = function(pixel) {
originalFireTick2(pixel);
originalFireTick3(pixel);
glowItsOwnColor(pixel);
};
@ -287,10 +328,8 @@ elements.rainbow.tick = function(pixel) {
var originalFireflyTick = elements.firefly.tick;
elements.firefly.tick = function(pixel) {
originalFireflyTick(pixel);
var x = Math.floor(pixel.x / lightmapScale);
var y = Math.floor(pixel.y / lightmapScale);
var tickMod = pixelTicks % pixel.fff;
var num;
@ -315,10 +354,8 @@ elements.sun.tick = glowItsOwnColor;
elements.magma.tick = glowItsOwnColor;
elements.plasma.tick = glowItsOwnColor;
elements.fw_ember.tick = glowItsOwnColor;
elements.cold_fire.tick = glowItsOwnColor;
// Radioactive elements
var radioactiveElements = [
"uranium", "radiation", "rad_glass", "fallout",
"molten_uranium", "rad_shard", "rad_cloud", "rad_steam"
@ -327,12 +364,11 @@ radioactiveElements.forEach(element => {
elements[element].tick = glowRadiationColor;
});
window.addEventListener('load', () => {
initializeLightmap(width, height);
var fireflyColor = [240, 255, 70];
var radColor = [75, 100, 30];
var strangeMatterColor = [220 * 0.3, 255 * 0.3, 210 * 0.3];
var sparkColors = [[255, 210, 120], [255, 140, 10]];
var originalResizeCanvas = resizeCanvas;
resizeCanvas = function(newHeight, newWidth, newPixelSize, clear) {
originalResizeCanvas(newHeight, newWidth, newPixelSize, clear);
initializeLightmap(width, height);
};
runAfterReset(() => {
initializeLightmap(width, height);
});

View File

@ -1,3 +1,4 @@
elements.mars_gunk = {
color: "#121212",
behavior: behaviors.DGAS,
@ -28,7 +29,8 @@ elements.molten_mars = {
state: "liquid",
hidden: "true",
extraInfo: "The Result of Burnt-up mars stuff. Some turn into this faster more than others.",
temp: 2500
temp: 2500,
density: 1150
}
elements.mars_rock = {
color: ["#a51002","#bd1102"],
@ -185,14 +187,15 @@ elements.liquid_red_gold = {
state: "liquid",
density: 8,
extraInfo: "Red Gold but a fludid.",
temp: 5500
temp: 5500,
density: 3500
}
elements.liquid_mars_dust = {
color: "#DB3629",
elements.mars_water = {
color: "#F94849",
behavior: behaviors.LIQUID,
category: "archived",
category: "mars",
state: "liquid",
extraInfo: "Mars Dust Fluid. Removed 04/02/25."
density: 997
}
elements.testy = {
color: "#FFFFFF",
@ -201,13 +204,6 @@ elements.testy = {
state: "solid",
extraInfo: "Don't mind me, just a test. Removed 06/02/25?"
}
elements.legacy_liquid_mars_dust = {
color: "#DB3629",
behavior: behaviors.SUPERFLUID,
category: "archived",
state: "liquid",
extraInfo: "Mars Dust Superfluid. Changed at the start."
}
elements.o2_tank = {
color: "#98F5F9",
behavior: [
@ -222,7 +218,7 @@ elements.o2_tank = {
breakInto: ["copper", "oxygen"]
}
// 1.6.11
// 1.7.12
// most elements done :D
// iron heart ore
// iron heart
@ -241,4 +237,5 @@ elements.o2_tank = {
// machines are smashable. please smash them.
// also heatable
// O2 BE YOU
// ironheart faster
// mars water
// removed legacy liquid mars dust

View File

@ -1,741 +0,0 @@
var modName = "mods/nellfire.js";
var groundMod = "mods/the_ground.js";
var libHookTickMod = "mods/libhooktick.js";
if(enabledMods.includes(groundMod) && enabledMods.includes(libHookTickMod)) {
function nellsunColor(pixel) {
if (pixel.temp < 0) { pixel.color = pixelColorPick(pixel,"#615e5e"); var c=0 }
else if (pixel.temp < 300) { pixel.color = pixelColorPick(pixel,"#664962"); var c=0 }
else if (pixel.temp < 500) { pixel.color = pixelColorPick(pixel,"#714487"); var c=0.00004 }
else if (pixel.temp < 850) { pixel.color = pixelColorPick(pixel,"#6a43bf"); var c=0.00015 }
else if (pixel.temp < 1300) { pixel.color = pixelColorPick(pixel,"#c356db"); var c=0.0005 }
else if (pixel.temp < 1800) { pixel.color = pixelColorPick(pixel,"#f04ac4"); var c=0.0015 }
else if (pixel.temp < 2100) { pixel.color = pixelColorPick(pixel,"#f788c5"); var c=0.004 }
else if (pixel.temp < 2400) { pixel.color = pixelColorPick(pixel,"#f7a3b8"); var c=0.007 }
else if (pixel.temp < 3200) { pixel.color = pixelColorPick(pixel,"#ffd1d9"); var c=0.01 }
else if (pixel.temp < 3900) { pixel.color = pixelColorPick(pixel,"#fce1e1"); var c=0.02 }
else if (pixel.temp < 4600) { pixel.color = pixelColorPick(pixel,"#fff5f5"); var c=0.035 }
else if (pixel.temp < 6100) { pixel.color = pixelColorPick(pixel,"#ffffff"); var c=0.05 }
else if (pixel.temp < 7200) { pixel.color = pixelColorPick(pixel,"#f4fad9"); var c=0.075 } //new in-between state because the transition is too jarring
else if (pixel.temp < 8300) { pixel.color = pixelColorPick(pixel,"#e4f2c2"); var c=0.1 } //most of these are not real because of the kid named Planckian locus, but it makes it more fun
else if (pixel.temp < 10400) { pixel.color = pixelColorPick(pixel,"#c6f2a2"); var c=0.125 }
else if (pixel.temp < 12500) { pixel.color = pixelColorPick(pixel,"#90f277"); var c=0.15 }
else if (pixel.temp < 15600) { pixel.color = pixelColorPick(pixel,"#75f754"); var c=0.175 }
else if (pixel.temp < 18700) { pixel.color = pixelColorPick(pixel,"#5aff30"); var c=0.2 }
else if (pixel.temp < 21800) { pixel.color = pixelColorPick(pixel,"#1df54f"); var c=0.25 }
else if (pixel.temp < 28900) { pixel.color = pixelColorPick(pixel,"#3ce873"); var c=0.3 }
else if (pixel.temp < 36000) { pixel.color = pixelColorPick(pixel,"#4fdb90"); var c=0.35 }
else if (pixel.temp < 45600) { pixel.color = pixelColorPick(pixel,"#5dcfa7"); var c=0.4 }
else if (pixel.temp < 52200) { pixel.color = pixelColorPick(pixel,"#4fe3af"); var c=0.45 }
else if (pixel.temp < 58300) { pixel.color = pixelColorPick(pixel,"#3cfad4"); var c=0.5 }
else if (pixel.temp < 63400) { pixel.color = pixelColorPick(pixel,"#26f8ff"); var c=0.6 }
else if (pixel.temp < 68500) { pixel.color = pixelColorPick(pixel,"#19d9ff"); var c=0.7 }
else if (pixel.temp < 73600) { pixel.color = pixelColorPick(pixel,"#08b1ff"); var c=0.8 }
else { pixel.color = pixelColorPick(pixel,"#0099ff"); var c=0.9 }
return c;
};
function nellSLAC(pixel,c,whitelist=["sun","nellsun"]) {
for (var i = 0; i < adjacentCoords.length; i++) {
var x = pixel.x+adjacentCoords[i][0];
var y = pixel.y+adjacentCoords[i][1];
if (isEmpty(x,y)) {
if (Math.random() <= c) {
createPixel("light", x, y);
pixelMap[x][y].color = pixel.color;
};
} else if (!outOfBounds(x,y)) {
var newPixel = pixelMap[x][y];
//console.log(whitelist,newPixel.element,whitelist.includes(newPixel.element));
if (pixel.temp!==newPixel.temp && whitelist.includes(newPixel.element)) {
var avg = (pixel.temp + newPixel.temp)/2;
pixel.temp = avg;
newPixel.temp = avg;
pixelTempCheck(pixel);
pixelTempCheck(newPixel);
}
}
}
};
elements.nellsun = {
color: ["#ff26ac", "#ffb8e4", "#ffffff", "#b7ffa8", "#2df7b4"],
tick: function(pixel) {
nellSLAC(pixel,nellsunColor(pixel));
},
reactions: {
"hydrogen": { "elem2":"helium", "temp1":5 },
"helium": { "elem2":"carbon_dioxide", "temp1":5, "tempMax":3600 },
"carbon_dioxide": { "elem2":"neon", "temp1":5, "tempMax":1800 },
},
temp: 5504,
tempLow: -100,
stateLow: "supernova",
category: "special",
state: "gas",
//density: 1408,
insulate: true,
nellfireImmune: true,
};
elements.nellfire = {
color: ["#ff8929","#ffb429","#ffde0a"],
behavior: [
"M1|M1|M1",
"M1%10 AND M2|HT%2|M1%10 AND M2",
"XX|M2|XX"
],
reactions: {
"fire": { "elem2": "nellfire" },
/*"water": { "elem1": "smoke" },
"steam": { "elem1": "smoke" },
"carbon_dioxide": { "elem1": "smoke" },
"dirty_water": { "elem1": "smoke" },
"salt_water": { "elem1": "smoke" },
"sugar_water": { "elem1": "smoke" },*/
},
tick: function(pixel) {
if(pixel.burning) {
delete pixel.burning;
delete pixel.burnStart;
pixel.nellburn = true;
pixel.nellburnStart ??= pixelTicks;
};
},
nellBurningWhenConverted: true,
temp:900,
nellFireSpawnChance: 0,
//tempLow:200,
//stateLow: "smoke",
category: "energy",
burning: true,
nellburnTime: 50,
nellburnInto: null,
state: "gas",
density: 0.06,
ignoreAir: true,
noMix: true,
desc: "Researchers first came into this place and thought it was Hell&mdash; it wasn't, so they renamed it Nell (Not Hell). They still named the materials in it hell references, though.",
},
elements.nellglass = {
color: ["#a161b0", "#b06177", "#b59159"],
behavior: behaviors.WALL,
tempHigh: 1765,
category: "solids",
state: "solid",
density: 5012,
breakInto: "nellglass_shard",
noMix: true,
nellfireImmune: true,
};
elements.dantite = {
color: ["#5effba", "#85edd1", "#62d9c7", "#3efa9c", "#21b9db"],
tempHigh: 2000,
behavior: behaviors.POWDER,
category: "powders",
state: "solid",
density: 1442,
hardness: 0.47,
nellfireImmune: "torch",
};
elements.molten_dantite = {
color: ["#5eff6b", "#70faaa", "#31e08b", "#a1f051"],
density: 4012,
hardness: 0.84,
nellfireImmune: "torch",
};
elements.limtupyte = { //λίμνη τοῦ πυρός
color: ["#212121", "#212121", "#40221f", "#611d14"],
behavior: behaviors.WALL,
category: "solids",
state: "solid",
density: 8012,
hardness: 0.87,
nellfireImmune: true,
tempHigh: 9011,
stateHigh: "alpha_limtupyte",
};
elements.alpha_limtupyte = {
name: "α-limtupyte",
color: ["#6e1414", "#8f210b", "#a34910", "#c27115"],
density: 10112,
behavior: behaviors.MOLTEN,
category: "molten",
hidden: true,
state: "liquid",
hardness: 0.91,
nellfireImmune: true,
temp: 9500,
tempHigh: 11022,
stateHigh: "beta_limtupyte",
tempLow: 9011,
stateLow: "limtupyte",
};
elements.beta_limtupyte = {
name: "β-limtupyte",
color: ["#e68917", "#ffbd24", "#ffe940", "#ffff61"],
density: 13178,
behavior: behaviors.MOLTEN,
category: "molten",
hidden: true,
state: "liquid",
hardness: 0.93,
nellfireImmune: true,
temp: 12000,
tempHigh: 14316,
stateHigh: "limtupyte_gas",
tempLow: 11022,
stateLow: "alpha_limtupyte",
};
elements.limtupyte_gas = {
color: ["#ffff80", "#ffe940", "#feffd1", "#ffffff"],
density: 17.12,
behavior: behaviors.GAS,
category: "states",
hidden: true,
state: "gas",
hardness: 1,
nellfireImmune: true,
temp: 15000,
tempLow: 14316,
stateLow: "beta_limtupyte",
};
elements.nellglass_shard = {
color: ["#7d5f8c","#875966","#9e7b47"],
behavior: behaviors.POWDER,
tempHigh: 1765,
stateHigh: "molten_nellglass",
category: "powders",
state: "solid",
density: 4212,
nellfireImmune: true,
};
elements.nellsand = {
color: ["#906fa8", "#80747a", "#b08464"],
behavior: behaviors.POWDER,
tempHigh: 1911,
stateHigh: "molten_nellglass",
category: "land",
state: "solid",
density: 3742,
_data: ["nellsand_material","nellsand_material","particulate"],
nellfireImmune: true,
};
runAfterLoad(function() {
elements.water.reactions.nellsand = { elem1: null, elem2: "wet_nellsand" };
elements.water.reactions.wet_nellsand = { "elem1": "nellsand_water", "elem2": [ "nellsand", "nellsand", "nellsand", "nellsand_water" ], "chance": 0.01 };
});
elements.wet_nellsand = {
color: sandizeToHex("nellsand","w"),
behavior: behaviors.STURDYPOWDER,
category: "land",
reactions: {
"dirt": { "elem1":"sand", "elem2":"mud", "chance":0.0005, "oneway":true },
},
state: "solid",
tempHigh: 100,
stateHigh: "packed_nellsand",
tempLow: -50,
stateLow:"packed_nellsand",
density: 3742 * 0.595 + 150,
_data: ["nellsand_material","nellsand_material","wet_particulate"],
nellfireImmune: true,
};
elements.packed_nellsand = {
color: sandizeToHex("nellsand","p"),
behavior: behaviors.SUPPORT,
category: "land",
state: "solid",
tempHigh: 1911,
stateHigh: "nellglass",
density: 3742 * 0.59,
breakInto: "nellsand",
_data: ["nellsand_material","nellsand_material","packed_particulate"],
nellfireImmune: true,
};
makeNonSandSedimentationElements("nellsand","nellsand_water","nellsandstone");
nellburnObject = {
"dirt": "nellsand",
"dry_dirt": "nellsand",
"mud": "wet_nellsand",
"mudstone": "packed_nellsand",
"brass": ["nell_ash","zinc"],
"thermite": ["nell_ash","zinc"],
"rose_gold": ["nell_ash","gold"],
"electrum": ["nell_ash","gold"],
"molten_brass": ["nell_ash","molten_zinc"],
"molten_thermite": ["nell_ash","molten_zinc"],
"molten_rose_gold": ["nell_ash","molten_gold"],
"molten_electrum": ["nell_ash","molten_gold"],
"sun": "nellsun",
};
var otherImmunes = ["fire","smoke","plasma","cold_fire","radiation","light","proton","neutron","electron","positron","antimatter","cold_smoke","rad_fire","rad_smoke","laser","liquid_fire","liquid_smoke","liquid_plasma","liquid_cold_fire","liquid_cold_smoke","liquid_rad_fire","liquid_rad_fire","liquid_rad_smoke","le_liquid_light","liquid_laser","pure_ice","pure_water","pure_steam","magic","gold","zinc","molten_gold","molten_zinc","pyreite","infernium","molten_pyreite","molten_infernium","infernyrite","molten_infernyrite","infernyreitheum","molten_infernyreitheum","pyrinfernyreitheum","molten_pyrinfernyreitheum","stellar_plasma","liquid_stellar_plasma","hydrogen","liquid_hydrogen","hydrogen_ice","neutronium","molten_neutronium","liquid_neutronium","neutronium_gas","liquid_degenerate_neutronium","gaseous_degenerate_neutronium"].concat(["water","ice","slush","snow","packed_snow","steam", "heavy_steam","heavy_water","heavy_ice","heavy_snow", "hydrogen_ice","liquid_hydrogen","hydrogen","ionized_hydrogen", "liquid_helium","helium","ionized_helium", "tralphium","liquid_tralphium","ionized_tralphium", "carbon","charcoal","diamond","molten_carbon", "carbon_monoxide","liquid_carbon_monoxide","carbon_monoxide_ice", "carbon_dioxide","dry_ice","seltzer","seltzer_ice","foam"]);
for(let i = 0; i < otherImmunes.length; i++) {
var element = otherImmunes[i];
if(elements[element]) { elements[element].nellfireImmune = true };
};
runAfterLoad(function() {
var rockdataElements = Object.keys(elements).filter(function(name) {
return (
elements[name]._data &&
!["blackened_carbonate","nellish","nellsand_material"].includes(elements[name]._data[0])
)
});
for(i = 0; i < rockdataElements.length; i++) {
name = rockdataElements[i];
var info = elements[name];
switch(info._data[1]) {
case "phanerite":
switch(info._data[2]) {
case "igneous_rock":
nellburnObject[name] = "gehennite"
break;
case "solid_igneous_rock":
nellburnObject[name] = "solid_gehennite"
break;
case "igneous_gravel":
nellburnObject[name] = "gehennite_gravel"
break;
case "particulate":
nellburnObject[name] = "gehennite_sand"
break;
case "dust":
nellburnObject[name] = "gehennite_dust"
break;
case "wet_particulate":
nellburnObject[name] = "wet_gehennite_sand"
break;
case "packed_particulate":
nellburnObject[name] = "packed_gehennite_sand"
break;
case "sediment":
nellburnObject[name] = "gehennite_sand_sediment"
break;
case "suspension":
nellburnObject[name] = "gehennite_sandy_water"
break;
};
break;
case "aphanite":
//console.log(info._data[2]);
switch(info._data[2]) {
case "igneous_rock":
nellburnObject[name] = "nellrock"
break;
case "solid_igneous_rock":
nellburnObject[name] = "solid_nellrock"
break;
case "igneous_gravel":
nellburnObject[name] = "nellrock_gravel"
break;
case "particulate":
nellburnObject[name] = "nellrock_sand"
break;
case "dust":
nellburnObject[name] = "nellrock_dust"
break;
case "wet_particulate":
nellburnObject[name] = "wet_nellrock_sand"
break;
case "packed_particulate":
nellburnObject[name] = "packed_nellrock_sand"
break;
case "sediment":
nellburnObject[name] = "nellrock_sand_sediment"
break;
case "suspension":
nellburnObject[name] = "nellrock_sandy_water"
break;
};
break;
case "vesiculite":
//console.log(info._data[2]);
switch(info._data[2]) {
case "igneous_rock":
nellburnObject[name] = "hadean_sponge"
break;
case "solid_igneous_rock":
nellburnObject[name] = "solid_hadean_sponge"
break;
case "igneous_gravel":
nellburnObject[name] = "hadean_sponge_gravel"
break;
case "particulate":
nellburnObject[name] = "hadean_sponge_sand"
break;
case "dust":
nellburnObject[name] = "hadean_sponge_dust"
break;
case "wet_particulate":
nellburnObject[name] = "wet_hadean_sponge_sand"
break;
case "packed_particulate":
nellburnObject[name] = "packed_hadean_sponge_sand"
break;
case "sediment":
nellburnObject[name] = "hadean_sponge_sand_sediment"
break;
case "suspension":
nellburnObject[name] = "hadean_sponge_sandy_water"
break;
};
break;
case "vitrite":
//console.log(info._data[2]);
switch(info._data[2]) {
case "igneous_rock":
nellburnObject[name] = "gehidian"
break;
case "solid_igneous_rock":
nellburnObject[name] = "solid_gehidian"
break;
case "igneous_gravel":
nellburnObject[name] = "gehidian_gravel"
break;
case "particulate":
nellburnObject[name] = "gehidian_sand"
break;
case "dust":
nellburnObject[name] = "gehidian_dust"
break;
case "wet_particulate":
nellburnObject[name] = "wet_gehidian_sand"
break;
case "packed_particulate":
nellburnObject[name] = "packed_gehidian_sand"
break;
case "sediment":
nellburnObject[name] = "gehidian_sand_sediment"
break;
case "suspension":
nellburnObject[name] = "gehidian_sandy_water"
break;
};
break;
case "phanerite_sandstone":
nellburnObject[name] = "gehennite_sandstone"
break;
case "aphanite_sandstone":
nellburnObject[name] = "nellrock_sandstone"
break;
case "vesiculite_sandstone":
nellburnObject[name] = "hadean_sponge_sandstone"
break;
case "vitrite_sandstone":
nellburnObject[name] = "gehidian_sandstone"
break;
case "silica_sandstone":
nellburnObject[name] = "nellsandstone"
break;
case "magma":
switch(info._data[2]) {
case "liquid":
nellburnObject[name] = "nellish_magma"
break;
case "vaporized":
nellburnObject[name] = "vaporized_nellish_magma"
break;
case "cloud":
nellburnObject[name] = "nellish_magma_cloud"
break;
};
break;
case "rock":
switch(name) {
case "shale":
nellburnObject[name] = "nellsandstone"
break;
case "limestone":
nellburnObject[name] = "black_limestone"
break;
};
break;
case "calcium":
switch(info._data[2]) {
case "particulate":
case "mineral":
nellburnObject[name] = bccd
break;
case "sediment":
nellburnObject[name] = "blackened_calcium_carbonate_dust_sediment"
break;
case "suspension":
nellburnObject[name] = bccs
break;
};
break;
case "silica":
switch(info._data[2]) {
case "particulate":
nellburnObject[name] = "nellsand"
break;
case "wet_particulate":
nellburnObject[name] = "wet_nellsand"
break;
case "packed_particulate":
nellburnObject[name] = "packed_nellsand"
break;
case "suspension":
nellburnObject[name] = "nellsand_water"
break;
case "sediment":
nellburnObject[name] = "nellsand_sediment"
break;
};
break;
case "clay":
switch(info._data[2]) {
case "particulate":
nellburnObject[name] = "nellsand"
break;
case "suspension":
nellburnObject[name] = "nellsand_water"
break;
case "sediment":
nellburnObject[name] = "nellsand_sediment"
break;
};
break;
default:
console.log(name,info._data);
};
};
nellfireSpawnBlacklist = ["nellfire"];
});
elements.nell_ash = {
color: ["#ab9393","#947873"],
behavior: behaviors.POWDER,
/*reactions: {
"steam": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" },
"rain_cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" },
"cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" },
"snow_cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" },
"hail_cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" },
"acid_cloud": { "elem1": "pyrocumulus", "chance":0.05, "y":[0,12], "setting":"clouds" },
"pyrocumulus": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" },
"stench": { "elem2":null, "chance":0.1 }
},*/
category:"powders",
state: "solid",
nellfireImmune: true,
tick: function(pixel) {
if(Math.random() < 0.01 && pixel.temp < 25) {
pixel.temp++;
};
},
density: 810,
//tempHigh: 2000,
//forceAutoGen: true,
//stateHigh: ["molten_ash","smoke","smoke","smoke"]
};
elements.wall.nellfireImmune = true;
/*
info.nellfireImmune
info.nellburnTempChange
info.nellFireElement
info.nellFireSpawnTemp
info.nellFireSpawnChance
info.nellburn
info.nellburnInto
info.nellFireColor
*/
function doNellfire(pixel) {
var info = elements[pixel.element];
if((info.nellfireImmune && info.nellfireImmune !== "torch") && pixel.nellburn) {
delete pixel.nellburn;
delete pixel.nellburnStart;
return;
};
if (pixel.nellburn) { // Burning
pixel.nellburnStart ??= pixelTicks;
var nellburnTempChange = info.nellburnTempChange ?? 1;
var fire = info.nellFireElement === undefined ? "nellfire" : info.nellFireElement; //allow null but disallow undefined
//console.log(info.nellFireElement,fire);
while(fire instanceof Array) {
fire = fire[Math.floor(Math.random()*fire.length)];
};
var nellFireTemp = info.nellFireSpawnTemp ?? pixel.temp;
var nellFireChance = info.nellFireSpawnChance ?? 20;
pixel.temp += nellburnTempChange ?? 4;
pixelTempCheck(pixel);
for (var i = 0; i < adjacentCoords.length; i++) { // Burn adjacent pixels
var x = pixel.x+adjacentCoords[i][0];
var y = pixel.y+adjacentCoords[i][1];
if (!isEmpty(x,y,true)) {
var newPixel = pixelMap[x][y];
var newInfo = elements[newPixel.element];
var spreadChance = newInfo.nellburn ?? 15
if (spreadChance && !newPixel.nellburn) {
if (Math.floor(Math.random()*100) < spreadChance) {
newPixel.nellburn = true;
newPixel.nellburnStart = pixelTicks;
}
}
}
}
if (info.nellfireImmune !== "torch" && (pixelTicks - pixel.nellburnStart > (info.nellburnTime || 150)) && Math.floor(Math.random()*100)<(info.nellburn || 25)) {
var burnInto = info.nellburnInto;
//console.log(burnInto);
if(burnInto === undefined) { burnInto = nellburnObject[pixel.element] };
//console.log(burnInto);
if(burnInto === undefined) { burnInto = [null,"nell_ash"] };
//console.log(burnInto);
while(burnInto instanceof Array) {
burnInto = burnInto[Math.floor(Math.random()*burnInto.length)];
};
//console.log(burnInto);
if(burnInto == null) { deletePixel(pixel.x,pixel.y); return } else { changePixel(pixel,burnInto,burnInto !== "smoke") };
if(!elements[burnInto].nellBurningWhenConverted) {
delete pixel.nellburn;
delete pixel.nellburnStart;
};
//console.log("ass");
pixel.temp = nellFireTemp;
if (info.nellFireColor != undefined && burnInto == "nellfire") {
pixel.color = pixelColorPick(pixel,info.nellFireColor);
}
else {
pixel.color = pixelColorPick(pixel)
}
}
else if (Math.floor(Math.random()*100)<nellFireChance && !nellfireSpawnBlacklist.includes(pixel.element)) { // Spawn fire
//console.log(fire);
if (isEmpty(pixel.x,pixel.y-1)) {
if(fire !== null) {
createPixel(fire,pixel.x,pixel.y-1);
pixelMap[pixel.x][pixel.y-1].temp = nellFireTemp;
if (info.nellFireColor != undefined) {
pixelMap[pixel.x][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x][pixel.y-1],info.nellFireColor);
};
};
}
// same for below if top is blocked
else if (isEmpty(pixel.x,pixel.y+1)) {
if(fire !== null) {
createPixel(fire,pixel.x,pixel.y+1);
pixelMap[pixel.x][pixel.y+1].temp = nellFireTemp;
if (info.nellFireColor != undefined) {
pixelMap[pixel.x][pixel.y+1].color = pixelColorPick(pixelMap[pixel.x][pixel.y+1],info.nellFireColor);
};
};
}
}
}
}
newIgneousCompositionFamily(
"nellish",
10,
3012,
-96,
-12,
3812,
"gehennite",
["#857c71", "#b5a98d", "#91847c", "#948b68", "#8a834a", "#adad34"],
2011,
3432,
"nellrock",
["#a15a42","#997849","#946043","#8c533e","#a66658"],
2036,
3371,
"hadean_sponge",
["#e66785", "#b54761", "#cc8156", "#dbc760", "#ab9a44"],
2213,
1012,
"gehidian",
["#754c2f", "#855d3a", "#702a1c", "#691a41"],
2054,
3112,
1,9
);
var bccd = "blackened_calcium_carbonate_dust";
var bccs = "blackened_calcium_carbonate_solution";
elements.calcium_carbonate_dust.reactions ??= {};
elements.calcium_carbonate_dust.reactions.charcoal = {
elem1: bccd, elem2: [bccd, "charcoal", "charcoal"]
};
newPowder(bccd,"#948e87",2771,804,["carbon_dioxide","quicklime","charcoal","ash"]);
elements[bccd]._data = ["blackened_carbonate","blackened_carbonate","particulate"];
elements[bccd].nellfireImmune = true;
makeNonSandSedimentationElements(bccd,bccs,"black_limestone");
elements.blackened_calcium_carbonate_dust_sediment.color = "#756e64";
elements.blackened_calcium_carbonate_dust_sediment.nellfireImmune = true;
elements.black_limestone.color = "#575148";
elements.black_limestone.stateHigh = ["fire","smoke","charcoal","carbon_dioxide","quicklime","quicklime","quicklime","quicklime","quicklime","quicklime","quicklime","quicklime"];
elements[bccs].nellfireImmune = true;
elements.water.reactions[bccd] = {
"elem1":"calcium_carbonate_solution",
"elem2":[bccd,bccd,bccd,bccs],
"chance":0.004
};
elements.seltzer.reactions[bccd] = {
"elem1":bccs,
"elem2":[bccd,bccd,bccd,bccs],
"chance":0.02
};
var resultingAutoElems = [ "gehennite", "solid_gehennite", "gehennite_gravel", "nellrock", "solid_nellrock", "gehennite_sand", "gehennite_dust", "wet_gehennite_sand", "packed_gehennite_sand", "nellrock_gravel", "nellrock_sand", "nellrock_dust", "wet_nellrock_sand", "packed_nellrock_sand", "hadean_sponge", "solid_hadean_sponge", "hadean_sponge_gravel", "hadean_sponge_sand", "hadean_sponge_dust", "wet_hadean_sponge_sand", "packed_hadean_sponge_sand", "gehidian", "solid_gehidian", "gehidian_shard", "gehidian_sand", "gehidian_dust", "wet_gehidian_sand", "packed_gehidian_sand", "nellish_magma", "vaporized_nellish_magma", "nellish_magma_cloud", "gehennite_sandy_water", "gehennite_sand_sediment", "gehennite_sandstone", "nellrock_sandy_water", "nellrock_sand_sediment", "nellrock_sandstone", "hadean_sponge_sandy_water", "hadean_sponge_sand_sediment", "hadean_sponge_sandstone", "gehidian_sandy_water", "gehidian_sand_sediment", "gehidian_sandstone", bccd, bccs, "black_limestone" ] //hard-coded
runAfterLoad(function() {
for(i = 0; i < resultingAutoElems.length; i++) {
if(!elements[resultingAutoElems[i]]) {
console.error(resultingAutoElems[i]);
continue;
}
elements[resultingAutoElems[i]].nellfireImmune = true;
};
});
everyTick(function() {
if(paused) { return };
var nellfirePixels = currentPixels.filter(function(pixel) { return pixel.nellburn });
for(var pixel in nellfirePixels) {
doNellfire(nellfirePixels[pixel]);
};
});
} else {
enabledMods.splice(enabledMods.indexOf(modName),0,groundMod);
enabledMods.splice(enabledMods.indexOf(modName),0,libHookTickMod);
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert(`The ${groundMod} and ${libHookTickMod} mods are required and have been automatically inserted (reload for this to take effect).`);
};

View File

@ -1,241 +0,0 @@
var modName = "mods/nellfire.js";
var groundMod = "mods/the_ground.js";
if(enabledMods.includes(groundMod)) {
function makeRegularRainbow(steps,s,l,outputFormat="rgb") {
var hslArray = [];
var divisionSize = 360 / steps;
for(i = 0; i < 360; i += divisionSize) {
hslArray.push({h: i, s: s, l: l});
};
return hslArray.map(x => convertHslObjects(x,outputFormat));
};
function rainbowSunColor(pixel) {
var age = pixelTicks - pixel.start;
var ss, ll;
if (pixel.temp < 0) { ss = 20; ll = 10; var c=0 }
else if (pixel.temp < 300) { ss = 20; ll = 15; var c=0 }
else if (pixel.temp < 500) { ss = 30; ll = 20; var c=0.00003 }
else if (pixel.temp < 850) { ss = 30; ll = 25; var c=0.0001 }
else if (pixel.temp < 1300) { ss = 35; ll = 30; var c=0.0004 }
else if (pixel.temp < 1800) { ss = 40; ll = 35; var c=0.001 }
else if (pixel.temp < 2100) { ss = 45; ll = 40; var c=0.0025 }
else if (pixel.temp < 2400) { ss = 50; ll = 45; var c=0.004 }
else if (pixel.temp < 3200) { ss = 55; ll = 50; var c=0.007 }
else if (pixel.temp < 3900) { ss = 65; ll = 55; var c=0.01 }
else if (pixel.temp < 4600) { ss = 70; ll = 60; var c=0.015 }
else if (pixel.temp < 6100) { ss = 75; ll = 65; var c=0.025 }
else if (pixel.temp < 7200) { ss = 85; ll = 65; var c=0.035 }
else if (pixel.temp < 8300) { ss = 95; ll = 70; var c=0.05 }
else if (pixel.temp < 10400) { ss = 100; ll = 72.5; var c=0.07 }
else if (pixel.temp < 12500) { ss = 100; ll = 75; var c=0.1 }
else if (pixel.temp < 15600) { ss = 100; ll = 77.5; var c=0.125 }
else if (pixel.temp < 18700) { ss = 100; ll = 80; var c=0.15 }
else if (pixel.temp < 21800) { ss = 100; ll = 85; var c=0.175 }
else if (pixel.temp < 28900) { ss = 100; ll = 90; var c=0.2 }
else if (pixel.temp < 36000) { ss = 100; ll = 92.5; var c=0.25 }
else if (pixel.temp < 45600) { ss = 100; ll = 94; var c=0.3 }
else if (pixel.temp < 52200) { ss = 100; ll = 96.5; var c=0.4 }
else if (pixel.temp < 58300) { ss = 100; ll = 98; var c=0.5 }
else if (pixel.temp < 63400) { ss = 100; ll = 98.5; var c=0.6 }
else if (pixel.temp < 68500) { ss = 100; ll = 98.5; var c=0.7 }
else if (pixel.temp < 73600) { ss = 100; ll = 98.5; var c=0.8 }
else { ss = 100; ll = 98.5; var c=0.9 }
var hslJson = {h: (age) % 360, s: ss, l: ll};
pixel.color = pixelColorPick(pixel,convertHslObjects(hslJson,"hex"));
return c;
};
elements.rainbow_sun = {
color: ["#ffbdbd", "#f2ffbd", "#bdffd7", "#bdd7ff", "#f2bdff"],
tick: function(pixel) {
starLightAndConduction(pixel,rainbowSunColor(pixel),["sun","nellsun","rainbow_sun"])
},
reactions: {
"hydrogen": { "elem2":"helium", "temp1":5 },
"helium": { "elem2":"carbon_dioxide", "temp1":5, "tempMax":3600 },
"carbon_dioxide": { "elem2":"neon", "temp1":5, "tempMax":1800 },
},
temp: 5700,
tempLow: -100,
stateLow: "supernova",
category: "special",
state: "gas",
//density: 1408,
insulate: true,
nellfireImmune: true,
};
elements.rainbow_fire = {
color: [
{h: 330, s: 100, l: 56},
{h: 0, s: 100, l: 59},
{h: 22, s: 100, l: 58},
{h: 42, s: 100, l: 57},
{h: 60, s: 100, l: 55},
{h: 73, s: 100, l: 49},
{h: 120, s: 100, l: 49.5},
{h: 159, s: 100, l: 52},
{h: 159, s: 100, l: 52},
{h: 180, s: 100, l: 49.5},
{h: 197, s: 100, l: 59},
{h: 240, s: 100, l: 58.5},
{h: 280, s: 94, l: 53},
{h: 307, s: 100, l: 55}
].map(x => convertHslObjects(x,"hex")),
behavior: behaviors.UL_UR,
reactions: {
"fire": { "elem1": "rainbow_fire" },
"water": { "elem1": "color_smoke" },
"steam": { "elem1": "color_smoke" },
"carbon_dioxide": { "elem1": "color_smoke" },
"dirty_water": { "elem1": "color_smoke" },
"salt_water": { "elem1": "color_smoke" },
"sugar_water": { "elem1": "color_smoke" },
},
nellfireImmune: true,
fireSpawnChance: 0,
temp:610,
tempLow:102,
stateLow: "color_smoke",
tempHigh: 7000,
stateHigh: "plasma",
category: "energy",
burning: true,
burnTime: 44,
burnInto: "color_smoke",
state: "gas",
density: 0.21,
ignoreAir: true,
noMix: true,
};
elements.color_smoke.tempHigh = 610;
elements.color_smoke.stateHigh = "rainbow_fire";
elements.rainbow_glass = {
color: makeRegularRainbow(12,100,70,"hex"),
behavior: behaviors.WALL,
tempHigh: 1765,
category: "solids",
state: "solid",
density: 2711,
breakInto: "rainbow_glass_shard",
noMix: true,
nellfireImmune: true,
};
elements.rainbow_glass_shard = {
color: makeRegularRainbow(18,70,65,"hex"),
behavior: behaviors.POWDER,
tempHigh: 1784,
stateHigh: "molten_rainbow_glass",
category: "powders",
state: "solid",
density: 2213,
nellfireImmune: true,
};
elements.rainbow_sand = {
color: makeRegularRainbow(7,100,94,"hex").concat("#fbfbfb"),
behavior: behaviors.POWDER,
tempHigh: 1731,
stateHigh: "molten_rainbow_glass",
category: "land",
state: "solid",
density: 1733,
_data: ["rainbow_sand_material","rainbow_sand_material","particulate"],
nellfireImmune: true,
};
runAfterLoad(function() {
elements.water.reactions.rainbow_sand = { elem1: null, elem2: "wet_rainbow_sand" };
elements.water.reactions.wet_rainbow_sand = { "elem1": "rainbow_sand_water", "elem2": [ "rainbow_sand", "rainbow_sand", "rainbow_sand", "rainbow_sand_water" ], "chance": 0.01 };
});
elements.wet_rainbow_sand = {
color: makeRegularRainbow(7,100,84,"hex").concat("#e0e0e0"),
behavior: behaviors.STURDYPOWDER,
category: "land",
reactions: {
"dirt": { "elem1":"sand", "elem2":"mud", "chance":0.0005, "oneway":true },
},
state: "solid",
tempHigh: 100,
stateHigh: "packed_rainbow_sand",
tempLow: -50,
stateLow:"packed_rainbow_sand",
density: 1733 * 0.595 + 150,
_data: ["rainbow_sand_material","rainbow_sand_material","wet_particulate"],
nellfireImmune: true,
};
elements.packed_rainbow_sand = {
color: makeRegularRainbow(7,70,86,"hex").concat("#dbdbdb"),
behavior: behaviors.SUPPORT,
category: "land",
state: "solid",
tempHigh: 1731,
stateHigh: "rainbow_glass",
density: 1733 * 0.59,
breakInto: "rainbow_sand",
_data: ["rainbow_sand_material","rainbow_sand_material","packed_particulate"],
nellfireImmune: true,
};
makeNonSandSedimentationElements("rainbow_sand","rainbow_sand_water","rainbow_sandstone");
elements.rainbow_sandstone.color = makeRegularRainbow(14,90,71,"hex").concat("#b5b5b5");
var immunes = ["rainbow_sand_water", "rainbow_sand_sediment", "rainbow_sandstone", "phirite", "solid_phirite", "phirite_gravel", "aphirite", "solid_aphirite", "phirite_sand", "wet_phirite_sand", "packed_phirite_sand", "aphirite_gravel", "aphirite_sand", "wet_aphirite_sand", "packed_aphirite_sand", "vesirite", "solid_vesirite", "vesirite_gravel", "vesirite_sand", "wet_vesirite_sand", "packed_vesirite_sand", "vitirite", "solid_vitirite", "vitirite_shard", "vitirite_sand", "wet_vitirite_sand", "packed_vitirite_sand", "rainbow_magma", "vaporized_rainbow_magma", "rainbow_magma_cloud", "phirite_sandy_water", "phirite_sand_sediment", "phirite_sandstone", "aphirite_sandy_water", "aphirite_sand_sediment", "aphirite_sandstone", "vesirite_sandy_water", "vesirite_sand_sediment", "vesirite_sandstone", "vitirite_sandy_water", "vitirite_sand_sediment", "vitirite_sandstone", "phirite_dust", "aphirite_dust", "vesirite_dust", "vitirite_dust" ];
runAfterLoad(function() {
for(i = 0; i < immunes.length; i++) {
if(!elements[immunes[i]]) {
console.error(immunes[i]);
continue;
}
elements[immunes[i]].nellfireImmune = true;
};
});
newIgneousCompositionFamily(
"rainbow",
133487,
5512,
-71,
-17,
4555,
"phirite",
makeRegularRainbow(6,70,45,"hex"),
1671,
4004,
"aphirite",
makeRegularRainbow(24,63,75,"hex").concat("#bfbfbf"),
1685,
3951,
"vesirite",
makeRegularRainbow(13,55,80,"hex").concat(makeRegularRainbow(13,45,50,"hex")),
1712,
2918,
"vitirite",
makeRegularRainbow(30,70,35,"hex").concat("#595959"),
2054,
3741,
3,7
);
} else {
enabledMods.splice(enabledMods.indexOf(modName),0,groundMod);
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert(`The ${groundMod} mod is required and has been automatically inserted (reload for this to take effect).`);
};

View File

@ -2,7 +2,7 @@ if (!enabledMods.includes("mods/betterSettings.js")) { enabledMods.unshift("mods
var sky_settingsTab = new SettingsTab("Sky");
var realtime_setting = new Setting("Use real life time for sky", "real_time", settingType.BOOLEAN, false, defaultValue=true);
var realtime_setting = new Setting("Use real life time for sky", "real_time", settingType.BOOLEAN, false, defaultValue=false);
var initial_hour_setting = new Setting("Initial hour", "initial_hour", settingType.NUMBER, false, defaultValue=8);
var ticks_per_hour_setting = new Setting("Ticks per hour", "ticks_per_hour", settingType.NUMBER, false, defaultValue=150);
@ -12,78 +12,80 @@ sky_settingsTab.registerSettings("Ticks per hour", ticks_per_hour_setting);
settingsManager.registerTab(sky_settingsTab);
var hour = initial_hour_setting.value;
function lerpColor(start, end, t) {
return start.map((s, i) => Math.round(s + (end[i] - s) * t));
//function lerpColor(start, end, t) {
// return start.map((s, i) => Math.round(s + (end[i] - s) * t));
//}
// Destructuring makes it faster
function lerpColor([r1, g1, b1], [r2, g2, b2], t) {
return [r1 + (r2 - r1) * t, g1 + (g2 - g1) * t, b1 + (b2 - b1) * t].map(Math.round);
}
function getSkyColors(hour) {
const SKY_COLOR_PAIRS = [
[[0, 0, 15], [0, 0, 30]], // midnight
[[10, 10, 40], [20, 20, 60]],
[[255, 100, 50], [255, 150, 100]],
[[135, 206, 235], [180, 230, 255]],
[[135, 206, 250], [135, 206, 255]],
[[135, 206, 250], [120, 190, 240]],
[[255, 150, 100], [120, 70, 70]],
[[30, 15, 60], [20, 10, 40]],
[[0, 0, 15], [0, 0, 30]], // midnight
];
const SKY_COLOR_PAIRS = [
[[0, 0, 15], [0, 0, 30]], // midnight
[[10, 10, 40], [20, 20, 60]],
[[255, 100, 50], [255, 150, 100]],
[[135, 206, 235], [180, 230, 255]],
[[135, 206, 250], [135, 206, 255]],
[[135, 206, 250], [120, 190, 240]],
[[255, 150, 100], [120, 70, 70]],
[[30, 15, 60], [20, 10, 40]],
[[0, 0, 15], [0, 0, 30]], // midnight
];
// Determine the interval (each interval is 3 hours)
const index = Math.floor(hour / 3);
const t = (hour % 3) / 3;
// Determine the interval (each interval is 3 hours)
const index = Math.floor(hour / 3);
const t = (hour % 3) / 3;
const [bottomStart, topStart] = SKY_COLOR_PAIRS[index];
const [bottomEnd, topEnd] = SKY_COLOR_PAIRS[index + 1];
const [bottomStart, topStart] = SKY_COLOR_PAIRS[index];
const [bottomEnd, topEnd] = SKY_COLOR_PAIRS[index + 1];
return {
skyTop: `rgb(${lerpColor(topStart, topEnd, t).join(", ")})`,
skyBottom: `rgb(${lerpColor(bottomStart, bottomEnd, t).join(", ")})`,
};
return {
skyTop: `rgb(${lerpColor(topStart, topEnd, t).join(", ")})`,
skyBottom: `rgb(${lerpColor(bottomStart, bottomEnd, t).join(", ")})`,
};
}
function renderSky(ctx) {
const { skyTop, skyBottom } = getSkyColors(hour);
const gradient = ctx.createLinearGradient(0, 0, 0, height * pixelSize);
// Get sky colors and make gradient
const { skyTop, skyBottom } = getSkyColors(hour);
const gradient = ctx.createLinearGradient(0, 0, 0, height * pixelSize);
gradient.addColorStop(0, skyTop);
gradient.addColorStop(1, skyBottom);
gradient.addColorStop(0, skyTop);
gradient.addColorStop(1, skyBottom);
ctx.fillStyle = gradient;
ctx.fillRect(0, 0, width * pixelSize, height * pixelSize);
ctx.fillStyle = gradient;
ctx.fillRect(0, 0, (width + 1) * pixelSize, (height + 1) * pixelSize);
}
function updateDayTime() {
if (realtime_setting.value) {
const now = new Date();
hour = now.getHours() + now.getMinutes() / 60;
} else {
hour = (hour + (1 / ticks_per_hour_setting.value)) % 24; // Keep within 0-23
}
if (paused) {return;}
if (realtime_setting.value) {
const now = new Date();
hour = now.getHours() + now.getMinutes() / 60;
} else {
hour = (hour + (1 / ticks_per_hour_setting.value)) % 24; // Keep within 0-23
}
}
// Make sure the sky gets VIP treatment in the render list
// Sky should be first layer
function prioritizeRenderSky() {
const idx = renderPrePixelList.indexOf(renderSky);
if (idx !== -1) {
const [skyFn] = renderPrePixelList.splice(idx, 1);
renderPrePixelList.unshift(skyFn);
}
const idx = renderPrePixelList.indexOf(renderSky);
if (idx !== -1) {
const [skyFn] = renderPrePixelList.splice(idx, 1);
renderPrePixelList.unshift(skyFn);
}
}
// Resetting canvas also resets time
function initializeCanvas() {
const resizeCanvas = autoResizeCanvas;
autoResizeCanvas = (clear) => {
resizeCanvas(clear);
hour = initial_hour_setting.value;
};
function initializeSky() {
hour = initial_hour_setting.value;
}
// Hooks
setTimeout(initializeCanvas, 500);
runAfterReset(initializeSky);
runAfterLoad(prioritizeRenderSky);
runEveryTick(updateDayTime);
renderPrePixel(renderSky);
var hour = initial_hour_setting.value;

View File

@ -1,4 +1,4 @@
var modName = "mods/the_ground.js";
var modName = "mods/structure_test.js";
var libraryMod = "mods/code_library.js";
if(!enabledMods.includes(libraryMod)) {

File diff suppressed because it is too large Load Diff

View File

@ -7,80 +7,80 @@ let receivers = [];
let transmitters = [];
function updateLogicLists() {
receivers = [];
transmitters = [];
logicReceivers = [];
receivers = [];
transmitters = [];
logicReceivers = [];
logicTransmitters = [];
for (let i = 0; i < currentPixels.length; i++) {
const pixel = currentPixels[i];
if (pixel.element === "logic_receiver") {
logicReceivers.push(pixel);
} else if (pixel.element === "logic_transmitter") {
logicTransmitters.push(pixel);
} else if (pixel.element === "receiver") {
receivers.push(pixel);
} else if (pixel.element === "transmitter") {
transmitters.push(pixel);
}
}
for (let i = 0; i < currentPixels.length; i++) {
const pixel = currentPixels[i];
if (pixel.element === "logic_receiver") {
logicReceivers.push(pixel);
} else if (pixel.element === "logic_transmitter") {
logicTransmitters.push(pixel);
} else if (pixel.element === "receiver") {
receivers.push(pixel);
} else if (pixel.element === "transmitter") {
transmitters.push(pixel);
}
}
}
// Function to draw lines between linked transmitters and receivers
function drawLinks() {
// Iterate through transmitters and receivers to draw lines for linked channels
for (const transmitter of logicTransmitters) {
for (const receiver of logicReceivers) {
if (transmitter.channel === receiver.channel) {
ctx.beginPath();
ctx.moveTo(transmitter.x * pixelSize + pixelSizeHalf, transmitter.y * pixelSize + pixelSizeHalf);
ctx.lineTo(receiver.x * pixelSize + pixelSizeHalf, receiver.y * pixelSize + pixelSizeHalf);
ctx.strokeStyle = "RGBA(255,255,255,0.2)";
function drawLinks(ctx) {
// Iterate through transmitters and receivers to draw lines for linked channels
for (const transmitter of logicTransmitters) {
for (const receiver of logicReceivers) {
if (transmitter.channel === receiver.channel) {
ctx.beginPath();
ctx.moveTo(transmitter.x * pixelSize + pixelSizeHalf, transmitter.y * pixelSize + pixelSizeHalf);
ctx.lineTo(receiver.x * pixelSize + pixelSizeHalf, receiver.y * pixelSize + pixelSizeHalf);
ctx.strokeStyle = "RGBA(255,255,255,0.2)";
const neighbors = [
{ x: transmitter.x, y: transmitter.y - 1 }, // Top
{ x: transmitter.x, y: transmitter.y + 1 }, // Bottom
{ x: transmitter.x - 1, y: transmitter.y }, // Left
{ x: transmitter.x + 1, y: transmitter.y } // Right
];
const neighbors = [
{ x: transmitter.x, y: transmitter.y - 1 }, // Top
{ x: transmitter.x, y: transmitter.y + 1 }, // Bottom
{ x: transmitter.x - 1, y: transmitter.y }, // Left
{ x: transmitter.x + 1, y: transmitter.y } // Right
];
let highlight = false;
for (const neighbor of neighbors) {
if (
neighbor.x >= 0 && neighbor.x < width &&
neighbor.y >= 0 && neighbor.y < height
) {
const neighborPixel = pixelMap[neighbor.x][neighbor.y];
if (neighborPixel && neighborPixel.lstate > 0) {
highlight = true;
break;
}
}
}
let highlight = false;
for (const neighbor of neighbors) {
if (
neighbor.x >= 0 && neighbor.x < width &&
neighbor.y >= 0 && neighbor.y < height
) {
const neighborPixel = pixelMap[neighbor.x][neighbor.y];
if (neighborPixel && neighborPixel.lstate > 0) {
highlight = true;
break;
}
}
}
if (highlight) {
ctx.strokeStyle = "RGBA(255,200,0,0.4)";
}
ctx.lineWidth = 2;
ctx.stroke();
}
}
}
if (highlight) {
ctx.strokeStyle = "RGBA(255,200,0,0.4)";
}
ctx.lineWidth = 2;
ctx.stroke();
}
}
}
// Iterate through transmitters and receivers to draw lines for linked channels
for (const transmitter of transmitters) {
for (const receiver of receivers) {
if (transmitter._channel === receiver._channel) {
ctx.beginPath();
ctx.moveTo(transmitter.x * pixelSize + pixelSizeHalf, transmitter.y * pixelSize + pixelSizeHalf);
ctx.lineTo(receiver.x * pixelSize + pixelSizeHalf, receiver.y * pixelSize + pixelSizeHalf);
ctx.strokeStyle = "RGBA(0,0,255,0.2)";
ctx.lineWidth = 2;
ctx.stroke();
}
}
}
// Iterate through transmitters and receivers to draw lines for linked channels
for (const transmitter of transmitters) {
for (const receiver of receivers) {
if (transmitter._channel === receiver._channel) {
ctx.beginPath();
ctx.moveTo(transmitter.x * pixelSize + pixelSizeHalf, transmitter.y * pixelSize + pixelSizeHalf);
ctx.lineTo(receiver.x * pixelSize + pixelSizeHalf, receiver.y * pixelSize + pixelSizeHalf);
ctx.strokeStyle = "RGBA(0,0,255,0.2)";
ctx.lineWidth = 2;
ctx.stroke();
}
}
}
}
renderPostPixel(updateLogicLists);