diff --git a/lang/qha.json b/lang/qha.json index a2e6aec9..71eddfb3 100644 --- a/lang/qha.json +++ b/lang/qha.json @@ -268,10 +268,10 @@ "chocolate_milk": "samoca_mayi-i_paema-ae-mayi-i_paemae", "fruit_milk": "mi-ooya_paemae", "pilk": "caepayehapae", -"eggnog": "hi_maciyoo_paemae", -"egg": "hi_maciyoo", -"yolk": "hi_maciyoo_paema", -"hard_yolk": "mo-e_hi_maciyoo_paema", +"eggnog": "macamapayi_paemae", +"egg": "macamapayi", +"yolk": "macamapayi_paema", +"hard_yolk": "mo-e_macamapayi_paema", "nut_milk": "mi-ooyi_paemae", "dough": "o_mo-e_mihaya", "batter": "o_mo-e_paema-ae-mayi-i_mihaya", @@ -321,7 +321,7 @@ "dry_ice": "opese_hasamapa_lamapa", "nitrogen_ice": "opese_lama_ra", "particleboard": "yecaece_mi-oosa", -"skin": "", +"skin": "a_samoca_ha", "hair": "hacasa_miyae-i", "alcohol": "ocemae", "alcohol_gas": "lamape_ocemae", @@ -351,35 +351,35 @@ "sap": "mi-oo_mae-e_paema-ae-mayi-i", "amber": "maye_mi-oo_mae-e_paema-ae-mayi-", "caramel": "paema-ae-mayi_momae", -"molasses": "", -"ketchup": "", -"mayo": "", -"melted_chocolate": "", -"liquid_hydrogen": "", -"liquid_oxygen": "", -"liquid_nitrogen": "", -"liquid_helium": "", -"sodium": "", -"molten_sodium": "", -"sodium_gas": "", -"calcium": "", -"molten_calcium": "", -"limestone": "", -"quicklime": "", -"slaked_lime": "", -"thermite": "", -"molten_thermite": "", -"slag": "", -"amalgam": "", -"molten_aluminum": "", -"molten_zinc": "", -"neon": "", -"liquid_neon": "", -"smog": "", -"stench": "", -"liquid_stench": "", -"fragrance": "", -"perfume": "", +"molasses": "samoca omoo-oo-e_paema-ae-mayi_momae", +"ketchup": "ae_oo-u_mi-ooya_mae", +"mayo": "ae_macamapahayi_mae", +"melted_chocolate": "opese_samoca_mayi-i_paema-ae-mayi-i", +"liquid_hydrogen": "lama_a-i", +"liquid_oxygen": "mae-e_lama_mapa", +"liquid_nitrogen": "lama_ra", +"liquid_helium": "lama_ca", +"sodium": "oopaema-mayi-i_lama", +"molten_sodium": "opese_oopaema-mayi-i_lama", +"sodium_gas": "lamapa_oopaema-mayi-i_lama", +"calcium": "omahayi_lama", +"molten_calcium": "opese_omahayi_lama", +"limestone": "omahayi_mayi", +"quicklime": "lama_mapa_omahyi_lama", +"slaked_lime": "mae-e_lama_mapa_omahayi_lama", +"thermite": "poomo_mayi-i", +"molten_thermite": "opese_poomo_mayi-i", +"slag": "ore_mayi", +"amalgam": "yecaece_mayi", +"molten_aluminum": "opese_oopaema-mayi-i_mayi-ae-oo", +"molten_zinc": "opese_lacooyi_mayi-ae-oo", +"neon": "samo-e_lamapa", +"liquid_neon": "mae-e_samo-e_lamapa", +"smog": "olama_mapa", +"stench": "olama_mapa_sa", +"liquid_stench": "mae-e_olama_mapa_sa", +"fragrance": "lama_mapa_sa", +"perfume": "mae-e_lama_mapa_sa", "cyanide": "", "cyanide_gas": "", "ozone": "", diff --git a/lang/template.json b/lang/template.json index 030a601b..fae3a38c 100644 --- a/lang/template.json +++ b/lang/template.json @@ -13,6 +13,7 @@ "machines": "", "special": "", "other": "", +"states": "", "heat": "", "cool": "", "erase": "", @@ -544,5 +545,10 @@ "tsunami": "", "blaster": "", "propane_ice": "", -"molten_caustic_potash": "" +"molten_caustic_potash": "", +"ectoplasm":"", +"soul":"", +"tombstone":"", +"spider":"", +"web":"" } diff --git a/lang/tok.json b/lang/tok.json new file mode 100644 index 00000000..7a1beaba --- /dev/null +++ b/lang/tok.json @@ -0,0 +1,548 @@ +{ + "#lang.name": "toki pona", + "#lang.credit": "squarescreamyt", + "land": "ma", + "liquids": "telo", + "life": "soweli", + "powders": "ko", + "solids": "kiwen", + "energy": "wawa", + "weapons": "pakala", + "gases": "kon", + "food": "moku", + "machines": "ilo", + "special": "nasa", + "other": "namako", + "heat": "o_seli", + "cool": "o_lete", + "erase": "o_weka", + "drag": "o_tawa", + "pick": "o_kepeken", + "mix": "o_pilin", + "lookup": "o_sona", + "shock": "o_pana_e_wawa", + "paint": "o_kule", + "sand": "ko_lili_jelo", + "water": "telo_laso_sewi", + "salt_water": "telo_pi_ko_uta_walo", + "sugar_water": "telo_pi_ko_suwi", + "seltzer": "telo_kon", + "dirty_water": "telo_jaki", + "pool_water": "telo_pi_lupa_suli_telo", + "dirt": "ma", + "mud": "ko_ma", + "wet_sand": "ko_lili_jelo_pi_telo_mute", + "rock": "kiwen_lili", + "rock_wall": "kiwen_wawa", + "mudstone": "kiwen_ko_ma", + "packed_sand": "kiwen_pi_ko_lili_jelo", + "plant": "kasi", + "dead_plant": "kasi_moli", + "frozen_plant": "kasi_lete", + "grass": "kasi_lili", + "algae": "kasi_telo", + "concrete": "kiwen_wawa", + "wall": "kiwen", + "fire": "seli", + "bomb": "ilo_pakala", + "steam": "kon_seli_pi_telo_laso_sewi", + "ice": "kiwen_lete_pi_telo_laso_sewi", + "rime": "kiwen_lete_lili_pi_telo_laso_sewi", + "snow": "ko_lete_walo_pi_telo_laso_sewi", + "slush": "ko_lete_pi_telo_laso_sewi", + "packed_snow": "kiwen_lete_pi_ko_lili_walo", + "wood": "kiwen_kasi", + "smoke": "kon_jaki_pimeja", + "magma": "telo_seli_kiwen", + "plasma": "seli_pi_seli_mute", + "cold_fire": "seli_lete", + "glass": "kiwen_lukin", + "molten_glass": "telo_seli_pi_kiwen_lukin", + "molten_rad_glass": "telo_seli_pi_kiwen_lukin_jaki", + "rad_glass": "kiwen_lukin_jaki", + "meat": "moku_soweli", + "rotten_meat": "moku_soweli_jaki", + "cooked_meat": "moku_soweli_seli", + "frozen_meat": "moku_soweli_lete", + "salt": "ko_walo_uta", + "molten_salt": "telo_seli_pi_ko_walo_uta", + "sugar": "ko_suwi", + "flour": "pan_ko_lili", + "wire": "linja_pi_tawa_wawa", + "battery": "ilo_pi_pana_wawa", + "cloner": "ilo_pi_pali_sama", + "sensor": "ilo_pilin", + "heater": "ilo_seli", + "cooler": "ilo_lete", + "random": "ale", + "image": "ilo_sitelen", + "unpaint": "o_weka_e_kule", + "uncharge": "o_weka_e_wawa", + "unburn": "o_weka_e_seli", + "smash": "o_pakala", + "filler": "ijo_pi_pini_ala", + "lattice": "ijo_pini_ala_pi_linja_mute", + "gravel": "kiwen_lili_mute", + "slime": "ko_jaki_pi_laso_kasi", + "cement": "ko_pi_pali_tomo", + "dust": "ko_jaki_pi_pimeja_walo", + "void": "ijo_pimeja_pi_weka_ale", + "sun": "suno_tan", + "cell": "tomo_lili", + "cancer": "tomo_lili_ike", + "dna": "linja_sona_pi_tomo_lili", + "plague": "kon_ike", + "worm": "pipi_linja", + "frozen_worm": "pipi_linja_lete", + "flea": "pipi_lili", + "termite": "pipi_lili_jelo_loje", + "ant": "pipi_lili_pimeja_loje", + "fly": "pipi_lili_pi_tawa_kon", + "firefly": "pipi_lili_pi_pana_suno", + "hive": "tomo_pi_pipi_jelo", + "bee": "pipi_jelo", + "stink_bug": "pipi_jaki", + "dead_bug": "pipi_moli", + "human": "jan", + "body": "sijelo", + "head": "lawa", + "bird": "waso", + "rat": "soweli_lili_pi_pimeja_walo", + "frog": "akesi_telo_pi_laso_kasi", + "frozen_frog": "kiwen_akesi_telo_pi_laso_kasi", + "tadpole": "kala_lili_pi_akesi_telo", + "fish": "kala", + "frozen_fish": "kala_lete", + "slug": "pipi_ko_jaki", + "snail": "pipi_tomo", + "burner": "ilo_pana_seli", + "superheater": "ilo_seli_mute", + "freezer": "ilo_lete_mute", + "pipe": "linja_tawa", + "pipe_wall": "kiwen_pi_linja_tawa", + "mixer": "ilo_pilin_ale", + "grinder": "ilo_pakala_ko", + "ewall": "kiwen_tawa_wawa", + "torch": "palisa_pi_pana_seli", + "spout": "ilo_pi_pana_telo", + "udder": "ilo_pi_pana_telo_walo", + "bone_marrow": "kiwen_sijelo_loje", + "bone": "kiwen_sijelo", + "balloon": "sike_kule_pi_tawa_kon", + "antipowder": "ko_pi_tawa_ante", + "antimolten": "telo_seli_pi_tawa_ante", + "antifire": "seli_pi_tawa_ante", + "antifluid": "telo_pi_tawa_ante", + "antigas": "kon_pi_tawa_ante", + "vertical": "ilo_pi_tawa_sewi", + "horizontal": "ilo_pi_tawa_poka", + "ash": "ko_seli_pi_pimeja_walo", + "molten_ash": "telo_seli_pi_ko_pimeja_walo", + "light": "suno", + "liquid_light": "telo_suno", + "laser": "suno_loje", + "ball": "sike_pi_loje_walo", + "pointer": "ilo_loje_pi_pali_e_nasin", + "charcoal": "kiwen_pimeja_pi_kiwen_kasi", + "tinder": "kiwen_kasi_lili", + "sawdust": "ko_pi_kiwen_kasi", + "hail": "kiwen_lili_lete_pi_pakala_lili", + "hydrogen": "kon_suno", + "oxygen": "kon_kon", + "nitrogen": "kon_kasi", + "helium": "kon_pi_sike_tawa_kon", + "anesthesia": "kon_lape", + "ammonia": "kon_pi_pali_kasi", + "liquid_ammonia": "telo_lete_pi_kon_pali_kasi", + "carbon_dioxide": "kon_soweli", + "oil": "telo_pimeja_jaki", + "lamp_oil": "telo_walo_jaki", + "propane": "kon_suli_pi_pali_seli", + "methane": "kon_pi_pali_seli", + "liquid_methane": "telo_lete_pi_kon_pali_seli", + "stained_glass": "kiwen_lukin_kule", + "molten_stained_glass": "telo_seli_pi_kiwen_lukin_kule", + "art": "kule", + "rainbow": "kiwen_kule", + "static": "kiwen_pi_ante_pimeja_walo", + "border": "kiwen_poka", + "clay": "ko_jelo", + "clay_soil": "ko_jelo_ma", + "brick": "palisa_suli_pi_pali_tomo", + "ruins": "kiwen_pakala_pi_pali_tomo", + "porcelain": "kiwen_pi_poki_telo", + "sapling": "kasi_suli_lili", + "pinecone": "kili_pi_kasi_tenpo_Kulisuma", + "evergreen": "kasi_tenpo_Kulisuma", + "cactus": "kasi_utala", + "kelp": "kasi_linja_telo", + "seeds": "kili_lili", + "grass_seed": "kili_lili_pi_kasi_lili", + "wheat_seed": "kili_lili_pi_kasi_pan", + "straw": "kasi_palisa_moli", + "paper": "lipu", + "pollen": "ko_kasi", + "flower_seed": "kili_lili_pi_kasi_kule", + "pistil": "linja_kasi_pi_pali_kili", + "petal": "kasi_kule_pi_kasi_lili", + "tree_branch": "kiwen_kasi_linja", + "vine": "kasi_linja", + "bamboo_plant": "kasi_palisa", + "foam": "ko_walo_pi_pilin_lili", + "bubble": "sike_walo_pi_pilin_walo", + "acid": "telo_pakala_pi_laso_kasi", + "neutral_acid": "telo_pakala_lili", + "acid_gas": "kon_laso_kasi_pi_telo_pakala", + "glue": "ko_walo", + "soda": "telo_kon_suwi_pi_pimeja_loje", + "gray_goo": "ko_nasa_pi_pimeja_walo", + "malware": "ko_ike_pi_loje_laso", + "ecloner": "ilo_wile_wawa_pi_pali_sama", + "slow_cloner": "ilo_wile_lape_pi_pali_sama", + "clone_powder": "ko_pi_pali_sama", + "floating_cloner": "kon_pi_pali_sama", + "virus": "ko_ike_moli", + "ice_nine": "kiwen_lete_9", + "strange_matter": "ko_nasa_pi_laso_kasi", + "permafrost": "ko_ma_lete", + "melted_butter": "telo_seli_pi_ko_moku_jelo", + "melted_cheese": "telo_seli_pi_kiwen_telo_walo", + "mushroom_spore": "kili_soko", + "mushroom_stalk": "palisa_soko", + "mushroom_gill": "linja_soko", + "mushroom_cap": "lawa_soko", + "hyphae": "linja_ma_soko", + "mycelium": "ma_soko", + "mulch": "ko_kasi", + "ant_wall": "kiwen_pi_pipi_lili", + "lichen": "kasi_kiwen", + "antimatter": "ijo_ante", + "plastic": "kiwen_lukin_pi_poki_telo", + "molten_plastic": "telo_seli_pi_kiwen_poki_telo", + "cloth": "len", + "cellulose": "ko_lipu", + "wax": "ko_pi_palisa_suno", + "melted_wax": "telo_seli_pi_ko_palisa_suno", + "incense": "palisa_pi_kon_pona", + "fuse": "linja_seli_pi_tawa_wawa", + "dioxin": "kon_ike_pi_kiwen_poki_telo", + "insulation": "kiwen_seli_ala", + "sponge": "kiwen_pi_weka_telo", + "bamboo": "palisa_kasi", + "iron": "kiwen_walo_pi_esun_suli", + "copper": "kiwen_loje_pi_tawa_wawa", + "gold": "kiwen_mani", + "steel": "kiwen_walo_pimeja_pi_esun_suli", + "nickel": "kiwen_mani_walo_pimeja", + "zinc": "kiwen_walo_pi_pali_sin", + "silver": "kiwen_mani_pi_pimeja_walo", + "tin": "kiwen_walo_pimeja_pi_poki_moku", + "lead": "kiwen_pimeja", + "aluminum": "kiwen_pimeja_walo_pi_poki_telo", + "tungsten": "kiwen_walo_wawa", + "molten_tungsten": "telo_seli_pi_kiwen_walo_wawa", + "brass": "kiwen_loje_jelo", + "bronze": "kiwen_pimeja_jelo", + "sterling": "kiwen_mani_pi_ma_Juke", + "gallium": "kiwen_pi_kama_telo_lon_seli_lili", + "molten_gallium": "telo_seli_pi_kiwen_walo_pimeja", + "gallium_gas": "kon_seli_pi_kiwen_walo_pimeja", + "rose_gold": "kiwen_mani_pi_loje_walo", + "purple_gold": "kiwen_mani_pi_loje_laso", + "blue_gold": "kiwen_mani_pi_laso_sewi", + "electrum": "kiwen_mani_pi_laso_kasi", + "pyrite": "kiwen_pi_lukin_sama_mani", + "solder": "kiwen_wawa_pi_pali_wan", + "molten_copper": "telo_seli_pi_kiwen_loje", + "molten_gold": "telo_seli_pi_kiwen_mani", + "molten_silver": "telo_seli_pi_kiwen_walo_mani", + "molten_iron": "telo_seli_pi_kiwen_walo", + "molten_nickel": "telo_seli_pi_kiwen_pimeja_walo", + "molten_tin": "telo_seli_pi_kiwen_walo_pimeja", + "molten_lead": "telo_seli_pi_kiwen_pimeja", + "molten_solder": "telo_seli_pi_kiwen_pali_wan", + "juice": "telo_kili", + "juice_ice": "telo_kili", + "broth": "telo_pi_moku_soweli", + "milk": "telo_walo_soweli", + "chocolate_milk": "telo_soweli_pi_pimeja_loje", + "fruit_milk": "telo_walo_soweli_pi_kili_loje", + "pilk": "telo_walo_soweli_pi_telo_kon_suwi", + "eggnog": "", + "egg": "", + "yolk": "", + "hard_yolk": "", + "nut_milk": "", + "dough": "", + "batter": "", + "homunculus": "", + "butter": "", + "cheese": "", + "rotten_cheese": "", + "chocolate": "", + "grape": "", + "vinegar": "", + "herb": "", + "lettuce": "", + "pickle": "", + "tomato": "", + "sauce": "", + "pumpkin": "", + "pumpkin_seed": "", + "corn": "", + "popcorn": "", + "corn_seed": "", + "potato": "", + "baked_potato": "", + "mashed_potato": "", + "potato_seed": "", + "root": "", + "fiber": "", + "yeast": "", + "bread": "", + "toast": "", + "gingerbread": "", + "crumb": "", + "baked_batter": "", + "wheat": "", + "candy": "", + "coffee_bean": "", + "coffee_ground": "", + "nut": "", + "nut_meat": "", + "nut_butter": "", + "jelly": "", + "baking_soda": "", + "yogurt": "", + "frozen_yogurt": "", + "ice_cream": "", + "cream": "", + "beans": "", + "dry_ice": "", + "nitrogen_ice": "", + "particleboard": "", + "skin": "", + "hair": "", + "alcohol": "", + "alcohol_gas": "", + "basalt": "", + "tuff": "", + "molten_tuff": "", + "soap": "", + "bleach": "", + "chlorine": "", + "liquid_chlorine": "", + "dye": "", + "ink": "", + "mercury": "", + "mercury_gas": "", + "solid_mercury": "", + "blood": "", + "vaccine": "", + "antibody": "", + "infection": "", + "poison": "", + "poison_gas": "", + "poison_ice": "", + "antidote": "", + "tea": "", + "coffee": "", + "honey": "", + "sap": "", + "amber": "", + "caramel": "", + "molasses": "", + "ketchup": "", + "mayo": "", + "melted_chocolate": "", + "liquid_hydrogen": "", + "liquid_oxygen": "", + "liquid_nitrogen": "", + "liquid_helium": "", + "sodium": "", + "molten_sodium": "", + "sodium_gas": "", + "calcium": "", + "molten_calcium": "", + "limestone": "", + "quicklime": "", + "slaked_lime": "", + "thermite": "", + "molten_thermite": "", + "slag": "", + "amalgam": "", + "molten_aluminum": "", + "molten_zinc": "", + "neon": "", + "liquid_neon": "", + "smog": "", + "stench": "", + "liquid_stench": "", + "fragrance": "", + "perfume": "", + "cyanide": "", + "cyanide_gas": "", + "ozone": "", + "cloud": "", + "rain_cloud": "", + "snow_cloud": "", + "hail_cloud": "", + "thunder_cloud": "", + "acid_cloud": "", + "pyrocumulus": "", + "fire_cloud": "", + "color_smoke": "", + "spray_paint": "", + "led_r": "", + "led_g": "", + "led_b": "", + "sulfur": "", + "molten_sulfur": "", + "sulfur_gas": "", + "copper_sulfate": "", + "snake": "", + "loopy": "", + "warp": "", + "radiation": "", + "rad_steam": "", + "rad_cloud": "", + "fallout": "", + "neutron": "", + "proton": "", + "electric": "", + "uranium": "", + "molten_uranium": "", + "diamond": "", + "gold_coin": "", + "rust": "", + "oxidized_copper": "", + "alga": "", + "metal_scrap": "", + "glass_shard": "", + "rad_shard": "", + "brick_rubble": "", + "baked_clay": "", + "clay_shard": "", + "porcelain_shard": "", + "feather": "", + "confetti": "", + "glitter": "", + "bead": "", + "color_sand": "", + "borax": "", + "epsom_salt": "", + "potassium_salt": "", + "sodium_acetate": "", + "lightning": "", + "bless": "", + "god_ray": "", + "heat_ray": "", + "freeze_ray": "", + "pop": "", + "explosion": "", + "n_explosion": "", + "supernova": "", + "cook": "", + "incinerate": "", + "room_temp": "", + "positron": "", + "tnt": "", + "c4": "", + "grenade": "", + "dynamite": "", + "gunpowder": "", + "ember": "", + "firework": "", + "fw_ember": "", + "nuke": "", + "h_bomb": "", + "dirty_bomb": "", + "emp_bomb": "", + "nitro": "", + "greek_fire": "", + "fireball": "", + "rocket": "", + "cold_bomb": "", + "hot_bomb": "", + "antimatter_bomb": "", + "party_popper": "", + "flashbang": "", + "flash": "", + "smoke_grenade": "", + "landmine": "", + "armageddon": "", + "tesla_coil": "", + "light_bulb": "", + "shocker": "", + "pressure_plate": "", + "primordial_soup": "", + "molten_slag": "", + "molten_dirt": "", + "debug": "", + "prop": "", + "salt_ice": "", + "sugar_ice": "", + "seltzer_ice": "", + "dirty_ice": "", + "pool_ice": "", + "blood_ice": "", + "antibody_ice": "", + "infection_ice": "", + "unknown": "", + "slime_ice": "", + "antiice": "", + "ammonia_ice": "", + "liquid_propane": "", + "methane_ice": "", + "molten_brick": "", + "acid_ice": "", + "soda_ice": "", + "molten_steel": "", + "molten_brass": "", + "molten_bronze": "", + "molten_sterling": "", + "molten_rose_gold": "", + "molten_purple_gold": "", + "molten_blue_gold": "", + "molten_electrum": "", + "molten_pyrite": "", + "broth_ice": "", + "frozen_vinegar": "", + "sauce_ice": "", + "alcohol_ice": "", + "bleach_ice": "", + "chlorine_ice": "", + "frozen_ink": "", + "tea_ice": "", + "coffee_ice": "", + "hydrogen_ice": "", + "oxygen_ice": "", + "molten_amalgam": "", + "neon_ice": "", + "cyanide_ice": "", + "molten_copper_sulfate": "", + "molten_alga": "", + "molten_metal_scrap": "", + "molten_borax": "", + "molten_epsom_salt": "", + "molten_potassium_salt": "", + "molten_sodium_acetate": "", + "frozen_nitro": "", + "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": "" + } diff --git a/mod-list.html b/mod-list.html index 1b747820..04f4401e 100644 --- a/mod-list.html +++ b/mod-list.html @@ -158,7 +158,6 @@ find.jsAdds a find mode that highlights a chosen element as pulsating red and yellow (read commit description)Alice jaydsfunctions.jsAdds extra toolsJayd insane_random_events.jsMassively buffs random eventsAlice -invertscroll.jsInverts the scroll wheel for adjusting brush sizeSquareScreamYT moretools.jsAdds more temperature-modifying tools (±10/tick, ±50/tick, and absolute zero tools)Sightnado move_tools.jsAdds tools that move pixelsAlice noconfirm.jsRemoves all confirmation pop upsmollthecoder @@ -277,6 +276,7 @@ bananas.jsAdds bananas and banana plantsAlice cat.jsAdds cats and cat foodSquareScreamYT cells.jsAdds several experimental edits of the Cell elementAlice +colonies.jsAdds rockets that contain settlers to terraform a planet.Nekonico crimson.jsAdds elements relating to the Crimson from TerrariaAlice dogs.jsAdds a simple dog and dog foodhedera-ivy fairy_chain.jsAdds way too many fairies to fey_and_more.jsAlice @@ -395,6 +395,7 @@ Broken or Deprecated humans.jsAdds humans. Now part of the base gameR74n +invertscroll.jsInverts the scroll wheel for adjusting brush size (now a setting)SquareScreamYT mobile_shift.jsAdds a button for shift on mobile (Now in the base game)SquareScreamYT nopixellimit.jsRemoves the pixel limit. (now a setting)Jayd unhide.jsUnhides all elements except molten ones. (This functionality now exists as a vanilla setting)R74n diff --git a/mods/10kelements.js b/mods/10kelements.js index fed58606..f22387d6 100644 --- a/mods/10kelements.js +++ b/mods/10kelements.js @@ -24,7 +24,7 @@ elements.change_count = { var choosebehaviors = behaviors delete choosebehaviors.KILLPIXEL2 delete choosebehaviors.KILLPIXEL1 -if (!settings.randomcount){settings.randomcount = 10000; saveSettings()} +if (!settings.randomcount || settings.randomcount > 50000){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"] @@ -162,4 +162,4 @@ document.getElementById("extraInfo").querySelectorAll("small")[1].replaceChildre } } }) -} \ No newline at end of file +} diff --git a/mods/UwUify.js b/mods/UwUify.js index 5f64ca53..6f3ef9b8 100644 --- a/mods/UwUify.js +++ b/mods/UwUify.js @@ -1,4 +1,4 @@ -document.body.style.backgroundImage = 'url("https://jayd-rubies.github.io/uwuify.png")'; +document.body.style.backgroundImage = 'url("https://jayd-rubies.github.io/image/uwuify.png")'; document.body.style.backgroundSize = 'cover'; gameDiv.style.border = "1px solid #ffffff00"; window.addEventListener("load",function(){ @@ -80,4 +80,4 @@ function pixelColorPick(pixel,customColor=null) { } }*/ return color; -} \ No newline at end of file +} diff --git a/mods/bere.js b/mods/bere.js new file mode 100644 index 00000000..4d3dca12 --- /dev/null +++ b/mods/bere.js @@ -0,0 +1,85 @@ +console.log("Welcome!") + +elements.electron = { + color: "#faffa1", + behavior: behaviors.GAS, + category: "energy", + state: "gas", + reactions: { + "ash": { "elem1": "acid_gas" }, + "battery": { "elem1": "bomb" }, + "greek_fire": { elem1: "fire" }, + "wire": { "elem1": "steel" }, + "vine": { "elem1": "plant" }, + "wood": { "elem1": "acid_gas" }, + "glass": { "elem1": "potassium" }, + "stained_glass": { "elem1": "potassium" }, + } +}; + +elements.iodum = { + color: ["#4d4218","#ffca00"], + behavior: behaviors.LIQUID, + category: "liquids", + state: "solid", + tempHigh: 94.1, + stateHigh: "iodum_gas", + reactions: { + "concrete": { "elem1": "ash", "chance": 0.6 }, + } +}; + +elements.iodum_gas = { + color: ["#4d4218","#ffca00"], + behavior: behaviors.GAS, + category: "states", + state: "gas", + tempLow: 21, + stateLow: "iodum", + reactions: { + "ash": { "elem1": "steam" }, + "cloud": { "elem1": "ozone" }, + "rain_cloud": { "elem1": "oxygen" }, + } +}; + +elements.salvador_powder = { + color: ["#484742","#3b3b3b","#cfccc0","#56544d","#ffe994"], + behavior: behaviors.POWDER, + category: "powders", + state: "solid", + burn: 5, + burnTime: 30, + burnInto: ["bless"], + tempHigh: 53.6, + stateHigh: "salvador_water", + tempLow: -7, + stateLow: "god_ray", + glow: true, + reactions: { + "rad_cloud": { "elem1": "bless" }, + "cloud": { "elem1": "ozone", "chance": 0.2 }, + "radiation": { "elem1": "water" }, + "dirt": { "elem1": "mud" }, + "basalt": { "elem1": "gravel", "chance": 0.4 }, + } +}; + +elements.salvador_water = { + color: ["#2986cc","#16537e","#0086ff","#9da0f7","#54aeff"], + behavior: behaviors.SUPERFLUID, + category: "liquids", + state: "solid", + tempLow: 53.5, + stateLow: "salvador_powder", + density: 26, + glow: true, + reactions: { + "rad_cloud": { "elem1": "bless" }, + "cloud": { "elem1": "ozone", "chance": 0.2 }, + "radiation": { "elem1": "water" }, + "dirt": { "elem1": "mud" }, + "basalt": { "elem1": "gravel", "chance": 0.4 }, + "plague": { "elem1": "water" }, + } +}; diff --git a/mods/bouncing_balls.js b/mods/bouncing_balls.js new file mode 100644 index 00000000..72b5cc1b --- /dev/null +++ b/mods/bouncing_balls.js @@ -0,0 +1,703 @@ +elements.better_ball = { + name: "ball", + tick: function(pixel) { + if (pixel.dir === "down") { + if (tryMove(pixel, pixel.x, pixel.y+1)) { + if ((!isEmpty(pixel.x, pixel.y+1, true) || outOfBounds(pixel.x,pixel.y+1)) && pixel.speed > 0.5) { + pixel.speed += 1 + console.log("go up and down code") + if (!isEmpty(pixel.x, pixel.y+1, true) && pixel.speed > 0.5) { + var beneath = pixelMap[pixel.x][pixel.y+1]; + if (elements[beneath.element].id === elements.better_ball.id) { + if (beneath.dir === "up") { + pixel.dir = "up" + beneath.dir = "down" + beneath.speed = pixel.speed + pixel.speed = beneath.speed + } + else { + pixel.dir = "up" + } + } + else { + pixel.dir = "up" + } + } + else if (outOfBounds(pixel.x,pixel.y+1) && pixel.speed > 0.5) { + pixel.dir = "up" + } + } + else { + pixel.speed += 1 + console.log("increase speed code") + } + } + else if (!tryMove(pixel, pixel.x, pixel.y+1) && (!isEmpty(pixel.x, pixel.y+1, true) || outOfBounds(pixel.x,pixel.y+1))) { + if (!isEmpty(pixel.x, pixel.y+1, true) && pixel.roll === false && (isEmpty(pixel.x-1, pixel.y+1) || isEmpty(pixel.x+1, pixel.y+1))) { + console.log("incline code") + if (isEmpty(pixel.x+1, pixel.y+1)) { + pixel.rolldir = 1 + } + else if (isEmpty(pixel.x-1, pixel.y+1)) { + pixel.rolldir = -1 + } + tryMove(pixel, pixel.x+(pixel.rolldir), pixel.y+1); + pixel.rollspeed += 1 + } + else if ((!isEmpty(pixel.x, pixel.y+1, true) || outOfBounds(pixel.x,pixel.y+1)) && pixel.rollspeed > 0) { + pixel.rollspeed -= 1 + pixel.speed = 0 + if (pixel.roll === false) { + pixel.roll = true + } + if (!isEmpty(pixel.x+(pixel.rolldir), pixel.y, true) && pixel.rollspeed < 10) { + console.log("bounce off wall code") + pixel.rolldir = (pixel.rolldir-(2*pixel.rolldir)) + } + else if (pixel.rollspeed > 9 && isEmpty(pixel, pixel.x+(pixel.rolldir), pixel.y-1) && !isEmpty(pixel.x+(pixel.rolldir), pixel.y, true)) { + console.log("uphill code") + tryMove(pixel, pixel.x+(pixel.rolldir), pixel.y-1); + pixel.rollspeed -= 1 + pixel.speed = 0 + } + else if (!isEmpty(pixel.x+(pixel.rolldir), pixel.y+1, true)) { + console.log("roll code") + tryMove(pixel, pixel.x+(pixel.rolldir), pixel.y) + } + else if (isEmpty(pixel.x+(pixel.rolldir), pixel.y)) { + console.log("stop roll code") + pixel.roll = false + } + } + else if (pixel.rollspeed < 1 && pixel.roll === true) { + pixel.roll = false + } + } + } + else if (pixel.speed > 0 && pixel.dir === "up") { + if (tryMove(pixel, pixel.x, pixel.y-1)) { + pixel.speed -= 1.15 + if (outOfBounds(pixel.x,pixel.y-1) || !isEmpty(pixel.x, pixel.y-1, true)) { + if (!isEmpty(pixel.x, pixel.y-1, true) && pixel.speed > 0) { + var above = pixelMap[pixel.x][pixel.y-1]; + if (elements[above.element].id === elements.better_ball.id) { + if (above.dir === "down") { + pixel.dir = "down" + above.dir = "up" + above.speed = pixel.speed + pixel.speed = above.speed + } + else { + pixel.dir = "down" + } + } + } + else if (outOfBounds(pixel.x,pixel.y-1) && pixel.speed > 0) { + pixel.dir = "down" + } + } + if (pixel.speed < 1) { + pixel.dir = "down" + } + } + } + doDefaults(pixel); + }, + properties: { + speed: 0, + dir: "down", + roll: false, + rollspeed: 0, + }, + color: "#e35693", + tempHigh: 250, + stateHigh: "molten_plastic", + category: "special" +} + +elements.basketball = { + tick: function(pixel) { + if (pixel.dir === "down") { + if (tryMove(pixel, pixel.x, pixel.y+1)) { + if ((!isEmpty(pixel.x, pixel.y+1, true) || outOfBounds(pixel.x,pixel.y+1)) && pixel.speed > 0.5) { + pixel.speed += 1 + console.log("go up and down code") + if (!isEmpty(pixel.x, pixel.y+1, true) && pixel.speed > 0.5) { + var beneath = pixelMap[pixel.x][pixel.y+1]; + if (elements[beneath.element].id === elements.better_ball.id) { + if (beneath.dir === "up") { + pixel.dir = "up" + beneath.dir = "down" + beneath.speed = pixel.speed + pixel.speed = beneath.speed + } + else { + pixel.dir = "up" + } + } + else { + pixel.dir = "up" + } + } + else if (outOfBounds(pixel.x,pixel.y+1) && pixel.speed > 0.5) { + pixel.dir = "up" + } + } + else { + pixel.speed += 1 + console.log("increase speed code") + } + } + else if (!tryMove(pixel, pixel.x, pixel.y+1) && (!isEmpty(pixel.x, pixel.y+1, true) || outOfBounds(pixel.x,pixel.y+1))) { + if (!isEmpty(pixel.x, pixel.y+1, true) && pixel.roll === false && (isEmpty(pixel.x-1, pixel.y+1) || isEmpty(pixel.x+1, pixel.y+1))) { + console.log("incline code") + if (isEmpty(pixel.x+1, pixel.y+1)) { + pixel.rolldir = 1 + } + else if (isEmpty(pixel.x-1, pixel.y+1)) { + pixel.rolldir = -1 + } + tryMove(pixel, pixel.x+(pixel.rolldir), pixel.y+1); + pixel.rollspeed += 1 + } + else if ((!isEmpty(pixel.x, pixel.y+1, true) || outOfBounds(pixel.x,pixel.y+1)) && pixel.rollspeed > 0) { + pixel.rollspeed -= 1 + pixel.speed = 0 + if (pixel.roll === false) { + pixel.roll = true + } + if (!isEmpty(pixel.x+(pixel.rolldir), pixel.y, true) && pixel.rollspeed < 10) { + console.log("bounce off wall code") + pixel.rolldir = (pixel.rolldir-(2*pixel.rolldir)) + } + else if (pixel.rollspeed > 9 && isEmpty(pixel, pixel.x+(pixel.rolldir), pixel.y-1) && !isEmpty(pixel.x+(pixel.rolldir), pixel.y, true)) { + console.log("uphill code") + tryMove(pixel, pixel.x+(pixel.rolldir), pixel.y-1); + pixel.rollspeed -= 1 + pixel.speed = 0 + } + else if (!isEmpty(pixel.x+(pixel.rolldir), pixel.y+1, true)) { + console.log("roll code") + tryMove(pixel, pixel.x+(pixel.rolldir), pixel.y) + } + else if (isEmpty(pixel.x+(pixel.rolldir), pixel.y)) { + console.log("stop roll code") + pixel.roll = false + } + } + else if (pixel.rollspeed < 1 && pixel.roll === true) { + pixel.roll = false + } + } + } + else if (pixel.speed > 0 && pixel.dir === "up") { + if (tryMove(pixel, pixel.x, pixel.y-1)) { + pixel.speed -= 1.4 + if (outOfBounds(pixel.x,pixel.y-1) || !isEmpty(pixel.x, pixel.y-1, true)) { + if (!isEmpty(pixel.x, pixel.y-1, true) && pixel.speed > 0) { + var above = pixelMap[pixel.x][pixel.y-1]; + if (elements[above.element].id === elements.better_ball.id) { + if (above.dir === "down") { + pixel.dir = "down" + above.dir = "up" + above.speed = pixel.speed + pixel.speed = above.speed + } + else { + pixel.dir = "down" + } + } + } + else if (outOfBounds(pixel.x,pixel.y-1) && pixel.speed > 0) { + pixel.dir = "down" + } + } + if (pixel.speed < 1) { + pixel.dir = "down" + } + } + } + doDefaults(pixel); + }, + properties: { + speed: 0, + dir: "down", + roll: false, + rollspeed: 0, + }, + color: ["#B54213","#B54213","#161616","#B54213","#B54213","#161616","#B54213","#B54213"], + tempHigh: 350, + stateHigh: ["cooked_meat","smoke","smoke","smoke","smoke","ash","molten_plastic","molten_plastic","molten_plastic","molten_plastic","molten_plastic","molten_plastic"], + category: "special" +} + +elements.tennis_ball = { + tick: function(pixel) { + if (pixel.dir === "down") { + if (tryMove(pixel, pixel.x, pixel.y+1)) { + if ((!isEmpty(pixel.x, pixel.y+1, true) || outOfBounds(pixel.x,pixel.y+1)) && pixel.speed > 0.5) { + pixel.speed += 1 + console.log("go up and down code") + if (!isEmpty(pixel.x, pixel.y+1, true) && pixel.speed > 0.5) { + var beneath = pixelMap[pixel.x][pixel.y+1]; + if (elements[beneath.element].id === elements.better_ball.id) { + if (beneath.dir === "up") { + pixel.dir = "up" + beneath.dir = "down" + beneath.speed = pixel.speed + pixel.speed = beneath.speed + } + else { + pixel.dir = "up" + } + } + else { + pixel.dir = "up" + } + } + else if (outOfBounds(pixel.x,pixel.y+1) && pixel.speed > 0.5) { + pixel.dir = "up" + } + } + else { + pixel.speed += 1 + console.log("increase speed code") + } + } + else if (!tryMove(pixel, pixel.x, pixel.y+1) && (!isEmpty(pixel.x, pixel.y+1, true) || outOfBounds(pixel.x,pixel.y+1))) { + if (!isEmpty(pixel.x, pixel.y+1, true) && pixel.roll === false && (isEmpty(pixel.x-1, pixel.y+1) || isEmpty(pixel.x+1, pixel.y+1))) { + console.log("incline code") + if (isEmpty(pixel.x+1, pixel.y+1)) { + pixel.rolldir = 1 + } + else if (isEmpty(pixel.x-1, pixel.y+1)) { + pixel.rolldir = -1 + } + tryMove(pixel, pixel.x+(pixel.rolldir), pixel.y+1); + pixel.rollspeed += 1 + } + else if ((!isEmpty(pixel.x, pixel.y+1, true) || outOfBounds(pixel.x,pixel.y+1)) && pixel.rollspeed > 0) { + pixel.rollspeed -= 1 + pixel.speed = 0 + if (pixel.roll === false) { + pixel.roll = true + } + if (!isEmpty(pixel.x+(pixel.rolldir), pixel.y, true) && pixel.rollspeed < 10) { + console.log("bounce off wall code") + pixel.rolldir = (pixel.rolldir-(2*pixel.rolldir)) + } + else if (pixel.rollspeed > 9 && isEmpty(pixel, pixel.x+(pixel.rolldir), pixel.y-1) && !isEmpty(pixel.x+(pixel.rolldir), pixel.y, true)) { + console.log("uphill code") + tryMove(pixel, pixel.x+(pixel.rolldir), pixel.y-1); + pixel.rollspeed -= 1 + pixel.speed = 0 + } + else if (!isEmpty(pixel.x+(pixel.rolldir), pixel.y+1, true)) { + console.log("roll code") + tryMove(pixel, pixel.x+(pixel.rolldir), pixel.y) + } + else if (isEmpty(pixel.x+(pixel.rolldir), pixel.y)) { + console.log("stop roll code") + pixel.roll = false + } + } + else if (pixel.rollspeed < 1 && pixel.roll === true) { + pixel.roll = false + } + } + } + else if (pixel.speed > 0 && pixel.dir === "up") { + if (tryMove(pixel, pixel.x, pixel.y-1)) { + pixel.speed -= 1.5 + if (outOfBounds(pixel.x,pixel.y-1) || !isEmpty(pixel.x, pixel.y-1, true)) { + if (!isEmpty(pixel.x, pixel.y-1, true) && pixel.speed > 0) { + var above = pixelMap[pixel.x][pixel.y-1]; + if (elements[above.element].id === elements.better_ball.id) { + if (above.dir === "down") { + pixel.dir = "down" + above.dir = "up" + above.speed = pixel.speed + pixel.speed = above.speed + } + else { + pixel.dir = "down" + } + } + } + else if (outOfBounds(pixel.x,pixel.y-1) && pixel.speed > 0) { + pixel.dir = "down" + } + } + if (pixel.speed < 1) { + pixel.dir = "down" + } + } + } + doDefaults(pixel); + }, + properties: { + speed: 0, + dir: "down", + roll: false, + rollspeed: 0, + }, + color: ["#ccff00","#ccff00","#dff6c8","#ccff00","#ccff00","#dff6c8","#ccff00","#ccff00"], + tempHigh: 412, + stateHigh: "fire", + burn: 5, + burnTime: 350, + burnInto: ["smoke","smoke","smoke","smoke","ash"], + state: "solid", + category: "special" +} + +elements.golf_ball = { + tick: function(pixel) { + if (pixel.dir === "down") { + if (tryMove(pixel, pixel.x, pixel.y+1)) { + if ((!isEmpty(pixel.x, pixel.y+1, true) || outOfBounds(pixel.x,pixel.y+1)) && pixel.speed > 0.5) { + pixel.speed += 1 + console.log("go up and down code") + if (!isEmpty(pixel.x, pixel.y+1, true) && pixel.speed > 0.5) { + var beneath = pixelMap[pixel.x][pixel.y+1]; + if (elements[beneath.element].id === elements.better_ball.id) { + if (beneath.dir === "up") { + pixel.dir = "up" + beneath.dir = "down" + beneath.speed = pixel.speed + pixel.speed = beneath.speed + } + else { + pixel.dir = "up" + } + } + else { + pixel.dir = "up" + } + } + else if (outOfBounds(pixel.x,pixel.y+1) && pixel.speed > 0.5) { + pixel.dir = "up" + } + } + else { + pixel.speed += 1 + console.log("increase speed code") + } + } + else if (!tryMove(pixel, pixel.x, pixel.y+1) && (!isEmpty(pixel.x, pixel.y+1, true) || outOfBounds(pixel.x,pixel.y+1))) { + if (!isEmpty(pixel.x, pixel.y+1, true) && pixel.roll === false && (isEmpty(pixel.x-1, pixel.y+1) || isEmpty(pixel.x+1, pixel.y+1))) { + console.log("incline code") + if (isEmpty(pixel.x+1, pixel.y+1)) { + pixel.rolldir = 1 + } + else if (isEmpty(pixel.x-1, pixel.y+1)) { + pixel.rolldir = -1 + } + tryMove(pixel, pixel.x+(pixel.rolldir), pixel.y+1); + pixel.rollspeed += 1 + } + else if ((!isEmpty(pixel.x, pixel.y+1, true) || outOfBounds(pixel.x,pixel.y+1)) && pixel.rollspeed > 0) { + pixel.rollspeed -= 0.9 + pixel.speed = 0 + if (pixel.roll === false) { + pixel.roll = true + } + if (!isEmpty(pixel.x+(pixel.rolldir), pixel.y, true) && pixel.rollspeed < 10) { + console.log("bounce off wall code") + pixel.rolldir = (pixel.rolldir-(2*pixel.rolldir)) + } + else if (pixel.rollspeed > 9 && isEmpty(pixel, pixel.x+(pixel.rolldir), pixel.y-1) && !isEmpty(pixel.x+(pixel.rolldir), pixel.y, true)) { + console.log("uphill code") + tryMove(pixel, pixel.x+(pixel.rolldir), pixel.y-1); + pixel.rollspeed -= 0.9 + pixel.speed = 0 + } + else if (!isEmpty(pixel.x+(pixel.rolldir), pixel.y+1, true)) { + console.log("roll code") + tryMove(pixel, pixel.x+(pixel.rolldir), pixel.y) + } + else if (isEmpty(pixel.x+(pixel.rolldir), pixel.y)) { + console.log("stop roll code") + pixel.roll = false + } + } + else if (pixel.rollspeed < 1 && pixel.roll === true) { + pixel.roll = false + } + } + } + else if (pixel.speed > 0 && pixel.dir === "up") { + if (tryMove(pixel, pixel.x, pixel.y-1)) { + pixel.speed -= 1.3 + if (outOfBounds(pixel.x,pixel.y-1) || !isEmpty(pixel.x, pixel.y-1, true)) { + if (!isEmpty(pixel.x, pixel.y-1, true) && pixel.speed > 0) { + var above = pixelMap[pixel.x][pixel.y-1]; + if (elements[above.element].id === elements.better_ball.id) { + if (above.dir === "down") { + pixel.dir = "down" + above.dir = "up" + above.speed = pixel.speed + pixel.speed = above.speed + } + else { + pixel.dir = "down" + } + } + } + else if (outOfBounds(pixel.x,pixel.y-1) && pixel.speed > 0) { + pixel.dir = "down" + } + } + if (pixel.speed < 1) { + pixel.dir = "down" + } + } + } + doDefaults(pixel); + }, + properties: { + speed: 0, + dir: "down", + roll: false, + rollspeed: 0, + }, + color: "#edf1e6", + tempHigh: 350, + stateHigh: "molten_plastic", + state: "solid", + category: "special" +} + +elements.golf_ball = { + tick: function(pixel) { + if (pixel.dir === "down") { + if (tryMove(pixel, pixel.x, pixel.y+1)) { + if ((!isEmpty(pixel.x, pixel.y+1, true) || outOfBounds(pixel.x,pixel.y+1)) && pixel.speed > 0.5) { + pixel.speed += 1 + console.log("go up and down code") + if (!isEmpty(pixel.x, pixel.y+1, true) && pixel.speed > 0.5) { + var beneath = pixelMap[pixel.x][pixel.y+1]; + if (elements[beneath.element].id === elements.better_ball.id) { + if (beneath.dir === "up") { + pixel.dir = "up" + beneath.dir = "down" + beneath.speed = pixel.speed + pixel.speed = beneath.speed + } + else { + pixel.dir = "up" + } + } + else { + pixel.dir = "up" + } + } + else if (outOfBounds(pixel.x,pixel.y+1) && pixel.speed > 0.5) { + pixel.dir = "up" + } + } + else { + pixel.speed += 1 + console.log("increase speed code") + } + } + else if (!tryMove(pixel, pixel.x, pixel.y+1) && (!isEmpty(pixel.x, pixel.y+1, true) || outOfBounds(pixel.x,pixel.y+1))) { + if (!isEmpty(pixel.x, pixel.y+1, true) && pixel.roll === false && (isEmpty(pixel.x-1, pixel.y+1) || isEmpty(pixel.x+1, pixel.y+1))) { + console.log("incline code") + if (isEmpty(pixel.x+1, pixel.y+1)) { + pixel.rolldir = 1 + } + else if (isEmpty(pixel.x-1, pixel.y+1)) { + pixel.rolldir = -1 + } + tryMove(pixel, pixel.x+(pixel.rolldir), pixel.y+1); + pixel.rollspeed += 1 + } + else if ((!isEmpty(pixel.x, pixel.y+1, true) || outOfBounds(pixel.x,pixel.y+1)) && pixel.rollspeed > 0) { + pixel.rollspeed -= 0.9 + pixel.speed = 0 + if (pixel.roll === false) { + pixel.roll = true + } + if (!isEmpty(pixel.x+(pixel.rolldir), pixel.y, true) && pixel.rollspeed < 10) { + console.log("bounce off wall code") + pixel.rolldir = (pixel.rolldir-(2*pixel.rolldir)) + } + else if (pixel.rollspeed > 9 && isEmpty(pixel, pixel.x+(pixel.rolldir), pixel.y-1) && !isEmpty(pixel.x+(pixel.rolldir), pixel.y, true)) { + console.log("uphill code") + tryMove(pixel, pixel.x+(pixel.rolldir), pixel.y-1); + pixel.rollspeed -= 0.9 + pixel.speed = 0 + } + else if (!isEmpty(pixel.x+(pixel.rolldir), pixel.y+1, true)) { + console.log("roll code") + tryMove(pixel, pixel.x+(pixel.rolldir), pixel.y) + } + else if (isEmpty(pixel.x+(pixel.rolldir), pixel.y)) { + console.log("stop roll code") + pixel.roll = false + } + } + else if (pixel.rollspeed < 1 && pixel.roll === true) { + pixel.roll = false + } + } + } + else if (pixel.speed > 0 && pixel.dir === "up") { + if (tryMove(pixel, pixel.x, pixel.y-1)) { + pixel.speed -= 1.3 + if (outOfBounds(pixel.x,pixel.y-1) || !isEmpty(pixel.x, pixel.y-1, true)) { + if (!isEmpty(pixel.x, pixel.y-1, true) && pixel.speed > 0) { + var above = pixelMap[pixel.x][pixel.y-1]; + if (elements[above.element].id === elements.better_ball.id) { + if (above.dir === "down") { + pixel.dir = "down" + above.dir = "up" + above.speed = pixel.speed + pixel.speed = above.speed + } + else { + pixel.dir = "down" + } + } + } + else if (outOfBounds(pixel.x,pixel.y-1) && pixel.speed > 0) { + pixel.dir = "down" + } + } + if (pixel.speed < 1) { + pixel.dir = "down" + } + } + } + doDefaults(pixel); + }, + properties: { + speed: 0, + dir: "down", + roll: false, + rollspeed: 0, + }, + color: "#edf1e6", + tempHigh: 350, + stateHigh: "molten_plastic", + state: "solid", + category: "special" +} + +elements.marble = { + tick: function(pixel) { + if (pixel.dir === "down") { + if (tryMove(pixel, pixel.x, pixel.y+1)) { + if ((!isEmpty(pixel.x, pixel.y+1, true) || outOfBounds(pixel.x,pixel.y+1)) && pixel.speed > 0.5) { + pixel.speed += 1 + console.log("go up and down code") + if (!isEmpty(pixel.x, pixel.y+1, true) && pixel.speed > 0.5) { + var beneath = pixelMap[pixel.x][pixel.y+1]; + if (elements[beneath.element].id === elements.better_ball.id) { + if (beneath.dir === "up") { + pixel.dir = "up" + beneath.dir = "down" + beneath.speed = pixel.speed + pixel.speed = beneath.speed + } + else { + pixel.dir = "up" + } + } + else { + pixel.dir = "up" + } + } + else if (outOfBounds(pixel.x,pixel.y+1) && pixel.speed > 0.5) { + pixel.dir = "up" + } + } + else { + pixel.speed += 1 + console.log("increase speed code") + } + } + else if (!tryMove(pixel, pixel.x, pixel.y+1) && (!isEmpty(pixel.x, pixel.y+1, true) || outOfBounds(pixel.x,pixel.y+1))) { + if (!isEmpty(pixel.x, pixel.y+1, true) && pixel.roll === false && (isEmpty(pixel.x-1, pixel.y+1) || isEmpty(pixel.x+1, pixel.y+1))) { + console.log("incline code") + if (isEmpty(pixel.x+1, pixel.y+1)) { + pixel.rolldir = 1 + } + else if (isEmpty(pixel.x-1, pixel.y+1)) { + pixel.rolldir = -1 + } + tryMove(pixel, pixel.x+(pixel.rolldir), pixel.y+1); + pixel.rollspeed += 1 + } + else if ((!isEmpty(pixel.x, pixel.y+1, true) || outOfBounds(pixel.x,pixel.y+1)) && pixel.rollspeed > 0) { + pixel.rollspeed -= 0.5 + pixel.speed = 0 + if (pixel.roll === false) { + pixel.roll = true + } + if (!isEmpty(pixel.x+(pixel.rolldir), pixel.y, true) && pixel.rollspeed < 10) { + console.log("bounce off wall code") + pixel.rolldir = (pixel.rolldir-(2*pixel.rolldir)) + } + else if (pixel.rollspeed > 9 && isEmpty(pixel, pixel.x+(pixel.rolldir), pixel.y-1) && !isEmpty(pixel.x+(pixel.rolldir), pixel.y, true)) { + console.log("uphill code") + tryMove(pixel, pixel.x+(pixel.rolldir), pixel.y-1); + pixel.rollspeed -= 0.5 + pixel.speed = 0 + } + else if (!isEmpty(pixel.x+(pixel.rolldir), pixel.y+1, true)) { + console.log("roll code") + tryMove(pixel, pixel.x+(pixel.rolldir), pixel.y) + } + else if (isEmpty(pixel.x+(pixel.rolldir), pixel.y)) { + console.log("stop roll code") + pixel.roll = false + } + } + else if (pixel.rollspeed < 1 && pixel.roll === true) { + pixel.roll = false + } + } + } + else if (pixel.speed > 0 && pixel.dir === "up") { + if (tryMove(pixel, pixel.x, pixel.y-1)) { + pixel.speed -= 5 + if (outOfBounds(pixel.x,pixel.y-1) || !isEmpty(pixel.x, pixel.y-1, true)) { + if (!isEmpty(pixel.x, pixel.y-1, true) && pixel.speed > 0) { + var above = pixelMap[pixel.x][pixel.y-1]; + if (elements[above.element].id === elements.better_ball.id) { + if (above.dir === "down") { + pixel.dir = "down" + above.dir = "up" + above.speed = pixel.speed + pixel.speed = above.speed + } + else { + pixel.dir = "down" + } + } + } + else if (outOfBounds(pixel.x,pixel.y-1) && pixel.speed > 0) { + pixel.dir = "down" + } + } + if (pixel.speed < 1) { + pixel.dir = "down" + } + } + } + doDefaults(pixel); + }, + properties: { + speed: 0, + dir: "down", + roll: false, + rollspeed: 0, + }, + color: ["#5e807d","#5e807d","#679e99","#5e807d","#5e807d","#ADD8E6","#90EE90","#ebbe4d"], + tempHigh: 1505, + stateHigh: "molten_glass", + state: "solid", + category: "special" +} \ No newline at end of file diff --git a/mods/colonies.js b/mods/colonies.js new file mode 100644 index 00000000..215cb3d0 --- /dev/null +++ b/mods/colonies.js @@ -0,0 +1,574 @@ +var modName = "mods/colonies.js"; +var exoplanetMod = "mods/exoplanet.js"; + +if(enabledMods.includes(exoplanetMod)) { + + window.addEventListener("load", () => { + document.getElementById("elementButton-base")?.remove() + }) + + window.addEventListener("load", () => { + document.getElementById("elementButton-empty_room")?.remove() + }) + + window.addEventListener("load", () => { + document.getElementById("elementButton-cafeteria")?.remove() + }) + + window.addEventListener("load", () => { + document.getElementById("elementButton-terraformer_room")?.remove() + }) + + window.addEventListener("load", () => { + document.getElementById("elementButton-base_door_left")?.remove() + }) + + window.addEventListener("load", () => { + document.getElementById("elementButton-base_door_right")?.remove() + }) + + elements.base = { + hidden: true, + color: "#ff0000", + behavior: [ + "XX|XX|CR:glass|CR:glass|CR:rocket_gate|CR:rocket_gate|CR:rocket_gate|CR:glass|CR:glass|XX|XX", + "XX|CR:glass|CR:glass|CR:air_filter|XX|XX|XX|XX|CR:glass|CR:glass|XX", + "XX|CR:glass|XX|XX|XX|XX|XX|XX|XX|CR:glass|XX", + "CR:glass|CR:glass|XX|XX|XX|XX|XX|XX|XX|CR:glass|CR:glass", + "CR:glass AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>glass|XX|XX|XX|XX|XX|XX|XX|XX|XX|CR:glass AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>glass", + "CR:base_door_left,base_door,base_door AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>base_door_left,base_door,base_door|XX|XX|XX|XX|CH:leaving_rocket%25|XX|XX|XX|XX|CR:base_door_right,base_door AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>base_door_right,base_door", + "CR:concrete|CR:glass AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>glass|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:glass AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>glass|CR:concrete", + "CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete", + "XX|XX|XX|XX|XX|XX|XX|XX|XX|XX|XX", + "XX|XX|XX|XX|XX|XX|XX|XX|XX|XX|XX", + "XX|XX|XX|XX|XX|XX|XX|XX|XX|XX|XX", + ], + category: "colonies", + state: "solid", + } + + elements.empty_room = { + hidden: true, + color: "#ff0000", + behavior: [ + "XX|XX|CR:glass|CR:glass|CR:glass|CR:glass|CR:glass|XX|XX", + "XX|CR:glass|CR:glass|XX|XX|XX|CR:glass|CR:glass|XX", + "CR:glass|CR:glass|CR:air_filter|XX|XX|XX|XX|CR:glass|CR:glass", + "CR:glass|XX|XX|XX|XX|XX|XX|XX|CR:glass", + "CR:base_door|XX|XX|XX|DL|XX|XX|XX|CR:base_door", + "CR:concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete", + "CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete", + "XX|XX|XX|XX|XX|XX|XX|XX|XX", + "XX|XX|XX|XX|XX|XX|XX|XX|XX", + ], + category: "colonies", + state: "solid", + } + + elements.cafeteria = { + hidden: true, + color: "#ff0000", + behavior: [ + "XX|CR:glass|CR:glass|CR:glass|CR:glass|CR:glass|CR:glass|CR:glass|XX", + "CR:glass|CR:glass|CR:food_dispenser|CR:food_dispenser|CR:air_filter|CR:food_dispenser|CR:food_dispenser|CR:glass|CR:glass", + "CR:glass|XX|XX|XX|XX|XX|XX|XX|CR:glass", + "CR:glass|XX|XX|XX|XX|XX|XX|XX|CR:glass", + "CR:base_door|XX|XX|XX|DL|XX|XX|XX|CR:base_door", + "CR:concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|DL:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass,concrete,mulch|DL:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass,concrete,mulch|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|DL:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass,concrete,mulch|DL:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass,concrete,mulch|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete", + "CR:concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete", + "XX|XX|XX|XX|XX|XX|XX|XX|XX", + "XX|XX|XX|XX|XX|XX|XX|XX|XX", + ], + category: "colonies", + state: "solid", + } + + elements.terraformer_room = { + hidden: true, + color: "#ff0000", + behavior: [ + "XX|XX|CR:glass|CR:glass|CR:glass|CR:glass|CR:glass|XX|XX", + "XX|CR:glass|CR:glass|XX|XX|XX|CR:glass|CR:glass|XX", + "CR:glass|CR:glass|CR:air_filter|XX|XX|XX|XX|CR:glass|CR:glass", + "CR:glass|XX|XX|XX|XX|XX|XX|XX|CR:glass", + "CR:base_door|XX|XX|XX|DL|XX|XX|XX|CR:base_door", + "CR:concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:room_temper AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>room_temper|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:nanobot_terraformers AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>nanobot_terraformers|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:room_temper AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>room_temper|CR:concrete AND CH:dirt,exoplanetary_dust,exoplanetary_rock,exoplanetary_sand,sand,mud,grass>concrete|CR:concrete", + "CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete|CR:concrete", + "XX|XX|XX|XX|XX|XX|XX|XX|XX", + "XX|XX|XX|XX|XX|XX|XX|XX|XX", + ], + category: "colonies", + state: "solid", + } + + elements.air_filter = { + hidden: true, + color: ["#d1c6be","#b5c0ad","#b9b8bc"], + reactions: { + "carbon_dioxide": { elem2:"oxygen" }, + "dust_cloud": { elem2:["oxygen",null], }, + "exoplanetary_dust": { elem2:null, }, + "dust": { elem2:null, }, + "radiation": { elem2:"electric", temp1:200 } + }, + behavior: [ + "XX|ST|XX", + "ST AND CR:oxygen%1|XX|ST AND CR:oxygen%1", + "XX|CR:oxygen%1|XX", + ], + tempHigh: 500, + stateHigh: "molten_aluminum", + category: "colonies", + density: 2710, + conduct: 0.73, + hardness: 0.01, + breakInto: "metal_scrap", + fireColor: "#A7B3BF", + superconductAt: -271.95, + state: "solid", + } + + elements.rocket_gate = { + hidden: true, + color: ["#d1c6be","#b5c0ad","#b9b8bc"], + behavior: behaviors.WALL, + tempHigh: 500, + stateHigh: "molten_aluminum", + category: "colonies", + density: 2710, + conduct: 0.73, + hardness: 0.05, + breakInto: "metal_scrap", + fireColor: "#A7B3BF", + superconductAt: -271.95, + state: "solid", + } + + elements.base_door = { + hidden: true, + color: ["#d1c6be","#b5c0ad","#b9b8bc"], + behavior: behaviors.WALL, + tempHigh: 500, + stateHigh: "molten_aluminum", + category: "colonies", + density: 2710, + conduct: 0.73, + hardness: 0.04, + breakInto: "metal_scrap", + fireColor: "#A7B3BF", + superconductAt: -271.95, + state: "solid", + } + + elements.base_door_left = { + hidden: true, + color: "#ff0000", + behavior: [ + "XX|XX|XX|XX|XX|XX|XX|XX|XX", + "XX|XX|XX|XX|XX|XX|XX|XX|XX", + "CR:empty_room,cafeteria,cafeteria,terraformer_room,terraformer_room|XX|XX|XX|CH:base_door|XX|XX|XX|XX", + "XX|XX|XX|XX|XX|XX|XX|XX|XX", + "XX|XX|XX|XX|XX|XX|XX|XX|XX", + ], + category: "colonies", + state: "solid", + } + + elements.base_door_right = { + hidden: true, + color: "#ff0000", + behavior: [ + "XX|XX|XX|XX|XX|XX|XX|XX|XX", + "XX|XX|XX|XX|XX|XX|XX|XX|XX", + "XX|XX|XX|XX|CH:base_door|XX|XX|XX|CR:empty_room,cafeteria,cafeteria,cafeteria,terraformer_room,terraformer_room,terraformer_room", + "XX|XX|XX|XX|XX|XX|XX|XX|XX", + "XX|XX|XX|XX|XX|XX|XX|XX|XX", + ], + category: "colonies", + state: "solid", + } + +elements.settler = { + color: ["#A8A7AB","#878689"], + category: "colonies", + tick: function(pixel) { + if (tryMove(pixel, pixel.x, pixel.y+1)) {} // Fall + doHeat(pixel); + doBurning(pixel); + doElectricity(pixel); + if (pixel.oxygen > 0.1 && Math.random() < 0.025) { pixel.oxygen -= 0.5 } // consume oxygen + else if (pixel.oxygen < 0.1) { pixel.dead = true } + + if (pixel.dead) { + // Turn into rotten_meat if pixelTicks-dead > 500 + if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) { + if (Math.random() < 0.5) { + changePixel(pixel,"metal_scrap"); + } + else { + changePixel(pixel,"rotten_meat"); + } + } + return + } + + if (pixel.burning) { + pixel.panic += 0.1; + } + else if (pixel.oxygen < 25.1) { + pixel.panic += 0.1; + } + else if (pixel.panic > 0) { + pixel.panic -= 0.1; + if (pixel.panic < 0) { pixel.panic = 0; } + } + + if (Math.random() < 0.1*(isEmpty(pixel.x, pixel.y+1) ? 1 : pixel.panic+1)) { // Move 10% chance + var movesToTry = [ + [1*pixel.dir,0], + [1*pixel.dir,-1], + ]; + // While movesToTry is not empty, tryMove(pixel, x, y) with a random move, then remove it. if tryMove returns true, break. + while (movesToTry.length > 0) { + var move = movesToTry.splice(Math.floor(Math.random() * movesToTry.length), 1)[0]; + if (isEmpty(pixel.x+move[0], pixel.y+move[1]-1)) { + var origx = pixel.x+move[0]; + var origy = pixel.y+move[1]; + if (tryMove(pixel, pixel.x+move[0], pixel.y+move[1]) && pixel.x===origx && pixel.y===origy) { + break; + } + } + else if (!isEmpty(pixel.x+move[0], pixel.y+move[1], true)) { + var hitPixel = pixelMap[pixel.x+move[0]][pixel.y+move[1]]; + if (hitPixel.element === "settler") { + // interact with other settlers + hitPixel.panic = pixel.panic; + } + else if (hitPixel.element === "base_door") { + if (pixel.dir === -1 && Math.random() > 0.5) { + tryMove(pixel,pixel.x-2,pixel.y); + } + else if (pixel.dir === 1 && Math.random() > 0.5) { + tryMove(pixel,pixel.x+2,pixel.y); + } + } + else if (hitPixel.element === "leaving_rocket" && pixel.ogcrew === false) { + if (Math.random() > 0.75) { + deletePixel(pixel.x,pixel.y); + hitPixel.passengers += 1; + } + } + else if (elements[hitPixel.element].state === "gas") { + swapPixels(pixel,hitPixel); + } + else if (elements[hitPixel.element].state === "liquid") { + swapPixels(pixel,pixelMap[hitPixel.x][hitPixel.y-1]); + } + } + } + // 15% chance to change direction + if (Math.random() < 0.15) { + pixel.dir *= -1; + } + // spacesuit A/C + if (pixel.temp > 40) { pixel.temp -= 3; } + else if (pixel.temp < 32) { pixel.temp += 3; } + } + + }, + foodNeed: 50, + egg: "settler", + density: 2710, + state: "solid", + conduct: .05, + temp: 37, + tempHigh: 300, + stateHigh: ["cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","molten_aluminum","smoke","dioxin","smoke","stench","ash","melted_plastic"], + tempLow: -75, + stateLow: "frozen_meat", + burn: 10, + burnTime: 250, + burnInto: ["cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","molten_aluminum","smoke","dioxin","smoke","stench","ash","melted_plastic"], + hardness: 0.02, + breakInto: ["blood","meat","bone","blood","meat","bone","metal_scrap"], + forceSaveColor: true, + reactions: { + "cancer": { elem1:"cancer", chance:0.0005 }, + "radiation": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.04 }, + "neutron": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.003 }, + "fallout": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.003 }, + "plague": { elem1:"plague", chance:0.005 }, + "oxygen": { func:function(pixel,air){pixel.oxygen += 5}, elem2:"carbon_dioxide", chance:0.5 }, + "carbon_dioxide": { func:function(pixel,air){pixel.oxygen -= 1}, chance:0.05 }, + "dust_cloud": { func:function(pixel,air){pixel.oxygen -= 5}, elem2:null, chance:0.05 }, + "exoplanetary_dust": { elem2:"dust_cloud", chance:0.001 }, + "meat": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "cooked_meat": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "cured_meat": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "sugar": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "broth": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "yolk": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "hard_yolk": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "dough": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "batter": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "butter": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "melted_butter": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "chocolate": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "melted_chocolate": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL }, + "grape": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "tomato": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "herb": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "lettuce": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "corn": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "popcorn": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL }, + "potato": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "baked_potato": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL }, + "bread": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "toast": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "gingerbread": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "baked_batter": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "wheat": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "candy": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "yogurt": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "frozen_yogurt": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "ice_cream": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "beans": { elem2:[null,null,null,null,null,null,null,null,null,null,null,null,null,null,"stench"], chance:0.2, func:behaviors.FEEDPIXEL }, + "tea": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "coffee": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "milk": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "cream": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "soda": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "chocolate_milk": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "fruit_milk": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "pilk": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "eggnog": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "juice": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "cheese": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "melted_cheese": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "alcohol": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "antidote": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "honey": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "caramel": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "molasses": { elem2:null, chance:0.05, func:behaviors.FEEDPIXEL }, + "ketchup": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "pumpkin_seed": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "nut": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "nut_meat": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "nut_butter": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "nut_milk": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "jelly": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "mayo": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "mashed_potato": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "sauce": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "pickle": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "food_container": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "sun": { elem1:["cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","cooked_meat","molten_aluminum","smoke","dioxin","smoke","stench","ash","melted_plastic"] }, + "water": { func:function(pixel,water){pixel.oxygen -= 1}, elem2:"bubble", attr2:{"clone":"water"}, chance:0.0002 }, + "salt_water": { func:function(pixel,water){pixel.oxygen -= 2}, elem2:"bubble", attr2:{"clone":"salt_water"}, chance:0.0002 }, + "sugar_water": { func:function(pixel,water){pixel.oxygen -= 2}, elem2:"bubble", attr2:{"clone":"sugar_water"}, chance:0.0002 }, + "seltzer": { func:function(pixel,water){pixel.oxygen -= 4}, elem2:"bubble", attr2:{"clone":["seltzer","seltzer","carbon_dioxide"]}, chance:0.0002 }, + "pool_water": { func:function(pixel,water){pixel.oxygen -= 1}, elem2:"bubble", attr2:{"clone":"pool_water"}, chance:0.0002 }, + "dirty_water": { func:function(pixel,water){pixel.oxygen -= 4}, elem2:"bubble", color2:["#0e824e","#07755a","#0c6934"], attr2:{"clone":"dirty_water"}, chance:0.0003 }, + "blood": { func:function(pixel,water){pixel.oxygen -= 5}, elem2:"bubble", color2:["#ff0000","#ee0000","#ff4040"], attr2:{"clone":"blood"}, chance:0.0003 }, + }, + properties: { + dead: false, + dir: 1, + panic: 0, + oxygen: 100, + ogcrew: false, + }, +} + +elements.nanobot_terraformers = { + color: "#c0c0c0", + hidden: true, + behavior: [ + "CH:exoplanetary_dust>nanobot_terraformers%50|CH:exoplanetary_dust>nanobot_terraformers%50 AND CR:oxygen%5|CH:exoplanetary_dust>nanobot_terraformers%50", + "CH:exoplanetary_dust>nanobot_terraformers%50|XX|CH:exoplanetary_dust>nanobot_terraformers%50", + "CH:exoplanetary_dust,exoplanetary_rock>nanobot_terraformers%50 AND M2|CH:exoplanetary_dust>nanobot_terraformers%50 AND M1|CH:exoplanetary_dust>nanobot_terraformers%50 AND M2", + ], + reactions: { + "exoplanetary_rock": { elem2:"nanobot_terraformers", attr2:{"clone":"rock"}}, + "dusty_water": { elem2:"nanobot_terraformers", attr2:{"clone":"water"}}, + "dusty_ice": { elem2:"nanobot_terraformers", attr2:{"clone":"ice"}}, + "exoplanetary_sand": { elem2:"nanobot_terraformers", attr2:{"clone":"sand"} }, + }, + tick: function(pixel) { + if (pixel.age > 25 || (pixel.clone && isEmpty(pixel.x,pixel.y-1))) { + if (pixel.clone) { + changePixel(pixel,pixel.clone); + return; + } + changePixel(pixel,"dirt"); + } + pixel.age ++; + }, + properties: { + "age": 0, + }, + category: "colonies", + state: "solid", + density: 21450, + excludeRandom: true, + conduct: 0.25, + darkText: true, + tempHigh: 1456, + stateHigh: "molten_steel" +} + +elements.room_temper = { + color: "#29632f", + behavior: behaviors.WALL, + tick: function(pixel) { + // from nouserthings.js <3 + for (var i = 0; i < squareCoords.length; i++) { + var coord = squareCoords[i]; + var x = pixel.x+coord[0]; + var y = pixel.y+coord[1]; + if (!isEmpty(x,y, true)) { + if(pixelMap[x][y].temp < -230) { + pixelMap[x][y].temp = (pixelMap[x][y].temp + 7) + } else if(pixelMap[x][y].temp > 270) { + pixelMap[x][y].temp = (pixelMap[x][y].temp - 7) + } else if (pixelMap[x][y].temp < 20) { + pixelMap[x][y].temp = (pixelMap[x][y].temp + 2) + } else if (pixelMap[x][y].temp > 20) { + pixelMap[x][y].temp = (pixelMap[x][y].temp - 2) + } + } + } + }, + category:"colonies", + state:"solid", + insulate: true, + noMix: true, + movable: false, +}; + +elements.food_dispenser = { + color: "#606378", + behavior: [ + "XX|ST|XX", + "ST|XX|ST", + "XX|XX|XX", + ], + tick: function(pixel) { + if (isEmpty(pixel.x, pixel.y+4) && isEmpty(pixel.x, pixel.y+1) && Math.random() > 0.95) { + createPixel("food_container",pixel.x,pixel.y+1); + } + }, + category:"colonies", + tempHigh: 1455.5, + stateHigh: "molten_steel", + conduct: 0.42 +} + +elements.food_container = { + behavior: behaviors.STURDYPOWDER, + category: "colonies", + hidden: true, + state: "solid", + color: ["#2b1107","#5c3322","#2b1107","#5c3322","#2b1107","#5c3322"], + tempHigh: 250, + stateHigh: ["sugar","cooked_meat","dead_plant","ash","ash","charcoal"], + burn: 10, + burnTime: 200, + burnInto: ["sugar","cooked_meat","dead_plant","ash","ash","charcoal"], + breakInto: ["sugar","cooked_meat","dead_plant","sugar","cooked_meat","dead_plant","sugar","cooked_meat","dead_plant","sawdust","sawdust","sawdust","sawdust"], + breakIntoColor: ["#2b1107","#5c3322","#5c3322","#5c3322","#5c3322","#5c3322","#5c3322","#5c3322","#41770B","#774C35"], + isFood: true +} + +elements.leaving_rocket = { + name: "rocket", + hidden: true, + color: "#ff6f47", + tick: function(pixel) { + if (pixel.passengers > 14) { + if (!tryMove(pixel, pixel.x, pixel.y-1)) { + if (outOfBounds(pixel.x,pixel.y-1)) { + deletePixel(pixel.x,pixel.y); + } + else if (pixelMap[pixel.x][pixel.y-1].element === "rocket_gate") { + tryMove(pixel, pixel.x, pixel.y-2); + } + else { + // tryMove again to the top left or top right + tryMove(pixel, pixel.x+(Math.random() < 0.5 ? -1 : 1), pixel.y-1); + } + } + if (Math.random() > 0.5 && isEmpty(pixel.x,pixel.y+1)) { + createPixel("smoke", pixel.x, pixel.y+1); + } + } + else { + if (!tryMove(pixel, pixel.x, pixel.y+1)) { + // tryMove again to the bottom left or bottom right + tryMove(pixel, pixel.x+(Math.random() < 0.5 ? -1 : 1), pixel.y+1); + } + } + doDefaults(pixel) + }, + properties: { + "passengers": 0, + }, + conduct: 0.5, + ignore: ["cloner","ecloner","slow_cloner","clone_powder","floating_cloner"], + category: "colonies", + state: "solid", + density: 7300, + cooldown: defaultCooldown +} + +elements.arriving_rocket = { + name: "rocket", + color: "#ff6f47", + tick: function(pixel) { + if (!tryMove(pixel, pixel.x, pixel.y+1)) { + tryMove(pixel, pixel.x+(Math.random() < 0.5 ? -1 : 1), pixel.y+1); + pixel.age++; + } + if (Math.random() > 0.5 && pixel.age < 10) { + createPixel("smoke", pixel.x, pixel.y-1); + } + if (pixel.age > 250 && pixel.base_established === false) { + if (isEmpty(pixel.x, pixel.y-1)) { + createPixel("base",pixel.x, pixel.y-1); + pixel.base_established = true; + } + } + if (pixel.age > 500 && pixel.passengers > 0) { + if (isEmpty(pixel.x+1, pixel.y-1)) { + createPixel("settler",pixel.x+1, pixel.y-1); + pixelMap[pixel.x+1][pixel.y-1].ogcrew = true; + pixel.passengers -= 1; + } + else if (isEmpty(pixel.x-1, pixel.y-1)) { + createPixel("settler",pixel.x-1, pixel.y-1); + pixelMap[pixel.x-1][pixel.y-1].ogcrew = true; + pixel.passengers -= 1; + } + } + if (pixel.passengers < 1) { + changePixel(pixel,"concrete"); + } + }, + properties: { + "passengers": 5, + "age": 0, + "base_established": false, + }, + conduct: 0.5, + ignore: ["cloner","ecloner","slow_cloner","clone_powder","floating_cloner"], + category: "colonies", + state: "solid", + density: 7300, + cooldown: defaultCooldown +} + +} else { + enabledMods.splice(enabledMods.indexOf(modName),0,exoplanetMod) + localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); + alert(`The ${exoplanetMod} mod is required and has been automatically inserted (reload for this to take effect).`) +}; diff --git a/mods/exoplanet.js b/mods/exoplanet.js new file mode 100644 index 00000000..564cf57b --- /dev/null +++ b/mods/exoplanet.js @@ -0,0 +1,220 @@ +elements.dusty_water = { + color: "#7C7C95", + behavior: behaviors.LIQUID, + tempHigh: 105, + stateHigh: ["steam","dust_cloud"], + tempLow: 0, + stateLowName: "dusty_ice", + viscosity: 10, + reactions: { + "rock": { elem2: "wet_sand", chance: 0.0004 }, + "exoplanetary_rock": { elem2: "exoplanetary_sand", chance: 0.0004 }, + "limestone": { elem2: "wet_sand", chance: 0.0004 }, + "plant": { elem1:"water", chance:0.05 }, + "algae": { elem1:"water", chance:0.05 }, + "kelp": { elem1:"water", chance:0.05 }, + "charcoal": { elem1:"water", chance:0.02 }, + "gravel": { elem1:"water", chance:0.01 }, + "fly": { elem2:"dead_bug", chance:0.1, oneway:true }, + "firefly": { elem2:"dead_bug", chance:0.1, oneway:true }, + "bee": { elem2:"dead_bug", chance:0.05, oneway:true }, + "stink_bug": { elem2:"dead_bug", chance:0.1, oneway:true }, + }, + hidden: true, + state: "liquid", + density: 1005, + conduct: 0.01, + extinguish: true, + category: "exoplanet", +} + +elements.exoplanetary_sand = { + color: ["#A29C7D","#c0c0c0","#808080","#4f4f4f","#808080","#949494","#A29C7D"], + behavior: behaviors.POWDER, + reactions: { + "tornado":{elem1:"sandstorm", oneway:true}, + }, + tempHigh: 1700, + stateHigh: "molten_exoplanetary_glass", + category: "exoplanet", + state: "solid", + density: 1602 +} + +elements.exoplanetary_glass = { + color: ["#6F807F","#6F807F","#748F8D","#6F807F","#6F807F"], + colorPattern: textures.GLASS, + colorKey: { + "g": "#6F807F", + "s": "#728886", + "S": "#748F8D"}, + behavior: behaviors.WALL, + reactions: { + "radiation": { elem1:"rad_glass", chance:0.33 }, + "rad_steam": { elem1:"rad_glass", elem2:null, chance:0.33 }, + "fallout": { elem1:"rad_glass", elem2:"radiation", chance:0.1 } + }, + tempHigh: 1500, + category: "exoplanet", + state: "solid", + density: 2500, + breakInto: "exoplanetary_sand", + noMix: true, + hidden: true, +} + +elements.molten_exoplanetary_glass = { + reactions: { + "radiation": { elem1:"molten_rad_glass", chance:0.66 }, + "rad_steam": { elem1:"molten_rad_glass", elem2:null, chance:0.33 }, + "molten_uranium": { elem1:"molten_rad_glass", elem2:null }, + "fallout": { elem1:"molten_rad_glass", elem2:"radiation" } + }, + hidden: true, + category: "exoplanet", +} + +elements.dust_cloud = { + color: ["#808080","#2e2e2e","#2e2e2e"], + behavior: [ + "XX|M1%0.5|M2%0.5", + "XX|CH:exoplanetary_dust%0.075|M1%2.5 AND BO", + "XX|M1%0.5|M2%0.5", + ], + reactions: { + "fireball": { elem1:null, elem2:"fire_cloud", chance:0.25 } + }, + category: "exoplanet", + tempHigh: 825, + stateHigh: ["exoplanetary_rock","exoplanetary_rock","fire",], + hidden: true, + state: "gas", + density: 0.7, + ignoreAir: true +} + +elements.exoplanetary_dust = { + color: "#808080", + behavior: [ + "XX|XX|XX", + "XX|XX|XX", + "M2|M1|M2", + ], + reactions: { + "water": { elem2: "dusty_water", elem1: null }, + }, + category: "exoplanet", + breakInto: ["exoplanetary_dust","exoplanetary_dust","exoplanetary_dust","dust_cloud"], + burn: 10, + burnTime: 1, + tempHigh: 700, + burnInto:"exoplanetary_rock", + stateHigh: "exoplanetary_rock", + state: "solid", + density: 1490 +} + +elements.exoplanetary_rock = { + color: ["#c0c0c0","#4f4f4f","#949494"], + behavior: behaviors.POWDER, + reactions: { + "fly": { elem2:"dead_bug", chance:0.25, oneway:true }, + "firefly": { elem2:"dead_bug", chance:0.2, oneway:true }, + "stink_bug": { elem2:"dead_bug", chance:0.15, oneway:true }, + "bee": { elem2:"dead_bug", chance:0.1, oneway:true }, + "bird": { elem2:"feather", chance:0.025, oneway:true }, + "egg": { elem2:"yolk", oneway:true }, + "grass": { elem2:null, chance:0.005, oneway:true }, + "bone": { elem2:"oil", tempMin:300, chance:0.005, oneway:true }, + "dead_plant": { elem2:"charcoal", tempMin:200, chance:0.005, oneway:true }, + "charcoal": { elem2:"diamond", tempMin:800, tempMax:900, chance:0.005, oneway:true }, + "sand": { elem2:"packed_sand", tempMin:500, chance:0.005, oneway:true }, + "wet_sand": { elem2:"packed_sand", chance:0.005, oneway:true }, + }, + tempHigh: 950, + stateHigh: "exoplanetary_magma", + category: "exoplanet", + state: "solid", + density: 2550, + hardness: 0.5, + breakInto: ["exoplanetary_sand","exoplanetary_sand","exoplanetary_dust","dust_cloud"] +} + +elements.exoplanetary_magma = { + color: ["#ff6f00","#ff8c00","#ff4d00"], + behavior: behaviors.MOLTEN, + reactions: { + "ice": { elem1: "basalt" }, + "ash": { elem1: "molten_tuff", "elem2":null }, + "molten_ash": { elem1: "molten_tuff", "elem2":null }, + "charcoal": { elem2:"diamond", tempMin:800, tempMax:900, chance:0.005, oneway:true }, + }, + temp: 1200, + tempLow: 800, + stateLow: ["basalt","exoplanetary_rock","exoplanetary_rock","exoplanetary_rock"], + viscosity: 10000, + state: "liquid", + density: 2725, + alias: "alien lava", + category: "exoplanet", + hidden: true, +} + +elements.exoplanetary_rock = { + color: ["#c0c0c0","#4f4f4f","#949494"], + behavior: behaviors.POWDER, + reactions: { + "fly": { elem2:"dead_bug", chance:0.25, oneway:true }, + "firefly": { elem2:"dead_bug", chance:0.2, oneway:true }, + "stink_bug": { elem2:"dead_bug", chance:0.15, oneway:true }, + "bee": { elem2:"dead_bug", chance:0.1, oneway:true }, + "bird": { elem2:"feather", chance:0.025, oneway:true }, + "egg": { elem2:"yolk", oneway:true }, + "grass": { elem2:null, chance:0.005, oneway:true }, + "bone": { elem2:"oil", tempMin:300, chance:0.005, oneway:true }, + "dead_plant": { elem2:"charcoal", tempMin:200, chance:0.005, oneway:true }, + "charcoal": { elem2:"diamond", tempMin:800, tempMax:900, chance:0.005, oneway:true }, + "sand": { elem2:"packed_sand", tempMin:500, chance:0.005, oneway:true }, + "wet_sand": { elem2:"packed_sand", chance:0.005, oneway:true }, + }, + tempHigh: 950, + stateHigh: "exoplanetary_magma", + category: "exoplanet", + state: "solid", + density: 2550, + hardness: 0.5, + breakInto: ["exoplanetary_sand","exoplanetary_sand","exoplanetary_dust","dust_cloud"] +} + +worldgentypes.exoplanet = { + layers: [ + [0.9, "exoplanetary_dust"], + [0.1, "exoplanetary_sand", 0.15], + [0.2, "dusty_ice", 0.075], + [0.05, "exoplanetary_rock"], + [0, "basalt"], + ], + decor: [ + ["exoplanetary_dust", 0.05], + ["dust_cloud", 0.25] + ], + baseHeight: 0.5, + temperature: -15 +} + +worldgentypes.exo_ocean = { + layers: [ + [0.99, "exoplanetary_dust"], + [0.40, "dusty_ice"], + [0.25, "bone", 0.01], + [0.25, "dusty_ice"], + [0.1, "exoplanetary_sand"], + [0.03, "exoplanetary_rock", 0.5], + [0.03, "exoplanetary_rock"], + [0, "basalt"], + ], + decor: [ + ["dust_cloud", 0.1, 10], + ], + temperature: -15 +} \ No newline at end of file diff --git a/mods/fast_lightmap.js b/mods/fast_lightmap.js index bd7a1f0d..0d0ed2b7 100644 --- a/mods/fast_lightmap.js +++ b/mods/fast_lightmap.js @@ -184,6 +184,8 @@ function renderLightmapPrePixel(ctx) { 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.fillRect( x * pixelSize * lightmapScale, diff --git a/mods/flesh_infection.js b/mods/flesh_infection.js new file mode 100644 index 00000000..155ceced --- /dev/null +++ b/mods/flesh_infection.js @@ -0,0 +1,645 @@ +// by Nekonico + +eLists.FESTER = ["fleshy_dirt","dirt","rock","rock_wall","basalt","limestone","steel","iron","glass_shard","dead_bug","mud","sand","wet_sand","clay_soil","clay","mycelium","skin","meat","rotten_meat","wood","ant_wall","dead_plant","plant","hair","bone","cancer","straw","cloth","brick","bamboo","sponge","paper","plastic","concrete"], + +elements.fleshy_dirt = { + color: ["#81512F","#895933","#825231","#906159"], + behavior: [ + "CH:dirt,mud>fleshy_dirt%1|CH:grass>flesh_mound%0.5 AND CH:root>vein_root%0.5 AND CH:fiber>fibrous_flesh%0.5|CH:dirt,mud>fleshy_dirt%1", + "XX|XX|XX", + "M2 AND CH:dirt,mud>fleshy_dirt%1|M1 AND CH:dirt,mud>fleshy_dirt%0.5|M2 AND CH:dirt,mud>fleshy_dirt%1", + ], + category: "flesh", + state: "solid", + density: 2000, + tempHigh: 225, + stateHigh: "dirt", + tempLow: -50, + stateLow: "permafrost", + burn: 20, + burnTime: 40, + burnInto: "dirt", +}; + +elements.teeth = { + color: "#d9d9d9", + behavior: [ + "XX|SM%0.75|XX", + "ST:flesh_mound|XX|ST:flesh_mound", + "XX|ST:flesh_mound AND M1|XX", + ], + reactions: { + "acid": { elem1: "quicklime", elem2: null }, + "head": { elem2:["flesh_mound",null,null,null], chance:0.01 }, + "body": { elem2:["flesh_mound",null,null,null], chance:0.01 }, + "frog": { elem2:["flesh_mound",null,null,null], chance:0.05 }, + "tadpole": { elem2:["flesh_mound",null,null,null], chance:0.05 }, + "fish": { elem2:["flesh_mound",null,null,null], chance:0.05 }, + "rat": { elem2:["flesh_mound",null,null,null], chance:0.05 }, + "bird": { elem2:["flesh_mound",null,null,null], chance:0.05 }, + "worm": { elem2:["flesh_mound",null], chance:0.1 }, + "fly": { elem2:["flesh_mound",null], chance:0.1 }, + "ant": { elem2:["flesh_mound",null], chance:0.1 }, + "frog": { elem2:["flesh_mound",null], chance:0.05 }, + "snail": { elem2:["flesh_mound","quicklime"] }, + "slug": { elem2:["flesh_mound",null], chance:0.1 }, + "meat": { elem2:["flesh_mound",null,null,null], chance:0.1 }, + "blood": { elem2:null, chance:0.05 }, + "infection": { elem2:null, chance:0.04 }, + "bone": { elem2:null, chance:0.1 }, + "cooked_meat": { elem2:null, chance:0.1 }, + "rotten_meat": { elem2:null, chance:0.1 }, + "sugar": { elem2:null, chance:0.1 }, + "broth": { elem2:null, chance:0.2 }, + "yolk": { elem2:null, chance:0.1 }, + "hard_yolk": { elem2:null, chance:0.1 }, + "dough": { elem2:null, chance:0.1 }, + "batter": { elem2:null, chance:0.2 }, + "butter": { elem2:null, chance:0.1 }, + "melted_butter": { elem2:null, chance:0.2 }, + "chocolate": { elem2:null, chance:0.2 }, + "melted_chocolate": { elem2:null, chance:0.3 }, + "grape": { elem2:null, chance:0.1 }, + "tomato": { elem2:null, chance:0.1 }, + "herb": { elem2:null, chance:0.1 }, + "lettuce": { elem2:null, chance:0.1 }, + "corn": { elem2:null, chance:0.1 }, + "popcorn": { elem2:null, chance:0.15 }, + "potato": { elem2:null, chance:0.1 }, + "baked_potato": { elem2:null, chance:0.15 }, + "bread": { elem2:null, chance:0.1 }, + "toast": { elem2:null, chance:0.1 }, + "gingerbread": { elem2:null, chance:0.1 }, + "baked_batter": { elem2:null, chance:0.2 }, + "wheat": { elem2:null, chance:0.1 }, + "candy": { elem2:null, chance:0.1 }, + "yogurt": { elem2:null, chance:0.2 }, + "frozen_yogurt": { elem2:null, chance:0.1 }, + "ice_cream": { elem2:null, chance:0.2 }, + "beans": { elem2:null, chance:0.2 }, + "tea": { elem2:null, chance:0.2 }, + "coffee": { elem2:null, chance:0.2 }, + "milk": { elem2:null, chance:0.2 }, + "cream": { elem2:null, chance:0.2 }, + "soda": { elem2:null, chance:0.2 }, + "chocolate_milk": { elem2:null, chance:0.2 }, + "fruit_milk": { elem2:null, chance:0.2 }, + "pilk": { elem2:null, chance:0.2 }, + "eggnog": { elem2:null, chance:0.2 }, + "juice": { elem2:null, chance:0.2 }, + "cheese": { elem2:null, chance:0.1 }, + "melted_cheese": { elem2:null, chance:0.2 }, + "alcohol": { elem2:null, chance:0.2 }, + "antidote": { elem2:null, chance:0.2 }, + "honey": { elem2:null, chance:0.2 }, + "caramel": { elem2:null, chance:0.2 }, + "molasses": { elem2:null, chance:0.05 }, + "ketchup": { elem2:null, chance:0.1 }, + "pumpkin_seed": { elem2:null, chance:0.1 }, + "nut": { elem2:null, chance:0.1 }, + "nut_meat": { elem2:null, chance:0.1 }, + "nut_butter": { elem2:null, chance:0.1 }, + "nut_milk": { elem2:null, chance:0.2 }, + "jelly": { elem2:null, chance:0.2 }, + "mayo": { elem2:null, chance:0.2 }, + "mashed_potato": { elem2:null, chance:0.2 }, + "sauce": { elem2:null, chance:0.2 }, + "pickle": { elem2:null, chance:0.1 }, + }, + category:"flesh", + tempHigh: 1000, + stateHigh: ["steam","salt","meat","quicklime"], + state: "solid", + density: 2000, + hardness: 0.5, + breakInto: ["flesh_mound","quicklime"], + hidden: true, + excludeRandom: true, +}, + +elements.flesh_mound = { + color: ["#9e4839","#ba6449","#d2856c","#a14940","#E94336"], + behavior: [ + "XX|CR:acidic_bile%0.005 AND CH:grass>flesh_mound%0.5 AND CR:fleshwood_sapling%0.0001|XX", + "CR:acidic_bile%0.005 AND CH:grass>flesh_mound%0.5|XX|CR:acidic_bile%0.005 AND CH:grass>flesh_mound%0.5", + "XX|CR:acidic_bile%0.005 AND CH:grass>flesh_mound%0.5 AND CH:dirt>fleshy_dirt%0.5|XX", + ], + tick: function(pixel) { + if (pixel.start === pixelTicks && pixel.fruit === undefined && !pixel.stop) { + if (Math.random() < 0.95) { + pixel.fruit = Math.random() < 0.75 ? "flesh_beast" : "teeth"; + } + else { pixel.fruit = "acidic_bile" } + } + if (!isEmpty(pixel.x-1,pixel.y,true)) { + if (pixelMap[pixel.x-1][pixel.y].fruit === undefined && pixelMap[pixel.x-1][pixel.y].element === "flesh_mound") { + pixelMap[pixel.x-1][pixel.y].fruit = pixel.fruit; + } + } + if (!isEmpty(pixel.x+1,pixel.y,true)) { + if (pixelMap[pixel.x+1][pixel.y].fruit === undefined && pixelMap[pixel.x+1][pixel.y].element === "flesh_mound") { + pixelMap[pixel.x+1][pixel.y].fruit = pixel.fruit; + } + } + if (!isEmpty(pixel.x,pixel.y+1,true)) { + if (pixelMap[pixel.x][pixel.y+1].fruit === undefined && pixelMap[pixel.x][pixel.y+1].element === "flesh_mound") { + pixelMap[pixel.x][pixel.y+1].fruit = pixel.fruit; + } + } + if (!isEmpty(pixel.x,pixel.y-1,true)) { + if (pixelMap[pixel.x][pixel.y-1].fruit === undefined && pixelMap[pixel.x][pixel.y-1].element === "flesh_mound") { + pixelMap[pixel.x][pixel.y-1].fruit = pixel.fruit; + } + } + if (isEmpty(pixel.x,pixel.y-1)) { + pixel.sp = 0; //not supported + } + else if (!outOfBounds(pixel.x,pixel.y-1) && pixelMap[pixel.x][pixel.y-1].element === "flesh_mound" && pixelMap[pixel.x][pixel.y-1].sp === 0) { + pixel.sp = 0; + } + else { pixel.sp = 1 } //supported + if (pixel.stop) { + if (pixel.sp === 0) { tryMove(pixel, pixel.x, pixel.y+1); } + return; + } + if (pixel.sp === 0) { tryMove(pixel, pixel.x, pixel.y+1); } + else { + if (pixel.fert && pixel.stage && Math.random() < 0.01 && isEmpty(pixel.x,pixel.y+1)) { + clonePixel(pixel,pixel.x,pixel.y+1); + pixelMap[pixel.x][pixel.y+1].fert = true; + pixelMap[pixel.x][pixel.y+1].stage = pixel.stage-1; + } + } + if (pixel.fert===undefined) { // able to grow down + pixel.fert = Math.random() < 0.50; + } + if (pixel.stage===undefined) { + pixel.stage = Math.floor(Math.random()*20)+10; + } + if (Math.random() < 0.03 && isEmpty(pixel.x-1,pixel.y) && !isEmpty(pixel.x-1,pixel.y-1) && (outOfBounds(pixel.x-1,pixel.y-1) || pixelMap[pixel.x-1][pixel.y-1].element !== "flesh_mound")) { + createPixel("flesh_mound",pixel.x-1,pixel.y); + pixelMap[pixel.x-1][pixel.y].fruit = pixel.fruit; + } + if (Math.random() < 0.03 && isEmpty(pixel.x+1,pixel.y) && !isEmpty(pixel.x+1,pixel.y-1) && (outOfBounds(pixel.x+1,pixel.y-1) || pixelMap[pixel.x+1][pixel.y-1].element !== "flesh_mound")) { + createPixel("flesh_mound",pixel.x+1,pixel.y); + pixelMap[pixel.x+1][pixel.y].fruit = pixel.fruit; + } + if (Math.random() < 0.03 && isEmpty(pixel.x,pixel.y-1) && ( + (!isEmpty(pixel.x-1,pixel.y-1) && (outOfBounds(pixel.x-1,pixel.y-1) || pixelMap[pixel.x-1][pixel.y-1].element !== "flesh_mound")) || + (!isEmpty(pixel.x+1,pixel.y-1) && (outOfBounds(pixel.x+1,pixel.y-1) || pixelMap[pixel.x+1][pixel.y-1].element !== "flesh_mound"))) + ) { + createPixel("flesh_mound",pixel.x,pixel.y-1); + pixelMap[pixel.x][pixel.y-1].fruit = pixel.fruit; + } + if (pixel.fruit && Math.random() < 0.0001) { + for (var i = 0; i < adjacentCoords.length; i++) { + var coords = adjacentCoords[i]; + var x = pixel.x + coords[0]; + var y = pixel.y + coords[1]; + if (isEmpty(x,y)) { + createPixel(pixel.fruit,x,y) + break; + } + } + } + if (pixel.h < 2 && Math.random() < 0.0005 && isEmpty(pixel.x,pixel.y-1)) { + createPixel(pixel.element,pixel.x,pixel.y-1); + pixelMap[pixel.x][pixel.y-1].h = pixel.h+1; + } + var coords = [ + [pixel.x+1,pixel.y], + [pixel.x-1,pixel.y], + [pixel.x+1,pixel.y+1], + [pixel.x-1,pixel.y+1], + ]; + for (var i = 0; i < coords.length; i++) { + if (Math.random() < 0.005 && isEmpty(coords[i][0],coords[i][1])) { + if (!isEmpty(coords[i][0],coords[i][1]+1,true)) { + var soil = pixelMap[coords[i][0]][coords[i][1]+1]; + if (eLists.FESTER.indexOf(soil.element) !== -1) { + createPixel(pixel.element,coords[i][0],coords[i][1]); + } + } + } + } + if (Math.random() < 0.0002 && pixel.age > 500 && pixel.temp < 90 && pixel.rooting === false) { + pixel.rooting = true; + } + if (Math.random() < 0.002 && pixel.age > 500 && pixel.temp < 90 && pixel.rooting === true) { + if (!outOfBounds(pixel.x,pixel.y+1)) { + var dirtPixel = pixelMap[pixel.x][pixel.y+1]; + if (dirtPixel && (eLists.FESTER.indexOf(dirtPixel.element) !== -1 || dirtPixel.element === "grass")) { + changePixel(dirtPixel,"vein_root"); + } + } + } + pixel.age++; + doDefaults(pixel); + }, + ignore: ["teeth","flesh_mound","flesh_beast"], + renderer: renderPresets.PLANTCHAR, + properties: { + "h": 0, + "age": 0, + "rooting": false, + "fruit": undefined, + }, + reactions: { + "cell": { elem2:"flesh_mound", chance:0.005 }, + "skin": { elem2:"flesh_mound", chance:0.005 }, + "sugar_water": { elem2:"flesh_mound", chance:0.05 }, + "acidic_bile": { elem2:null, chance:0.005 }, + "plant": { elem2:["dead_plant","solid_flesh"], chance:0.005 }, + "dead_plant": { elem2:"flesh_mound", chance:0.005 }, + "sapling": { elem2:"fleshwood_sapling", chance:0.005 }, + "wood": { elem2:"dry_fleshwood", chance:0.005 }, + "tree_branch": { elem2:"fleshwood", chance:0.005 }, + "head": { elem2:"flesh_mound", chance:0.001}, + "body": { elem2:"flesh_mound", chance:0.001 }, + "frog": { elem2:"flesh_mound", chance:0.005 }, + "tadpole": { elem2:"flesh_mound", chance:0.005 }, + "fish": { elem2:"flesh_mound", chance:0.005 }, + "rat": { elem2:"flesh_mound", chance:0.005 }, + "bird": { elem2:"flesh_mound", chance:0.005 }, + }, + tempHigh: 100, + stateHigh: "meat", + tempLow: -2, + stateLow: "frozen_meat", + burn:3, + burnTime:20, + breakInto: "meat", + category:"flesh", + state: "solid", + density: 1400, +} + +elements.vein_root = { + color: ["#c72114","#8d3728","#a95338","#c72114","#d83225","#c1745b","#903830", "#c72114",], + behavior: [ + "XX|XX|XX", + "XX|XX|XX", + "CH:fleshy_dirt,dirt,mud,sand,wet_sand,clay_soil,clay,mycelium,grass,color_sand,skin,meat,rotten_meat,concrete,dead_plant,dead_bug,root>vein_root,fibrous_flesh%0.5 AND CR:vein_root%0.005|CH:fleshy_dirt,dirt,mud,sand,wet_sand,clay_soil,clay,mycelium,grass,color_sand,skin,meat,rotten_meat,concrete,dead_plant,dead_bug,root>vein_root,fibrous_flesh,fibrous_flesh%0.5|CH:fleshy_dirt,dirt,mud,sand,wet_sand,clay_soil,clay,mycelium,grass,color_sand,skin,meat,rotten_meat,concrete,dead_plant,dead_bug,root>vein_root,fibrous_flesh%0.5 AND CR:vein_root%0.005", + ], + reactions: { + "rock": { elem2:"sand", chance:0.0008 }, + "mud": { elem2:"dirt", chance:0.01 }, + "wet_sand": { elem2:"sand", chance:0.01 }, + "water": { elem2:null, chance:0.001 }, + "blood": { elem2:null, chance:0.01 }, + "sugar_water": { elem2:null, chance:0.0025 }, + "acidic_bile": { elem2:null, chance:0.0025 } + }, + tempHigh: 175, + stateHigh: "meat", + tempLow: -50, + stateLow: "frozen_meat", + burn: 20, + burnTime: 60, + burnInto: "meat", + breakInto: "blood", + category: "flesh", + state: "solid", + density: 1250, + conduct: 0.1, + hidden: true +} + +elements.fibrous_flesh = { + color: ["#c72114","#7c2617","#984227","#c72114","#b0634a","#802720","#c72114"], + behavior: behaviors.STURDYPOWDER, + tempHigh:175, + stateHigh: "meat", + tempLow: -50, + stateLow: "frozen_meat", + burn: 20, + burnTime: 60, + burnInto: "meat", + category:"flesh", + hidden: true, + breakInto: "blood", + state: "solid", + density: 462 +} + +elements.solid_flesh = { + color: ["#7c2617","#984227","#c72114","#b0634a","#802720"], + behavior: behaviors.WALL, + reactions: { + "plant": { elem2:["dead_plant","solid_flesh"], chance:0.005 }, + "grass": { elem2:["dead_plant","flesh_mound"], chance:0.005 }, + "tree_branch": { elem1:null, elem2:"fleshwood" }, + "sapling": { elem2:"fleshwood_sapling", chance:0.005 }, + }, + tempHigh:175, + stateHigh: "meat", + tempLow: -50, + stateLow: "frozen_meat", + burn: 20, + burnTime: 60, + burnInto: "meat", + category:"flesh", + hidden: true, + breakInto: ["blood","meat","meat"], + state: "solid", + density: 462 +} + +elements.flesh_beast = { + color: ["#9e4839","#ba6449","#a14940"], + behavior: [ + "XX|CR:acidic_bile%0.05 AND M2%0.5|M2%5 AND SW:acidic_bile,meat,rotten_meat,blood%14", + "XX|FX%2|M2%50 AND BO", + "XX|M1|M2%50 AND SW:acidic_bile,meat,rotten_meat,blood%14", + ], + reactions: { + "cell": { elem2:"flesh_mound", chance:0.05, func:behaviors.FEEDPIXEL }, + "head": { elem2:["flesh_mound",null], chance:0.01, func:behaviors.FEEDPIXEL }, + "body": { elem2:["flesh_mound",null], chance:0.01, func:behaviors.FEEDPIXEL }, + "frog": { elem2:["flesh_mound",null], chance:0.05, func:behaviors.FEEDPIXEL }, + "tadpole": { elem2:["flesh_mound",null], chance:0.05, func:behaviors.FEEDPIXEL }, + "fish": { elem2:["flesh_mound",null], chance:0.05, func:behaviors.FEEDPIXEL }, + "rat": { elem2:["flesh_mound",null], chance:0.05, func:behaviors.FEEDPIXEL }, + "bird": { elem2:["flesh_mound",null], chance:0.05, func:behaviors.FEEDPIXEL }, + "bone": { elem2:"quicklime", chance:0.005, func:behaviors.FEEDPIXEL }, + "bone_marrow": { elem2:["flesh_mound","quicklime"], chance:0.005, func:behaviors.FEEDPIXEL }, + "skin": { elem2:"flesh_mound", chance:0.005, func:behaviors.FEEDPIXEL }, + "sugar": { elem2:null, chance:0.04, func:behaviors.FEEDPIXEL }, + "sugar_water": { elem2:null, chance:0.05, func:behaviors.FEEDPIXEL }, + "plant": { elem2:["dead_plant","flesh_mound",null], chance:0.005, func:behaviors.FEEDPIXEL }, + "grass": { elem2:["dead_plant","flesh_mound",null], chance:0.005, func:behaviors.FEEDPIXEL }, + "oxygen": { elem2:"carbon_dioxide", chance:0.5 }, + "meat": { elem2:["flesh_mound",null], chance:0.01, func:behaviors.FEEDPIXEL }, + "cooked_meat": { elem2:["flesh_mound",null,null,null], chance:0.1, func:behaviors.FEEDPIXEL }, + "rotten_meat": { elem2:["flesh_mound","plague",null,null], chance:0.1, func:behaviors.FEEDPIXEL }, + "cheese": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "rotten_cheese": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "melted_cheese": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL }, + "tomato": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "sauce": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL }, + "vine": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "evergreen": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "algae": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "grass_seed": { elem2:null, chance:0.3 , func:behaviors.FEEDPIXEL}, + "wheat_seed": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL }, + "wheat": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "potato_seed": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL }, + "potato": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "corn_seed": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL }, + "corn": { elem2:null, chance:0.1 , func:behaviors.FEEDPIXEL}, + "lichen": { elem2:null, chance:0.04, func:behaviors.FEEDPIXEL }, + "flower_seed": { elem2:null, chance:0.4 , func:behaviors.FEEDPIXEL}, + "flour": { elem2:null, chance:0.1 , func:behaviors.FEEDPIXEL}, + "dough": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "bread": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "toast": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "gingerbread": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL }, + "rice": { elem2:null, chance:0.1 , func:behaviors.FEEDPIXEL}, + "yogurt": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL }, + "beans": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL }, + "salt": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "sugar": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "crumb": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "herb": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "popcorn": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL }, + "candy": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL }, + "caramel": { elem2:null, chance:0.4, func:behaviors.FEEDPIXEL }, + "lichen": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "egg": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "yolk": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "eggnog": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "milk": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "grape": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL }, + "batter": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL }, + "baked_batter": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "butter": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "melted_butter": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL }, + "lettuce": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "baked_potato": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "ice_cream": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "cream": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL }, + "pumpkin": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "pumpkin_seed": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "coffee_bean": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "coffee_ground": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "nut": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "nut_meat": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "nut_butter": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "jelly": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "worm": { elem2:["flesh_mound",null], chance:0.1, func:behaviors.FEEDPIXEL }, + "fly": { elem2:["flesh_mound",null], chance:0.1, func:behaviors.FEEDPIXEL }, + "ant": { elem2:["flesh_mound",null], chance:0.1, func:behaviors.FEEDPIXEL }, + "frog": { elem2:["flesh_mound",null], chance:0.05, func:behaviors.FEEDPIXEL }, + "snail": { elem2:["flesh_mound","quicklime"], chance:0.1, func:behaviors.FEEDPIXEL }, + "slug": { elem2:["flesh_mound",null], chance:0.1, func:behaviors.FEEDPIXEL }, + "sapling": { elem2:"fleshwood_sapling", chance:0.005 }, + "wood": { elem2:"dry_fleshwood", chance:0.005 }, + "tree_branch": { elem2:"fleshwood", chance:0.005 }, + }, + foodNeed: 2, + egg: "flesh_beast", + category: "flesh", + temp: 37.6, + tempHigh: 120, + stateHigh: "rotten_meat", + tempLow: -18, + stateLow: "frozen_meat", + breakInto: ["acidic_bile","rotten_meat"], + burn:80, + burnTime:150, + state: "solid", + density: 1450, + conduct: 0.25 +} + +elements.fleshwood_sapling = { + color: ["#7c2617","#984227","#c72114","#b0634a","#802720"], + tick: function(pixel) { + if (!tryMove(pixel,pixel.x,pixel.y+1)) { + if (Math.random() < 0.02 && pixel.age > 50 && pixel.temp < 100) { + if (!outOfBounds(pixel.x,pixel.y+1)) { + var dirtPixel = pixelMap[pixel.x][pixel.y+1]; + if (dirtPixel && (eLists.FESTER.indexOf(dirtPixel.element) !== -1 || dirtPixel.element === "grass")) { + changePixel(dirtPixel,"vein_root"); + } + } + if (isEmpty(pixel.x,pixel.y-1)) { + if (!pixel.wc) { + var c = Math.random(); + if (c < 0.01) { pixel.wc="#632e1f"; pixel.lc="#7c2617" } + else if (c < 0.05) { pixel.wc="#9e4839"; pixel.lc="#7c2617" } + else if (c < 0.1) { pixel.wc="#9e4839"; pixel.lc="#984227" } + else if (c < 0.2) { pixel.wc="#a14940"; pixel.lc="#984227" } + else if (c < 0.3) { pixel.wc="#ba6449"; pixel.lc="#c72114" } + else if (c < 0.4) { pixel.wc="#a14940"; pixel.lc="#c72114" } + else if (c < 0.45) { pixel.wc="#ba6449"; pixel.lc="#b0634a" } + else if (c < 0.5) { pixel.wc="#a14940"; pixel.lc="#b0634a" } + else { pixel.wc="#9e4839"; pixel.lc="#802720" } + pixel.color = pixelColorPick(pixel, pixel.lc); + } + movePixel(pixel,pixel.x,pixel.y-1); + createPixel(Math.random() > 0.5 ? "dry_fleshwood" : "fleshwood",pixel.x,pixel.y+1); + pixelMap[pixel.x][pixel.y+1].wc = pixel.wc; + pixelMap[pixel.x][pixel.y+1].lc = pixel.lc; + pixelMap[pixel.x][pixel.y+1].color = pixelColorPick(pixelMap[pixel.x][pixel.y+1], pixel.wc); + } + } + else if (pixel.age > 1000 && Math.random() < 0.05) { + changePixel(pixel,"dry_fleshwood"); + pixel.color = pixelColorPick(pixel, pixel.wc); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0 + }, + tempHigh: 100, + stateHigh: "meat", + tempLow: -25, + stateLow: "meat", + burn: 65, + burnTime: 15, + category: "flesh", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true +} + +elements.fleshwood = { + color: ["#9e4839","#ba6449","#a14940"], + tick: function(pixel) { + if (!pixel.burning) { + if (!pixel.lc) { pixel.lc = "#7c2617" } + if (!pixel.wc) { pixel.wc = "#ba6449" } + if (isEmpty(pixel.x-1,pixel.y-1) && Math.random() < 0.02) { + if (Math.random() < 0.55) { + createPixel("solid_flesh",pixel.x-1,pixel.y-1); + pixelMap[pixel.x-1][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x-1][pixel.y-1], pixel.lc); + } + else { + createPixel("fleshwood",pixel.x-1,pixel.y-1); + pixelMap[pixel.x-1][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x-1][pixel.y-1], pixel.wc); + pixelMap[pixel.x-1][pixel.y-1].wc = pixel.wc; + pixelMap[pixel.x-1][pixel.y-1].lc = pixel.lc; + } + } + if (isEmpty(pixel.x+1,pixel.y-1) && Math.random() < 0.02) { + if (Math.random() < 0.55) { + createPixel("solid_flesh",pixel.x+1,pixel.y-1); + pixelMap[pixel.x+1][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x+1][pixel.y-1], pixel.lc); + } + else { + createPixel("fleshwood",pixel.x+1,pixel.y-1); + pixelMap[pixel.x+1][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x+1][pixel.y-1], pixel.wc); + pixelMap[pixel.x+1][pixel.y-1].wc = pixel.wc; + pixelMap[pixel.x+1][pixel.y-1].lc = pixel.lc; + } + } + if (isEmpty(pixel.x,pixel.y-1) && Math.random() < 0.02) { + if (Math.random() < 0.8) { + createPixel("solid_flesh",pixel.x,pixel.y-1); + pixelMap[pixel.x][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x][pixel.y-1], pixel.lc); + } + else { + createPixel("fleshwood",pixel.x,pixel.y-1); + pixelMap[pixel.x][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x][pixel.y-1], pixel.wc); + pixelMap[pixel.x][pixel.y-1].wc = pixel.wc; + pixelMap[pixel.x][pixel.y-1].lc = pixel.lc; + } + } + } + doDefaults(pixel); + }, + renderer: renderPresets.WOODCHAR, + reactions: { + "plant": { elem2:["dead_plant","solid_flesh"], chance:0.005 }, + "grass": { elem2:["dead_plant","flesh_mound"], chance:0.005 }, + "tree_branch": { elem1:null, elem2:"fleshwood" }, + "sapling": { elem2:"fleshwood_sapling", chance:0.005 }, + }, + movable: false, + tempHigh: 175, + stateHigh: "meat", + tempLow: -30, + stateLow: "meat", + category: "flesh", + burn: 2, + burnTime: 300, + burnInto: ["blood","ash","cooked_meat","ash"], + hidden: true, + state: "solid", + density: 1500, + hardness: 0.15, + breakInto: ["blood","meat"], + forceSaveColor: true +} + +elements.dry_fleshwood = { + color: ["#9e4839","#ba6449","#a14940"], + behavior: behaviors.WALL, + renderer: renderPresets.WOODCHAR, + reactions: { + "plant": { elem2:["dead_plant","solid_flesh"], chance:0.005 }, + "grass": { elem2:["dead_plant","flesh_mound"], chance:0.005 }, + "tree_branch": { elem1:null, elem2:"fleshwood" }, + "sapling": { elem2:"fleshwood_sapling", chance:0.005 }, + }, + tempHigh: 400, + stateHigh: ["ash","cooked_meat","fire","fire","fire"], + tempLow: -30, + stateLow: "meat", + category: "solids", + burn: 5, + burnTime: 300, + burnInto: ["ash","cooked_meat","fire"], + state: "solid", + hardness: 0.15, + breakInto: ["blood","meat"], + forceSaveColor: true +} + +elements.acidic_bile = { + color: ["#81cf63","#81cf63","#81cf63","#81cf63","#81cf63","#81cf63","#439809","#258b08","#118511","#127b12","#136d14"], + behavior: [ + "XX|DB%1|XX", + "DB%1 AND M2%25|DL%0.001|DB%1 AND M2%25", + "DB%1 AND M2%25|DB%2 AND M1|DB%1 AND M2%25", + ], + ignore: ["flesh_beast","flesh_mound","vein_root","glass","rad_glass","glass_shard","rad_shard","stained_glass","baked_clay","acid","acid_gas","neutral_acid","acid_cloud","water","salt_water","sugar_water","dirty_water","copper","gold","porcelain","plastic","bead","microplastic","molten_plastic","pool_water","chlorine","hydrogen","gold_coin","silver","nickel","calcium","bone","earthquake","tornado","tsunami","liquid_light","sensor"], + reactions: { + "ash": { elem1:null, elem2:null }, + "limestone": { elem1:null, elem2:["calcium","carbon_dioxide"] }, + "quicklime": { elem1:null, elem2:null }, + "slaked_lime": { elem1:null, elem2:null }, + "borax": { elem1:null, elem2:null }, + "ammonia": { elem1:null, elem2:null }, + "bleach": { elem1:null, elem2:null }, + "cement": { elem1:null, elem2:null }, + "glass": { elem1:null, elem2:"glass_shard", chance:0.05 }, + "caustic_potash": { elem1:"water", elem2:"potassium_salt" }, + "bone": { elem2:"flesh_mound", chance:0.01 }, + "water": { elem1:null, elem2:"dirty_water" }, + "salt_water": { elem1:null, elem2:"water" }, + "sugar_water": { elem1:null, elem2:"water" }, + "plant": { elem2:["dead_plant","flesh_mound"], chance:0.005 }, + "grass": { elem2:["dead_plant","flesh_mound"], chance:0.005 }, + "tree_branch": { elem1:null, elem2:["dry_fleshwood","dry_fleshwood","dead_plant","fleshwood"] }, + "charcoal": { elem1:null, elem2:"carbon_dioxide" }, + "rock": { elem1:null, elem2:"sand", chance:0.05 }, + "baking_soda": { elem1:"salt_water", elem2:["carbon_dioxide","foam"] }, + "calcium": { elem1:"chlorine", elem2:"hydrogen", chance:0.01 }, + "zinc": { elem1:"hydrogen", elem2:null, chance:0.03 }, + "sugar": { elem1:"steam", elem2:"carbon_dioxide" }, + "sapling": { elem2:"fleshwood_sapling", chance:0.005 }, + }, + tempHigh: 120, + stateHigh: ["steam","steam","salt"], + tempLow: 0, + category:"flesh", + state: "liquid", + density: 1450, + stain: 0.05 +} diff --git a/mods/genetics.js b/mods/genetics.js index be89639c..f8b58098 100644 --- a/mods/genetics.js +++ b/mods/genetics.js @@ -3992,4 +3992,47 @@ elements.antiaging_pill = { isFood: true } +elements.regression_pill = { + behavior: behaviors.POWDER, + reactions: { + "organism": { elem1: null, chance:0.1, func:function(pixel1,pixel2) { + if (pixel2.vore > 0) { + if (Math.random() > 0.9) { + pixel2.food += 1 + }; + if (Math.random() > 0.99) { + pixel2.vore -= 1 + }; + pixel2.geneticCode -= 1 + } + else if (pixel2.vore < 0) { + if (Math.random() > 0.8) { + pixel2.food += 1 + }; + if (Math.random() > 0.99) { + pixel2.vore += 1 + }; + pixel2.geneticCode -= 1 + } + else if (pixel2.vore === 0) { + if (Math.random() > 0.75) { + pixel2.food += 1 + }; + pixel2.geneticCode -= 1 + } + }}, + }, + category: "organism", + state: "solid", + color: ["#c5dede","#c5dede","#D1D099","#CBCA8C","#a4b3b3","#c5dede","#D1D099","#CBCA8C","#c5dede","#c5dede","#D1D099","#CBCA8C"], + tempHigh: 250, + stateHigh: ["molten_plastic","sugar","smoke","smoke","smoke","herb","smoke","smoke","smoke","stench"], + burn: 10, + burnTime: 200, + burnInto: ["molten_plastic","sugar","smoke","smoke","smoke","herb","smoke","smoke","smoke","stench"], + breakInto: ["sugar","dust","dust","dust","dust","dust","dust","herb","dust","dust","dust","dust","dust","dust"], + breakIntoColor: ["#a4b3b3","#ECF4B0","#a4b3b3","#a4b3b3"], + isFood: true +} + /* by nekonico, do not steal!!!!!! >:3*/ diff --git a/mods/lightmap.js b/mods/lightmap.js index 85d929b5..65a5c545 100644 --- a/mods/lightmap.js +++ b/mods/lightmap.js @@ -184,6 +184,8 @@ function renderLightmapPrePixel(ctx) { 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.fillRect( x * pixelSize * lightmapScale, diff --git a/mods/moveable_cubes.js b/mods/moveable_cubes.js new file mode 100644 index 00000000..139d7ac2 --- /dev/null +++ b/mods/moveable_cubes.js @@ -0,0 +1,258 @@ +elements.steel_cube = { + color: "#71797e", + colorKey: { + "L":"#888f94", + "B":"#71797e" + }, + colorPattern: [ + "BBLB", + "BBBL", + "BLBB", + "LBBB" + ], + reactions: { + "water": { elem1:"rust", chance:0.002 }, + "salt_water": { elem1:"rust", chance:0.004 }, + "dirty_water": { elem1:"rust", chance:0.03 }, + "pool_water": { elem1:"rust", chance:0.03 }, + "sugar_water": { elem1:"rust", chance:0.003 }, + "seltzer": { elem1:"rust", chance:0.005 }, + "salt": { elem1:"rust", chance:0.003 }, + "blood": { elem1:"rust", chance:0.002 }, + "infection": { elem1:"rust", chance:0.002 }, + "antibody": { elem1:"rust", chance:0.002 }, + "coffee": { elem1:"rust", chance:0.0002 }, + "tea": { elem1:"rust", chance:0.0002 }, + "broth": { elem1:"rust", chance:0.0002 }, + "juice": { elem1:"rust", chance:0.0002 }, + "nut_milk": { elem1:"rust", chance:0.0002 }, + }, + tempHigh: 1455.5, + stateHigh: "molten_steel", + category: "cubes", + density: 7850, + conduct: 0.42, + hardness: 0.8, + tick: function(pixel) { + if (tryMove(pixel, pixel.x, pixel.y+1)) { // Fall + if (!isEmpty(pixel.x, pixel.y-2, true)) { + var cube2 = pixelMap[pixel.x][pixel.y-2]; + if (cube2.element == "steel") { + if (isEmpty(pixel.x, pixel.y-1)) { + movePixel(pixelMap[pixel.x][pixel.y-2], pixel.x, pixel.y-1); + } + else { + swapPixels(pixelMap[pixel.x][pixel.y-2], pixelMap[pixel.x][pixel.y-1]); + } + } + } + if (!isEmpty(pixel.x+1, pixel.y-1, true)) { + var cube2 = pixelMap[pixel.x+1][pixel.y-1]; + if (cube2.element == "steel") { + if (isEmpty(pixel.x+1, pixel.y)) { + movePixel(pixelMap[pixel.x+1][pixel.y-1], pixel.x+1, pixel.y); + } + else { + swapPixels(pixelMap[pixel.x+1][pixel.y-1], pixelMap[pixel.x+1][pixel.y]); + } + } + } + if (!isEmpty(pixel.x+2, pixel.y-1, true)) { + var cube2 = pixelMap[pixel.x+2][pixel.y-1]; + if (cube2.element == "steel") { + if (isEmpty(pixel.x+2, pixel.y)) { + movePixel(pixelMap[pixel.x+2][pixel.y-1], pixel.x+2, pixel.y); + } + else { + swapPixels(pixelMap[pixel.x+2][pixel.y-1], pixelMap[pixel.x+2][pixel.y]); + } + } + } + if (!isEmpty(pixel.x-1, pixel.y-1, true)) { + var cube2 = pixelMap[pixel.x-1][pixel.y-1]; + if (cube2.element == "steel") { + if (isEmpty(pixel.x-1, pixel.y)) { + movePixel(pixelMap[pixel.x-1][pixel.y-1], pixel.x-1, pixel.y); + } + else { + swapPixels(pixelMap[pixel.x-1][pixel.y-1], pixelMap[pixel.x-1][pixel.y]); + } + } + } + if (!isEmpty(pixel.x-2, pixel.y-1, true)) { + var cube2 = pixelMap[pixel.x-2][pixel.y-1]; + if (cube2.element == "steel") { + if (isEmpty(pixel.x-2, pixel.y)) { + movePixel(pixelMap[pixel.x-2][pixel.y-1], pixel.x-2, pixel.y); + } + else { + swapPixels(pixelMap[pixel.x-2][pixel.y-1], pixelMap[pixel.x-2][pixel.y]); + } + } + } + if (!isEmpty(pixel.x+1, pixel.y-2, true)) { + var cube2 = pixelMap[pixel.x+1][pixel.y-2]; + if (cube2.element == "steel") { + if (isEmpty(pixel.x+1, pixel.y-1)) { + movePixel(pixelMap[pixel.x+1][pixel.y-2], pixel.x+1, pixel.y-1); + } + else { + swapPixels(pixelMap[pixel.x+1][pixel.y-2], pixelMap[pixel.x+1][pixel.y-1]); + } + } + } + if (!isEmpty(pixel.x+2, pixel.y-2, true)) { + var cube2 = pixelMap[pixel.x+2][pixel.y-2]; + if (cube2.element == "steel") { + if (isEmpty(pixel.x+2, pixel.y-1)) { + movePixel(pixelMap[pixel.x+2][pixel.y-2], pixel.x+2, pixel.y-1); + } + else { + swapPixels(pixelMap[pixel.x+2][pixel.y-2], pixelMap[pixel.x+2][pixel.y-1]); + } + } + } + if (!isEmpty(pixel.x-1, pixel.y-2, true)) { + var cube2 = pixelMap[pixel.x-1][pixel.y-2]; + if (cube2.element == "steel") { + if (isEmpty(pixel.x-1, pixel.y-1)) { + movePixel(pixelMap[pixel.x-1][pixel.y-2], pixel.x-1, pixel.y-1); + } + else { + swapPixels(pixelMap[pixel.x-1][pixel.y-2], pixelMap[pixel.x-1][pixel.y-1]); + } + } + } + if (!isEmpty(pixel.x-2, pixel.y-2, true)) { + var cube2 = pixelMap[pixel.x-2][pixel.y-2]; + if (cube2.element == "steel") { + if (isEmpty(pixel.x-2, pixel.y-1)) { + movePixel(pixelMap[pixel.x-2][pixel.y-2], pixel.x-2, pixel.y-1); + } + else { + swapPixels(pixelMap[pixel.x-2][pixel.y-2], pixelMap[pixel.x-2][pixel.y-1]); + } + } + } + } + } +} + +elements.wood_cube = { + color: "#a0522d", + behavior: behaviors.WALL, + renderer: renderPresets.WOODCHAR, + tempHigh: 400, + stateHigh: ["ember","charcoal","fire","fire","fire"], + category: "cubes", + burn: 5, + burnTime: 300, + burnInto: ["ember","charcoal","fire"], + state: "solid", + hardness: 0.15, + breakInto: "sawdust", + forceSaveColor: true, + tick: function(pixel) { + if (tryMove(pixel, pixel.x, pixel.y+1)) { // Fall + if (!isEmpty(pixel.x, pixel.y-2, true)) { + var cube2 = pixelMap[pixel.x][pixel.y-2]; + if (cube2.element == "wood") { + if (isEmpty(pixel.x, pixel.y-1)) { + movePixel(pixelMap[pixel.x][pixel.y-2], pixel.x, pixel.y-1); + } + else { + swapPixels(pixelMap[pixel.x][pixel.y-2], pixelMap[pixel.x][pixel.y-1]); + } + } + } + if (!isEmpty(pixel.x+1, pixel.y-1, true)) { + var cube2 = pixelMap[pixel.x+1][pixel.y-1]; + if (cube2.element == "wood") { + if (isEmpty(pixel.x+1, pixel.y)) { + movePixel(pixelMap[pixel.x+1][pixel.y-1], pixel.x+1, pixel.y); + } + else { + swapPixels(pixelMap[pixel.x+1][pixel.y-1], pixelMap[pixel.x+1][pixel.y]); + } + } + } + if (!isEmpty(pixel.x+2, pixel.y-1, true)) { + var cube2 = pixelMap[pixel.x+2][pixel.y-1]; + if (cube2.element == "wood") { + if (isEmpty(pixel.x+2, pixel.y)) { + movePixel(pixelMap[pixel.x+2][pixel.y-1], pixel.x+2, pixel.y); + } + else { + swapPixels(pixelMap[pixel.x+2][pixel.y-1], pixelMap[pixel.x+2][pixel.y]); + } + } + } + if (!isEmpty(pixel.x-1, pixel.y-1, true)) { + var cube2 = pixelMap[pixel.x-1][pixel.y-1]; + if (cube2.element == "wood") { + if (isEmpty(pixel.x-1, pixel.y)) { + movePixel(pixelMap[pixel.x-1][pixel.y-1], pixel.x-1, pixel.y); + } + else { + swapPixels(pixelMap[pixel.x-1][pixel.y-1], pixelMap[pixel.x-1][pixel.y]); + } + } + } + if (!isEmpty(pixel.x-2, pixel.y-1, true)) { + var cube2 = pixelMap[pixel.x-2][pixel.y-1]; + if (cube2.element == "wood") { + if (isEmpty(pixel.x-2, pixel.y)) { + movePixel(pixelMap[pixel.x-2][pixel.y-1], pixel.x-2, pixel.y); + } + else { + swapPixels(pixelMap[pixel.x-2][pixel.y-1], pixelMap[pixel.x-2][pixel.y]); + } + } + } + if (!isEmpty(pixel.x+1, pixel.y-2, true)) { + var cube2 = pixelMap[pixel.x+1][pixel.y-2]; + if (cube2.element == "wood") { + if (isEmpty(pixel.x+1, pixel.y-1)) { + movePixel(pixelMap[pixel.x+1][pixel.y-2], pixel.x+1, pixel.y-1); + } + else { + swapPixels(pixelMap[pixel.x+1][pixel.y-2], pixelMap[pixel.x+1][pixel.y-1]); + } + } + } + if (!isEmpty(pixel.x+2, pixel.y-2, true)) { + var cube2 = pixelMap[pixel.x+2][pixel.y-2]; + if (cube2.element == "wood") { + if (isEmpty(pixel.x+2, pixel.y-1)) { + movePixel(pixelMap[pixel.x+2][pixel.y-2], pixel.x+2, pixel.y-1); + } + else { + swapPixels(pixelMap[pixel.x+2][pixel.y-2], pixelMap[pixel.x+2][pixel.y-1]); + } + } + } + if (!isEmpty(pixel.x-1, pixel.y-2, true)) { + var cube2 = pixelMap[pixel.x-1][pixel.y-2]; + if (cube2.element == "wood") { + if (isEmpty(pixel.x-1, pixel.y-1)) { + movePixel(pixelMap[pixel.x-1][pixel.y-2], pixel.x-1, pixel.y-1); + } + else { + swapPixels(pixelMap[pixel.x-1][pixel.y-2], pixelMap[pixel.x-1][pixel.y-1]); + } + } + } + if (!isEmpty(pixel.x-2, pixel.y-2, true)) { + var cube2 = pixelMap[pixel.x-2][pixel.y-2]; + if (cube2.element == "wood") { + if (isEmpty(pixel.x-2, pixel.y-1)) { + movePixel(pixelMap[pixel.x-2][pixel.y-2], pixel.x-2, pixel.y-1); + } + else { + swapPixels(pixelMap[pixel.x-2][pixel.y-2], pixelMap[pixel.x-2][pixel.y-1]); + } + } + } + } + } +} \ No newline at end of file diff --git a/mods/occlusion.js b/mods/occlusion.js new file mode 100644 index 00000000..d493710b --- /dev/null +++ b/mods/occlusion.js @@ -0,0 +1,149 @@ +const DEFAULT_LIGHT_FACTOR = 0.8; +const MIN_LIGHT_INTENSITY = 0.6; // If pixel is completely obscured, it will still have this amount of light + +const MAX_DIRECT_NEIGHBORS = 4; // getNeighbors() returns max 4 pixels +const FOLLOWUP_COORDS_TO_CHECK = [ + [-1, -1], [-1, 1], [1, -1], [1, 1], + [-2, 0], [2, 0], [0, -2], [0, 2], + [-3, 0], [3, 0], [0, -3], [0, 3], + [-4, 0], [4, 0], [0, -4], [0, 4] +]; + +// Pre-initialize the list of transparent elements +let transparentElementsTmp = "glass,stained_glass,glass_shard,solid_diamond,ice,led_r,led_g,led_b".split(","); +let transparentElements = []; + +// Function to create the list of transparent elements based on their properties +function initializeTransparentElements() { + Object.keys(elements).forEach(elementName => { + const element = elements[elementName]; + + // Check if the element is in a gas or liquid state + if (element.state === "gas") { + transparentElements.push(elementName); + } + + // Check if the element's category is "special" + if (element.category === "special") { + transparentElements.push(elementName); + } + + // Check if the element has a custom flag for transparency + if (element.putInTransparentList) { + transparentElements.push(elementName); + } + }); +} + +// Call the function once at startup to populate the transparentElements list +initializeTransparentElements(); + +// Customizable frame interval for recalculating brightness +const calculateEveryNFrames = 2; +let frameCounter = 0; + +// Cache for storing pixel brightnesses +let pixelBrightnessCache = {}; + +// scaleList should only be defined once +if (typeof scaleList === 'undefined') { + function scaleList(numbers, scale) { + return numbers.map(number => number * scale); + } +} + +function isOutOfBounds(x, y) { + return x >= width || y >= height || x < 0 || y < 0; +} + +function getOutOfBoundsNeighbors(pixel) { + const outOfBoundsNeighbors = []; + + // Define the 4 direct neighbors: left, right, top, bottom + const neighborsToCheck = [ + { x: pixel.x - 1, y: pixel.y }, + { x: pixel.x + 1, y: pixel.y }, + { x: pixel.x, y: pixel.y - 1 }, + { x: pixel.x, y: pixel.y + 1 } + ]; + + // Check each of the neighbors to see if they are out of bounds + neighborsToCheck.forEach(neighbor => { + if (isOutOfBounds(neighbor.x, neighbor.y)) { + outOfBoundsNeighbors.push(neighbor); + } + }); + + return outOfBoundsNeighbors; +} + +// Iterate over each pixel and either calculate or draw occlusion lighting +function applyLightingToPixels(ctx) { + // Recalculate pixel brightnesses every `n` frames + if (frameCounter % calculateEveryNFrames === 0) { + currentPixels.forEach(pixel => { + const brightness = calculateBrightness(pixel); + pixelBrightnessCache[`${pixel.x},${pixel.y}`] = brightness; // Cache the brightness + }); + } + + // Draw pixels based on cached brightness + currentPixels.forEach(pixel => { + const brightness = pixelBrightnessCache[`${pixel.x},${pixel.y}`] || 1; // Default to full brightness if not calculated yet + drawPixelShade(ctx, pixel, brightness); + }); + + // Increment the frame counter + frameCounter++; +} + +// Darken a pixel based on brightness +function drawPixelShade(ctx, pixel, brightness) { + ctx.globalAlpha = 1.0; + ctx.fillStyle = `rgba(0, 0, 0, ${1 - brightness})`; + ctx.fillRect(pixel.x * pixelSize, pixel.y * pixelSize, pixelSize, pixelSize); +} + +// Compute brightness for a given pixel +function calculateBrightness(pixel) { + const neighboringPixelsCount = getNeighbors(pixel).length + getOutOfBoundsNeighbors(pixel).length; + + // If the pixel has enough light-blocking neighbors, perform a deeper search + if (neighboringPixelsCount >= MAX_DIRECT_NEIGHBORS) { + const lightFactor = computeBrightnessFurther(pixel); + return adjustBrightness(lightFactor); + } + + return 1; // Full brightness +} + +// Compute brightness based on further pixels that block light +function computeBrightnessFurther(pixel) { + let lightBlockers = 0; + + FOLLOWUP_COORDS_TO_CHECK.forEach(offset => { + const [dx, dy] = offset; + const xCoord = pixel.x + dx; + const yCoord = pixel.y + dy; + + if (isOutOfBounds(xCoord, yCoord)) { + lightBlockers++; + return; + } + + // Check if the element is transparent + const element = pixelMap[xCoord][yCoord]; + if (element != undefined && !transparentElements.includes(element.element)) { + lightBlockers++; + } + }); + + return 1 - (lightBlockers / FOLLOWUP_COORDS_TO_CHECK.length); +} + +// Adjust brightness based on light factor +function adjustBrightness(lightFactor) { + return lightFactor * DEFAULT_LIGHT_FACTOR + MIN_LIGHT_INTENSITY; +} + +renderPostPixel(applyLightingToPixels); diff --git a/mods/single_humans.js b/mods/single_humans.js new file mode 100644 index 00000000..eebdb809 --- /dev/null +++ b/mods/single_humans.js @@ -0,0 +1,147 @@ +elements.single_human = { + color: ["#f3e7db","#f7ead0","#eadaba","#d7bd96","#a07e56","#825c43","#604134","#3a312a"], + category: "life", + tick: function(pixel) { + if (tryMove(pixel, pixel.x, pixel.y+1)) {} // Fall + doHeat(pixel); + doBurning(pixel); + doElectricity(pixel); + if (pixel.dead) { + // Turn into rotten_meat if pixelTicks-dead > 500 + if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) { + changePixel(pixel,"rotten_meat"); + } + return + } + + if (pixel.panic > 0) { + pixel.panic -= 0.1; + if (pixel.panic < 0) { pixel.panic = 0; } + } + + if (Math.random() < 0.1*(isEmpty(pixel.x, pixel.y+1) ? 1 : pixel.panic+1)) { // Move 10% chance + var movesToTry = [ + [1*pixel.dir,0], + [1*pixel.dir,-1], + ]; + // While movesToTry is not empty, tryMove(pixel, x, y) with a random move, then remove it. if tryMove returns true, break. + while (movesToTry.length > 0) { + var move = movesToTry.splice(Math.floor(Math.random() * movesToTry.length), 1)[0]; + if (isEmpty(pixel.x+move[0], pixel.y+move[1]-1)) { + var origx = pixel.x+move[0]; + var origy = pixel.y+move[1]; + if (tryMove(pixel, pixel.x+move[0], pixel.y+move[1]) && pixel.x===origx && pixel.y===origy) { + break; + } + } + else if (!isEmpty(pixel.x+move[0], pixel.y+move[1], true)) { + var hitPixel = pixelMap[pixel.x+move[0]][pixel.y+move[1]]; + if (hitPixel.element === "single_human") { + // interact with other humans + hitPixel.panic = pixel.panic; + } + } + } + // 15% chance to change direction + if (Math.random() < 0.15) { + pixel.dir *= -1; + } + // homeostasis + if (pixel.temp > 37) { pixel.temp -= 1; } + else if (pixel.temp < 37) { pixel.temp += 1; } + } + + }, + hidden: true, + density: 1080, + state: "solid", + conduct: .05, + temp: 37, + tempHigh: 200, + stateHigh: "cooked_meat", + tempLow: -30, + stateLow: "frozen_meat", + burn: 10, + burnTime: 250, + burnInto: "cooked_meat", + breakInto: ["blood","meat","bone"], + forceSaveColor: true, + reactions: { + "cancer": { elem1:"cancer", chance:0.005 }, + "radiation": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.4 }, + "neutron": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.03 }, + "fallout": { elem1:["ash","meat","rotten_meat","cooked_meat"], chance:0.03 }, + "plague": { elem1:"plague", chance:0.05 }, + "oxygen": { elem2:"carbon_dioxide", chance:0.5 }, + "meat": { elem2:null, chance:0.1 }, + "cooked_meat": { elem2:null, chance:0.1 }, + "cured_meat": { elem2:null, chance:0.1 }, + "sugar": { elem2:null, chance:0.1 }, + "broth": { elem2:null, chance:0.2 }, + "yolk": { elem2:null, chance:0.1 }, + "hard_yolk": { elem2:null, chance:0.1 }, + "dough": { elem2:null, chance:0.1 }, + "batter": { elem2:null, chance:0.2 }, + "butter": { elem2:null, chance:0.1 }, + "melted_butter": { elem2:null, chance:0.2 }, + "chocolate": { elem2:null, chance:0.2 }, + "melted_chocolate": { elem2:null, chance:0.3 }, + "grape": { elem2:null, chance:0.1 }, + "tomato": { elem2:null, chance:0.1 }, + "herb": { elem2:null, chance:0.1 }, + "lettuce": { elem2:null, chance:0.1 }, + "corn": { elem2:null, chance:0.1 }, + "popcorn": { elem2:null, chance:0.15 }, + "potato": { elem2:null, chance:0.1 }, + "baked_potato": { elem2:null, chance:0.15 }, + "bread": { elem2:null, chance:0.1 }, + "toast": { elem2:null, chance:0.1 }, + "gingerbread": { elem2:null, chance:0.1 }, + "baked_batter": { elem2:null, chance:0.2 }, + "wheat": { elem2:null, chance:0.1 }, + "candy": { elem2:null, chance:0.1 }, + "yogurt": { elem2:null, chance:0.2 }, + "frozen_yogurt": { elem2:null, chance:0.1 }, + "ice_cream": { elem2:null, chance:0.2 }, + "beans": { elem2:[null,null,null,null,null,null,null,null,"stench"], chance:0.2 }, + "tea": { elem2:null, chance:0.2 }, + "coffee": { elem2:null, chance:0.2 }, + "milk": { elem2:null, chance:0.2 }, + "cream": { elem2:null, chance:0.2 }, + "soda": { elem2:null, chance:0.2 }, + "chocolate_milk": { elem2:null, chance:0.2 }, + "fruit_milk": { elem2:null, chance:0.2 }, + "pilk": { elem2:null, chance:0.2 }, + "eggnog": { elem2:null, chance:0.2 }, + "juice": { elem2:null, chance:0.2 }, + "cheese": { elem2:null, chance:0.1 }, + "melted_cheese": { elem2:null, chance:0.2 }, + "alcohol": { elem2:null, chance:0.2 }, + "antidote": { elem2:null, chance:0.2 }, + "honey": { elem2:null, chance:0.2 }, + "caramel": { elem2:null, chance:0.2 }, + "molasses": { elem2:null, chance:0.05 }, + "ketchup": { elem2:null, chance:0.1 }, + "pumpkin_seed": { elem2:null, chance:0.1 }, + "nut": { elem2:null, chance:0.1 }, + "nut_meat": { elem2:null, chance:0.1 }, + "nut_butter": { elem2:null, chance:0.1 }, + "nut_milk": { elem2:null, chance:0.2 }, + "jelly": { elem2:null, chance:0.2 }, + "mayo": { elem2:null, chance:0.2 }, + "mashed_potato": { elem2:null, chance:0.2 }, + "sauce": { elem2:null, chance:0.2 }, + "pickle": { elem2:null, chance:0.1 }, + "sun": { elem1:"cooked_meat" }, + "light": { stain1:"#825043" }, + "bee": { stain1:"#cc564b", chance:0.2 }, + "water": { elem2:"bubble", attr2:{"clone":"water"}, chance:0.001 }, + "salt_water": { elem2:"bubble", attr2:{"clone":"salt_water"}, chance:0.001 }, + "pool_water": { elem2:"bubble", attr2:{"clone":"pool_water"}, chance:0.001 }, + }, + properties: { + dead: false, + dir: 1, + panic: 0 + }, +} diff --git a/mods/texture_pack_by_jayd.js b/mods/texture_pack_by_jayd.js index 9f8ee49e..46434ed1 100644 --- a/mods/texture_pack_by_jayd.js +++ b/mods/texture_pack_by_jayd.js @@ -1,5 +1,5 @@ //texture_pack_by_jayd -document.body.style.backgroundImage = 'url("https://jayd-rubies.github.io/1236951076024877107.png")'; +document.body.style.backgroundImage = 'url("https://jayd-rubies.github.io/image/1236951076024877107.png")'; gameDiv.style.border = "1px solid #ffffff00"; window.addEventListener("load",function(){ document.querySelectorAll(".categoryButton").forEach(e => { @@ -113,4 +113,4 @@ viewInfo[4] = { // Small Pixels } else{renderBall(ctx,pixel.color,pixel.x,pixel.y,0,1);} } -} \ No newline at end of file +}