├── .editorconfig ├── .github ├── issue_template.md ├── pull_request_map_template.md ├── pull_request_module_template.md ├── pull_request_template.md ├── stale.yml └── workflows │ ├── AutoRelease.yml │ ├── CI.yml │ └── CheckMaps.yml ├── .gitignore ├── .luacheckrc ├── LICENSE ├── control.lua ├── description.json ├── image.png ├── info.json ├── locale ├── de │ ├── commands.cfg │ └── locale.cfg ├── en │ ├── amap.cfg │ ├── chronosphere.cfg │ ├── commands.cfg │ ├── crab_defender.cfg │ ├── fish_defender_v2.cfg │ ├── freeplay.cfg │ ├── gui.cfg │ ├── ic.cfg │ ├── journey.cfg │ ├── locale.cfg │ ├── modules.cfg │ ├── mtn_fortress_v3.cfg │ ├── pidgeotto.cfg │ ├── pirates.cfg │ ├── rpg.cfg │ └── wave_defense.cfg ├── ru │ ├── amap.cfg │ ├── chronosphere.cfg │ ├── commands.cfg │ ├── crab_defender.cfg │ ├── fish_defender_v2.cfg │ ├── gui.cfg │ ├── ic.cfg │ ├── journey.cfg │ ├── locale.cfg │ ├── modules.cfg │ ├── mtn_fortress_v3.cfg │ ├── pidgeotto.cfg │ ├── pirates.cfg │ ├── rpg.cfg │ └── wave_defense.cfg └── zh-CN │ ├── amap.cfg │ ├── chronosphere.cfg │ ├── commands.cfg │ ├── crab_defender.cfg │ ├── fish_defender_v2.cfg │ ├── gui.cfg │ ├── ic.cfg │ ├── journey.cfg │ ├── locale.cfg │ ├── modules.cfg │ ├── mtn_fortress_v3.cfg │ ├── pidgeotto.cfg │ ├── pirates.cfg │ └── rpg.cfg ├── map_loader.lua ├── maps ├── anarchy.lua ├── atoll.lua ├── biter_battles │ ├── biter_battles.lua │ ├── biter_battles_changelog.txt │ ├── biter_battles_terrain.lua │ └── biter_battles_terrain_neko.lua ├── biter_battles_v2 │ ├── ai.lua │ ├── biter_raffle.lua │ ├── commands.lua │ ├── config.lua │ ├── difficulty_vote.lua │ ├── feeding.lua │ ├── functions.lua │ ├── game_over.lua │ ├── gui.lua │ ├── init.lua │ ├── main.lua │ ├── mirror_terrain.lua │ ├── sciencelogs_tab.lua │ ├── spec_spy.lua │ ├── tables.lua │ ├── team_manager.lua │ └── terrain.lua ├── biter_hatchery │ ├── gui.lua │ ├── main.lua │ ├── raffle_tables.lua │ ├── share_chat.lua │ ├── team.lua │ └── terrain.lua ├── blue_beach.lua ├── cave_choppy │ ├── cave_miner_kaboomsticks.lua │ ├── cave_miner_market_items.lua │ ├── forest_world.lua │ ├── infinity_chest.lua │ ├── main.lua │ └── player_elevator.lua ├── cave_miner.lua ├── cave_miner_kaboomsticks.lua ├── cave_miner_market_items.lua ├── cave_miner_v2 │ ├── constants.lua │ ├── functions.lua │ ├── main.lua │ ├── market.lua │ ├── rocks_yield_ore.lua │ └── terrain.lua ├── choppy.lua ├── choppy_dx.lua ├── chronosphere │ ├── ai.lua │ ├── balance.lua │ ├── chrono.lua │ ├── comfylatron.lua │ ├── commands.lua │ ├── config_tab.lua │ ├── event_functions.lua │ ├── gui.lua │ ├── locomotive.lua │ ├── main.lua │ ├── minimap.lua │ ├── on_event.lua │ ├── ores.lua │ ├── production.lua │ ├── production_list.lua │ ├── raffles.lua │ ├── table.lua │ ├── terrain_specials.lua │ ├── tick_functions.lua │ ├── treasure.lua │ ├── upgrade_list.lua │ ├── upgrades.lua │ ├── world_functions.lua │ ├── world_list.lua │ └── worlds │ │ ├── basic.lua │ │ ├── blueprints.lua │ │ ├── caveworld.lua │ │ ├── fishmarket.lua │ │ ├── forest.lua │ │ ├── locomotive_surface.lua │ │ ├── maze.lua │ │ ├── riverlands.lua │ │ ├── scrapyard.lua │ │ └── swamp.lua ├── crab_defender │ ├── b.lua │ ├── boss_biters.lua │ ├── bouncy_shells.lua │ ├── commands.lua │ ├── crumbly_walls.lua │ ├── explosive_gun_bullets.lua │ ├── flame_boots.lua │ ├── laser_pointer.lua │ ├── launch_fish_to_win.lua │ ├── main.lua │ ├── map.lua │ ├── market.lua │ ├── on_entity_damaged.lua │ ├── shotgun_buff.lua │ ├── table.lua │ ├── terrain.lua │ ├── trapped_capsules.lua │ ├── ultra_mines.lua │ └── vehicle_nanobots.lua ├── cratewood_forest.lua ├── crossing.lua ├── cube.lua ├── deep_jungle │ ├── generate.lua │ ├── main.lua │ ├── table.lua │ └── terrain.lua ├── desert_oasis.lua ├── dungeons │ ├── biome_acid_zone.lua │ ├── biome_concrete.lua │ ├── biome_deepblue.lua │ ├── biome_desert.lua │ ├── biome_dirtlands.lua │ ├── biome_doom.lua │ ├── biome_glitch.lua │ ├── biome_grasslands.lua │ ├── biome_laboratory.lua │ ├── biome_market.lua │ ├── biome_rainbow.lua │ ├── biome_red_desert.lua │ ├── biome_treasure.lua │ ├── boss_arena.lua │ ├── functions.lua │ ├── main.lua │ ├── research.lua │ ├── table.lua │ └── tiered_dungeon.lua ├── expanse │ ├── functions.lua │ ├── main.lua │ └── price_raffle.lua ├── fish_defender │ ├── boss_biters.lua │ ├── bouncy_shells.lua │ ├── combat_balance.lua │ ├── commands.lua │ ├── crumbly_walls.lua │ ├── explosive_gun_bullets.lua │ ├── flame_boots.lua │ ├── laser_pointer.lua │ ├── main.lua │ ├── market.lua │ ├── on_entity_damaged.lua │ ├── railgun_enhancer.lua │ ├── table.lua │ ├── terrain.lua │ ├── trapped_capsules.lua │ ├── ultra_mines.lua │ └── vehicle_nanobots.lua ├── fish_defender_v1 │ ├── boss_biters.lua │ ├── bouncy_shells.lua │ ├── crumbly_walls.lua │ ├── explosive_gun_bullets.lua │ ├── fish_defender.lua │ ├── flame_boots.lua │ ├── laser_pointer.lua │ ├── map_intro.lua │ ├── market.lua │ ├── on_entity_damaged.lua │ ├── railgun_enhancer.lua │ ├── shotgun_buff.lua │ ├── trapped_capsules.lua │ ├── ultra_mines.lua │ └── vehicle_nanobots.lua ├── fish_defender_v2 │ ├── b.lua │ ├── boss_biters.lua │ ├── bouncy_shells.lua │ ├── cat_defender_layout.lua │ ├── cat_defender_layout_v2.lua │ ├── check_damaged.lua │ ├── commands.lua │ ├── core.lua │ ├── crumbly_walls.lua │ ├── explosive_gun_bullets.lua │ ├── fish_defender_layout.lua │ ├── flame_boots.lua │ ├── laser_pointer.lua │ ├── main.lua │ ├── map.lua │ ├── market.lua │ ├── shotgun_buff.lua │ ├── table.lua │ ├── terrain.lua │ ├── trapped_capsules.lua │ ├── ultra_mines.lua │ └── vehicle_nanobots.lua ├── hedge_maze.lua ├── hunger_games_map_intro.lua ├── island_troopers │ ├── enemies.lua │ ├── main.lua │ ├── map_intro.lua │ └── terrain.lua ├── journey │ ├── constants.lua │ ├── functions.lua │ ├── main.lua │ └── unique_modifiers.lua ├── junkyard.lua ├── junkyard_pvp │ ├── gui.lua │ ├── main.lua │ ├── share_chat.lua │ ├── surrounded_by_worms.lua │ ├── team.lua │ ├── terrain.lua │ └── treasure.lua ├── labyrinth.lua ├── labyrinth_map_intro.lua ├── labyrinth_unique_rooms.lua ├── lost.lua ├── lost_desert.lua ├── maze_challenge.lua ├── minesweeper │ ├── functions.lua │ └── main.lua ├── mixed_railworld.lua ├── mountain_fortress.lua ├── mountain_fortress_v2 │ ├── collapse.lua │ ├── flamethrower_nerf.lua │ ├── locomotive.lua │ ├── main.lua │ ├── terrain.lua │ └── treasure.lua ├── mountain_fortress_v3 │ ├── balance.lua │ ├── basic_markets.lua │ ├── biters_yield_coins.lua │ ├── breached_wall.lua │ ├── buried_enemies.lua │ ├── charging_station.lua │ ├── commands.lua │ ├── core.lua │ ├── entities.lua │ ├── functions.lua │ ├── generate.lua │ ├── get_perlin.lua │ ├── gui.lua │ ├── highscore.lua │ ├── ic │ │ ├── functions.lua │ │ ├── gui.lua │ │ ├── main.lua │ │ ├── minimap.lua │ │ └── table.lua │ ├── icw │ │ ├── commands.lua │ │ ├── functions.lua │ │ ├── linked_chests.lua │ │ ├── main.lua │ │ └── table.lua │ ├── locomotive.lua │ ├── locomotive │ │ ├── defense_system.lua │ │ ├── friendly_pet.lua │ │ ├── market.lua │ │ ├── permission_groups.lua │ │ └── spawn_locomotive.lua │ ├── loot.lua │ ├── main.lua │ ├── mining.lua │ ├── mystical_chest.lua │ ├── resource_generator.lua │ ├── rocks_yield_ore_veins.lua │ ├── season_highscore.lua │ ├── soft_reset.lua │ ├── stateful │ │ ├── blueprints.lua │ │ ├── gui.lua │ │ ├── main.lua │ │ └── table.lua │ ├── surface.lua │ ├── surface_id.lua │ ├── table.lua │ ├── terrain.lua │ └── traps.lua ├── mountain_race │ ├── gui.lua │ ├── main.lua │ ├── team.lua │ └── terrain.lua ├── native_war │ ├── gui.lua │ ├── init.lua │ ├── main.lua │ ├── map_info.lua │ ├── mineable_wreckage_yields_scrap.lua │ ├── settings.lua │ ├── share_chat.lua │ ├── team.lua │ ├── team_manager.lua │ ├── terrain.lua │ └── xp.lua ├── nightfall.lua ├── nightfall_map_intro.lua ├── overgrowth.lua ├── overgrowth_map_info.lua ├── pirates │ ├── ai.lua │ ├── api_events.lua │ ├── api_on_tick.lua │ ├── balance.lua │ ├── buried_treasure.lua │ ├── commands.lua │ ├── common.lua │ ├── coredata.lua │ ├── crew.lua │ ├── effects.lua │ ├── gui │ │ ├── classes.lua │ │ ├── color.lua │ │ ├── common.lua │ │ ├── crew.lua │ │ ├── evo.lua │ │ ├── gui.lua │ │ ├── info.lua │ │ ├── minimap.lua │ │ ├── progress.lua │ │ ├── runs.lua │ │ ├── treasure.lua │ │ └── welcome.lua │ ├── highscore.lua │ ├── loot.lua │ ├── main.lua │ ├── math.lua │ ├── memory.lua │ ├── noise_pregen │ │ ├── noise_pregen.lua │ │ ├── perlinwavelength100boxsize1000octaves5gain0p8lacunity2lengthpower1rms0p05423.lua │ │ └── simplexwavelength100boxsize1000octaves5gain0p65lacunity2lengthpower1p2rms0p06243.lua │ ├── ores.lua │ ├── overworld.lua │ ├── parrot.lua │ ├── permissions.lua │ ├── player_colors.lua │ ├── progression.lua │ ├── quest.lua │ ├── reference │ │ └── default_map_settings.lua │ ├── roles │ │ ├── classes.lua │ │ ├── roles.lua │ │ └── tick_functions.lua │ ├── shop │ │ ├── boat_upgrades.lua │ │ ├── covered.lua │ │ ├── dock.lua │ │ ├── merchants.lua │ │ └── shop.lua │ ├── structures │ │ ├── boats │ │ │ ├── boats.lua │ │ │ ├── merchant_1 │ │ │ │ ├── data.lua │ │ │ │ └── merchant_1.lua │ │ │ ├── raft │ │ │ │ ├── data.lua │ │ │ │ └── raft.lua │ │ │ ├── raft_large │ │ │ │ ├── data.lua │ │ │ │ └── raft_large.lua │ │ │ └── sloop │ │ │ │ ├── data.lua │ │ │ │ └── sloop.lua │ │ ├── island_structures │ │ │ ├── island_structures.lua │ │ │ ├── mattisso │ │ │ │ ├── data.lua │ │ │ │ └── mattisso.lua │ │ │ └── roc │ │ │ │ ├── data.lua │ │ │ │ └── roc.lua │ │ ├── quest_structures │ │ │ ├── furnace1 │ │ │ │ ├── data.lua │ │ │ │ └── furnace1.lua │ │ │ ├── market1 │ │ │ │ ├── data.lua │ │ │ │ └── market1.lua │ │ │ ├── old_data.lua │ │ │ └── quest_structures.lua │ │ └── structures.lua │ ├── surfaces │ │ ├── cabin.lua │ │ ├── channel │ │ │ ├── channel.lua │ │ │ └── data.lua │ │ ├── common.lua │ │ ├── crowsnest.lua │ │ ├── dock.lua │ │ ├── hold.lua │ │ ├── islands │ │ │ ├── cave │ │ │ │ ├── cave.lua │ │ │ │ ├── cave_source.lua │ │ │ │ └── data.lua │ │ │ ├── common.lua │ │ │ ├── first │ │ │ │ ├── data.lua │ │ │ │ └── first.lua │ │ │ ├── horseshoe │ │ │ │ ├── data.lua │ │ │ │ └── horseshoe.lua │ │ │ ├── hunt.lua │ │ │ ├── island_enum.lua │ │ │ ├── islands.lua │ │ │ ├── maze │ │ │ │ ├── data.lua │ │ │ │ └── maze.lua │ │ │ ├── radioactive │ │ │ │ ├── data.lua │ │ │ │ └── radioactive.lua │ │ │ ├── red_desert │ │ │ │ ├── data.lua │ │ │ │ └── red_desert.lua │ │ │ ├── standard │ │ │ │ ├── data.lua │ │ │ │ └── standard.lua │ │ │ ├── standard_variant │ │ │ │ ├── data.lua │ │ │ │ └── standard_variant.lua │ │ │ ├── swamp │ │ │ │ ├── data.lua │ │ │ │ └── swamp.lua │ │ │ └── walkways │ │ │ │ ├── data.lua │ │ │ │ └── walkways.lua │ │ ├── lobby.lua │ │ ├── sea │ │ │ ├── kraken.lua │ │ │ └── sea.lua │ │ └── surfaces.lua │ └── utils_local.lua ├── pitch_black │ ├── blood_moon.lua │ ├── difficulty.lua │ ├── gui.lua │ └── main.lua ├── planet_prison.lua ├── planet_prison │ ├── ai.lua │ ├── bp │ │ ├── merchant.lua │ │ └── player_ship.lua │ ├── config.lua │ └── mod │ │ ├── afk.lua │ │ ├── bp.lua │ │ ├── claims.lua │ │ ├── layers.lua │ │ └── simplex_noise.lua ├── quarters.lua ├── railway_troopers │ └── main.lua ├── railway_troopers_v2 │ └── main.lua ├── rainbow_road.lua ├── refactor-io.lua ├── rivers.lua ├── rocky_waste.lua ├── scrap_railworld.lua ├── scrap_towny_ffa │ ├── biters.lua │ ├── building.lua │ ├── colors.lua │ ├── combat_balance.lua │ ├── enemy.lua │ ├── evolution.lua │ ├── explosives_are_explosive.lua │ ├── fish_reproduction.lua │ ├── fluids_are_explosive.lua │ ├── info.lua │ ├── limbo.lua │ ├── limited_radar.lua │ ├── main.lua │ ├── map.lua │ ├── map_defaults.lua │ ├── market.lua │ ├── mining.lua │ ├── nauvis.lua │ ├── player.lua │ ├── pollution.lua │ ├── reset.lua │ ├── rocks_yield_ore_veins.lua │ ├── scrap.lua │ ├── slots.lua │ ├── spaceship.lua │ ├── spawn.lua │ ├── spawners_contain_biters.lua │ ├── suicide.lua │ ├── table.lua │ ├── team.lua │ ├── terrain.lua │ ├── town_center.lua │ ├── trap.lua │ ├── turrets_drop_ammo.lua │ ├── vehicles.lua │ ├── worms_create_oil_patches.lua │ └── wreckage_yields_scrap.lua ├── spaghettorio.lua ├── spiral_troopers.lua ├── spooky_forest.lua ├── spooky_forest_changelog.txt ├── stone_maze │ ├── 1x1_rooms.lua │ ├── 2x2_rooms.lua │ ├── 3x3_rooms.lua │ ├── global_functions.lua │ ├── main.lua │ └── noise.lua ├── stoneblock.lua ├── tank_battles.lua ├── tank_battles_old.lua ├── tank_conquest │ ├── blueprint_poi_base_json.lua │ ├── blueprint_poi_fire_json.lua │ ├── blueprint_poi_laser_json.lua │ ├── blueprint_poi_spot_one_json.lua │ ├── blueprint_poi_spot_three_json.lua │ ├── blueprint_poi_spot_two_json.lua │ └── tank_conquest.lua ├── territorial_control.lua ├── tetris │ ├── bricks.lua │ ├── main.lua │ └── unused.lua ├── wave_defense.lua └── wave_of_death │ ├── WoD.lua │ ├── ai.lua │ ├── biter_waves.lua │ ├── game_status.lua │ ├── init.lua │ ├── intro.lua │ ├── logo.lua │ ├── spectate.lua │ └── terrain.lua ├── modules ├── admins_operate_biters.lua ├── ai.lua ├── area_unlocked_on_rotated_entity.lua ├── autodecon_when_depleted.lua ├── autofill.lua ├── autohotbar.lua ├── autostash.lua ├── backpack_research.lua ├── balance.lua ├── ban_drop.lua ├── biter_evasion_hp_increaser.lua ├── biter_health_booster.lua ├── biter_health_booster_v2.lua ├── biter_noms_you.lua ├── biter_pets.lua ├── biter_player_count_difficulty.lua ├── biter_reanimator.lua ├── biters_attack_moving_players.lua ├── biters_avoid_damage.lua ├── biters_double_damage.lua ├── biters_landfill_on_death.lua ├── biters_yield_coins.lua ├── biters_yield_ore.lua ├── burden.lua ├── changelog.lua ├── charging_station.lua ├── check_fullness.lua ├── clear_vacant_players.lua ├── collapse.lua ├── comfylatron.lua ├── corpse_marker.lua ├── crawl_into_pipes.lua ├── custom_death_messages.lua ├── dangerous_goods.lua ├── dangerous_nights.lua ├── difficulty_vote.lua ├── difficulty_vote_by_amount.lua ├── dynamic_landfill.lua ├── dynamic_player_spawn.lua ├── entity_spawn_queue.lua ├── evolution_extended.lua ├── explosive_biters.lua ├── explosive_player_respawn.lua ├── explosives.lua ├── explosives_2.lua ├── explosives_are_explosive.lua ├── fish_respawner.lua ├── fjei │ ├── functions.lua │ ├── gui.lua │ └── main.lua ├── flamethrower_nerf.lua ├── flashlight_toggle_button.lua ├── floaty_chat.lua ├── fluids_are_explosive.lua ├── force_health_booster.lua ├── global_chat_toggle.lua ├── hidden_dimension │ ├── main.lua │ └── table.lua ├── hunger.lua ├── hunger_games.lua ├── hunger_games_balance.lua ├── immersive_cargo_wagons │ ├── constants.lua │ ├── functions.lua │ └── main.lua ├── infinity_chest.lua ├── inserter_drops_pickup.lua ├── landfill_reveals_nauvis.lua ├── landmine_effects.lua ├── launch_fish_to_win.lua ├── manual_mining_booster.lua ├── map_info.lua ├── market_friendly_fire_protection.lua ├── melee_mode.lua ├── mineable_wreckage_yields_ores.lua ├── mineable_wreckage_yields_scrap.lua ├── mobs_drop_loot.lua ├── no_acid_puddles.lua ├── no_blueprint_library.lua ├── no_deconstruction_of_neutral_entities.lua ├── no_handcrafting.lua ├── no_robots.lua ├── no_solar.lua ├── no_turrets.lua ├── offline_characters.lua ├── ores_are_mixed.lua ├── pistol_buffs.lua ├── players_trample_paths.lua ├── portable_chest.lua ├── railgun_enhancer.lua ├── render_beam.lua ├── restrictive_fluid_mining.lua ├── rewards.lua ├── robot_limits.lua ├── rocks_broken_paint_tiles.lua ├── rocks_heal_over_time.lua ├── rocks_yield_coins.lua ├── rocks_yield_ore.lua ├── rocks_yield_ore_veins.lua ├── rpg.lua ├── rpg │ ├── commands.lua │ ├── core.lua │ ├── explosive_gun_bullets.lua │ ├── functions.lua │ ├── gui.lua │ ├── main.lua │ ├── range_buffs.lua │ ├── settings.lua │ ├── spells.lua │ └── table.lua ├── satellite_score.lua ├── scramble_ores.lua ├── shopping_chests.lua ├── shotgun_buff.lua ├── show_health.lua ├── show_inventory.lua ├── simple_tags.lua ├── spaghett_challenge.lua ├── spawners_contain_acid.lua ├── spawners_contain_biters.lua ├── spitters_spit_biters.lua ├── splice.lua ├── splice_double.lua ├── sticky_landfill.lua ├── surrounded_by_worms.lua ├── team_teleport.lua ├── teleporters.lua ├── teleporting_worms.lua ├── the_floor_is_lava.lua ├── thirst.lua ├── towny │ ├── biters.lua │ ├── building.lua │ ├── combat_balance.lua │ ├── info.lua │ ├── main.lua │ ├── market.lua │ ├── table.lua │ ├── team.lua │ └── town_center.lua ├── trees_grow.lua ├── trees_randomly_die.lua ├── turret_filler.lua ├── wave_defense │ ├── biter_rolls.lua │ ├── buried_enemies.lua │ ├── commands.lua │ ├── core.lua │ ├── enemy_states.lua │ ├── gui.lua │ ├── main.lua │ ├── pause_waves.lua │ ├── side_targets.lua │ ├── table.lua │ └── threat_events.lua └── worms_create_oil_patches.lua ├── readme.md └── utils ├── alert.lua ├── antigrief.lua ├── chatbot.lua ├── color_presets.lua ├── command_handler.lua ├── commands.lua ├── commands ├── misc.lua ├── trust_system.lua └── where.lua ├── common.lua ├── common_commands.lua ├── core.lua ├── data_stages.lua ├── datastore ├── banhandler.lua ├── color_data.lua ├── init.lua ├── jail_data.lua ├── message_on_join_data.lua ├── player_tag_data.lua ├── quickbar_data.lua ├── rpg_data.lua ├── server_ups_data.lua ├── session_data.lua ├── statistics.lua ├── supporters.lua └── warning_on_join_data.lua ├── debug.lua ├── debug ├── _g_view.lua ├── command.lua ├── event_view.lua ├── global_view.lua ├── gui_data_view.lua ├── main_view.lua ├── model.lua ├── package_view.lua └── public_global_view.lua ├── discord.lua ├── discord_handler.lua ├── dump_env.lua ├── event.lua ├── event_core.lua ├── files ├── arrow-down.png ├── arrow-up.png ├── beam.png ├── beam_1.png ├── beam_2.png ├── berserk.png ├── infinity.png ├── info.png ├── pin-black.png ├── pin-white.png ├── settings-black.png ├── settings-white.png ├── spew.png ├── tidal.png ├── victory-space-age.png ├── victory.png ├── warp.png └── x.png ├── freeplay.lua ├── freeplay ├── silo_script.lua └── space_age_finish.lua ├── functions ├── AI.lua ├── basic_markets.lua ├── biter_raffle.lua ├── boss_unit.lua ├── connect_belts.lua ├── create_entity_chain.lua ├── create_tile_chain.lua ├── flying_texts.lua ├── loot_raffle.lua ├── maze.lua ├── noise_vector_path.lua ├── omegakaboom.lua ├── room_generator.lua ├── soft_reset.lua ├── tick_tack_trap.lua ├── unearthing_biters.lua └── unearthing_worm.lua ├── game.lua ├── global.lua ├── gui.lua ├── gui ├── admin.lua ├── bottom_frame.lua ├── config.lua ├── group.lua ├── init.lua ├── map_score.lua ├── player_list.lua ├── poll.lua ├── score.lua ├── server_select.lua └── statistics.lua ├── inspect.lua ├── list_utils.lua ├── math ├── geometry.lua ├── get_noise.lua ├── get_perlin.lua ├── math.lua ├── perlin_noise.lua ├── raffle.lua ├── simplex_noise.lua └── stats.lua ├── one_dimensional_noise.lua ├── pause_game.lua ├── player_list_vars.lua ├── player_modifiers.lua ├── print_override.lua ├── priority_queue.lua ├── profiler.lua ├── queue.lua ├── remote_chunks.lua ├── scheduler.lua ├── sem.lua ├── server.lua ├── server_commands.lua ├── spam_protection.lua ├── start.lua ├── table.lua ├── task.lua ├── task_token.lua ├── templates ├── Biter_Battles_v2 │ └── map_loader.lua ├── Biter_Hatchery │ └── map_loader.lua ├── Choppy_dx │ └── map_loader.lua ├── Chronosphere │ └── map_loader.lua ├── Crab_Defender │ └── map_loader.lua ├── Desert_Oasis │ └── map_loader.lua ├── Develop │ └── map_loader.lua ├── Expanse │ └── map_loader.lua ├── Fish_Defender │ └── map_loader.lua ├── Journey │ └── map_loader.lua ├── Labyrinth │ └── map_loader.lua ├── Minesweeper │ └── map_loader.lua ├── Mountain_Fortress_v3 │ └── map_loader.lua ├── Pirate_Ship │ └── map_loader.lua ├── Planet_Prison │ └── map_loader.lua ├── Towny │ └── map_loader.lua ├── Vanilla │ └── map_loader.lua └── VanillaMixedOresMarathonSA │ └── map_loader.lua ├── terrain_layouts ├── biters_and_resources_east.lua ├── caves.lua ├── cone_to_east.lua ├── scrap_01.lua ├── scrap_02.lua ├── tree_01.lua ├── watery_world.lua └── winter.lua ├── timers.lua ├── timestamp.lua ├── token.lua ├── tools ├── cheat_mode.lua ├── fancy_time.lua ├── map_functions.lua ├── map_intro.lua ├── map_pregen.lua ├── rainbow_colors.lua ├── scrap.lua └── shapes.lua ├── utils.lua └── whisper_notice.lua /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | # Please follow the general troubleshooting steps first: 2 | 3 | - [ ] Have you checked to ensure there aren't other open [Issues](../../../issues) for the same issue? 4 | 5 | ### Bug reports: 6 | 7 | Please replace this line with a brief summary of your issue. 8 | -------------------------------------------------------------------------------- /.github/pull_request_map_template.md: -------------------------------------------------------------------------------- 1 | ### All Submissions: 2 | 3 | - [ ] Have you checked to ensure there aren't any other maps that are alike or similar to the PR? 4 | - [ ] Have you checked to ensure there aren't other open [Pull Requests](../../../pulls) for the same update/change? 5 | 6 | ### Tested Changes: 7 | 8 | 1. [ ] Have you lint your code (lua lint) locally prior to submission? 9 | 10 | ### Changes to Core Features: 11 | 12 | - [ ] Have you added an explanation of what your changes do and why you'd like us to include them? 13 | - [ ] Have you successfully ran tests with your changes locally? 14 | 15 | ### Comments 16 | -------------------------------------------------------------------------------- /.github/pull_request_module_template.md: -------------------------------------------------------------------------------- 1 | ### All Submissions: 2 | 3 | - [ ] Have you checked to ensure there aren't any other modules that are alike or similar to the PR? 4 | - [ ] Have you checked to ensure there aren't other open [Pull Requests](../../../pulls) for the same update/change? 5 | 6 | ### Tested Changes: 7 | 8 | 1. [ ] Have you lint your code (lua lint) locally prior to submission? 9 | 10 | ### Changes to Core Features: 11 | 12 | - [ ] Have you added an explanation of what your changes do and why you'd like us to include them? 13 | - [ ] Have you successfully ran tests with your changes locally? 14 | 15 | ### Comments 16 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ### All Submissions: 2 | 3 | - [ ] Have you checked to ensure there aren't other open [Pull Requests](../../../pulls) for the same update/change? 4 | 5 | ### Tested Changes: 6 | 7 | 1. [ ] Have you lint your code (lua lint) locally prior to submission? 8 | 9 | ### Changes to Core Features: 10 | 11 | - [ ] Have you added an explanation of what your changes do and why you'd like us to include them? 12 | - [ ] Have you successfully ran tests with your changes locally? 13 | 14 | ### Comments 15 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 60 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - security 9 | # Label to use when marking an issue as stale 10 | staleLabel: wontfix 11 | # Comment to post when marking an issue as stale. Set to `false` to disable 12 | markComment: > 13 | This issue has been automatically marked as stale because it has not had 14 | recent activity. It will be closed if no further activity occurs. Thank you 15 | for your contributions. 16 | # Comment to post when closing a stale issue. Set to `false` to disable 17 | closeComment: false 18 | -------------------------------------------------------------------------------- /.github/workflows/AutoRelease.yml: -------------------------------------------------------------------------------- 1 | name: 'Auto-release' 2 | 3 | # Controls when the action will run. Triggers the workflow on push or pull request 4 | # events but only for the develop branch 5 | on: 6 | push: 7 | branches: [develop] 8 | 9 | jobs: 10 | auto-release: 11 | name: 'Auto Release' 12 | runs-on: 'ubuntu-latest' 13 | steps: 14 | - name: Checkout code 15 | uses: actions/checkout@v2 16 | - name: Changelog 17 | uses: scottbrenner/generate-changelog-action@master 18 | id: Changelog 19 | env: 20 | REPO: ${{ github.repository }} 21 | - id: next_version 22 | uses: zwaldowski/semver-release-action@v2 23 | with: 24 | prefix: v 25 | dry_run: true 26 | bump: patch 27 | github_token: ${{ secrets.GITHUB_TOKEN }} 28 | - name: Create Release 29 | id: create_release 30 | uses: actions/create-release@latest 31 | env: 32 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 33 | with: 34 | tag_name: ${{ steps.next_version.outputs.version}} 35 | release_name: Main Scenario 36 | body: | 37 | This is the main release of the stable version of Factorio. 38 | Check out the [wiki](https://github.com/ComfyFactory/ComfyFactorio/wiki) for getting started. 39 | ${{ steps.Changelog.outputs.changelog }} 40 | draft: false 41 | prerelease: false 42 | -------------------------------------------------------------------------------- /.github/workflows/CI.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | # Controls when the action will run. Triggers the workflow on push or pull request 4 | # events but only for the develop branch 5 | on: 6 | push: 7 | branches: [develop] 8 | pull_request: 9 | branches: [develop] 10 | 11 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 12 | jobs: 13 | # This workflow contains a single job called "build" 14 | build: 15 | # The type of runner that the job will run on 16 | runs-on: ubuntu-latest 17 | 18 | # Steps represent a sequence of tasks that will be executed as part of the job 19 | steps: 20 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 21 | - uses: actions/checkout@v2 22 | 23 | # Use "Factorio Mod luacheck" from the marketplace 24 | - name: Factorio Mod luacheck 25 | uses: Roang-zero1/factorio-mod-luacheck@v1.1.0 26 | with: 27 | # URL to the luacheckrc configuration file to be used during checking. 28 | # Per https://github.com/Roang-zero1/factorio-mod-luacheck/issues/2 - an empty string will use the project's .luacheckrc 29 | luacheckrc_url: 'https://raw.githubusercontent.com/ComfyFactory/ComfyFactorio/develop/.luacheckrc' # optional, default is https://raw.githubusercontent.com/Nexela/Factorio-luacheckrc/0.17/.luacheckrc 30 | -------------------------------------------------------------------------------- /.github/workflows/CheckMaps.yml: -------------------------------------------------------------------------------- 1 | name: CheckMaps 2 | 3 | # Controls when the action will run. Triggers the workflow on push or pull request 4 | # events but only for the develop branch 5 | on: 6 | push: 7 | branches: [develop] 8 | pull_request: 9 | branches: [develop] 10 | 11 | jobs: 12 | check: 13 | name: Check if requestor has made a boo boo 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Factorio Control comment 20 | uses: Gerkiz/FactorioControlChecker@v1.0.6 21 | id: factorio_control_runner 22 | 23 | - name: Check control.lua 24 | if: steps.factorio_control_runner.outputs.should_run == 1 25 | run: | 26 | echo "Maps are required in control.lua - please fix these." 27 | exit 1 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/ 2 | .history/ 3 | .git/ 4 | maps/biter_battles_v3/ 5 | todo/ 6 | stylua.toml 7 | 8 | #==Mac ignores== 9 | # General 10 | .DS_Store 11 | 12 | todo/ 13 | 14 | # Ignore tests 15 | tmp.lua 16 | *.txt 17 | 18 | # Ignore IDEA 19 | .idea -------------------------------------------------------------------------------- /description.json: -------------------------------------------------------------------------------- 1 | { 2 | "order": "a", 3 | "multiplayer-compatible": true, 4 | "is-main-game": true 5 | } 6 | -------------------------------------------------------------------------------- /image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComfyFactory/ComfyFactorio/e4f4626f9c1fa8a661f5992367bd9d6ea59c6b03/image.png -------------------------------------------------------------------------------- /info.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /locale/de/commands.cfg: -------------------------------------------------------------------------------- 1 | [commands] 2 | clear_corpse=Klicken Sie hier, um Leichen zu löschen! 3 | -------------------------------------------------------------------------------- /locale/en/commands.cfg: -------------------------------------------------------------------------------- 1 | [commands] 2 | clear_corpse=Click to clear corpses! 3 | -------------------------------------------------------------------------------- /locale/en/freeplay.cfg: -------------------------------------------------------------------------------- 1 | victory-message=[font=default-bold]Congratulations!\nYou have beaten the game by launching a rocket into space![/font]\n\nYou can continue playing this level as long as you like.\n\nAlthough you have won, there is still a lot to accomplish: 2 | victory-bullet-point-1=Grow your factory 3 | victory-bullet-point-2=Research infinite technologies 4 | victory-bullet-point-3=Optimize your production 5 | victory-bullet-point-4=Unlock more achievements 6 | victory-final-message=Thanks for playing.\nThe Factorio team & ComfyFactorio 7 | 8 | victory-message-space-age=[font=default-bold]Congratulations!\nYou have beaten the game by dispatching an interstellar space platform![/font]\n\nYou can continue playing this level as long as you like.\n\nAlthough you have won, there is still a lot to accomplish: 9 | -------------------------------------------------------------------------------- /locale/en/gui.cfg: -------------------------------------------------------------------------------- 1 | [gui] 2 | groups=Groups 3 | title=Title 4 | description=Description 5 | members=Members 6 | create=Create 7 | join=Join 8 | leave=Leave 9 | delete=Delete 10 | gui_data_cleaning=Gui Data Cleaning 11 | spaghett_mode=Spaghett Mode 12 | notify_on_polls=Notify on polls 13 | spectator_mode=SpectatorMode 14 | 15 | [gui-description] 16 | gui_data_cleaning=Toggles the Gui data cleaning. 17 | spaghett_mode=Disables the Logistic System research.\nRequester, buffer or active-provider containers can not be built. 18 | notify_on_polls=Receive a message when new polls are created and popup the poll. 19 | spectator_mode=Toggles zoom-to-world view noise effect.\nEnvironmental sounds will be based on map view. 20 | -------------------------------------------------------------------------------- /locale/en/ic.cfg: -------------------------------------------------------------------------------- 1 | [ic] 2 | transfer_car=Transfer Car 3 | car_settings=Car Settings 4 | allow_anyone=Allow everyone to enter: On 5 | auto_upgrade=Auto Upgrade Vehicle: On 6 | notify_on_driver_change=Notify on driver change: On 7 | add_player=Add Player 8 | off=Off 9 | on=On 10 | select_player=Select Player 11 | discard=Discard 12 | save=Save 13 | name=Name 14 | warning=Warning, this action can't be undone! 15 | warning_2=THIS ACTION IS IRREVERSIBLE!! 16 | kick=Kick 17 | allowed=Allowed 18 | allowed_tooltip=Press to toggle between allowed and not allowed to enter this surface. 19 | not_self=Cannot select yourself. 20 | drive=Can drive 21 | drive_tooltip=Press to toggle between allowed and not allowed to drive. 22 | operations=Operations 23 | control=Control who may enter your vehicle. 24 | destroy_surface=Destroy Surface 25 | -------------------------------------------------------------------------------- /locale/en/pidgeotto.cfg: -------------------------------------------------------------------------------- 1 | [pidgeotto] 2 | map_info_main_caption=--Pidgeotto-- 3 | map_info_sub_caption= ~~kr´r´r´r´rah~~ 4 | map_info_text=The biters have caught the scent of fish in the market.\nFend them off as long as possible!\nThis however will not be an easy task,\nsince their strength and resistance increases constantly over time.\n\nYour ultimate goal is to evacuate all the fish!\nPut them in your rocket's cargo and launch them into space.\nDon't worry, you will still get space science.\n\nThe Market will gladly take any coin you might find.\nAdditional turret slots can be bought at the market.\nSeveral unique upgrades are available too.\nResearching tanks will unlock the artillery technology early.\nAny container bearing dangerous goods, like ammo, grenades or barrels,\ncauses heavy explosions when it breaks.\nMaybe this can be used to our advantage. 5 | boss_message=Boss Wave __1__ - - __2__ 6 | 50=The Big Biter Gang 7 | 100=Biterzilla 8 | 150=The Spitter Squad 9 | 200=The Wall Nibblers 10 | 250=Conveyor Munchers 11 | 300=Furnace Freezers 12 | 350=Cable Chewers 13 | 400=Power Pole Thieves 14 | 450=Assembler Annihilators 15 | 500=Inserter Crunchers 16 | 550=Engineer Eaters 17 | 600=Belt Unbalancers 18 | 650=Turret Devourers 19 | 700=Pipe Perforators 20 | 750=Desync Bros 21 | 800=Ratio Randomizers 22 | 850=Wire Chompers 23 | 900=The Bus Mixers 24 | 950=Roundabout Deadlockers 25 | 1000=Happy Tree Friends 26 | 1050=Uranium Digesters 27 | 1100=Bot Banishers 28 | 1150=Chest Crushers 29 | 1200=Cargo Wagon Scratchers 30 | 1250=Transport Belt Surfers 31 | 1300=Pumpjack Pulverizers 32 | 1350=Radar Ravagers 33 | 1400=Mall Deconstrutors 34 | 1450=Lamp Dimmers 35 | 1500=Roboport Disablers 36 | 1550=Signal Spammers 37 | 1600=Brick Tramplers 38 | 1650=Drill Destroyers 39 | 1700=Gearwheel Grinders 40 | 1750=Silo Seekers 41 | 1800=Circuit Breakers 42 | 1850=Bullet Absorbers 43 | 1900=Oil Guzzlers 44 | 1950=Belt Rotators 45 | 2000=Bluescreen Factor 46 | -------------------------------------------------------------------------------- /locale/en/wave_defense.cfg: -------------------------------------------------------------------------------- 1 | [wave_defense] 2 | pause_waves=[color=blue][Wave Defense][/color] New waves will not spawn for __1__ minutes! 3 | start_waves=[color=blue][Wave Defense][/color] Waves will spawn normally again. 4 | -------------------------------------------------------------------------------- /locale/ru/commands.cfg: -------------------------------------------------------------------------------- 1 | [commands] 2 | clear_corpse=Нажмите, чтобы убрать трупы! 3 | -------------------------------------------------------------------------------- /locale/ru/gui.cfg: -------------------------------------------------------------------------------- 1 | [gui] 2 | groups=Группы 3 | title=Название 4 | description=Описание 5 | members=Участники 6 | create=Создать 7 | join=Вступить 8 | leave=Покинуть 9 | delete=Удалить 10 | gui_data_cleaning=Очистка данных интерфейса 11 | spaghett_mode=Режим спагетти 12 | notify_on_polls=Уведомлять об опросах 13 | spectator_mode=Режим наблюдателя 14 | 15 | [gui-description] 16 | gui_data_cleaning=Переключает очистку данных интерфейса. 17 | spaghett_mode=Отключает исследование логистической системы.\nСундук запроса, буферный сундук и сундук активного снабжения нельзя построить. 18 | notify_on_polls=Получать сообщение, когда кто-то создаёт опрос, и выводить опрос на экран. 19 | spectator_mode=Переключает режим обзора карты с размытием по краям.\nЗвуки окружения будут зависеть от просмотра карты. 20 | -------------------------------------------------------------------------------- /locale/ru/ic.cfg: -------------------------------------------------------------------------------- 1 | [ic] 2 | transfer_car=Перенос автомобиля 3 | car_settings=Настройки автомобиля 4 | allow_anyone=Разрешить вход всем: Вкл 5 | auto_upgrade=Авто-улучшение транспорта: Вкл 6 | notify_on_driver_change=Уведомлять о смене водителя: Вкл 7 | add_player=Добавить игрока 8 | off=Выкл 9 | on=Вкл 10 | select_player=Выбрать игрока 11 | discard=Отмена 12 | save=Сохранить 13 | name=Имя 14 | warning=Внимание, это действие нельзя отменить! 15 | warning_2=ЭТО ДЕЙСТВИЕ НЕОБРАТИМО!! 16 | kick=Кикнуть 17 | allowed=Разрешено 18 | allowed_tooltip=Нажмите, чтобы переключить возможность доступа к этой поверхности. 19 | not_self=Нельзя выбрать себя. 20 | drive=Может управлять 21 | drive_tooltip=Нажмите для переключения возможности управлять транспортом. 22 | operations=Операции 23 | control=Управляйте, кто может войти в ваш транспорт. 24 | destroy_surface=Уничтожить поверхность 25 | -------------------------------------------------------------------------------- /locale/ru/wave_defense.cfg: -------------------------------------------------------------------------------- 1 | [wave_defense] 2 | pause_waves=[color=blue][Оборона волн][/color] Новые волны не будут появляться __1__ минут! 3 | start_waves=[color=blue][Оборона волн][/color] Волны снова появляются. 4 | -------------------------------------------------------------------------------- /locale/zh-CN/commands.cfg: -------------------------------------------------------------------------------- 1 | [commands] 2 | clear_corpse=点击删除尸体! 3 | -------------------------------------------------------------------------------- /locale/zh-CN/crab_defender.cfg: -------------------------------------------------------------------------------- 1 | [crab_defender] 2 | map_info_main_caption=-- 螃蟹保卫者 -- 3 | map_info_sub_caption= ~~ 为保卫螃蟹星球而战 ~~ 4 | map_info_text=咬人者正试图占领螃蟹世界。\n尽可能长时间地抵御它们!\n但这不是一件容易的事,\n因为它们的力量和抵抗力会随着时间的推移而不断增强。\n\n你的最终目标是将螃蟹湖中的所有鱼类疏散到螃蟹星球!\n将它们放入火箭的货物中,然后将它们发射到太空。\n别担心,你仍然会获得太空科学。\n\n市场将很乐意接受任何 你可能会找到硬币。\n额外的炮塔插槽可以在市场上购买。\n还可以进行一些独特的升级。\n研究坦克将尽早解锁火炮技术。\n任何装有危险物品的容器,例如弹药、手榴弹或桶,\n破裂时会引起剧烈爆炸。\n也许这对我们有利。\n\n咬人只会从蟹爪的两侧攻击,防御速度要快!\n\n咬人很聪明,\n他们安装了某种反居民系统,所以在白色瓷砖上行走会伤害你。 5 | boss_message=Boss 波次 __1__ - - __2__ 6 | 50=The Big Anti-crab Gang 7 | 100=Crabzilla 8 | 150=The Spitter Squad 9 | 200=The Wall Nibblers 10 | 250=Conveyor Munchers 11 | 300=Furnace Freezers 12 | 350=Crabby Cabel Chewers 13 | 400=Power Pole Thieves 14 | 450=Assembler Annihilators 15 | 500=Inserter Crunchers 16 | 550=Crab Engineer Eaters 17 | 600=Belt Unbalancers 18 | 650=Turret Devourers 19 | 700=Pipe Perforators 20 | 750=Desync Bros 21 | 800=Ratio Randomizers 22 | 850=Wire Chompers 23 | 900=The Bus Mixers 24 | 950=Roundabout Deadlockers 25 | 1000=Happy Tree Friends 26 | 1050=Uranium Digesters 27 | 1100=Bot Banishers 28 | 1150=Chest Crushers 29 | 1200=Cargo Wagon Scratchers 30 | 1250=Transport Belt Surfers 31 | 1300=Pumpjack Pulverizers 32 | 1350=Radar Ravagers 33 | 1400=Mall Deconstrutors 34 | 1450=Lamp Dimmers 35 | 1500=Roboport Disablers 36 | 1550=Signal Spammers 37 | 1600=Brick Tramplers 38 | 1650=Drill Destroyers 39 | 1700=Gearwheel Grinders 40 | 1750=Crab Inhabitant Seekers 41 | 1800=Circuit Breakers 42 | 1850=Bullet Absorbers 43 | 1900=Oil Guzzlers 44 | 1950=Belt Rotators 45 | 2000=Bluescreen Factor 46 | -------------------------------------------------------------------------------- /locale/zh-CN/fish_defender_v2.cfg: -------------------------------------------------------------------------------- 1 | [fish_defender_v2] 2 | map_info_main_caption=--咸鱼保卫者 v2-- 3 | map_info_sub_caption= ~~blb blubby blub~~ 4 | map_info_text=虫子已经闻到了市场上的鱼的气味。\n尽可能长时间地抵御它们!\n但这并不是一件容易的事,\n因为它们的力量和抵抗力会随着时间的推移而不断增强。\n\n你的最终目标是 将所有的鱼发射到猫星球!\n将它们放入火箭的货物中,然后将它们发射到太空。\n别担心,你仍然会获得太空科学。\n\n市场很乐意接受你可能找到的任何硬币。\n其他 炮塔插槽可以在市场上购买。\n还可以进行几种独特的升级。\n研究坦克将尽早解锁火炮技术。\n任何装有危险物品的容器,如弹药、手榴弹或桶,\n在破裂时会引起严重爆炸。\n也许这可以为我们带来优势。\n\n咬人只会在中间攻击,直到波数大于 80。 5 | boss_message=Boss 波次 __1__ - - __2__ 6 | 50=The Big Biter Gang 7 | 100=Biterzilla 8 | 150=The Spitter Squad 9 | 200=The Wall Nibblers 10 | 250=Conveyor Munchers 11 | 300=Furnace Freezers 12 | 350=Cable Chewers 13 | 400=Power Pole Thieves 14 | 450=Assembler Annihilators 15 | 500=Inserter Crunchers 16 | 550=Engineer Eaters 17 | 600=Belt Unbalancers 18 | 650=Turret Devourers 19 | 700=Pipe Perforators 20 | 750=Desync Bros 21 | 800=Ratio Randomizers 22 | 850=Wire Chompers 23 | 900=The Bus Mixers 24 | 950=Roundabout Deadlockers 25 | 1000=Happy Tree Friends 26 | 1050=Uranium Digesters 27 | 1100=Bot Banishers 28 | 1150=Chest Crushers 29 | 1200=Cargo Wagon Scratchers 30 | 1250=Transport Belt Surfers 31 | 1300=Pumpjack Pulverizers 32 | 1350=Radar Ravagers 33 | 1400=Mall Deconstrutors 34 | 1450=Lamp Dimmers 35 | 1500=Roboport Disablers 36 | 1550=Signal Spammers 37 | 1600=Brick Tramplers 38 | 1650=Drill Destroyers 39 | 1700=Gearwheel Grinders 40 | 1750=Silo Seekers 41 | 1800=Circuit Breakers 42 | 1850=Bullet Absorbers 43 | 1900=Oil Guzzlers 44 | 1950=Belt Rotators 45 | 2000=Bluescreen Factor 46 | -------------------------------------------------------------------------------- /locale/zh-CN/gui.cfg: -------------------------------------------------------------------------------- 1 | [gui] 2 | groups=队伍 3 | title=队名 4 | description=描述/宣言 5 | members=成员 6 | create=创建 7 | join=加入 8 | leave=离开 9 | delete=删除 10 | gui_data_cleaning=GUI 数据清理 11 | spaghett_mode=拧麻花模式 12 | notify_on_polls=投票时通知 13 | spectator_mode=旁观者模式 14 | 15 | [gui-description] 16 | gui_data_cleaning=切换 GUI 数据清理。 17 | spaghett_mode=禁用物流系统研究。\n无法建造物流机器人和物流箱子。 18 | notify_on_polls=创建新投票时会收到一条消息并弹出投票。 19 | spectator_mode=切换缩放到世界视图的噪音效果。\n环境声音将基于地图视图。 20 | -------------------------------------------------------------------------------- /locale/zh-CN/ic.cfg: -------------------------------------------------------------------------------- 1 | [ic] 2 | transfer_car=转移载具 3 | car_settings=载具设置 4 | allow_anyone=允许有所人进入: On 5 | auto_upgrade=自动升级载具: On 6 | notify_on_driver_change=当载具发生变化时通知: On 7 | add_player=添加玩家 8 | off=Off 9 | on=On 10 | select_player=选择玩家 11 | discard=关闭 12 | save=保存 13 | name=Name 14 | warning=警告,此操作无法撤消! 15 | warning_2=此操作不可逆转!! 16 | kick=Kick 17 | allowed=Allowed 18 | allowed_tooltip=Press to toggle between allowed and not allowed to enter this surface. 19 | not_self=不能选择自己 20 | drive=Can drive 21 | drive_tooltip=Press to toggle between allowed and not allowed to drive. 22 | operations=Operations 23 | control=设置谁可以进入你的载具 24 | destroy_surface=销毁载具空间 25 | -------------------------------------------------------------------------------- /locale/zh-CN/journey.cfg: -------------------------------------------------------------------------------- 1 | [journey] 2 | map_info_main_caption=星际旅程 3 | map_info_sub_caption=v 1.9 4 | map_info_text=母舰中的选择器允许您选择目的地。\n可以通过在顶部选择器上花费一颗卫星来重开。\n一旦选择器上有足够多的玩家,母舰将开始旅行。\n\n到达目标后,将部署远程传送器。\n然而,它只能转移你的身体。\n\n每跃迁一次,世界都会变得更加困难,会叠加所选的修改。\n通过运载火箭发射铀燃料电池,向下一个世界迈进。\n顶部按钮的工具提示提供有关当前世界的信息。\n如果旅程结束,管理员可以通过命令“/reset-journey”完全重置地图。\n\n旅程会走多远?\n汉化: [color=blue]plexpt[/color] 有问题可联系 5 | 6 | tooltip_satellite=存储的卫星: __1__ / __2__\n母舰使用卫星来寻找新的目的地。 7 | tooltip_nuclear_fuel=应急运行反应堆:__1__ / __2__\n如果决定丢弃当前殖民地并且母舰匆忙离开,则通常会损坏 30 个紧急反应堆。\n如果传送器丢失且没有应急电源,则游戏结束并重置运行。 8 | tooltip_fuel=进入下一个世界所需的燃料:__1__\n母舰中存储的核燃料棒:__2__ 9 | tooltip_delivery=轨道站交付:__1__ / __2__\n站台每次随机选择一个物品来进行交付。\n时间:120min, 240min, 480min, 960min, 1920min, 3840min\n当前时间:__3__ 分钟。 10 | beacon_hp=HP: __1__/10000 11 | teleporter=星际传送器 12 | 13 | chunks_delete=Deleting chunks.. __1__ 14 | mothership_format=[font=heading-1][color=255,155,155]<母舰> [/color][/font][font=default-game][color=200,200,200]__1__[/color][/font] 15 | world=World __1__ | __2__ 16 | world_tooltip=__1__\n\n__2__\n救生舱:\n__3__ 17 | tooltip_modifier=__1__ - __2__%\n 18 | tooltip_capsule= __1__x [item=__2__] 19 | tooltip_capsule2= __1__x [item=__2__]\n 20 | 21 | message_rocket_launched=用火箭发射了 __1__x [item=__2__] at [gps=__3__,__4__,nauvis]。 22 | message_min_players=为新世界投票的最低玩家数量设定为 __1__。 23 | message_delivery_done=[img=item/__1__] 轨道站交付完成于 __2__ minutes, 授予 __3__ loot rolls! 24 | message_delivered=从轨道站传送:__2__x [img=item/__1__] 添加至救生舱中 25 | cmd_server_restarting=服务器正在重新启动以将更新应用到场景...请稍后重新连接。 26 | -------------------------------------------------------------------------------- /locale/zh-CN/pidgeotto.cfg: -------------------------------------------------------------------------------- 1 | [pidgeotto] 2 | map_info_main_caption=--Pidgeotto-- 3 | map_info_sub_caption= ~~kr´r´r´r´rah~~ 4 | map_info_text=咬人者已经闻到了市场上的鱼的气味。\n尽可能长时间地抵御它们!\n但这并不是一件容易的事,\n因为它们的力量和抵抗力会随着时间的推移而不断增强。\n\n你的最终目标 就是疏散所有的鱼!\n将它们放入火箭的货物中,然后将它们发射到太空。\n别担心,你仍然会获得太空科学。\n\n市场很乐意接受你可能找到的任何硬币。\n额外的炮塔 插槽可以在市场上购买。\n还可以进行几种独特的升级。\n研究坦克将尽早解锁火炮技术。\n任何装有危险物品的容器,例如弹药、手榴弹或桶,\n在破裂时会引起严重爆炸。\n也许 这可以为我们带来优势。 5 | boss_message=Boss 波次 __1__ - - __2__ 6 | -------------------------------------------------------------------------------- /map_loader.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComfyFactory/ComfyFactorio/e4f4626f9c1fa8a661f5992367bd9d6ea59c6b03/map_loader.lua -------------------------------------------------------------------------------- /maps/biter_battles_v2/config.lua: -------------------------------------------------------------------------------- 1 | --BITER BATTLES CONFIG-- 2 | 3 | local bb_config = { 4 | --Optional custom team names, can also be modified via "Team Manager" 5 | ['north_side_team_name'] = 'Team North', 6 | ['south_side_team_name'] = 'Team South', 7 | --TERRAIN OPTIONS-- 8 | ['match_mirror'] = false, --If both sides should match in terrain generation 9 | ['border_river_width'] = 36, --Approximate width of the horizontal impassable river seperating the teams. (values up to 100) 10 | ['builders_area'] = true, --Grant each side a peaceful direction with no nests and biters? 11 | ['random_scrap'] = true, --Generate harvestable scrap around worms randomly? 12 | --BITER SETTINGS-- 13 | ['max_active_biters'] = 1280, --Maximum total amount of attacking units per side. 14 | ['max_group_size'] = 288, --Maximum unit group size. 15 | ['biter_timeout'] = 162000, --Time it takes in ticks for an attacking unit to be deleted. This prevents perma stuck units. 16 | ['bitera_area_distance'] = 512, --Distance to the biter area. 17 | --CHEATY STARTS 18 | ['spawn_turrets_at_silo'] = false, --This spawns two turrets near the silo of each team. 19 | ['additional_starting_resources'] = false --This gives each starting player 10 burner-mining-drill to skip the start. 20 | } 21 | 22 | return bb_config 23 | -------------------------------------------------------------------------------- /maps/biter_hatchery/raffle_tables.lua: -------------------------------------------------------------------------------- 1 | --luacheck: ignore 2 | local raffle = { 3 | ['automation-science-pack'] = {{}, 1}, 4 | ['logistic-science-pack'] = {{}, 2}, 5 | ['military-science-pack'] = {{}, 3}, 6 | ['chemical-science-pack'] = {{}, 4}, 7 | ['production-science-pack'] = {{}, 5}, 8 | ['utility-science-pack'] = {{}, 5}, 9 | ['space-science-pack'] = {{}, 9} 10 | } 11 | 12 | local function add_unit(t, size, chance) 13 | for _ = 1, chance, 1 do 14 | table.insert(t, size .. '-spitter') 15 | end 16 | for _ = 1, chance * 6, 1 do 17 | table.insert(t, size .. '-biter') 18 | end 19 | end 20 | 21 | local t = raffle['automation-science-pack'][1] 22 | add_unit(t, 'small', 1) 23 | 24 | local t = raffle['logistic-science-pack'][1] 25 | add_unit(t, 'small', 5) 26 | add_unit(t, 'medium', 1) 27 | 28 | local t = raffle['military-science-pack'][1] 29 | add_unit(t, 'small', 10) 30 | add_unit(t, 'medium', 3) 31 | add_unit(t, 'big', 1) 32 | 33 | local t = raffle['chemical-science-pack'][1] 34 | add_unit(t, 'small', 1) 35 | add_unit(t, 'medium', 9) 36 | add_unit(t, 'big', 2) 37 | 38 | local t = raffle['production-science-pack'][1] 39 | add_unit(t, 'medium', 1) 40 | add_unit(t, 'big', 12) 41 | add_unit(t, 'behemoth', 2) 42 | 43 | local t = raffle['utility-science-pack'][1] 44 | add_unit(t, 'big', 5) 45 | add_unit(t, 'behemoth', 1) 46 | 47 | local t = raffle['space-science-pack'][1] 48 | add_unit(t, 'big', 1) 49 | add_unit(t, 'behemoth', 3) 50 | 51 | return raffle 52 | -------------------------------------------------------------------------------- /maps/biter_hatchery/share_chat.lua: -------------------------------------------------------------------------------- 1 | --luacheck: ignore 2 | ----------share chat with spectator force------------------- 3 | local function on_console_chat(event) 4 | if not event.message then 5 | return 6 | end 7 | if not event.player_index then 8 | return 9 | end 10 | local player = game.players[event.player_index] 11 | 12 | local color = {} 13 | color = player.color 14 | color.r = color.r * 0.6 + 0.35 15 | color.g = color.g * 0.6 + 0.35 16 | color.b = color.b * 0.6 + 0.35 17 | color.a = 1 18 | 19 | if player.force.name == 'west' then 20 | game.forces.spectator.print(player.name .. ' (west): ' .. event.message, color) 21 | end 22 | if player.force.name == 'east' then 23 | game.forces.spectator.print(player.name .. ' (east): ' .. event.message, color) 24 | end 25 | if player.force.name == 'spectator' then 26 | game.forces.west.print(player.name .. ' (spectator): ' .. event.message, color) 27 | game.forces.east.print(player.name .. ' (spectator): ' .. event.message, color) 28 | end 29 | end 30 | 31 | local event = require 'utils.event' 32 | event.add(defines.events.on_console_chat, on_console_chat) 33 | -------------------------------------------------------------------------------- /maps/crab_defender/crumbly_walls.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local FDT = require 'maps.crab_defender.table' 3 | local math_random = math.random 4 | 5 | local rock_raffle = { 'big-sand-rock', 'big-rock', 'big-rock', 'big-rock', 'huge-rock' } 6 | 7 | local function on_entity_died(event) 8 | local crumbly_walls_unlocked = FDT.get('crumbly_walls_unlocked') 9 | if not crumbly_walls_unlocked then 10 | return 11 | end 12 | local entity = event.entity 13 | if not entity.valid then 14 | return 15 | end 16 | if entity.name ~= 'stone-wall' then 17 | return 18 | end 19 | if math_random(1, 4) == 1 then 20 | return 21 | end 22 | entity.surface.create_entity({ name = rock_raffle[math_random(1, #rock_raffle)], position = entity.position, force = 'player' }) 23 | end 24 | 25 | Event.add(defines.events.on_entity_died, on_entity_died) 26 | -------------------------------------------------------------------------------- /maps/crab_defender/explosive_gun_bullets.lua: -------------------------------------------------------------------------------- 1 | local radius = 3 2 | 3 | local function splash_damage(surface, position, final_damage_amount) 4 | local damage = math.random(math.floor(final_damage_amount * 3), math.floor(final_damage_amount * 4)) 5 | for _, e in pairs(surface.find_entities_filtered({area = {{position.x - radius, position.y - radius}, {position.x + radius, position.y + radius}}})) do 6 | if e.valid and e.health then 7 | local distance_from_center = math.sqrt((e.position.x - position.x) ^ 2 + (e.position.y - position.y) ^ 2) 8 | if distance_from_center <= radius then 9 | local damage_distance_modifier = 1 - distance_from_center / radius 10 | if damage > 0 then 11 | if math.random(1, 3) == 1 then 12 | surface.create_entity({name = 'explosion', position = e.position}) 13 | end 14 | e.damage(damage * damage_distance_modifier, 'player', 'explosion') 15 | end 16 | end 17 | end 18 | end 19 | end 20 | 21 | local function explosive_bullets(event) 22 | if math.random(1, 3) ~= 1 then 23 | return false 24 | end 25 | if event.damage_type.name ~= 'physical' then 26 | return false 27 | end 28 | local player = event.cause 29 | if player.shooting_state.state == defines.shooting.not_shooting then 30 | return false 31 | end 32 | local selected_weapon = player.get_inventory(defines.inventory.character_guns)[player.selected_gun_index] 33 | if selected_weapon.name ~= 'submachine-gun' and selected_weapon.name ~= 'pistol' then 34 | return false 35 | end 36 | 37 | player.surface.create_entity({name = 'explosion', position = event.entity.position}) 38 | 39 | splash_damage(player.surface, event.entity.position, event.final_damage_amount) 40 | end 41 | 42 | return explosive_bullets 43 | -------------------------------------------------------------------------------- /maps/crab_defender/flame_boots.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local FDT = require 'maps.crab_defender.table' 3 | 4 | local function on_player_changed_position(event) 5 | local flame_boots = FDT.get('flame_boots') 6 | if not flame_boots then 7 | return 8 | end 9 | local player = game.players[event.player_index] 10 | if not player.character then 11 | return 12 | end 13 | if player.character.driving then 14 | return 15 | end 16 | 17 | if not flame_boots[player.index] then 18 | flame_boots[player.index] = {} 19 | end 20 | 21 | if not flame_boots[player.index].fuel then 22 | return 23 | end 24 | 25 | if flame_boots[player.index].fuel < 0 then 26 | player.print('Your flame boots have worn out.', {r = 0.22, g = 0.77, b = 0.44}) 27 | flame_boots[player.index] = {} 28 | return 29 | end 30 | 31 | if flame_boots[player.index].fuel % 500 == 0 then 32 | player.print('Fuel remaining: ' .. flame_boots[player.index].fuel, {r = 0.22, g = 0.77, b = 0.44}) 33 | end 34 | 35 | if not flame_boots[player.index].step_history then 36 | flame_boots[player.index].step_history = {} 37 | end 38 | 39 | local elements = #flame_boots[player.index].step_history 40 | 41 | flame_boots[player.index].step_history[elements + 1] = {x = player.position.x, y = player.position.y} 42 | 43 | if elements < 50 then 44 | return 45 | end 46 | 47 | player.surface.create_entity({name = 'fire-flame', position = flame_boots[player.index].step_history[elements - 2]}) 48 | 49 | flame_boots[player.index].fuel = flame_boots[player.index].fuel - 1 50 | end 51 | 52 | Event.add(defines.events.on_player_changed_position, on_player_changed_position) 53 | -------------------------------------------------------------------------------- /maps/crab_defender/laser_pointer.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local FDT = require 'maps.crab_defender.table' 3 | local radius = 32 4 | 5 | local function on_player_used_capsule(event) 6 | local laser_pointer_unlocked = FDT.get('laser_pointer_unlocked') 7 | if not laser_pointer_unlocked then 8 | return 9 | end 10 | 11 | local player = game.players[event.player_index] 12 | local position = event.position 13 | local used_item = event.item 14 | if used_item.name ~= 'artillery-targeting-remote' then 15 | return 16 | end 17 | 18 | for _, unit in pairs(player.surface.find_enemy_units(position, radius, 'player')) do 19 | if math.random(1, 2) == 1 then 20 | unit.set_command( 21 | { 22 | type = defines.command.go_to_location, 23 | destination = position, 24 | radius = 2, 25 | distraction = defines.distraction.none, 26 | pathfind_flags = { 27 | allow_destroy_friendly_entities = false, 28 | prefer_straight_paths = false, 29 | low_priority = false 30 | } 31 | } 32 | ) 33 | end 34 | end 35 | end 36 | 37 | Event.add(defines.events.on_player_used_capsule, on_player_used_capsule) 38 | -------------------------------------------------------------------------------- /maps/crab_defender/on_entity_damaged.lua: -------------------------------------------------------------------------------- 1 | require 'maps.crab_defender.boss_biters' 2 | 3 | local Event = require 'utils.event' 4 | local explosive_bullets = require 'maps.crab_defender.explosive_gun_bullets' 5 | local bouncy_shells = require 'maps.crab_defender.bouncy_shells' 6 | local FDT = require 'maps.crab_defender.table' 7 | 8 | local function protect_market(event) 9 | if event.entity.name ~= 'market' then 10 | return 11 | end 12 | if event.cause then 13 | if event.cause.force.name == 'enemy' then 14 | return 15 | end 16 | end 17 | event.entity.health = event.entity.health + event.final_damage_amount 18 | return true 19 | end 20 | 21 | local function on_entity_damaged(event) 22 | if not event.entity then 23 | return 24 | end 25 | if not event.entity.valid then 26 | return 27 | end 28 | 29 | if protect_market(event) then 30 | return 31 | end 32 | 33 | if not event.cause then 34 | return 35 | end 36 | local explosive_bullets_unlocked = FDT.get('explosive_bullets_unlocked') 37 | local bouncy_shells_unlocked = FDT.get('bouncy_shells_unlocked') 38 | 39 | --if event.cause.unit_number then 40 | -- if this.boss_biters[event.cause.unit_number] then 41 | -- boss_biter.damaged_entity(event) 42 | -- end 43 | --end 44 | 45 | if event.cause.name ~= 'character' then 46 | return 47 | end 48 | 49 | if explosive_bullets_unlocked then 50 | if explosive_bullets(event) then 51 | return 52 | end 53 | end 54 | if bouncy_shells_unlocked then 55 | if bouncy_shells(event) then 56 | return 57 | end 58 | end 59 | end 60 | 61 | Event.add(defines.events.on_entity_damaged, on_entity_damaged) 62 | -------------------------------------------------------------------------------- /maps/crab_defender/shotgun_buff.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local FDT = require 'maps.crab_defender.table' 3 | local gain_multiplier = 4 4 | 5 | local function on_research_finished(event) 6 | local research = event.research 7 | local force_name = research.force.name 8 | local this = FDT.get() 9 | 10 | if not this.shotgun_shell_damage_modifier_old[force_name] then 11 | this.shotgun_shell_damage_modifier_old[force_name] = game.forces[force_name].get_ammo_damage_modifier('shotgun-shell') - 0.1 12 | end 13 | 14 | if string.sub(research.name, 0, 26) == 'physical-projectile-damage' then 15 | local current_damage = game.forces[force_name].get_ammo_damage_modifier('shotgun-shell') 16 | local vanilla_gain = current_damage - this.shotgun_shell_damage_modifier_old[force_name] 17 | local additional_gain = vanilla_gain * (gain_multiplier - 1) 18 | game.forces[force_name].set_ammo_damage_modifier('shotgun-shell', current_damage + additional_gain) 19 | end 20 | 21 | this.shotgun_shell_damage_modifier_old[force_name] = game.forces[force_name].get_ammo_damage_modifier('shotgun-shell') 22 | end 23 | 24 | local function on_init() 25 | game.forces.player.set_ammo_damage_modifier('shotgun-shell', 1) 26 | end 27 | 28 | Event.on_init(on_init) 29 | Event.add(defines.events.on_research_finished, on_research_finished) 30 | -------------------------------------------------------------------------------- /maps/crab_defender/trapped_capsules.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local FDT = require 'maps.crab_defender.table' 3 | 4 | local radius = 20 5 | 6 | local whitelist = { 7 | ['defender'] = 'explosive-cannon-projectile', 8 | ['distractor'] = 'explosive-uranium-cannon-projectile', 9 | ['destroyer'] = 'explosive-uranium-cannon-projectile' 10 | } 11 | 12 | local function on_entity_died(event) 13 | local trapped_capsules_unlocked = FDT.get('trapped_capsules_unlocked') 14 | if not trapped_capsules_unlocked then 15 | return 16 | end 17 | 18 | if not event.entity.valid then 19 | return 20 | end 21 | if not whitelist[event.entity.name] then 22 | return 23 | end 24 | 25 | local valid_targets = {} 26 | local position = event.entity.position 27 | 28 | for _, e in pairs( 29 | event.entity.surface.find_entities_filtered( 30 | { 31 | area = {{position.x - radius, position.y - radius}, {position.x + radius, position.y + radius}}, 32 | force = 'enemy' 33 | } 34 | ) 35 | ) do 36 | if e.health then 37 | local distance_from_center = math.sqrt((e.position.x - position.x) ^ 2 + (e.position.y - position.y) ^ 2) 38 | if distance_from_center <= radius then 39 | valid_targets[#valid_targets + 1] = e 40 | end 41 | end 42 | end 43 | 44 | if not valid_targets[1] then 45 | return 46 | end 47 | 48 | event.entity.surface.create_entity( 49 | { 50 | name = whitelist[event.entity.name], 51 | position = position, 52 | force = 'player', 53 | source = position, 54 | target = valid_targets[math.random(1, #valid_targets)].position, 55 | max_range = 20, 56 | speed = 0.1 57 | } 58 | ) 59 | end 60 | 61 | Event.add(defines.events.on_entity_died, on_entity_died) 62 | -------------------------------------------------------------------------------- /maps/crab_defender/ultra_mines.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local FDT = require 'maps.crab_defender.table' 3 | local radius = 8 4 | 5 | local function damage_entities_around_target(entity, damage) 6 | for _, e in pairs( 7 | entity.surface.find_entities_filtered( 8 | { 9 | area = { 10 | {entity.position.x - radius, entity.position.y - radius}, 11 | {entity.position.x + radius, entity.position.y + radius} 12 | } 13 | } 14 | ) 15 | ) do 16 | if e.health then 17 | if e.force.name ~= 'player' then 18 | local distance_from_center = math.sqrt((e.position.x - entity.position.x) ^ 2 + (e.position.y - entity.position.y) ^ 2) 19 | if distance_from_center <= radius then 20 | e.damage(damage, 'player', 'explosion') 21 | end 22 | end 23 | end 24 | end 25 | end 26 | 27 | local function on_entity_died(event) 28 | local ultra_mines_unlocked = FDT.get('ultra_mines_unlocked') 29 | if not ultra_mines_unlocked then 30 | return 31 | end 32 | if not event.entity.valid then 33 | return 34 | end 35 | if event.entity.name ~= 'land-mine' then 36 | return 37 | end 38 | 39 | event.entity.surface.create_entity( 40 | { 41 | name = 'big-artillery-explosion', 42 | position = event.entity.position 43 | } 44 | ) 45 | 46 | local damage = (1 + event.entity.force.get_ammo_damage_modifier('grenade')) * 250 47 | 48 | damage_entities_around_target(event.entity, damage) 49 | end 50 | 51 | Event.add(defines.events.on_entity_died, on_entity_died) 52 | -------------------------------------------------------------------------------- /maps/crab_defender/vehicle_nanobots.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local FDT = require 'maps.crab_defender.table' 3 | 4 | local function on_player_changed_position(event) 5 | local vehicle_nanobots_unlocked = FDT.get('vehicle_nanobots_unlocked') 6 | 7 | if not vehicle_nanobots_unlocked then 8 | return 9 | end 10 | local player = game.players[event.player_index] 11 | if not player.character then 12 | return 13 | end 14 | if not player.character.driving then 15 | return 16 | end 17 | if not player.vehicle then 18 | return 19 | end 20 | if not player.vehicle.valid then 21 | return 22 | end 23 | if player.vehicle.health == player.vehicle.max_health then 24 | return 25 | end 26 | player.vehicle.health = player.vehicle.health + player.vehicle.max_health * 0.005 27 | end 28 | 29 | Event.add(defines.events.on_player_changed_position, on_player_changed_position) 30 | -------------------------------------------------------------------------------- /maps/deep_jungle/table.lua: -------------------------------------------------------------------------------- 1 | local Global = require 'utils.global' 2 | 3 | local this = { 4 | settings = { 5 | chunk_load_tick = false, 6 | chunks_charted = {} 7 | } 8 | } 9 | 10 | Global.register( 11 | this, 12 | function(tbl) 13 | this = tbl 14 | end 15 | ) 16 | 17 | local Public = {} 18 | 19 | function Public.get(key) 20 | if key then 21 | return this[key] 22 | else 23 | return this 24 | end 25 | end 26 | 27 | function Public.set(key, value) 28 | if key and (value or value == false) then 29 | this[key] = value 30 | return this[key] 31 | elseif key then 32 | return this[key] 33 | else 34 | return this 35 | end 36 | end 37 | 38 | function Public.remove(key, sub_key) 39 | if key and sub_key then 40 | if this[key] and this[key][sub_key] then 41 | this[key][sub_key] = nil 42 | end 43 | elseif key then 44 | if this[key] then 45 | this[key] = nil 46 | end 47 | end 48 | end 49 | 50 | return Public 51 | -------------------------------------------------------------------------------- /maps/dungeons/biome_laboratory.lua: -------------------------------------------------------------------------------- 1 | local Functions = require 'maps.dungeons.functions' 2 | 3 | local table_shuffle_table = table.shuffle_table 4 | local table_insert = table.insert 5 | local math_random = math.random 6 | 7 | local rainbow_tiles = { 8 | 'orange-refined-concrete', 9 | 'purple-refined-concrete' 10 | } 11 | 12 | local function laboratory(surface, room) 13 | local tiles = {} 14 | for _, tile in pairs(room.path_tiles) do 15 | table_insert(tiles, tile) 16 | end 17 | for _, tile in pairs(room.room_border_tiles) do 18 | table_insert(tiles, tile) 19 | end 20 | for _, tile in pairs(room.room_tiles) do 21 | table_insert(tiles, tile) 22 | end 23 | 24 | for _, tile in pairs(tiles) do 25 | surface.set_tiles({{name = rainbow_tiles[math_random(1, 2)], position = tile.position}}, true) 26 | end 27 | 28 | if not room.room_border_tiles[1] then 29 | return 30 | end 31 | 32 | table_shuffle_table(room.room_tiles) 33 | for key, tile in pairs(room.room_tiles) do 34 | if key == 1 then 35 | Functions.laboratory(surface, tile.position) 36 | else 37 | if math_random(1, 128) == 1 then 38 | Functions.rare_loot_crate(surface, tile.position, true) 39 | end 40 | end 41 | end 42 | 43 | table_shuffle_table(room.room_border_tiles) 44 | for key, tile in pairs(room.room_border_tiles) do 45 | if key % 8 == 1 then 46 | Functions.place_border_rock(surface, tile.position) 47 | end 48 | end 49 | end 50 | 51 | return laboratory 52 | -------------------------------------------------------------------------------- /maps/dungeons/biome_market.lua: -------------------------------------------------------------------------------- 1 | local Functions = require 'maps.dungeons.functions' 2 | 3 | local table_shuffle_table = table.shuffle_table 4 | local table_insert = table.insert 5 | local math_random = math.random 6 | 7 | local rainbow_tiles = { 8 | 'yellow-refined-concrete', 9 | 'blue-refined-concrete' 10 | } 11 | 12 | local function market(surface, room) 13 | local tiles = {} 14 | for _, tile in pairs(room.path_tiles) do 15 | table_insert(tiles, tile) 16 | end 17 | for _, tile in pairs(room.room_border_tiles) do 18 | table_insert(tiles, tile) 19 | end 20 | for _, tile in pairs(room.room_tiles) do 21 | table_insert(tiles, tile) 22 | end 23 | 24 | for _, tile in pairs(tiles) do 25 | surface.set_tiles({{name = rainbow_tiles[math_random(1, 2)], position = tile.position}}, true) 26 | end 27 | 28 | if not room.room_border_tiles[1] then 29 | return 30 | end 31 | 32 | table_shuffle_table(room.room_tiles) 33 | for key, tile in pairs(room.room_tiles) do 34 | if key == 1 then 35 | Functions.market(surface, tile.position) 36 | else 37 | if math_random(1, 128) == 1 then 38 | Functions.rare_loot_crate(surface, tile.position, true) 39 | end 40 | end 41 | end 42 | 43 | table_shuffle_table(room.room_border_tiles) 44 | for key, tile in pairs(room.room_border_tiles) do 45 | if key % 8 == 1 then 46 | Functions.place_border_rock(surface, tile.position) 47 | end 48 | end 49 | end 50 | 51 | return market 52 | -------------------------------------------------------------------------------- /maps/fish_defender/crumbly_walls.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local FDT = require 'maps.fish_defender.table' 3 | local math_random = math.random 4 | 5 | local rock_raffle = { 'big-sand-rock', 'big-rock', 'big-rock', 'big-rock', 'huge-rock' } 6 | 7 | local function on_entity_died(event) 8 | local crumbly_walls_unlocked = FDT.get('crumbly_walls_unlocked') 9 | if not crumbly_walls_unlocked then 10 | return 11 | end 12 | local entity = event.entity 13 | if not entity.valid then 14 | return 15 | end 16 | if entity.name ~= 'stone-wall' then 17 | return 18 | end 19 | if math_random(1, 4) == 1 then 20 | return 21 | end 22 | entity.surface.create_entity({ name = rock_raffle[math_random(1, #rock_raffle)], position = entity.position, force = 'player' }) 23 | end 24 | 25 | Event.add(defines.events.on_entity_died, on_entity_died) 26 | -------------------------------------------------------------------------------- /maps/fish_defender/explosive_gun_bullets.lua: -------------------------------------------------------------------------------- 1 | local radius = 3 2 | 3 | local function splash_damage(surface, position, final_damage_amount) 4 | local damage = math.random(math.floor(final_damage_amount * 3), math.floor(final_damage_amount * 4)) 5 | for _, e in pairs(surface.find_entities_filtered({area = {{position.x - radius, position.y - radius}, {position.x + radius, position.y + radius}}})) do 6 | if e.valid and e.health then 7 | local distance_from_center = math.sqrt((e.position.x - position.x) ^ 2 + (e.position.y - position.y) ^ 2) 8 | if distance_from_center <= radius then 9 | local damage_distance_modifier = 1 - distance_from_center / radius 10 | if damage > 0 then 11 | if math.random(1, 3) == 1 then 12 | surface.create_entity({name = 'explosion', position = e.position}) 13 | end 14 | e.damage(damage * damage_distance_modifier, 'player', 'explosion') 15 | end 16 | end 17 | end 18 | end 19 | end 20 | 21 | local function explosive_bullets(event) 22 | if math.random(1, 3) ~= 1 then 23 | return false 24 | end 25 | if event.damage_type.name ~= 'physical' then 26 | return false 27 | end 28 | local player = event.cause 29 | if player.shooting_state.state == defines.shooting.not_shooting then 30 | return false 31 | end 32 | local selected_weapon = player.get_inventory(defines.inventory.character_guns)[player.selected_gun_index] 33 | if selected_weapon.name ~= 'submachine-gun' and selected_weapon.name ~= 'pistol' then 34 | return false 35 | end 36 | 37 | player.surface.create_entity({name = 'explosion', position = event.entity.position}) 38 | 39 | splash_damage(player.surface, event.entity.position, event.final_damage_amount) 40 | end 41 | 42 | return explosive_bullets 43 | -------------------------------------------------------------------------------- /maps/fish_defender/flame_boots.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local FDT = require 'maps.fish_defender.table' 3 | 4 | local function on_player_changed_position(event) 5 | local flame_boots = FDT.get('flame_boots') 6 | if not flame_boots then 7 | return 8 | end 9 | local player = game.players[event.player_index] 10 | if not player.character then 11 | return 12 | end 13 | if player.character.driving then 14 | return 15 | end 16 | 17 | if not flame_boots[player.index] then 18 | flame_boots[player.index] = {} 19 | end 20 | 21 | if not flame_boots[player.index].fuel then 22 | return 23 | end 24 | 25 | if flame_boots[player.index].fuel < 0 then 26 | player.print('Your flame boots have worn out.', {r = 0.22, g = 0.77, b = 0.44}) 27 | flame_boots[player.index] = {} 28 | return 29 | end 30 | 31 | if flame_boots[player.index].fuel % 500 == 0 then 32 | player.print('Fuel remaining: ' .. flame_boots[player.index].fuel, {r = 0.22, g = 0.77, b = 0.44}) 33 | end 34 | 35 | if not flame_boots[player.index].step_history then 36 | flame_boots[player.index].step_history = {} 37 | end 38 | 39 | local elements = #flame_boots[player.index].step_history 40 | 41 | flame_boots[player.index].step_history[elements + 1] = {x = player.position.x, y = player.position.y} 42 | 43 | if elements < 50 then 44 | return 45 | end 46 | 47 | player.surface.create_entity({name = 'fire-flame', position = flame_boots[player.index].step_history[elements - 2]}) 48 | 49 | flame_boots[player.index].fuel = flame_boots[player.index].fuel - 1 50 | end 51 | 52 | Event.add(defines.events.on_player_changed_position, on_player_changed_position) 53 | -------------------------------------------------------------------------------- /maps/fish_defender/laser_pointer.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local FDT = require 'maps.fish_defender.table' 3 | local radius = 32 4 | 5 | local function on_player_used_capsule(event) 6 | local laser_pointer_unlocked = FDT.get('laser_pointer_unlocked') 7 | if not laser_pointer_unlocked then 8 | return 9 | end 10 | 11 | local player = game.players[event.player_index] 12 | local position = event.position 13 | local used_item = event.item 14 | if used_item.name ~= 'artillery-targeting-remote' then 15 | return 16 | end 17 | 18 | for _, unit in pairs(player.surface.find_enemy_units(position, radius, 'player')) do 19 | if math.random(1, 2) == 1 then 20 | unit.set_command( 21 | { 22 | type = defines.command.go_to_location, 23 | destination = position, 24 | radius = 2, 25 | distraction = defines.distraction.none, 26 | pathfind_flags = { 27 | allow_destroy_friendly_entities = false, 28 | prefer_straight_paths = false, 29 | low_priority = false 30 | } 31 | } 32 | ) 33 | end 34 | end 35 | end 36 | 37 | Event.add(defines.events.on_player_used_capsule, on_player_used_capsule) 38 | -------------------------------------------------------------------------------- /maps/fish_defender/on_entity_damaged.lua: -------------------------------------------------------------------------------- 1 | require 'maps.fish_defender.boss_biters' 2 | 3 | local Event = require 'utils.event' 4 | local enhance_railgun = require 'maps.fish_defender.railgun_enhancer' 5 | local explosive_bullets = require 'maps.fish_defender.explosive_gun_bullets' 6 | local bouncy_shells = require 'maps.fish_defender.bouncy_shells' 7 | local FDT = require 'maps.fish_defender.table' 8 | 9 | local function protect_market(event) 10 | if event.entity.name ~= 'market' then 11 | return 12 | end 13 | if event.cause then 14 | if event.cause.force.name == 'enemy' then 15 | return 16 | end 17 | end 18 | event.entity.health = event.entity.health + event.final_damage_amount 19 | return true 20 | end 21 | 22 | local function on_entity_damaged(event) 23 | if not event.entity then 24 | return 25 | end 26 | if not event.entity.valid then 27 | return 28 | end 29 | 30 | if protect_market(event) then 31 | return 32 | end 33 | 34 | if not event.cause then 35 | return 36 | end 37 | local explosive_bullets_unlocked = FDT.get('explosive_bullets_unlocked') 38 | local bouncy_shells_unlocked = FDT.get('bouncy_shells_unlocked') 39 | 40 | --if event.cause.unit_number then 41 | -- if this.boss_biters[event.cause.unit_number] then 42 | -- boss_biter.damaged_entity(event) 43 | -- end 44 | --end 45 | 46 | if event.cause.name ~= 'character' then 47 | return 48 | end 49 | 50 | if enhance_railgun(event) then 51 | return 52 | end 53 | if explosive_bullets_unlocked then 54 | if explosive_bullets(event) then 55 | return 56 | end 57 | end 58 | if bouncy_shells_unlocked then 59 | if bouncy_shells(event) then 60 | return 61 | end 62 | end 63 | end 64 | 65 | Event.add(defines.events.on_entity_damaged, on_entity_damaged) 66 | -------------------------------------------------------------------------------- /maps/fish_defender/trapped_capsules.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local FDT = require 'maps.fish_defender.table' 3 | 4 | local radius = 20 5 | 6 | local whitelist = { 7 | ['defender'] = 'explosive-cannon-projectile', 8 | ['distractor'] = 'explosive-uranium-cannon-projectile', 9 | ['destroyer'] = 'explosive-uranium-cannon-projectile' 10 | } 11 | 12 | local function on_entity_died(event) 13 | local trapped_capsules_unlocked = FDT.get('trapped_capsules_unlocked') 14 | if not trapped_capsules_unlocked then 15 | return 16 | end 17 | 18 | if not event.entity.valid then 19 | return 20 | end 21 | if not whitelist[event.entity.name] then 22 | return 23 | end 24 | 25 | local valid_targets = {} 26 | local position = event.entity.position 27 | 28 | for _, e in pairs( 29 | event.entity.surface.find_entities_filtered( 30 | { 31 | area = {{position.x - radius, position.y - radius}, {position.x + radius, position.y + radius}}, 32 | force = 'enemy' 33 | } 34 | ) 35 | ) do 36 | if e.health then 37 | local distance_from_center = math.sqrt((e.position.x - position.x) ^ 2 + (e.position.y - position.y) ^ 2) 38 | if distance_from_center <= radius then 39 | valid_targets[#valid_targets + 1] = e 40 | end 41 | end 42 | end 43 | 44 | if not valid_targets[1] then 45 | return 46 | end 47 | 48 | event.entity.surface.create_entity( 49 | { 50 | name = whitelist[event.entity.name], 51 | position = position, 52 | force = 'player', 53 | source = position, 54 | target = valid_targets[math.random(1, #valid_targets)].position, 55 | max_range = 20, 56 | speed = 0.1 57 | } 58 | ) 59 | end 60 | 61 | Event.add(defines.events.on_entity_died, on_entity_died) 62 | -------------------------------------------------------------------------------- /maps/fish_defender/ultra_mines.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local FDT = require 'maps.fish_defender.table' 3 | local radius = 8 4 | 5 | local function damage_entities_around_target(entity, damage) 6 | for _, e in pairs( 7 | entity.surface.find_entities_filtered( 8 | { 9 | area = { 10 | {entity.position.x - radius, entity.position.y - radius}, 11 | {entity.position.x + radius, entity.position.y + radius} 12 | } 13 | } 14 | ) 15 | ) do 16 | if e.health then 17 | if e.force.name ~= 'player' then 18 | local distance_from_center = math.sqrt((e.position.x - entity.position.x) ^ 2 + (e.position.y - entity.position.y) ^ 2) 19 | if distance_from_center <= radius then 20 | e.damage(damage, 'player', 'explosion') 21 | end 22 | end 23 | end 24 | end 25 | end 26 | 27 | local function on_entity_died(event) 28 | local ultra_mines_unlocked = FDT.get('ultra_mines_unlocked') 29 | if not ultra_mines_unlocked then 30 | return 31 | end 32 | if not event.entity.valid then 33 | return 34 | end 35 | if event.entity.name ~= 'land-mine' then 36 | return 37 | end 38 | 39 | event.entity.surface.create_entity( 40 | { 41 | name = 'big-artillery-explosion', 42 | position = event.entity.position 43 | } 44 | ) 45 | 46 | local damage = (1 + event.entity.force.get_ammo_damage_modifier('grenade')) * 250 47 | 48 | damage_entities_around_target(event.entity, damage) 49 | end 50 | 51 | Event.add(defines.events.on_entity_died, on_entity_died) 52 | -------------------------------------------------------------------------------- /maps/fish_defender/vehicle_nanobots.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local FDT = require 'maps.fish_defender.table' 3 | 4 | local function on_player_changed_position(event) 5 | local vehicle_nanobots_unlocked = FDT.get('vehicle_nanobots_unlocked') 6 | 7 | if not vehicle_nanobots_unlocked then 8 | return 9 | end 10 | local player = game.players[event.player_index] 11 | if not player.character then 12 | return 13 | end 14 | if not player.character.driving then 15 | return 16 | end 17 | if not player.vehicle then 18 | return 19 | end 20 | if not player.vehicle.valid then 21 | return 22 | end 23 | if player.vehicle.health == player.vehicle.max_health then 24 | return 25 | end 26 | player.vehicle.health = player.vehicle.health + player.vehicle.max_health * 0.005 27 | end 28 | 29 | Event.add(defines.events.on_player_changed_position, on_player_changed_position) 30 | -------------------------------------------------------------------------------- /maps/fish_defender_v1/crumbly_walls.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local math_random = math.random 3 | 4 | local rock_raffle = { 'big-sand-rock', 'big-rock', 'big-rock', 'big-rock', 'huge-rock' } 5 | 6 | local function on_entity_died(event) 7 | if not storage.crumbly_walls_unlocked then 8 | return 9 | end 10 | local entity = event.entity 11 | if not entity.valid then 12 | return 13 | end 14 | if entity.name ~= 'stone-wall' then 15 | return 16 | end 17 | if math_random(1, 4) == 1 then 18 | return 19 | end 20 | entity.surface.create_entity({ name = rock_raffle[math_random(1, #rock_raffle)], position = entity.position, force = 'player' }) 21 | end 22 | 23 | Event.add(defines.events.on_entity_died, on_entity_died) 24 | -------------------------------------------------------------------------------- /maps/fish_defender_v1/explosive_gun_bullets.lua: -------------------------------------------------------------------------------- 1 | local radius = 3 2 | 3 | local function splash_damage(surface, position, final_damage_amount) 4 | local damage = math.random(math.floor(final_damage_amount * 3), math.floor(final_damage_amount * 4)) 5 | for _, e in pairs(surface.find_entities_filtered({area = {{position.x - radius, position.y - radius}, {position.x + radius, position.y + radius}}})) do 6 | if e.valid and e.health then 7 | local distance_from_center = math.sqrt((e.position.x - position.x) ^ 2 + (e.position.y - position.y) ^ 2) 8 | if distance_from_center <= radius then 9 | local damage_distance_modifier = 1 - distance_from_center / radius 10 | if damage > 0 then 11 | if math.random(1, 3) == 1 then 12 | surface.create_entity({name = 'explosion', position = e.position}) 13 | end 14 | e.damage(damage * damage_distance_modifier, 'player', 'explosion') 15 | end 16 | end 17 | end 18 | end 19 | end 20 | 21 | local function explosive_bullets(event) 22 | if math.random(1, 3) ~= 1 then 23 | return false 24 | end 25 | if event.damage_type.name ~= 'physical' then 26 | return false 27 | end 28 | local player = event.cause 29 | if player.shooting_state.state == defines.shooting.not_shooting then 30 | return false 31 | end 32 | local selected_weapon = player.get_inventory(defines.inventory.character_guns)[player.selected_gun_index] 33 | if selected_weapon.name ~= 'submachine-gun' and selected_weapon.name ~= 'pistol' then 34 | return false 35 | end 36 | 37 | player.surface.create_entity({name = 'explosion', position = event.entity.position}) 38 | 39 | splash_damage(player.surface, event.entity.position, event.final_damage_amount) 40 | end 41 | 42 | return explosive_bullets 43 | -------------------------------------------------------------------------------- /maps/fish_defender_v1/flame_boots.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | 3 | local function on_player_changed_position(event) 4 | if not storage.flame_boots then 5 | return 6 | end 7 | local player = game.players[event.player_index] 8 | if not player.character then 9 | return 10 | end 11 | if player.character.driving then 12 | return 13 | end 14 | 15 | if not storage.flame_boots[player.index] then 16 | storage.flame_boots[player.index] = {} 17 | end 18 | 19 | if not storage.flame_boots[player.index].fuel then 20 | return 21 | end 22 | 23 | if storage.flame_boots[player.index].fuel < 0 then 24 | player.print('Your flame boots have worn out.', { r = 0.22, g = 0.77, b = 0.44 }) 25 | storage.flame_boots[player.index] = {} 26 | return 27 | end 28 | 29 | if storage.flame_boots[player.index].fuel % 500 == 0 then 30 | player.print('Fuel remaining: ' .. storage.flame_boots[player.index].fuel, { r = 0.22, g = 0.77, b = 0.44 }) 31 | end 32 | 33 | if not storage.flame_boots[player.index].step_history then 34 | storage.flame_boots[player.index].step_history = {} 35 | end 36 | 37 | local elements = #storage.flame_boots[player.index].step_history 38 | 39 | storage.flame_boots[player.index].step_history[elements + 1] = { x = player.position.x, y = player.position.y } 40 | 41 | if elements < 50 then 42 | return 43 | end 44 | 45 | player.surface.create_entity({ name = 'fire-flame', position = storage.flame_boots[player.index].step_history[elements - 2] }) 46 | 47 | storage.flame_boots[player.index].fuel = storage.flame_boots[player.index].fuel - 1 48 | end 49 | 50 | local function on_init() 51 | if not storage.flame_boots then 52 | storage.flame_boots = {} 53 | end 54 | end 55 | 56 | Event.on_init(on_init) 57 | Event.add(defines.events.on_player_changed_position, on_player_changed_position) 58 | -------------------------------------------------------------------------------- /maps/fish_defender_v1/laser_pointer.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local radius = 32 3 | 4 | local function on_player_used_capsule(event) 5 | if not storage.laser_pointer_unlocked then 6 | return 7 | end 8 | 9 | local player = game.players[event.player_index] 10 | local position = event.position 11 | local used_item = event.item 12 | if used_item.name ~= 'artillery-targeting-remote' then 13 | return 14 | end 15 | 16 | for _, unit in pairs(player.surface.find_enemy_units(position, radius, 'player')) do 17 | if math.random(1, 2) == 1 then 18 | unit.set_command( 19 | { 20 | type = defines.command.go_to_location, 21 | destination = position, 22 | radius = 2, 23 | distraction = defines.distraction.none, 24 | pathfind_flags = { 25 | allow_destroy_friendly_entities = false, 26 | prefer_straight_paths = false, 27 | low_priority = false 28 | } 29 | } 30 | ) 31 | end 32 | end 33 | end 34 | 35 | Event.add(defines.events.on_player_used_capsule, on_player_used_capsule) 36 | -------------------------------------------------------------------------------- /maps/fish_defender_v1/on_entity_damaged.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | 3 | local enhance_railgun = require 'maps.fish_defender_v1.railgun_enhancer' 4 | local explosive_bullets = require 'maps.fish_defender_v1.explosive_gun_bullets' 5 | local bouncy_shells = require 'maps.fish_defender_v1.bouncy_shells' 6 | local boss_biter = require 'maps.fish_defender_v1.boss_biters' 7 | 8 | local function protect_market(event) 9 | if event.entity.name ~= 'market' then 10 | return false 11 | end 12 | if event.cause then 13 | if event.cause.force.name == 'enemy' then 14 | return false 15 | end 16 | end 17 | event.entity.health = event.entity.health + event.final_damage_amount 18 | return true 19 | end 20 | 21 | local function on_entity_damaged(event) 22 | if not event.entity then 23 | return 24 | end 25 | if not event.entity.valid then 26 | return 27 | end 28 | 29 | if protect_market(event) then 30 | return 31 | end 32 | 33 | if not event.cause then 34 | return 35 | end 36 | 37 | if event.cause.unit_number then 38 | if storage.boss_biters[event.cause.unit_number] then 39 | boss_biter.damaged_entity(event) 40 | end 41 | end 42 | 43 | if event.cause.name ~= 'character' then 44 | return 45 | end 46 | 47 | if enhance_railgun(event) then 48 | return 49 | end 50 | if storage.explosive_bullets_unlocked then 51 | if explosive_bullets(event) then 52 | return 53 | end 54 | end 55 | if storage.bouncy_shells_unlocked then 56 | if bouncy_shells(event) then 57 | return 58 | end 59 | end 60 | end 61 | 62 | Event.add(defines.events.on_entity_damaged, on_entity_damaged) 63 | -------------------------------------------------------------------------------- /maps/fish_defender_v1/shotgun_buff.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local gain_multiplier = 4 3 | 4 | local function on_research_finished(event) 5 | local research = event.research 6 | local force_name = research.force.name 7 | 8 | if not storage.shotgun_shell_damage_modifier_old[force_name] then 9 | storage.shotgun_shell_damage_modifier_old[force_name] = game.forces[force_name].get_ammo_damage_modifier('shotgun-shell') - 0.1 10 | end 11 | 12 | if string.sub(research.name, 0, 26) == 'physical-projectile-damage' then 13 | local current_damage = game.forces[force_name].get_ammo_damage_modifier('shotgun-shell') 14 | local vanilla_gain = current_damage - storage.shotgun_shell_damage_modifier_old[force_name] 15 | local additional_gain = vanilla_gain * (gain_multiplier - 1) 16 | game.forces[force_name].set_ammo_damage_modifier('shotgun-shell', current_damage + additional_gain) 17 | end 18 | 19 | storage.shotgun_shell_damage_modifier_old[force_name] = game.forces[force_name].get_ammo_damage_modifier('shotgun-shell') 20 | end 21 | 22 | local function on_init() 23 | game.forces.player.set_ammo_damage_modifier('shotgun-shell', 1) 24 | storage.shotgun_shell_damage_modifier_old = {} 25 | end 26 | 27 | Event.on_init(on_init) 28 | Event.add(defines.events.on_research_finished, on_research_finished) 29 | -------------------------------------------------------------------------------- /maps/fish_defender_v1/trapped_capsules.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | 3 | local radius = 20 4 | 5 | local whitelist = { 6 | ['defender'] = 'explosive-cannon-projectile', 7 | ['distractor'] = 'explosive-uranium-cannon-projectile', 8 | ['destroyer'] = 'explosive-uranium-cannon-projectile' 9 | } 10 | 11 | local function on_entity_died(event) 12 | if not storage.trapped_capsules_unlocked then 13 | return 14 | end 15 | 16 | if not event.entity.valid then 17 | return 18 | end 19 | if not whitelist[event.entity.name] then 20 | return 21 | end 22 | 23 | local valid_targets = {} 24 | local position = event.entity.position 25 | 26 | for _, e in pairs( 27 | event.entity.surface.find_entities_filtered({ area = { { position.x - radius, position.y - radius }, { position.x + radius, position.y + radius } }, force = 'enemy' }) 28 | ) do 29 | if e.health then 30 | local distance_from_center = math.sqrt((e.position.x - position.x) ^ 2 + (e.position.y - position.y) ^ 2) 31 | if distance_from_center <= radius then 32 | valid_targets[#valid_targets + 1] = e 33 | end 34 | end 35 | end 36 | 37 | if not valid_targets[1] then 38 | return 39 | end 40 | 41 | event.entity.surface.create_entity( 42 | { 43 | name = whitelist[event.entity.name], 44 | position = position, 45 | force = 'player', 46 | source = position, 47 | target = valid_targets[math.random(1, #valid_targets)].position, 48 | max_range = 20, 49 | speed = 0.1 50 | } 51 | ) 52 | end 53 | 54 | Event.add(defines.events.on_entity_died, on_entity_died) 55 | -------------------------------------------------------------------------------- /maps/fish_defender_v1/ultra_mines.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local radius = 8 3 | 4 | local function damage_entities_around_target(entity, damage) 5 | for _, e in pairs( 6 | entity.surface.find_entities_filtered({ area = { { entity.position.x - radius, entity.position.y - radius }, { entity.position.x + radius, entity.position.y + radius } } }) 7 | ) do 8 | if e.health then 9 | if e.force.name ~= 'player' then 10 | local distance_from_center = math.sqrt((e.position.x - entity.position.x) ^ 2 + (e.position.y - entity.position.y) ^ 2) 11 | if distance_from_center <= radius then 12 | e.damage(damage, 'player', 'explosion') 13 | end 14 | end 15 | end 16 | end 17 | end 18 | 19 | local function on_entity_died(event) 20 | if not storage.ultra_mines_unlocked then 21 | return 22 | end 23 | if not event.entity.valid then 24 | return 25 | end 26 | if event.entity.name ~= 'land-mine' then 27 | return 28 | end 29 | 30 | event.entity.surface.create_entity( 31 | { 32 | name = 'big-artillery-explosion', 33 | position = event.entity.position 34 | } 35 | ) 36 | 37 | local damage = (1 + event.entity.force.get_ammo_damage_modifier('grenade')) * 250 38 | 39 | damage_entities_around_target(event.entity, damage) 40 | end 41 | 42 | Event.add(defines.events.on_entity_died, on_entity_died) 43 | -------------------------------------------------------------------------------- /maps/fish_defender_v1/vehicle_nanobots.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | 3 | local function on_player_changed_position(event) 4 | if not storage.vehicle_nanobots_unlocked then 5 | return 6 | end 7 | local player = game.players[event.player_index] 8 | if not player.character then 9 | return 10 | end 11 | if not player.character.driving then 12 | return 13 | end 14 | if not player.vehicle then 15 | return 16 | end 17 | if not player.vehicle.valid then 18 | return 19 | end 20 | if player.vehicle.health == player.vehicle.max_health then 21 | return 22 | end 23 | player.vehicle.health = player.vehicle.health + player.vehicle.max_health * 0.005 24 | end 25 | 26 | Event.add(defines.events.on_player_changed_position, on_player_changed_position) 27 | -------------------------------------------------------------------------------- /maps/fish_defender_v2/check_damaged.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local Public = require 'maps.fish_defender_v2.table' 3 | 4 | local function protect_market(entity, cause, final_damage_amount) 5 | if entity.name ~= 'market' then 6 | return 7 | end 8 | if cause then 9 | if cause.force.name == 'enemy' then 10 | return 11 | end 12 | end 13 | entity.health = entity.health + final_damage_amount 14 | return true 15 | end 16 | 17 | Event.add( 18 | defines.events.on_entity_damaged, 19 | function(event) 20 | local entity = event.entity 21 | local cause = event.cause 22 | local final_damage_amount = event.final_damage_amount 23 | 24 | if not entity then 25 | return 26 | end 27 | if not entity.valid then 28 | return 29 | end 30 | 31 | if protect_market(entity, cause, final_damage_amount) then 32 | return 33 | end 34 | 35 | if not cause then 36 | return 37 | end 38 | local explosive_bullets_unlocked = Public.get('explosive_bullets_unlocked') 39 | local bouncy_shells_unlocked = Public.get('bouncy_shells_unlocked') 40 | 41 | if cause.name ~= 'character' then 42 | return 43 | end 44 | 45 | if explosive_bullets_unlocked then 46 | if Public.explosive_bullets(event) then 47 | return 48 | end 49 | end 50 | if bouncy_shells_unlocked then 51 | if Public.bouncy_shells(event) then 52 | return 53 | end 54 | end 55 | end 56 | ) 57 | 58 | return Public 59 | -------------------------------------------------------------------------------- /maps/fish_defender_v2/core.lua: -------------------------------------------------------------------------------- 1 | local Public = require 'maps.fish_defender_v2.table' 2 | 3 | Public[#Public + 1] = require 'maps.fish_defender_v2.b' 4 | Public[#Public + 1] = require 'maps.fish_defender_v2.boss_biters' 5 | Public[#Public + 1] = require 'maps.fish_defender_v2.bouncy_shells' 6 | Public[#Public + 1] = require 'maps.fish_defender_v2.commands' 7 | Public[#Public + 1] = require 'maps.fish_defender_v2.check_damaged' 8 | Public[#Public + 1] = require 'maps.fish_defender_v2.crumbly_walls' 9 | Public[#Public + 1] = require 'maps.fish_defender_v2.explosive_gun_bullets' 10 | Public[#Public + 1] = require 'maps.fish_defender_v2.flame_boots' 11 | Public[#Public + 1] = require 'maps.fish_defender_v2.laser_pointer' 12 | Public[#Public + 1] = require 'maps.fish_defender_v2.market' 13 | Public[#Public + 1] = require 'maps.fish_defender_v2.shotgun_buff' 14 | Public[#Public + 1] = require 'maps.fish_defender_v2.terrain' 15 | Public[#Public + 1] = require 'maps.fish_defender_v2.trapped_capsules' 16 | Public[#Public + 1] = require 'maps.fish_defender_v2.ultra_mines' 17 | Public[#Public + 1] = require 'maps.fish_defender_v2.vehicle_nanobots' 18 | 19 | return Public 20 | -------------------------------------------------------------------------------- /maps/fish_defender_v2/crumbly_walls.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local Public = require 'maps.fish_defender_v2.table' 3 | local random = math.random 4 | 5 | local rock_raffle = { 'big-sand-rock', 'big-rock', 'big-rock', 'big-rock', 'huge-rock' } 6 | 7 | local function on_entity_died(event) 8 | local crumbly_walls_unlocked = Public.get('crumbly_walls_unlocked') 9 | if not crumbly_walls_unlocked then 10 | return 11 | end 12 | local entity = event.entity 13 | if not entity.valid then 14 | return 15 | end 16 | if entity.name ~= 'stone-wall' then 17 | return 18 | end 19 | if random(1, 4) == 1 then 20 | return 21 | end 22 | entity.surface.create_entity({ name = rock_raffle[random(1, #rock_raffle)], position = entity.position, force = 'player' }) 23 | end 24 | 25 | Event.add(defines.events.on_entity_died, on_entity_died) 26 | 27 | return Public 28 | -------------------------------------------------------------------------------- /maps/fish_defender_v2/flame_boots.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local Public = require 'maps.fish_defender_v2.table' 3 | 4 | local function on_player_changed_position(event) 5 | local flame_boots = Public.get('flame_boots') 6 | if not flame_boots then 7 | return 8 | end 9 | local player = game.get_player(event.player_index) 10 | if not (player and player.valid) then 11 | return 12 | end 13 | 14 | if not player.character then 15 | return 16 | end 17 | 18 | if player.character.driving then 19 | return 20 | end 21 | 22 | if not flame_boots[player.index] then 23 | flame_boots[player.index] = {} 24 | end 25 | 26 | if not flame_boots[player.index].fuel then 27 | return 28 | end 29 | 30 | if flame_boots[player.index].fuel < 0 then 31 | player.print('Your flame boots have worn out.', { r = 0.22, g = 0.77, b = 0.44 }) 32 | flame_boots[player.index] = {} 33 | return 34 | end 35 | 36 | if flame_boots[player.index].fuel % 500 == 0 then 37 | player.print('Fuel remaining: ' .. flame_boots[player.index].fuel, { r = 0.22, g = 0.77, b = 0.44 }) 38 | end 39 | 40 | if not flame_boots[player.index].step_history then 41 | flame_boots[player.index].step_history = {} 42 | end 43 | 44 | local elements = #flame_boots[player.index].step_history 45 | 46 | flame_boots[player.index].step_history[elements + 1] = { x = player.physical_position.x, y = player.physical_position.y } 47 | 48 | if elements < 50 then 49 | return 50 | end 51 | 52 | player.surface.create_entity({ name = 'fire-flame', position = flame_boots[player.index].step_history[elements - 2] }) 53 | 54 | flame_boots[player.index].fuel = flame_boots[player.index].fuel - 1 55 | end 56 | 57 | Event.add(defines.events.on_player_changed_position, on_player_changed_position) 58 | 59 | return Public 60 | -------------------------------------------------------------------------------- /maps/fish_defender_v2/laser_pointer.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local Public = require 'maps.fish_defender_v2.table' 3 | local radius = 32 4 | 5 | local function on_player_used_capsule(event) 6 | local laser_pointer_unlocked = Public.get('laser_pointer_unlocked') 7 | if not laser_pointer_unlocked then 8 | return 9 | end 10 | 11 | local player = game.get_player(event.player_index) 12 | local position = event.position 13 | local used_item = event.item 14 | if used_item.name ~= 'artillery-targeting-remote' then 15 | return 16 | end 17 | 18 | for _, unit in pairs(player.surface.find_enemy_units(position, radius, 'player')) do 19 | if math.random(1, 2) == 1 then 20 | unit.set_command( 21 | { 22 | type = defines.command.go_to_location, 23 | destination = position, 24 | radius = 2, 25 | distraction = defines.distraction.none, 26 | pathfind_flags = { 27 | allow_destroy_friendly_entities = false, 28 | prefer_straight_paths = false, 29 | low_priority = false 30 | } 31 | } 32 | ) 33 | end 34 | end 35 | end 36 | 37 | Event.add(defines.events.on_player_used_capsule, on_player_used_capsule) 38 | 39 | return Public 40 | -------------------------------------------------------------------------------- /maps/fish_defender_v2/shotgun_buff.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local Public = require 'maps.fish_defender_v2.table' 3 | local gain_multiplier = 4 4 | 5 | local function on_research_finished(event) 6 | local research = event.research 7 | local force_name = research.force.name 8 | local shotgun_shell_damage_modifier_old = Public.get('shotgun_shell_damage_modifier_old') 9 | 10 | if not shotgun_shell_damage_modifier_old[force_name] then 11 | shotgun_shell_damage_modifier_old[force_name] = game.forces[force_name].get_ammo_damage_modifier('shotgun-shell') - 0.1 12 | end 13 | 14 | if string.sub(research.name, 0, 26) == 'physical-projectile-damage' then 15 | local current_damage = game.forces[force_name].get_ammo_damage_modifier('shotgun-shell') 16 | local vanilla_gain = current_damage - shotgun_shell_damage_modifier_old[force_name] 17 | local additional_gain = vanilla_gain * (gain_multiplier - 1) 18 | game.forces[force_name].set_ammo_damage_modifier('shotgun-shell', current_damage + additional_gain) 19 | end 20 | 21 | shotgun_shell_damage_modifier_old[force_name] = game.forces[force_name].get_ammo_damage_modifier('shotgun-shell') 22 | end 23 | 24 | local function on_init() 25 | game.forces.player.set_ammo_damage_modifier('shotgun-shell', 1) 26 | end 27 | 28 | Event.on_init(on_init) 29 | Event.add(defines.events.on_research_finished, on_research_finished) 30 | 31 | return Public 32 | -------------------------------------------------------------------------------- /maps/fish_defender_v2/ultra_mines.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local Public = require 'maps.fish_defender_v2.table' 3 | local radius = 8 4 | 5 | local function damage_entities_around_target(entity, damage) 6 | for _, e in pairs( 7 | entity.surface.find_entities_filtered( 8 | { 9 | area = { 10 | {entity.position.x - radius, entity.position.y - radius}, 11 | {entity.position.x + radius, entity.position.y + radius} 12 | } 13 | } 14 | ) 15 | ) do 16 | if e.health then 17 | if e.force.name ~= 'player' then 18 | local distance_from_center = math.sqrt((e.position.x - entity.position.x) ^ 2 + (e.position.y - entity.position.y) ^ 2) 19 | if distance_from_center <= radius then 20 | e.damage(damage, 'player', 'explosion') 21 | end 22 | end 23 | end 24 | end 25 | end 26 | 27 | local function on_entity_died(event) 28 | local ultra_mines_unlocked = Public.get('ultra_mines_unlocked') 29 | if not ultra_mines_unlocked then 30 | return 31 | end 32 | local entity = event.entity 33 | if not entity.valid then 34 | return 35 | end 36 | 37 | if entity.name ~= 'land-mine' then 38 | return 39 | end 40 | 41 | entity.surface.create_entity( 42 | { 43 | name = 'big-artillery-explosion', 44 | position = entity.position 45 | } 46 | ) 47 | 48 | local damage = (1 + entity.force.get_ammo_damage_modifier('grenade')) * 250 49 | 50 | damage_entities_around_target(entity, damage) 51 | end 52 | 53 | Event.add(defines.events.on_entity_died, on_entity_died) 54 | 55 | return Public 56 | -------------------------------------------------------------------------------- /maps/fish_defender_v2/vehicle_nanobots.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local Public = require 'maps.fish_defender_v2.table' 3 | 4 | local function on_player_changed_position(event) 5 | local vehicle_nanobots_unlocked = Public.get('vehicle_nanobots_unlocked') 6 | 7 | if not vehicle_nanobots_unlocked then 8 | return 9 | end 10 | local player = game.get_player(event.player_index) 11 | if not (player and player.valid) then 12 | return 13 | end 14 | 15 | if not player.character then 16 | return 17 | end 18 | 19 | if not player.character.driving then 20 | return 21 | end 22 | if not (player.vehicle and player.vehicle.valid) then 23 | return 24 | end 25 | 26 | if player.vehicle.health == player.vehicle.max_health then 27 | return 28 | end 29 | player.vehicle.health = player.vehicle.health + player.vehicle.max_health * 0.005 30 | end 31 | 32 | Event.add(defines.events.on_player_changed_position, on_player_changed_position) 33 | 34 | return Public 35 | -------------------------------------------------------------------------------- /maps/junkyard_pvp/share_chat.lua: -------------------------------------------------------------------------------- 1 | ----------share chat with spectator force------------------- 2 | local function on_console_chat(event) 3 | if not event.message then 4 | return 5 | end 6 | if not event.player_index then 7 | return 8 | end 9 | local player = game.players[event.player_index] 10 | 11 | local color = player.color 12 | color.r = color.r * 0.6 + 0.35 13 | color.g = color.g * 0.6 + 0.35 14 | color.b = color.b * 0.6 + 0.35 15 | color.a = 1 16 | 17 | if player.force.name == 'west' then 18 | game.forces.spectator.print(player.name .. ' (west): ' .. event.message, color) 19 | end 20 | if player.force.name == 'east' then 21 | game.forces.spectator.print(player.name .. ' (east): ' .. event.message, color) 22 | end 23 | if player.force.name == 'spectator' then 24 | game.forces.west.print(player.name .. ' (spectator): ' .. event.message, color) 25 | game.forces.east.print(player.name .. ' (spectator): ' .. event.message, color) 26 | end 27 | end 28 | 29 | local event = require 'utils.event' 30 | event.add(defines.events.on_console_chat, on_console_chat) 31 | -------------------------------------------------------------------------------- /maps/junkyard_pvp/surrounded_by_worms.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local math_random = math.random 3 | local turrets = { 4 | [1] = 'small-worm-turret', 5 | [2] = 'medium-worm-turret', 6 | [3] = 'big-worm-turret', 7 | [4] = 'behemoth-worm-turret' 8 | } 9 | 10 | local tile_coords = {} 11 | for x = 0, 31, 1 do 12 | for y = 0, 31, 1 do 13 | tile_coords[#tile_coords + 1] = {x, y} 14 | end 15 | end 16 | 17 | local function on_chunk_generated(event) 18 | local surface = event.surface 19 | if surface.name ~= 'mirror_terrain' then 20 | return 21 | end 22 | local starting_distance = surface.map_gen_settings.starting_area * 200 23 | local left_top = event.area.left_top 24 | local chunk_distance_to_center = math.sqrt(left_top.x ^ 2 + left_top.y ^ 2) 25 | if starting_distance > chunk_distance_to_center then 26 | return 27 | end 28 | 29 | local highest_worm_tier = math.floor((chunk_distance_to_center - starting_distance) * 0.0025) + 1 30 | if highest_worm_tier > 4 then 31 | highest_worm_tier = 4 32 | end 33 | 34 | for _ = 1, 4, 1 do 35 | local coord_modifier = tile_coords[math_random(1, #tile_coords)] 36 | local pos = {left_top.x + coord_modifier[1], left_top.y + coord_modifier[2]} 37 | local name = turrets[math_random(1, highest_worm_tier)] 38 | local position = surface.find_non_colliding_position('big-worm-turret', pos, 8, 1) 39 | if position then 40 | surface.create_entity({name = name, position = position, force = 'enemy'}) 41 | end 42 | end 43 | end 44 | 45 | Event.add(defines.events.on_chunk_generated, on_chunk_generated) 46 | -------------------------------------------------------------------------------- /maps/mountain_fortress_v2/flamethrower_nerf.lua: -------------------------------------------------------------------------------- 1 | --Flamethrower Turret Nerf 2 | local function on_research_finished(event) 3 | local research = event.research 4 | local force_name = research.force.name 5 | if research.name == 'military' then 6 | if not storage.flamethrower_damage then 7 | storage.flamethrower_damage = {} 8 | end 9 | storage.flamethrower_damage[force_name] = -0.65 10 | game.forces[force_name].set_turret_attack_modifier('flamethrower-turret', storage.flamethrower_damage[force_name]) 11 | game.forces[force_name].set_ammo_damage_modifier('flamethrower', storage.flamethrower_damage[force_name]) 12 | end 13 | 14 | if string.sub(research.name, 0, 18) == 'refined-flammables' then 15 | storage.flamethrower_damage[force_name] = storage.flamethrower_damage[force_name] + 0.10 16 | game.forces[force_name].set_turret_attack_modifier('flamethrower-turret', storage.flamethrower_damage[force_name]) 17 | game.forces[force_name].set_ammo_damage_modifier('flamethrower', storage.flamethrower_damage[force_name]) 18 | end 19 | end 20 | 21 | local event = require 'utils.event' 22 | event.add(defines.events.on_research_finished, on_research_finished) 23 | -------------------------------------------------------------------------------- /maps/mountain_fortress_v3/icw/commands.lua: -------------------------------------------------------------------------------- 1 | local ICW_Func = require 'maps.mountain_fortress_v3.icw.functions' 2 | local Public = require 'maps.mountain_fortress_v3.table' 3 | local Discord = require 'utils.discord_handler' 4 | local Commands = require 'utils.commands' 5 | local mapkeeper = '[color=blue]Mapkeeper:[/color]' 6 | 7 | Commands.new('icw_reconnect_train', 'Usable only for admins - reconnects all trains!') 8 | :require_admin() 9 | :require_validation() 10 | :callback( 11 | function (player) 12 | local suc = ICW_Func.reconstruct_all_trains(true) 13 | Discord.send_notification_raw(Public.discord_name, player.name .. ' is reconnecting all trains via icw module.') 14 | if suc then 15 | player.print(mapkeeper .. 'All trains have been reconnected!') 16 | else 17 | player.print(mapkeeper .. 'Failed to reconnect all trains!') 18 | end 19 | return true 20 | end 21 | ) 22 | -------------------------------------------------------------------------------- /maps/mountain_fortress_v3/surface_id.lua: -------------------------------------------------------------------------------- 1 | local surface_name = 'fortress' 2 | 3 | return surface_name 4 | -------------------------------------------------------------------------------- /maps/mountain_race/gui.lua: -------------------------------------------------------------------------------- 1 | local Public = {} 2 | 3 | function Public.create_top_gui(player) 4 | local element = player.gui.top.mountain_race 5 | if element then 6 | return 7 | end 8 | element = player.gui.top.add({type = 'frame', name = 'mountain_race', direction = 'horizontal'}) 9 | element.style.maximal_height = 38 10 | 11 | local team = element.add({type = 'label', caption = 'Loading...'}) 12 | team.style.font = 'heading-2' 13 | local text = element.add({type = 'label'}) 14 | text.style.font = 'heading-2' 15 | text.style.font_color = {225, 225, 225} 16 | end 17 | 18 | local function get_status_string(mountain_race) 19 | local north = mountain_race.locomotives.north 20 | local south = mountain_race.locomotives.south 21 | 22 | if not north then 23 | return {{255, 65, 65}, 'SOUTH', ' has won the race!'} 24 | end 25 | if not south then 26 | return {{75, 75, 255}, 'NORTH', ' has won the race!'} 27 | end 28 | 29 | local distance = math.floor(math.abs(north.position.x - south.position.x)) 30 | if distance == 0 then 31 | return {{200, 200, 0}, 'Teams', ' are equal'} 32 | end 33 | 34 | if north.position.x > south.position.x then 35 | return {{75, 75, 255}, 'NORTH', ' is ' .. distance .. ' units in the lead'} 36 | else 37 | return {{255, 65, 65}, 'SOUTH', ' is ' .. distance .. ' units in the lead'} 38 | end 39 | end 40 | 41 | function Public.update_top_gui(mountain_race) 42 | local status = get_status_string(mountain_race) 43 | for _, player in pairs(game.connected_players) do 44 | local element = player.gui.top.mountain_race 45 | if element and element.valid then 46 | element.children[1].style.font_color = status[1] 47 | element.children[1].caption = status[2] 48 | element.children[2].caption = status[3] 49 | end 50 | end 51 | end 52 | 53 | return Public 54 | -------------------------------------------------------------------------------- /maps/native_war/share_chat.lua: -------------------------------------------------------------------------------- 1 | --luacheck: ignore 2 | ----------share chat with spectator force------------------- 3 | local function on_console_chat(event) 4 | if not event.message then 5 | return 6 | end 7 | if not event.player_index then 8 | return 9 | end 10 | local player = game.players[event.player_index] 11 | 12 | local color = {} 13 | color = player.color 14 | color.r = color.r * 0.6 + 0.35 15 | color.g = color.g * 0.6 + 0.35 16 | color.b = color.b * 0.6 + 0.35 17 | color.a = 1 18 | 19 | if player.force.name == 'west' then 20 | game.forces.spectator.print(player.name .. ' (west): ' .. event.message, color) 21 | end 22 | if player.force.name == 'east' then 23 | game.forces.spectator.print(player.name .. ' (east): ' .. event.message, color) 24 | end 25 | if player.force.name == 'spectator' then 26 | game.forces.west.print(player.name .. ' (spectator): ' .. event.message, color) 27 | game.forces.east.print(player.name .. ' (spectator): ' .. event.message, color) 28 | end 29 | end 30 | 31 | local event = require 'utils.event' 32 | event.add(defines.events.on_console_chat, on_console_chat) 33 | -------------------------------------------------------------------------------- /maps/pirates/gui/color.lua: -------------------------------------------------------------------------------- 1 | ---@diagnostic disable: inject-field 2 | -- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/ComfyFactory/ComfyFactorio and https://github.com/danielmartin0/ComfyFactorio-Pirates. 3 | 4 | -- local Memory = require 'maps.pirates.memory' 5 | -- local Utils = require 'maps.pirates.utils_local' 6 | -- local Math = require 'maps.pirates.math' 7 | local GuiCommon = require('maps.pirates.gui.common') 8 | local PlayerColors = require('maps.pirates.player_colors') 9 | local Public = {} 10 | 11 | local window_name = 'color' 12 | 13 | function Public.toggle_window(player) 14 | local flow, flow2 15 | 16 | if player.gui.screen[window_name .. '_piratewindow'] then 17 | player.gui.screen[window_name .. '_piratewindow'].destroy() 18 | return 19 | end 20 | 21 | flow = GuiCommon.new_window(player, window_name) 22 | flow.caption = 'Colors!' 23 | flow.style.width = 500 24 | flow.style.height = 500 25 | 26 | -- local label = '' 27 | -- for i, v in ipairs(PlayerColors.names) do 28 | -- if i>1 then label = label .. ', ' end 29 | -- local c = PlayerColors.colors[v] 30 | -- label = label .. ', [color=' .. c.r .. ',' .. c.g .. ',' .. c.b .. ']' .. v .. '[/color]' 31 | -- -- label = label .. v 32 | -- end 33 | -- log(label) 34 | 35 | flow2 = flow.add({ 36 | name = 'colors', 37 | type = 'text-box', 38 | text = PlayerColors.printable, 39 | }) 40 | flow2.word_wrap = true 41 | flow2.read_only = true 42 | flow2.selectable = true 43 | flow2.style.width = 450 44 | flow2.style.height = 400 45 | 46 | GuiCommon.flow_add_close_button(flow, window_name .. '_piratebutton') 47 | end 48 | 49 | -- function Public.regular_update(player) 50 | 51 | -- end 52 | 53 | function Public.full_update(player) 54 | if Public.regular_update then 55 | Public.regular_update(player) 56 | end 57 | end 58 | 59 | -- function Public.click(event) 60 | -- end 61 | 62 | return Public 63 | -------------------------------------------------------------------------------- /maps/pirates/noise_pregen/noise_pregen.lua: -------------------------------------------------------------------------------- 1 | local Public = {} 2 | 3 | -- no longer using the below code 4 | Public.encoding = [[!#$%&'()*+'-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ/^_`abcdefghijklmnopqrstuvwxyz{}|~]] 5 | Public.encoding_length = 91 6 | Public.enc = {} 7 | Public.dec = {} 8 | for i = 1, Public.encoding_length do 9 | Public.enc[i] = Public.encoding:sub(i, i) 10 | Public.dec[Public.encoding:sub(i, i)] = i 11 | end 12 | 13 | Public.island1 = {} 14 | Public.island1.Data = 15 | require('maps.pirates.noise_pregen.perlinwavelength100boxsize1000octaves5gain0p8lacunity2lengthpower1rms0p05423') 16 | Public.island1.upperscale = 100 17 | Public.island1.boxsize = 1000 18 | Public.island1.wordlength = 5 19 | Public.island1.factor = 0.1925 / 0.05423 20 | 21 | Public.forest1 = {} 22 | Public.forest1.Data = require( 23 | 'maps.pirates.noise_pregen.simplexwavelength100boxsize1000octaves5gain0p65lacunity2lengthpower1p2rms0p06243' 24 | ) 25 | Public.forest1.upperscale = 100 26 | Public.forest1.boxsize = 1000 27 | Public.forest1.wordlength = 5 28 | Public.forest1.factor = 0.1925 / 0.06243 29 | 30 | return Public 31 | -------------------------------------------------------------------------------- /maps/pirates/structures/boats/merchant_1/merchant_1.lua: -------------------------------------------------------------------------------- 1 | -- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/ComfyFactory/ComfyFactorio and https://github.com/danielmartin0/ComfyFactorio-Pirates. 2 | 3 | -- local Data = require 'maps.pirates.structures.boats.merchant_1.data' 4 | 5 | local Public = {} 6 | Public.Data = require('maps.pirates.structures.boats.merchant_1.data') 7 | 8 | return Public 9 | -------------------------------------------------------------------------------- /maps/pirates/structures/boats/raft/data.lua: -------------------------------------------------------------------------------- 1 | -- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/ComfyFactory/ComfyFactorio and https://github.com/danielmartin0/ComfyFactorio-Pirates. 2 | 3 | local Public = {} 4 | 5 | Public.display_name = 'raft' 6 | Public.capacity = 11 7 | Public.tile_areas = { 8 | { { -9, -4 }, { 0, 5 } }, 9 | } 10 | Public.width = 9 11 | Public.height = 9 12 | Public.spawn_point = { x = -3, y = 0 } 13 | Public.areas_infront = { 14 | { { 0, -4 }, { 1, 5 } }, 15 | } 16 | Public.areas_behind = { 17 | { { -10, -4 }, { -9, 5 } }, 18 | } 19 | Public.areas_offright = { 20 | { { -9, 5 }, { 0, 6 } }, 21 | } 22 | Public.areas_offleft = { 23 | { { -9, -5 }, { 0, -4 } }, 24 | } 25 | Public.entities = { 26 | inaccessible = { --this 'left wall' stops biters from being deleted by water 27 | pos = { x = -8.5, y = 0 }, 28 | bp_str = [[0eNqV08sOwiAQBdB/mTU1ltIXv2KMqXZSSdqhKfhoDP9uQRcmsmF5k7mHWQwvOI83nBdFFuQLDHVzZnU2LKr3+QkyZ7CCbB0DddFkQB62MTVQN/oBu84IEpTFCRhQN/n00LpHyi5XNBZ8kXr0kjsyQLLKKvw4Iawnuk1nXMJTMYHBrM1W0vRdab8rw1L5rnSO/TE8kdnHmSKRKeKMSGR4nCkTmTLOVImMiDN1IlPHmSaRqeJMm8g0ntluMVyt/PkBDO64mFDgTS7qlteiqETLG+fekGkHZg==]], 29 | }, 30 | } 31 | 32 | Public.landingtrack = { 33 | offset = { x = -3, y = 0 }, 34 | bp = [[0eNqV2M1qwkAUhuF7mXUEz/wnt1JcpDrIgE5CMi0Vyb3XqIsu2uK7ksCXCXm+s/Dkqt5PH2mccqmqu6q59OOmDpvjlA/r9ZfqRDfqcvtxS6Pyfiiz6t5uwXws/WmN1MuYVKdyTWfVqNKf16tbbj+lmtR6Uzmk9Zxl16iaT+lxwDjMueahPJ+yvT9ku/x2wh9hIWGNTmZpg9L2tbQQECEgQkAEgQgCEQSiCYgmIJqAaASiEYhGIIaAGAJiCIhBIAaBGARiCYglIJaAWARiEYhFII6AOALiCIhDIA6BOATiCYgnIJ6AeATiEYhHIIGABAISCEhAIAGBBAQSCUgkIJGARAQSEUhEIC0BaQlIS0AeYUPC6AUdCXsSDiQcSbhFpbAKUYeCShTU4sv/l9EGIWiFELRDPNMGpdlbOpT2KB1QOqJ0y9qBZbI2hdUprM+Xx5bteWzRY5ueoLEVNLaCxlbQ2AoaW0FjK2hshY2tsLGFqzjcxf9bxnfN4/NO9+NjUaM+0zTfD9BRbGh1cM5aF/yyfAPSTNjI]], 35 | } 36 | 37 | return Public 38 | -------------------------------------------------------------------------------- /maps/pirates/structures/boats/raft/raft.lua: -------------------------------------------------------------------------------- 1 | -- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/ComfyFactory/ComfyFactorio and https://github.com/danielmartin0/ComfyFactorio-Pirates. 2 | 3 | -- local Data = require 'maps.pirates.structures.boats.raft.data' 4 | 5 | local Public = {} 6 | Public.Data = require('maps.pirates.structures.boats.raft.data') 7 | 8 | return Public 9 | -------------------------------------------------------------------------------- /maps/pirates/structures/boats/raft_large/raft_large.lua: -------------------------------------------------------------------------------- 1 | -- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/ComfyFactory/ComfyFactorio and https://github.com/danielmartin0/ComfyFactorio-Pirates. 2 | 3 | -- local Data = require 'maps.pirates.structures.boats.raft_large.data' 4 | 5 | local Public = {} 6 | Public.Data = require('maps.pirates.structures.boats.raft_large.data') 7 | 8 | return Public 9 | -------------------------------------------------------------------------------- /maps/pirates/structures/boats/sloop/sloop.lua: -------------------------------------------------------------------------------- 1 | -- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/ComfyFactory/ComfyFactorio and https://github.com/danielmartin0/ComfyFactorio-Pirates. 2 | 3 | -- local Data = require 'maps.pirates.structures.boats.sloop.data' 4 | 5 | local Public = {} 6 | Public.Data = require('maps.pirates.structures.boats.sloop.data') 7 | 8 | return Public 9 | -------------------------------------------------------------------------------- /maps/pirates/structures/island_structures/island_structures.lua: -------------------------------------------------------------------------------- 1 | -- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/ComfyFactory/ComfyFactorio and https://github.com/danielmartin0/ComfyFactorio-Pirates. 2 | 3 | -- local Memory = require 'maps.pirates.memory' 4 | -- local Math = require 'maps.pirates.math' 5 | -- local Balance = require 'maps.pirates.balance' 6 | -- local Common = require 'maps.pirates.common' 7 | -- local Utils = require 'maps.pirates.utils_local' 8 | local _inspect = require('utils.inspect').inspect 9 | 10 | local Public = {} 11 | local enum = { 12 | MATTISSO = 'MATTISSO', 13 | ROC = 'ROC', 14 | } 15 | Public[enum.MATTISSO] = require('maps.pirates.structures.island_structures.mattisso.mattisso') 16 | Public[enum.ROC] = require('maps.pirates.structures.island_structures.roc.roc') 17 | Public.enum = enum 18 | 19 | return Public 20 | -------------------------------------------------------------------------------- /maps/pirates/structures/island_structures/roc/roc.lua: -------------------------------------------------------------------------------- 1 | -- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/ComfyFactory/ComfyFactorio and https://github.com/danielmartin0/ComfyFactorio-Pirates. 2 | 3 | local Data = require('maps.pirates.structures.island_structures.roc.data') 4 | 5 | local Public = {} 6 | Public.shelter1 = {} 7 | Public.shelter1.Data = Data.shelter1 8 | Public.shelter2 = {} 9 | Public.shelter2.Data = Data.shelter2 10 | 11 | Public.lonely_storage_tank = {} 12 | Public.lonely_storage_tank.Data = Data.lonely_storage_tank 13 | Public.swamp_lonely_storage_tank = {} 14 | Public.swamp_lonely_storage_tank.Data = Data.swamp_lonely_storage_tank 15 | Public.maze_labs = {} 16 | Public.maze_labs.Data = Data.maze_labs 17 | Public.maze_defended_camp = {} 18 | Public.maze_defended_camp.Data = Data.maze_defended_camp 19 | Public.maze_undefended_camp = {} 20 | Public.maze_undefended_camp.Data = Data.maze_undefended_camp 21 | Public.maze_mines = {} 22 | Public.maze_mines.Data = Data.maze_mines 23 | Public.maze_worms = {} 24 | Public.maze_worms.Data = Data.maze_worms 25 | Public.maze_belts_1 = {} 26 | Public.maze_belts_1.Data = Data.maze_belts_1 27 | Public.maze_belts_2 = {} 28 | Public.maze_belts_2.Data = Data.maze_belts_2 29 | Public.maze_belts_3 = {} 30 | Public.maze_belts_3.Data = Data.maze_belts_3 31 | Public.maze_belts_4 = {} 32 | Public.maze_belts_4.Data = Data.maze_belts_4 33 | Public.maze_treasure = {} 34 | Public.maze_treasure.Data = Data.maze_treasure 35 | 36 | return Public 37 | -------------------------------------------------------------------------------- /maps/pirates/surfaces/channel/channel.lua: -------------------------------------------------------------------------------- 1 | -- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/ComfyFactory/ComfyFactorio and https://github.com/danielmartin0/ComfyFactorio-Pirates. 2 | 3 | -- local Memory = require 'maps.pirates.memory' 4 | -- local Math = require 'maps.pirates.math' 5 | -- local Balance = require 'maps.pirates.balance' 6 | -- local Structures = require 'maps.pirates.structures.structures' 7 | -- local Boats = require 'maps.pirates.structures.boats.boats' 8 | -- local Common = require 'maps.pirates.common' 9 | -- local Utils = require 'maps.pirates.utils_local' 10 | local _inspect = require('utils.inspect').inspect 11 | 12 | local Public = {} 13 | Public.Data = require('maps.pirates.surfaces.channel.data') 14 | 15 | Public.info = { 16 | display_name = 'Channel', 17 | } 18 | 19 | function Public.terrain(args) 20 | if (args.p.y > 30 or args.p.y < -20) and args.p.x > -80 and args.p.x < 80 then 21 | args.tiles[#args.tiles + 1] = { name = 'sand-1', position = args.p } 22 | else 23 | args.tiles[#args.tiles + 1] = { name = 'deepwater', position = args.p } 24 | end 25 | end 26 | 27 | function Public.chunk_structures() 28 | return nil 29 | end 30 | 31 | return Public 32 | -------------------------------------------------------------------------------- /maps/pirates/surfaces/channel/data.lua: -------------------------------------------------------------------------------- 1 | -- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/ComfyFactory/ComfyFactorio and https://github.com/danielmartin0/ComfyFactorio-Pirates. 2 | 3 | -- local Common = require 'maps.pirates.common' 4 | -- local Utils = require 'maps.pirates.utils_local' 5 | 6 | local Public = {} 7 | 8 | Public.width = 384 9 | Public.height = 384 10 | Public.extra_water_on_left = 96 11 | 12 | Public.noiseparams = {} 13 | 14 | return Public 15 | -------------------------------------------------------------------------------- /maps/pirates/surfaces/islands/cave/data.lua: -------------------------------------------------------------------------------- 1 | -- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/ComfyFactory/ComfyFactorio and https://github.com/danielmartin0/ComfyFactorio-Pirates. 2 | 3 | local Public = {} 4 | 5 | Public.display_names = { { 'pirates.location_displayname_cave_1' } } 6 | 7 | Public.terraingen_frame_width = 640 8 | Public.terraingen_frame_height = 640 9 | Public.static_params_default = { 10 | decorative_preset = 'nauvis', 11 | base_starting_treasure = 1000, 12 | base_starting_rock_material = 800, 13 | base_starting_wood = 1200, 14 | base_starting_treasure_maps = 0, 15 | starting_time_of_day = 0.43, 16 | daynightcycletype = 1, 17 | brightness_visual_weights = { 0.92, 0.92, 0.92 }, 18 | min_brightness = 0.08, 19 | } 20 | 21 | -- Here we set values somewhat higher, because getting all resources requires work and bit of luck (island needs enough rock) 22 | function Public.base_ores() 23 | return { 24 | ['copper-ore'] = 3.3, 25 | ['iron-ore'] = 7.7, 26 | ['coal'] = 5.5, 27 | ['stone'] = 3.3, 28 | ['uranium-ore'] = 0.6, 29 | } 30 | end 31 | 32 | function Public.spawn_fish(args) 33 | if math.random(1, 32) == 1 then 34 | args.entities[#args.entities + 1] = { name = 'fish', position = args.p } 35 | end 36 | end 37 | 38 | return Public 39 | -------------------------------------------------------------------------------- /maps/pirates/surfaces/islands/island_enum.lua: -------------------------------------------------------------------------------- 1 | -- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/ComfyFactory/ComfyFactorio and https://github.com/danielmartin0/ComfyFactorio-Pirates. 2 | 3 | local Public = {} 4 | 5 | local enum = { 6 | STANDARD = '1', 7 | FIRST = '2', 8 | WALKWAYS = '3', 9 | RED_DESERT = '4', 10 | RADIOACTIVE = '5', 11 | STANDARD_VARIANT = '6', 12 | HORSESHOE = '7', 13 | SWAMP = '8', 14 | MAZE = '9', 15 | CAVE = '10', 16 | CAVE_SOURCE = '11', -- Used as extra layer for cave island 17 | } 18 | Public.enum = enum 19 | 20 | return Public 21 | -------------------------------------------------------------------------------- /maps/pirates/surfaces/islands/maze/data.lua: -------------------------------------------------------------------------------- 1 | -- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/ComfyFactory/ComfyFactorio and https://github.com/danielmartin0/ComfyFactorio-Pirates. 2 | 3 | -- local Common = require 'maps.pirates.common' 4 | -- local Utils = require 'maps.pirates.utils_local' 5 | -- local Math = require 'maps.pirates.math' 6 | 7 | local Public = {} 8 | 9 | Public.display_names = { { 'pirates.location_displayname_maze_1' } } 10 | 11 | Public.terraingen_frame_width = 896 12 | Public.terraingen_frame_height = 896 13 | Public.static_params_default = { 14 | starting_time_of_day = 0, 15 | daynightcycletype = 1, 16 | decorative_preset = 'nauvis', 17 | base_starting_treasure = 1000, 18 | base_starting_rock_material = 800, 19 | base_starting_wood = 1200, 20 | base_starting_treasure_maps = 3, 21 | } 22 | 23 | function Public.base_ores() 24 | return { 25 | ['copper-ore'] = 3.5, 26 | ['iron-ore'] = 6.5, 27 | ['coal'] = 4, 28 | ['stone'] = 2.0, 29 | ['crude-oil'] = 30, 30 | } 31 | end 32 | 33 | local rscale = 240 34 | -- local hscale = 0.1 35 | Public.noiseparams = { 36 | radius = { 37 | type = 'simplex_2d', 38 | normalised = false, 39 | params = { 40 | { wavelength = 0, amplitude = rscale * 1 }, 41 | { wavelength = 1.6, amplitude = rscale * 0.15 }, 42 | }, 43 | }, 44 | 45 | maze = { 46 | type = 'simplex_2d', 47 | normalised = true, 48 | params = { 49 | { wavelength = 250, amplitude = 70 }, 50 | { wavelength = 50, amplitude = 20 }, 51 | }, 52 | }, 53 | } 54 | 55 | return Public 56 | -------------------------------------------------------------------------------- /maps/pitch_black/blood_moon.lua: -------------------------------------------------------------------------------- 1 | local Public = {} 2 | 3 | local get_noise = require 'utils.math.get_noise' 4 | local math_abs = math.abs 5 | local math_round = math.round 6 | 7 | function Public.set_daytime(surface, tick) 8 | local noise = get_noise('n1', { x = tick * 1, y = 0 }, surface.map_gen_settings.seed) 9 | local daytime = math_abs(math_round(noise, 5)) 10 | 11 | local brightness_modifier = 1.55 - daytime * 1.5 12 | if brightness_modifier < 0 then 13 | brightness_modifier = 0 14 | end 15 | if brightness_modifier > 1 then 16 | brightness_modifier = 1 17 | end 18 | 19 | if noise > 0 then 20 | surface.brightness_visual_weights = { 1, brightness_modifier, 1 } 21 | else 22 | surface.brightness_visual_weights = { brightness_modifier, 1, 1 } 23 | end 24 | 25 | storage.daytime = daytime 26 | 27 | if daytime > 0.55 then 28 | daytime = 0.55 29 | end 30 | surface.daytime = daytime 31 | end 32 | 33 | return Public 34 | -------------------------------------------------------------------------------- /maps/pitch_black/gui.lua: -------------------------------------------------------------------------------- 1 | local Public = {} 2 | 3 | local tooltip = 'Difficulty increases with higher score.' 4 | 5 | local function create_score_gui(player) 6 | local frame = player.gui.left.add({ type = 'frame', name = 'pitch_black_score', direction = 'vertical' }) 7 | local t = frame.add({ type = 'table', column_count = 2 }) 8 | 9 | frame.tooltip = tooltip 10 | t.tooltip = tooltip 11 | 12 | local element = t.add({ type = 'label', caption = 'Score: ' }) 13 | element.style.font = 'heading-1' 14 | element.style.font_color = { 175, 175, 200 } 15 | element.style.horizontal_align = 'right' 16 | element.style.maximal_width = 56 17 | element.style.minimal_width = 56 18 | element.tooltip = tooltip 19 | 20 | element = t.add({ type = 'label', caption = 0 }) 21 | element.style.font = 'heading-1' 22 | element.style.font_color = { 100, 0, 255 } 23 | element.style.horizontal_align = 'left' 24 | element.style.minimal_width = 32 25 | element.tooltip = tooltip 26 | 27 | return frame 28 | end 29 | 30 | local function update_score_gui(player) 31 | local frame = player.gui.left.pitch_black_score 32 | if not player.gui.left.pitch_black_score then 33 | frame = create_score_gui(player) 34 | end 35 | 36 | local frame_table = frame.children[1] 37 | 38 | local score_value = frame_table.children[2] 39 | score_value.caption = storage.map_score 40 | end 41 | 42 | function Public.update() 43 | for _, player in pairs(game.connected_players) do 44 | update_score_gui(player) 45 | end 46 | end 47 | 48 | return Public 49 | -------------------------------------------------------------------------------- /maps/pitch_black/main.lua: -------------------------------------------------------------------------------- 1 | require 'modules.biter_reanimator' 2 | 3 | local Blood_moon = require 'maps.pitch_black.blood_moon' 4 | local Gui = require 'maps.pitch_black.gui' 5 | local Difficulty = require 'maps.pitch_black.difficulty' 6 | 7 | local function on_entity_died(event) 8 | local entity = event.entity 9 | if not entity.valid then 10 | return 11 | end 12 | local cause = event.cause 13 | Difficulty.fleeing_biteys(entity, cause) 14 | Difficulty.add_score(entity) 15 | end 16 | 17 | local function on_tick() 18 | local tick = game.tick 19 | if tick % 2 ~= 0 then 20 | return 21 | end 22 | 23 | local surface = game.surfaces[1] 24 | 25 | Blood_moon.set_daytime(surface, tick) 26 | 27 | if tick % 30 ~= 0 then 28 | return 29 | end 30 | Difficulty.set_daytime_difficulty(surface, tick) 31 | Difficulty.set_biter_difficulty() 32 | 33 | Gui.update() 34 | end 35 | 36 | local function on_init() 37 | local surface = game.surfaces[1] 38 | 39 | surface.freeze_daytime = true 40 | surface.min_brightness = 0 41 | 42 | storage.daytime = 0 43 | storage.map_score = 0 44 | end 45 | 46 | local Event = require 'utils.event' 47 | Event.add(defines.events.on_entity_died, on_entity_died) 48 | Event.add(defines.events.on_tick, on_tick) 49 | Event.on_init(on_init) 50 | -------------------------------------------------------------------------------- /maps/planet_prison/bp/player_ship.lua: -------------------------------------------------------------------------------- 1 | return '{"blueprint":{"icons":[{"signal":{"type":"item","name":"crash-site-spaceship-wreck-medium-1"},"index":1},{"signal":{"type":"item","name":"crash-site-spaceship-wreck-big-1"},"index":2}],"entities":[{"entity_number":1,"name":"crash-site-spaceship-wreck-big-2","position":{"x":3,"y":-3.5}},{"entity_number":2,"name":"crash-site-spaceship-wreck-medium-3","position":{"x":-2,"y":-1}},{"entity_number":3,"name":"crash-site-chest-1","position":{"x":4,"y":-1}},{"entity_number":4,"name":"crash-site-chest-2","position":{"x":-3,"y":3}},{"entity_number":5,"name":"assembling-machine-1","position":{"x":-2,"y":-5},"revoke_minable":"true"}, {"entity_number":6,"name":"small-electric-pole","position":{"x":-4,"y":-6}}, {"entity_number":7,"name":"burner-generator","position":{"x":-6,"y":-6},"fill":{"name":"coal","count":"50"},"revoke_minable":"true", "operable":"false"}],"item":"blueprint","version":73019621376}}' 2 | -------------------------------------------------------------------------------- /maps/planet_prison/mod/afk.lua: -------------------------------------------------------------------------------- 1 | local Public = {} 2 | 3 | --[[ 4 | on_inactive_players - Performs operation on inactive players from the game 5 | if they exceed time. 6 | @param time - Maximum time a player can be inactive. 7 | --]] 8 | Public.on_inactive_players = function (time) 9 | if not time then 10 | time = 60 11 | end 12 | 13 | for _, p in pairs(game.connected_players) do 14 | local afk = p.afk_time 15 | time = time * 60 * 60 16 | if afk >= time then 17 | game.kick_player(p, 'Kicked by script') 18 | end 19 | end 20 | end 21 | 22 | return Public 23 | -------------------------------------------------------------------------------- /maps/scrap_towny_ffa/fish_reproduction.lua: -------------------------------------------------------------------------------- 1 | local ScenarioTable = require 'maps.scrap_towny_ffa.table' 2 | 3 | local Public = {} 4 | local math_random = math.random 5 | local math_floor = math.floor 6 | 7 | function Public.reproduce() 8 | local this = ScenarioTable.get_table() 9 | for _, town_center in pairs(this.town_centers) do 10 | if not town_center then 11 | return 12 | end 13 | 14 | if not town_center.market or not town_center.market.valid then 15 | return 16 | end 17 | 18 | local surface = town_center.market.surface 19 | local position = town_center.market.position 20 | local fishes = surface.find_entities_filtered({name = 'fish', position = position, radius = 27}) 21 | if #fishes == 0 then 22 | return 23 | end 24 | if #fishes >= 100 then 25 | return 26 | end 27 | -- pick a random fish 28 | local t = math_random(1, #fishes) 29 | local fish = fishes[t] 30 | -- test against all other fishes 31 | local guppy = false 32 | for i, f in pairs(fishes) do 33 | if i ~= t then 34 | if math_floor(fish.position.x) == math_floor(f.position.x) and math_floor(fish.position.y) == math_floor(f.position.y) then 35 | guppy = true 36 | end 37 | end 38 | end 39 | if guppy == true then 40 | for i = 1, math_random(1, 5) do 41 | surface.create_entity({name = 'water-splash', position = fish.position}) 42 | surface.create_entity({name = 'fish', position = fish.position}) 43 | end 44 | end 45 | end 46 | end 47 | 48 | return Public 49 | -------------------------------------------------------------------------------- /maps/scrap_towny_ffa/limbo.lua: -------------------------------------------------------------------------------- 1 | local Public = {} 2 | 3 | local function initialize_limbo() 4 | if game.surfaces['limbo'] then 5 | -- clear the surface 6 | game.surfaces['limbo'].clear(false) 7 | else 8 | game.create_surface('limbo') 9 | end 10 | local surface = game.surfaces['limbo'] 11 | surface.generate_with_lab_tiles = true 12 | surface.peaceful_mode = true 13 | surface.always_day = true 14 | surface.freeze_daytime = true 15 | surface.clear(true) 16 | end 17 | 18 | function Public.initialize() 19 | initialize_limbo() 20 | end 21 | 22 | return Public 23 | -------------------------------------------------------------------------------- /maps/scrap_towny_ffa/map.lua: -------------------------------------------------------------------------------- 1 | local Public = {} 2 | 3 | function Public.disable_world_map(player) 4 | player.map_view_settings = { 5 | ["show-player-names"] = false, 6 | } 7 | player.show_on_map = false 8 | player.game_view_settings.show_minimap = false 9 | end 10 | 11 | function Public.enable_world_map(player) 12 | player.map_view_settings = { 13 | ["show-player-names"] = true, 14 | } 15 | player.show_on_map = true 16 | player.game_view_settings.show_minimap = true 17 | end 18 | 19 | return Public -------------------------------------------------------------------------------- /maps/scrap_towny_ffa/scrap.lua: -------------------------------------------------------------------------------- 1 | local Public = {} 2 | 3 | local scrapable = { 4 | ['crash-site-spaceship-wreck-small-1'] = true, 5 | ['crash-site-spaceship-wreck-small-2'] = true, 6 | ['crash-site-spaceship-wreck-small-3'] = true, 7 | ['crash-site-spaceship-wreck-small-4'] = true, 8 | ['crash-site-spaceship-wreck-small-5'] = true, 9 | ['crash-site-spaceship-wreck-small-6'] = true, 10 | ['crash-site-chest-1'] = true, 11 | ['crash-site-chest-2'] = true, 12 | ['crash-site-spaceship-wreck-medium-1'] = true, 13 | ['crash-site-spaceship-wreck-medium-2'] = true, 14 | ['crash-site-spaceship-wreck-medium-3'] = true, 15 | ['crash-site-spaceship-wreck-big-1'] = true, 16 | ['crash-site-spaceship-wreck-big-2'] = true, 17 | ['crash-site-spaceship'] = true 18 | } 19 | 20 | function Public.is_scrap(entity) 21 | if not entity.valid then 22 | return false 23 | end 24 | return scrapable[entity.name] or false 25 | end 26 | 27 | return Public 28 | -------------------------------------------------------------------------------- /maps/scrap_towny_ffa/spawners_contain_biters.lua: -------------------------------------------------------------------------------- 1 | -- spawners release biters on death -- by mewmew 2 | local Event = require 'utils.event' 3 | local Evolution = require 'maps.scrap_towny_ffa.evolution' 4 | 5 | local math_random = math.random 6 | 7 | local biter_building_inhabitants = { 8 | [1] = {{'small-biter', 8, 16}}, 9 | [2] = {{'small-biter', 12, 24}}, 10 | [3] = {{'small-biter', 8, 16}, {'medium-biter', 1, 2}}, 11 | [4] = {{'small-biter', 4, 8}, {'medium-biter', 4, 8}}, 12 | [5] = {{'small-biter', 3, 5}, {'medium-biter', 8, 12}}, 13 | [6] = {{'small-biter', 3, 5}, {'medium-biter', 5, 7}, {'big-biter', 1, 2}}, 14 | [7] = {{'medium-biter', 6, 8}, {'big-biter', 3, 5}}, 15 | [8] = {{'medium-biter', 2, 4}, {'big-biter', 6, 8}}, 16 | [9] = {{'medium-biter', 2, 3}, {'big-biter', 7, 9}}, 17 | [10] = {{'big-biter', 4, 8}, {'behemoth-biter', 3, 4}} 18 | } 19 | 20 | local function on_entity_died(event) 21 | if not event.entity.valid then 22 | return 23 | end 24 | if event.entity.name ~= 'biter-spawner' then 25 | return 26 | end 27 | local e = math.ceil(Evolution.get_biter_evolution(event.entity) * 10) 28 | if e < 1 then 29 | e = 1 30 | end 31 | for _, t in pairs(biter_building_inhabitants[e]) do 32 | for _ = 1, math_random(t[2], t[3]), 1 do 33 | local p = event.entity.surface.find_non_colliding_position(t[1], event.entity.position, 6, 1) 34 | if p then 35 | event.entity.surface.create_entity {name = t[1], position = p, force = event.entity.force.name} 36 | end 37 | end 38 | end 39 | end 40 | 41 | Event.add(defines.events.on_entity_died, on_entity_died) 42 | -------------------------------------------------------------------------------- /maps/scrap_towny_ffa/trap.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local Evolution = require 'maps.scrap_towny_ffa.evolution' 3 | local Town_center = require 'maps.scrap_towny_ffa.town_center' 4 | local Scrap = require 'maps.scrap_towny_ffa.scrap' 5 | local unearthing_worm = require 'utils.functions.unearthing_worm' 6 | local unearthing_biters = require 'utils.functions.unearthing_biters' 7 | local tick_tack_trap = require 'utils.functions.tick_tack_trap' 8 | 9 | local math_random = math.random 10 | 11 | local function trap(entity) 12 | -- check if within 32 blocks of market 13 | if entity.type == 'tree' or Scrap.is_scrap(entity) and not Town_center.in_any_town(entity.position) then 14 | if math_random(1, 1024) == 1 then 15 | tick_tack_trap(entity.surface, entity.position) 16 | end 17 | if math_random(1, 256) == 1 then 18 | unearthing_worm(entity.surface, entity.position, Evolution.get_worm_evolution(entity)) 19 | end 20 | if math_random(1, 128) == 1 then 21 | unearthing_biters(entity.surface, entity.position, math_random(4, 8), Evolution.get_biter_evolution(entity)) 22 | end 23 | end 24 | end 25 | 26 | local function on_player_mined_entity(event) 27 | local entity = event.entity 28 | if entity and entity.valid then 29 | trap(entity) 30 | end 31 | end 32 | 33 | Event.add(defines.events.on_player_mined_entity, on_player_mined_entity) 34 | -------------------------------------------------------------------------------- /maps/scrap_towny_ffa/turrets_drop_ammo.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | 3 | local math_random = math.random 4 | local math_min = math.min 5 | 6 | local function on_entity_died(event) 7 | local entity = event.entity 8 | local surface = entity.surface 9 | if entity.type == 'ammo-turret' and entity.force.name == 'enemy' then 10 | local min = math_min(entity.get_item_count('piercing-rounds-magazine'), 20) 11 | if min > 0 then 12 | surface.spill_item_stack(entity.position, {name = 'piercing-rounds-magazine', count = math_random(1, min)}, true) 13 | end 14 | end 15 | end 16 | 17 | Event.add(defines.events.on_entity_died, on_entity_died) 18 | -------------------------------------------------------------------------------- /maps/scrap_towny_ffa/vehicles.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | 3 | local Public = {} 4 | 5 | local function on_player_driving_changed_state(event) 6 | local player = game.players[event.player_index] 7 | if not player or not player.valid then 8 | return 9 | end 10 | local vehicle = player.vehicle 11 | if player.force.name ~= 'player' and player.force.name ~= 'rogue' then 12 | return 13 | end 14 | if vehicle and vehicle.valid then 15 | -- player entered a vehicle 16 | if vehicle.name == 'locomotive' or vehicle.name == 'cargo-wagon' or vehicle.name == 'fluid-wagon' then 17 | vehicle.force = 'neutral' 18 | else 19 | -- includes cars, tanks and artillery-wagons 20 | vehicle.force = player.force.name 21 | end 22 | else 23 | -- player exited a vehicle 24 | vehicle = event.entity 25 | vehicle.force = 'neutral' 26 | end 27 | end 28 | 29 | Event.add(defines.events.on_player_driving_changed_state, on_player_driving_changed_state) 30 | 31 | return Public 32 | -------------------------------------------------------------------------------- /maps/spooky_forest_changelog.txt: -------------------------------------------------------------------------------- 1 | 0.09 2 | worms spawn out of rocks rarely 3 | decorative regeneration 4 | spawn now has 1 turret 5 | 6 | 0.08 7 | spawn is now biter free 8 | 9 | 0.07 10 | added randomly breaking trees 11 | added randomly attacking biters 12 | added spawn area 13 | 14 | 0.06 15 | added markets 16 | added hunger and respawning fish 17 | 18 | 0.05 19 | map reveal fixes 20 | reduced evolution 21 | 22 | 0.04 23 | disabled flamethrower turret 24 | 25 | 0.03 26 | bigger map reveal on nest findings 27 | more ore 28 | more tree 29 | 30 | 0.02 31 | less ore spawns 32 | less evolution game on nest destruction 33 | 34 | 0.01 35 | spooked ya 36 | -------------------------------------------------------------------------------- /maps/stone_maze/noise.lua: -------------------------------------------------------------------------------- 1 | local simplex_noise = require 'utils.math.simplex_noise'.d2 2 | 3 | local noises = { 4 | ['trees_01'] = {{modifier = 0.03, weight = 1}, {modifier = 0.05, weight = 0.3}, {modifier = 0.1, weight = 0.05}}, 5 | ['scrap_01'] = {{modifier = 0.04, weight = 1}, {modifier = 0.06, weight = 0.3}, {modifier = 0.08, weight = 0.1}} 6 | } 7 | 8 | local function get_noise(name, pos, seed) 9 | local noise = 0 10 | local x = pos.x 11 | local y = pos.y 12 | if not x then 13 | x = pos[1] 14 | end 15 | if not y then 16 | y = pos[2] 17 | end 18 | for _, n in pairs(noises[name]) do 19 | noise = noise + simplex_noise(x * n.modifier, y * n.modifier, seed) * n.weight 20 | seed = seed + 10000 21 | end 22 | return noise 23 | end 24 | 25 | return get_noise 26 | -------------------------------------------------------------------------------- /maps/tetris/unused.lua: -------------------------------------------------------------------------------- 1 | --luacheck: ignore 2 | local function is_position_inside_playfield(position) 3 | if position.x > playfield_area.right_bottom.x then 4 | return false 5 | end 6 | if position.y > playfield_area.right_bottom.y then 7 | return false 8 | end 9 | if position.x <= playfield_area.left_top.x then 10 | return false 11 | end 12 | if position.y < playfield_area.left_top.y then 13 | return false 14 | end 15 | return true 16 | end 17 | -------------------------------------------------------------------------------- /maps/wave_defense.lua: -------------------------------------------------------------------------------- 1 | --vanilla with wave_defense 2 | 3 | local WD = require 'modules.wave_defense.main' 4 | local Map = require 'modules.map_info' 5 | 6 | local starting_items = {['pistol'] = 1, ['firearm-magazine'] = 16, ['iron-plate'] = 16, ['iron-gear-wheel'] = 8, ['raw-fish'] = 3} 7 | 8 | local function set_difficulty() 9 | local wave_defense_table = WD.get_table() 10 | --20 Players for maximum difficulty 11 | wave_defense_table.wave_interval = 7200 - #game.connected_players * 270 12 | if wave_defense_table.wave_interval < 1800 then 13 | wave_defense_table.wave_interval = 1800 14 | end 15 | end 16 | 17 | local function on_player_joined_game(event) 18 | set_difficulty() 19 | 20 | local player = game.players[event.player_index] 21 | if player.online_time == 0 then 22 | for item, amount in pairs(starting_items) do 23 | player.insert({name = item, count = amount}) 24 | end 25 | end 26 | end 27 | 28 | local function on_player_left_game() 29 | set_difficulty() 30 | end 31 | 32 | local function on_init() 33 | local T = Map.Pop_info() 34 | T.main_caption = 'Wave Defense' 35 | T.sub_caption = '~~~~~~' 36 | T.text = 37 | table.concat( 38 | { 39 | 'Survive\n', 40 | 'as\n', 41 | 'long\n', 42 | 'as\n', 43 | 'possible.\n' 44 | } 45 | ) 46 | T.main_caption_color = {r = 150, g = 0, b = 150} 47 | T.sub_caption_color = {r = 100, g = 150, b = 0} 48 | game.surfaces[1].request_to_generate_chunks({0, 0}, 16) 49 | game.surfaces[1].force_generate_chunk_requests() 50 | end 51 | 52 | local event = require 'utils.event' 53 | event.on_init(on_init) 54 | event.add(defines.events.on_player_left_game, on_player_left_game) 55 | event.add(defines.events.on_player_joined_game, on_player_joined_game) 56 | -------------------------------------------------------------------------------- /maps/wave_of_death/spectate.lua: -------------------------------------------------------------------------------- 1 | --luacheck: ignore 2 | local function spectate_button() 3 | end 4 | 5 | local function on_gui_click() 6 | end 7 | 8 | event.add(defines.events.on_gui_click, on_gui_click) 9 | -------------------------------------------------------------------------------- /modules/autodecon_when_depleted.lua: -------------------------------------------------------------------------------- 1 | --luacheck: ignore 2 | local event = require 'utils.event' 3 | local function is_depleted(drill, entity) 4 | local position = drill.position 5 | local area 6 | if drill.name == 'electric-mining-drill' then 7 | area = {{position.x - 2.5, position.y - 2.5}, {position.x + 2.5, position.y + 2.5}} 8 | else 9 | area = {{position.x - 1, position.y - 1}, {position.x + 1, position.y + 1}} 10 | end 11 | 12 | for _, resource in pairs(drill.surface.find_entities_filtered {type = 'resource', area = area}) do 13 | if resource ~= entity and resource.name ~= 'crude-oil' then 14 | return false 15 | end 16 | end 17 | return true 18 | end 19 | 20 | local function on_resource_depleted(event) 21 | local entity = event.entity 22 | if entity.name == 'uranium-ore' then 23 | return nil 24 | end 25 | 26 | local position = entity.position 27 | local area = {{position.x - 1, position.y - 1}, {position.x + 1, position.y + 1}} 28 | local drills = event.entity.surface.find_entities_filtered {area = area, type = 'mining-drill'} 29 | for _, drill in ipairs(drills) do 30 | if drill.name ~= 'pumpjack' and is_depleted(drill, entity) then 31 | drill.order_deconstruction(drill.force) 32 | end 33 | end 34 | end 35 | 36 | event.add(defines.events.on_resource_depleted, on_resource_depleted) 37 | -------------------------------------------------------------------------------- /modules/backpack_research.lua: -------------------------------------------------------------------------------- 1 | -- backpack research -- researching mining efficiency increases your backpack capacity (inventory slots) 2 | 3 | local Event = require 'utils.event' 4 | 5 | local function on_research_finished(event) 6 | local force = event.research.force 7 | local toolbelt_bonus = (force.technologies['toolbelt'].researched and 10) or 0 8 | local prod_bonus = force.mining_drill_productivity_bonus * 100 9 | force.character_inventory_slots_bonus = prod_bonus + toolbelt_bonus 10 | end 11 | 12 | Event.add(defines.events.on_research_finished, on_research_finished) 13 | -------------------------------------------------------------------------------- /modules/ban_drop.lua: -------------------------------------------------------------------------------- 1 | --When a player is banned, their inventory will be spilled on the ground. 2 | 3 | local function drop_inventory(player, inventory) 4 | if not inventory then 5 | return 6 | end 7 | if not inventory.valid then 8 | return 9 | end 10 | if inventory.is_empty() then 11 | return 12 | end 13 | local position = player.position 14 | local surface = player.surface 15 | for i = 1, #inventory, 1 do 16 | if inventory[i] and inventory[i].valid_for_read then 17 | surface.spill_item_stack(position, inventory[i], true) 18 | end 19 | end 20 | inventory.clear() 21 | end 22 | 23 | local function on_player_banned(event) 24 | local player = game.players[event.player_index] 25 | drop_inventory(player, player.get_inventory(defines.inventory.character_main)) 26 | drop_inventory(player, player.get_inventory(defines.inventory.character_guns)) 27 | drop_inventory(player, player.get_inventory(defines.inventory.character_ammo)) 28 | drop_inventory(player, player.get_inventory(defines.inventory.character_armor)) 29 | drop_inventory(player, player.get_inventory(defines.inventory.character_trash)) 30 | end 31 | 32 | local Event = require 'utils.event' 33 | Event.add(defines.events.on_player_banned, on_player_banned) 34 | -------------------------------------------------------------------------------- /modules/biter_evasion_hp_increaser.lua: -------------------------------------------------------------------------------- 1 | -- biters and their buildings gain pseudo hp increase through the means of evasion mechanics -- by mewmew 2 | -- use storage.biter_evasion_health_increase_factor to modify their health 3 | 4 | local Event = require 'utils.event' 5 | local random_max = 1000000 6 | local types = { 7 | ['unit'] = true, 8 | ['unit-spawner'] = true, 9 | ['turret'] = true 10 | } 11 | 12 | local function get_evade_chance() 13 | return random_max - (random_max / storage.biter_evasion_health_increase_factor) 14 | end 15 | 16 | local function on_entity_damaged(event) 17 | if storage.biter_evasion_health_increase_factor == 1 then 18 | return 19 | end 20 | if not event.entity.valid then 21 | return 22 | end 23 | if not types[event.entity.type] then 24 | return 25 | end 26 | if event.final_damage_amount > event.entity.max_health * storage.biter_evasion_health_increase_factor then 27 | return 28 | end 29 | if math.random(1, random_max) > get_evade_chance() then 30 | return 31 | end 32 | event.entity.health = event.entity.health + event.final_damage_amount 33 | end 34 | 35 | local function on_init() 36 | storage.biter_evasion_health_increase_factor = 1 37 | end 38 | 39 | Event.on_init(on_init) 40 | Event.add(defines.events.on_entity_damaged, on_entity_damaged) 41 | -------------------------------------------------------------------------------- /modules/biter_noms_you.lua: -------------------------------------------------------------------------------- 1 | --biters make comic like text sounds when they damage something -- mewmew 2 | 3 | local Event = require 'utils.event' 4 | local math_random = math.random 5 | 6 | local strings = { 7 | 'delicious!', 8 | 'yum', 9 | 'yum', 10 | 'crunch', 11 | 'crunch', 12 | 'chomp', 13 | 'chomp', 14 | 'chow', 15 | 'chow', 16 | 'nibble', 17 | 'nibble', 18 | 'nom', 19 | 'nom', 20 | 'nom', 21 | 'nom', 22 | 'nom', 23 | 'nom', 24 | 'nom', 25 | 'nom', 26 | 'nom', 27 | 'nom', 28 | 'nom', 29 | 'nom', 30 | 'nom', 31 | 'nom', 32 | 'nom', 33 | 'nom', 34 | 'nom', 35 | 'nom', 36 | 'nom', 37 | 'nom', 38 | 'nom', 39 | 'nom' 40 | } 41 | local size_of_strings = #strings 42 | 43 | local whitelist = { 44 | ['small-biter'] = true, 45 | ['medium-biter'] = true, 46 | ['big-biter'] = true, 47 | ['behemoth-biter'] = true 48 | } 49 | 50 | local function on_entity_damaged(event) 51 | if not event.cause then return end 52 | if not event.cause.valid then return end 53 | 54 | if not whitelist[event.cause.name] then return end 55 | 56 | local surface = event.cause.surface 57 | if not surface.valid then return end 58 | 59 | if math_random(1, 5) == 1 then 60 | for _, player in pairs(game.connected_players) do 61 | if player.surface_index == event.cause.surface_index then 62 | player.create_local_flying_text( 63 | { 64 | position = event.cause.position, 65 | text = strings[math_random(1, size_of_strings)], 66 | color = { r = math_random(130, 170), g = math_random(130, 170), b = 130 } 67 | } 68 | ) 69 | end 70 | end 71 | end 72 | end 73 | 74 | Event.add(defines.events.on_entity_damaged, on_entity_damaged) 75 | -------------------------------------------------------------------------------- /modules/biter_player_count_difficulty.lua: -------------------------------------------------------------------------------- 1 | -- biters gain strength scaling with player amount in the game -- by mewmew 2 | 3 | local Event = require 'utils.event' 4 | 5 | local function refresh_difficulty() 6 | storage.connected_players = #game.connected_players 7 | if storage.connected_players > 75 then 8 | storage.connected_players = 75 9 | end 10 | 11 | local f = game.forces.enemy 12 | local m = #game.connected_players * 0.05 13 | 14 | f.set_ammo_damage_modifier('melee', m) 15 | f.set_ammo_damage_modifier('biological', m * 0.5) 16 | f.set_ammo_damage_modifier('artillery-shell', m * 0.5) 17 | f.set_ammo_damage_modifier('flamethrower', m * 0.5) 18 | f.set_ammo_damage_modifier('laser-turret', m * 0.5) 19 | end 20 | 21 | local function on_entity_damaged(event) 22 | if not event.entity.valid then 23 | return 24 | end 25 | if event.entity.type ~= 'unit' then 26 | return 27 | end 28 | if math.random(1, 100) >= storage.connected_players then 29 | return 30 | end 31 | if event.final_damage_amount > event.entity.max_health then 32 | return 33 | end 34 | event.entity.health = event.entity.health + event.final_damage_amount 35 | end 36 | 37 | local function on_player_joined_game() 38 | refresh_difficulty() 39 | end 40 | 41 | local function on_player_left_game() 42 | refresh_difficulty() 43 | end 44 | 45 | Event.add(defines.events.on_player_left_game, on_player_left_game) 46 | Event.add(defines.events.on_player_joined_game, on_player_joined_game) 47 | Event.add(defines.events.on_entity_damaged, on_entity_damaged) 48 | -------------------------------------------------------------------------------- /modules/biters_attack_moving_players.lua: -------------------------------------------------------------------------------- 1 | --moving players attract biters from far away 2 | 3 | local Event = require 'utils.event' 4 | local math_random = math.random 5 | 6 | local function on_player_changed_position(event) 7 | if math_random(1, 128) ~= 1 then 8 | return 9 | end 10 | if game.tick - storage.biters_attack_moving_players_last_action_tick < 7200 then 11 | return 12 | end 13 | local player = game.players[event.player_index] 14 | if not player.character then 15 | return 16 | end 17 | local amount = math.floor(game.tick * 0.0005) + 1 18 | if amount > 32 then 19 | amount = 32 20 | end 21 | player.surface.set_multi_command( 22 | { 23 | command = { 24 | type = defines.command.attack_area, 25 | destination = player.position, 26 | radius = 16, 27 | distraction = defines.distraction.by_anything 28 | }, 29 | unit_count = amount, 30 | force = 'enemy', 31 | unit_search_distance = 1024 32 | } 33 | ) 34 | storage.biters_attack_moving_players_last_action_tick = game.tick 35 | end 36 | 37 | local function on_init() 38 | storage.biters_attack_moving_players_last_action_tick = 0 39 | end 40 | 41 | Event.add(defines.events.on_player_changed_position, on_player_changed_position) 42 | Event.on_init(on_init) 43 | -------------------------------------------------------------------------------- /modules/biters_avoid_damage.lua: -------------------------------------------------------------------------------- 1 | -- enemy biters have pseudo double hp -- by mewmew 2 | 3 | local Event = require 'utils.event' 4 | 5 | local function on_entity_damaged(event) 6 | if not event.entity.valid then 7 | return 8 | end 9 | if math.random(1, 2) == 1 then 10 | return 11 | end 12 | if event.entity.type ~= 'unit' then 13 | return 14 | end 15 | if event.final_damage_amount > event.entity.max_health then 16 | return 17 | end 18 | event.entity.health = event.entity.health + event.final_damage_amount 19 | end 20 | 21 | Event.add(defines.events.on_entity_damaged, on_entity_damaged) 22 | -------------------------------------------------------------------------------- /modules/biters_double_damage.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | 3 | local function on_player_joined_game() 4 | game.forces.enemy.set_ammo_damage_modifier('melee', 1) 5 | game.forces.enemy.set_ammo_damage_modifier('biological', 1) 6 | game.forces.enemy.set_ammo_damage_modifier('artillery-shell', 0.5) 7 | game.forces.enemy.set_ammo_damage_modifier('flamethrower', 0.5) 8 | game.forces.enemy.set_ammo_damage_modifier('laser', 0.5) 9 | end 10 | 11 | Event.add(defines.events.on_player_joined_game, on_player_joined_game) 12 | -------------------------------------------------------------------------------- /modules/corpse_marker.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local Global = require 'utils.global' 3 | local Util = require 'utils.core' 4 | local Task = require 'utils.task_token' 5 | 6 | local this = 7 | { 8 | death_tags = {} 9 | } 10 | 11 | Global.register( 12 | this, 13 | function (tbl) 14 | this = tbl 15 | end 16 | ) 17 | 18 | local add_corpse_marker_token = 19 | Task.register( 20 | function (event) 21 | local player_index = event.player_index 22 | local player = game.get_player(player_index) 23 | if not player or not player.valid then 24 | return 25 | end 26 | 27 | local ents = player.surface.find_entities_filtered 28 | { 29 | name = 'character-corpse', 30 | position = player.position, 31 | radius = 5, 32 | } 33 | 34 | if #ents == 0 then 35 | return 36 | end 37 | local entity = ents[1] 38 | 39 | if not entity or not entity.valid then 40 | return 41 | end 42 | 43 | player.add_pin 44 | { 45 | entity = entity, 46 | } 47 | end 48 | ) 49 | 50 | 51 | Event.add(defines.events.on_pre_player_died, function (event) 52 | local player = game.get_player(event.player_index) 53 | if not player and not player.valid then 54 | return 55 | end 56 | 57 | if not player.has_items_inside() then 58 | return 59 | end 60 | 61 | local surface = player.surface 62 | 63 | Util.iter_players(function (p) 64 | if p.physical_surface_index == surface.index then 65 | Task.set_timeout_in_ticks(10, add_corpse_marker_token, { player_index = p.index }) 66 | end 67 | end) 68 | end) 69 | -------------------------------------------------------------------------------- /modules/dynamic_player_spawn.lua: -------------------------------------------------------------------------------- 1 | -- this automatically sets player's force spawn point to where a lot of buildings are 2 | 3 | local Event = require 'utils.event' 4 | 5 | local valid_types = {'boiler', 'furnace', 'generator', 'offshore-pump', 'lab', 'assembling-machine'} 6 | 7 | local function on_built_entity(event) 8 | if not event.entity.valid then 9 | return 10 | end 11 | local player = game.players[event.player_index] 12 | local area = {{event.entity.position.x - 12, event.entity.position.y - 12}, {event.entity.position.x + 12, event.entity.position.y + 12}} 13 | if player.surface.count_entities_filtered({area = area, force = player.force, type = valid_types}) > 12 then 14 | player.force.set_spawn_position(player.position, player.surface) 15 | end 16 | end 17 | 18 | Event.add(defines.events.on_built_entity, on_built_entity) 19 | -------------------------------------------------------------------------------- /modules/explosive_biters.lua: -------------------------------------------------------------------------------- 1 | -- biters explode -- by mewmew 2 | 3 | local Event = require 'utils.event' 4 | 5 | local biter_values = { 6 | ['medium-biter'] = {'blood-explosion-big', 20, 1.5}, 7 | ['big-biter'] = {'blood-explosion-huge', 40, 2}, 8 | ['behemoth-biter'] = {'blood-explosion-huge', 60, 2.5} 9 | } 10 | 11 | local function damage_entities_in_radius(surface, position, radius, damage) 12 | local entities_to_damage = surface.find_entities_filtered({area = {{position.x - radius, position.y - radius}, {position.x + radius, position.y + radius}}}) 13 | for _, entity in pairs(entities_to_damage) do 14 | if entity.health and entity.name ~= 'land-mine' then 15 | if entity.force.name ~= 'enemy' then 16 | if entity.name == 'character' then 17 | entity.damage(damage, 'enemy') 18 | else 19 | entity.health = entity.health - damage 20 | if entity.health <= 0 then 21 | entity.die('enemy') 22 | end 23 | end 24 | end 25 | end 26 | end 27 | end 28 | 29 | local function on_entity_died(event) 30 | if not event.entity.valid then 31 | return 32 | end 33 | if biter_values[event.entity.name] then 34 | local entity = event.entity 35 | entity.surface.create_entity({name = biter_values[entity.name][1], position = entity.position}) 36 | damage_entities_in_radius( 37 | entity.surface, 38 | entity.position, 39 | biter_values[entity.name][3], 40 | math.random(math.ceil(biter_values[entity.name][2] * 0.75), math.ceil(biter_values[entity.name][2] * 1.25)) 41 | ) 42 | end 43 | end 44 | 45 | Event.add(defines.events.on_entity_died, on_entity_died) 46 | -------------------------------------------------------------------------------- /modules/explosive_player_respawn.lua: -------------------------------------------------------------------------------- 1 | -- clear the player respawn from enemies with a kaboom -- by mewmew 2 | local Event = require 'utils.event' 3 | 4 | local function damage_entities_in_radius(surface, position, radius) 5 | local entities_to_damage = surface.find_entities_filtered({area = {{position.x - radius, position.y - radius}, {position.x + radius, position.y + radius}}}) 6 | for _, entity in pairs(entities_to_damage) do 7 | if entity.health and entity.force.name == 'enemy' then 8 | entity.surface.create_entity({name = 'big-explosion', position = entity.position}) 9 | entity.destroy() 10 | end 11 | end 12 | end 13 | 14 | local function on_player_respawned(event) 15 | local player = game.players[event.player_index] 16 | player.surface.create_entity({name = 'uranium-cannon-shell-explosion', position = player.position}) 17 | damage_entities_in_radius(player.surface, player.position, 11) 18 | end 19 | 20 | Event.add(defines.events.on_player_respawned, on_player_respawned) 21 | -------------------------------------------------------------------------------- /modules/flamethrower_nerf.lua: -------------------------------------------------------------------------------- 1 | --Flamethrower Turret Nerf 2 | local function on_research_finished(event) 3 | local research = event.research 4 | local force_name = research.force.name 5 | if research.name == 'military' then 6 | if not storage.flamethrower_damage then 7 | storage.flamethrower_damage = {} 8 | end 9 | storage.flamethrower_damage[force_name] = -0.50 10 | game.forces[force_name].set_turret_attack_modifier('flamethrower-turret', storage.flamethrower_damage[force_name]) 11 | game.forces[force_name].set_ammo_damage_modifier('flamethrower', storage.flamethrower_damage[force_name]) 12 | end 13 | 14 | if string.sub(research.name, 0, 18) == 'refined-flammables' then 15 | storage.flamethrower_damage[force_name] = storage.flamethrower_damage[force_name] + 0.10 16 | game.forces[force_name].set_turret_attack_modifier('flamethrower-turret', storage.flamethrower_damage[force_name]) 17 | game.forces[force_name].set_ammo_damage_modifier('flamethrower', storage.flamethrower_damage[force_name]) 18 | end 19 | end 20 | 21 | local event = require 'utils.event' 22 | event.add(defines.events.on_research_finished, on_research_finished) 23 | -------------------------------------------------------------------------------- /modules/hidden_dimension/table.lua: -------------------------------------------------------------------------------- 1 | local Global = require 'utils.global' 2 | local Event = require 'utils.event' 3 | 4 | local this = { 5 | hidden_dimension = { 6 | logistic_research_level = 0, 7 | energy = {} 8 | } 9 | } 10 | local Public = {} 11 | 12 | local deepcopy = table.deepcopy 13 | 14 | Global.register( 15 | this, 16 | function(tbl) 17 | this = tbl 18 | end 19 | ) 20 | 21 | Public.transport_table = { 22 | transport_type = 'in_and_out', 23 | reference = nil, 24 | name = nil, 25 | entities = { 26 | chest_1 = nil, 27 | chest_2 = nil, 28 | loader_1 = nil, 29 | loader_2 = nil, 30 | pipe_1 = nil, 31 | pipe_2 = nil, 32 | pipe_3 = nil, 33 | pipe_4 = nil, 34 | pipe_5 = nil, 35 | pipe_6 = nil 36 | } 37 | } 38 | 39 | Public.levels_table = { 40 | surface = nil, 41 | size = nil, 42 | going_up = deepcopy(Public.transport_table), 43 | going_down = deepcopy(Public.transport_table), 44 | upgrade_level = 0 45 | } 46 | 47 | --- Resets the table to default 48 | function Public.reset_table() 49 | if this.hidden_dimension then 50 | this.hidden_dimension.logistic_research_level = 0 51 | end 52 | this.hidden_dimension.energy = {} 53 | end 54 | 55 | --- Gets key from this table 56 | function Public.get(key) 57 | if key then 58 | return this[key] 59 | else 60 | return this 61 | end 62 | end 63 | 64 | Event.on_init( 65 | function() 66 | Public.reset_table() 67 | end 68 | ) 69 | 70 | return Public 71 | -------------------------------------------------------------------------------- /modules/immersive_cargo_wagons/constants.lua: -------------------------------------------------------------------------------- 1 | local Public = {} 2 | 3 | Public.wagon_types = { 4 | ['cargo-wagon'] = true, 5 | ['artillery-wagon'] = true, 6 | ['fluid-wagon'] = true, 7 | ['locomotive'] = true 8 | } 9 | 10 | Public.wagon_areas = { 11 | ['cargo-wagon'] = {left_top = {x = -11, y = 0}, right_bottom = {x = 11, y = 40}}, 12 | ['artillery-wagon'] = {left_top = {x = -11, y = 0}, right_bottom = {x = 11, y = 40}}, 13 | ['fluid-wagon'] = {left_top = {x = -11, y = 0}, right_bottom = {x = 11, y = 40}}, 14 | ['locomotive'] = {left_top = {x = -11, y = 0}, right_bottom = {x = 11, y = 40}} 15 | } 16 | 17 | return Public 18 | -------------------------------------------------------------------------------- /modules/inserter_drops_pickup.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local controllers_with_inventory = { 3 | [defines.controllers.character] = true, 4 | [defines.controllers.god] = true, 5 | [defines.controllers.editor] = true, 6 | } 7 | 8 | Event.add(defines.events.on_player_mined_entity, function(event) 9 | local inserter = event.entity 10 | if (not inserter.valid) or (inserter.type ~= "inserter") or inserter.drop_target then return end 11 | 12 | local item_entity = inserter.surface.find_entity("item-on-ground", inserter.drop_position) 13 | if item_entity then 14 | local player = game.get_player(event.player_index) 15 | if controllers_with_inventory[player.controller_type] then 16 | player.mine_entity(item_entity) 17 | end 18 | end 19 | end) 20 | -------------------------------------------------------------------------------- /modules/manual_mining_booster.lua: -------------------------------------------------------------------------------- 1 | --manually mining continuously will speed it up 2 | 3 | local Event = require 'utils.event' 4 | 5 | local valid_entities = { 6 | ['big-rock'] = true, 7 | ['huge-rock'] = true, 8 | ['big-sand-rock'] = true 9 | } 10 | 11 | local function mining_speed_cooldown(p) 12 | if not storage.manual_mining_booster[p.index] then 13 | return 14 | end 15 | if game.tick - storage.manual_mining_booster[p.index] < 180 then 16 | return 17 | end 18 | --if not p.character then p.character.character_mining_speed_modifier = 0 return end 19 | if not p.character then 20 | return 21 | end 22 | p.character.character_mining_speed_modifier = p.character.character_mining_speed_modifier - 1 23 | if p.character.character_mining_speed_modifier <= 0 then 24 | p.character.character_mining_speed_modifier = 0 25 | storage.manual_mining_booster[p.index] = nil 26 | end 27 | end 28 | 29 | local function on_player_mined_entity(event) 30 | if not valid_entities[event.entity.name] then 31 | return 32 | end 33 | local player = game.players[event.player_index] 34 | player.character.character_mining_speed_modifier = player.character.character_mining_speed_modifier + (math.random(25, 50) * 0.01) 35 | if player.character.character_mining_speed_modifier > 10 then 36 | player.character.character_mining_speed_modifier = 10 37 | end 38 | storage.manual_mining_booster[event.player_index] = game.tick 39 | end 40 | 41 | local function tick() 42 | for _, p in pairs(game.connected_players) do 43 | mining_speed_cooldown(p) 44 | end 45 | end 46 | 47 | local function on_init() 48 | storage.manual_mining_booster = {} 49 | end 50 | 51 | Event.add(defines.events.on_player_mined_entity, on_player_mined_entity) 52 | Event.on_nth_tick(60, tick) 53 | Event.on_init(on_init) 54 | -------------------------------------------------------------------------------- /modules/market_friendly_fire_protection.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | 3 | local function on_entity_damaged(event) 4 | if event.entity.name ~= 'market' then 5 | return false 6 | end 7 | if event.cause then 8 | if event.cause.force.name == 'enemy' then 9 | return false 10 | end 11 | end 12 | event.entity.health = event.entity.health + event.final_damage_amount 13 | return true 14 | end 15 | 16 | Event.add(defines.events.on_entity_damaged, on_entity_damaged) 17 | -------------------------------------------------------------------------------- /modules/no_acid_puddles.lua: -------------------------------------------------------------------------------- 1 | local r = 1.5 2 | 3 | local acid_puddles = { 4 | 'acid-splash-fire-spitter-behemoth', 5 | 'acid-splash-fire-spitter-big', 6 | 'acid-splash-fire-spitter-medium', 7 | 'acid-splash-fire-spitter-small', 8 | 'acid-splash-fire-worm-behemoth', 9 | 'acid-splash-fire-worm-big', 10 | 'acid-splash-fire-worm-medium', 11 | 'acid-splash-fire-worm-small' 12 | } 13 | 14 | local valid_enemies = { 15 | ['small-spitter'] = true, 16 | ['medium-spitter'] = true, 17 | ['big-spitter'] = true, 18 | ['behemoth-spitter'] = true, 19 | ['small-worm-turret'] = true, 20 | ['medium-worm-turret'] = true, 21 | ['big-worm-turret'] = true, 22 | ['behemoth-worm-turret'] = true 23 | } 24 | 25 | local function remove_puddles(event) 26 | local cause = event.cause 27 | if not cause then 28 | return true 29 | end 30 | if not cause.valid then 31 | return true 32 | end 33 | if valid_enemies[cause.name] then 34 | return true 35 | end 36 | end 37 | 38 | local function on_entity_damaged(event) 39 | if not remove_puddles(event) then 40 | return 41 | end 42 | local entity = event.entity 43 | if not entity or not entity.valid then 44 | return 45 | end 46 | local position = entity.position 47 | for _, puddle in pairs(entity.surface.find_entities_filtered({name = acid_puddles, area = {{position.x - r, position.y - r}, {position.x + r, position.y + r}}})) do 48 | puddle.destroy() 49 | end 50 | end 51 | 52 | local Event = require 'utils.event' 53 | Event.add(defines.events.on_entity_damaged, on_entity_damaged) 54 | -------------------------------------------------------------------------------- /modules/no_blueprint_library.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | 3 | local function on_player_joined_game() 4 | game.permissions.get_group('Default').set_allows_action(defines.input_action.grab_blueprint_record, false) 5 | game.permissions.get_group('Default').set_allows_action(defines.input_action.import_blueprint_string, false) 6 | game.permissions.get_group('Default').set_allows_action(defines.input_action.import_blueprint, false) 7 | end 8 | 9 | Event.add(defines.events.on_player_joined_game, on_player_joined_game) 10 | -------------------------------------------------------------------------------- /modules/no_deconstruction_of_neutral_entities.lua: -------------------------------------------------------------------------------- 1 | local blacklist = { 2 | ['cliff'] = true, 3 | ['item-entity'] = true 4 | } 5 | 6 | local function on_marked_for_deconstruction(event) 7 | local entity = event.entity 8 | if not entity.valid then 9 | return 10 | end 11 | if not event.player_index then 12 | return 13 | end 14 | if entity.force.name ~= 'neutral' then 15 | return 16 | end 17 | if blacklist[entity.type] then 18 | return 19 | end 20 | entity.cancel_deconstruction(game.players[event.player_index].force.name) 21 | end 22 | 23 | local Event = require 'utils.event' 24 | Event.add(defines.events.on_marked_for_deconstruction, on_marked_for_deconstruction) 25 | -------------------------------------------------------------------------------- /modules/no_handcrafting.lua: -------------------------------------------------------------------------------- 1 | -- Disables all hand-crafting recipes and spawns a assembling-machine-2 close to spawn --- by Quadrum 2 | -- "would make it so there is only 1 crafting machine that can not be mined and players have to fight over what it is making in the beginning" ~mewmew 3 | 4 | local function disable_recipe(recipe, force) 5 | force.set_hand_crafting_disabled_for_recipe(recipe.name, 1) 6 | end 7 | 8 | local function on_player_joined_game() 9 | if game.tick == 0 then 10 | local surface = game.surfaces[1] 11 | 12 | local power_source = surface.create_entity({name = 'solar-panel', position = {x = -4, y = 3}, force = 'player'}) 13 | power_source.destructible = false 14 | power_source.minable = true 15 | 16 | local power_pole = surface.create_entity({name = 'small-electric-pole', position = {x = -4, y = 1}, force = 'player'}) 17 | power_pole.destructible = false 18 | power_pole.minable = true 19 | 20 | local assembler = surface.create_entity({name = 'assembling-machine-2', position = {x = -4, y = -1}, force = 'player'}) 21 | assembler.destructible = false 22 | assembler.minable = false 23 | assembler.operable = true 24 | end 25 | end 26 | 27 | local function on_pre_player_crafted_item(event) 28 | local recipe = event.recipe 29 | local player = game.players[event.player_index] 30 | local count = event.queued_count 31 | 32 | player.cancel_crafting({index = 1, count = count}) 33 | disable_recipe(recipe, player.force) 34 | end 35 | 36 | local Event = require 'utils.event' 37 | Event.add(defines.events.on_player_joined_game, on_player_joined_game) 38 | Event.add(defines.events.on_pre_player_crafted_item, on_pre_player_crafted_item) 39 | -------------------------------------------------------------------------------- /modules/no_solar.lua: -------------------------------------------------------------------------------- 1 | local function deny_building(event) 2 | local entity = event.entity 3 | if not entity.valid then 4 | return 5 | end 6 | if entity.type ~= 'solar-panel' then 7 | return 8 | end 9 | local surface = entity.surface 10 | local name = entity.name 11 | local position = {entity.position.x, entity.position.y} 12 | entity.destroy() 13 | surface.create_entity({name = 'flying-text', position = position, text = name .. ' can not be placed.', color = {r = 0.77, g = 0.00, b = 0.00}}) 14 | surface.spill_item_stack(position, {name = name, count = 1}, true) 15 | end 16 | 17 | local function on_built_entity(event) 18 | deny_building(event) 19 | end 20 | 21 | local function on_robot_built_entity(event) 22 | deny_building(event) 23 | end 24 | 25 | local event = require 'utils.event' 26 | event.add(defines.events.on_built_entity, on_built_entity) 27 | event.add(defines.events.on_robot_built_entity, on_robot_built_entity) 28 | -------------------------------------------------------------------------------- /modules/no_turrets.lua: -------------------------------------------------------------------------------- 1 | local turret_types = { 2 | ['ammo-turret'] = true, 3 | ['artillery-turret'] = true, 4 | ['electric-turret'] = true, 5 | ['fluid-turret'] = true 6 | } 7 | 8 | local function destroy_turret(entity) 9 | if not entity.valid then 10 | return 11 | end 12 | if not turret_types[entity.type] then 13 | return 14 | end 15 | entity.die() 16 | end 17 | 18 | local function on_built_entity(event) 19 | destroy_turret(event.entity) 20 | end 21 | 22 | local function on_robot_built_entity(event) 23 | destroy_turret(event.entity) 24 | end 25 | 26 | local event = require 'utils.event' 27 | event.add(defines.events.on_built_entity, on_built_entity) 28 | event.add(defines.events.on_robot_built_entity, on_robot_built_entity) 29 | -------------------------------------------------------------------------------- /modules/offline_characters.lua: -------------------------------------------------------------------------------- 1 | local Global = require 'utils.global' 2 | local Event = require 'utils.event' 3 | 4 | local offline_characters = {} 5 | Global.register( 6 | offline_characters, 7 | function(tbl) 8 | offline_characters = tbl 9 | end 10 | ) 11 | 12 | local function on_player_joined_game(event) 13 | local player = game.players[event.player_index] 14 | if not offline_characters[player.index] then 15 | return 16 | end 17 | 18 | local offline_character = offline_characters[player.index] 19 | if not offline_character or not offline_character.valid then 20 | offline_characters[player.index] = nil 21 | if not player.character or player.character.valid then 22 | player.set_controller({type = defines.controllers.god}) 23 | player.create_character() 24 | end 25 | return 26 | end 27 | 28 | local c = player.character 29 | if c and c.valid then 30 | player.character = nil 31 | c.destroy() 32 | end 33 | 34 | player.associate_character(offline_character) 35 | player.set_controller({type = defines.controllers.character, character = offline_character}) 36 | offline_characters[player.index] = nil 37 | end 38 | 39 | local function on_pre_player_left_game(event) 40 | local player = game.players[event.player_index] 41 | local character = player.character 42 | if not character or not character.valid then 43 | return 44 | end 45 | player.set_controller({type = defines.controllers.god}) 46 | character.driving = false 47 | character.associated_player = nil 48 | character.color = {125, 125, 125} 49 | offline_characters[player.index] = character 50 | end 51 | 52 | Event.add(defines.events.on_player_joined_game, on_player_joined_game) 53 | Event.add(defines.events.on_pre_player_left_game, on_pre_player_left_game) 54 | -------------------------------------------------------------------------------- /modules/ores_are_mixed.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local simplex_noise = require 'utils.math.simplex_noise'.d2 3 | local Public = {} 4 | local ore_raffle = { 5 | 'iron-ore', 6 | 'iron-ore', 7 | 'iron-ore', 8 | 'copper-ore', 9 | 'copper-ore', 10 | 'coal', 11 | 'stone' 12 | } 13 | 14 | Public.settings = { 15 | mixed_ores_on_nauvis_only = false 16 | } 17 | 18 | local function on_chunk_generated(event) 19 | local surface = event.surface 20 | if Public.settings.mixed_ores_on_nauvis_only and surface.name ~= 'nauvis' then 21 | return 22 | end 23 | local ores = surface.find_entities_filtered({ area = event.area, name = { 'iron-ore', 'copper-ore', 'coal', 'stone' } }) 24 | if #ores == 0 then 25 | return 26 | end 27 | local seed = game.surfaces[1].map_gen_settings.seed 28 | 29 | for _, ore in pairs(ores) do 30 | local pos = ore.position 31 | local noise = 32 | simplex_noise(pos.x * 0.005, pos.y * 0.005, seed) + simplex_noise(pos.x * 0.01, pos.y * 0.01, seed) * 0.3 + simplex_noise(pos.x * 0.05, pos.y * 0.05, seed) * 0.2 33 | 34 | local i = (math.floor(noise * 100) % 7) + 1 35 | surface.create_entity({ name = ore_raffle[i], position = ore.position, amount = ore.amount }) 36 | ore.destroy() 37 | end 38 | end 39 | 40 | Event.add(defines.events.on_chunk_generated, on_chunk_generated) 41 | 42 | return Public 43 | -------------------------------------------------------------------------------- /modules/pistol_buffs.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | 3 | local function on_entity_damaged(event) 4 | if not event.cause then 5 | return 6 | end 7 | if not event.cause.valid then 8 | return 9 | end 10 | if event.cause.name ~= 'character' then 11 | return 12 | end 13 | if event.damage_type.name ~= 'physical' then 14 | return 15 | end 16 | 17 | local player = event.cause 18 | if player.shooting_state.state == defines.shooting.not_shooting then 19 | return 20 | end 21 | local weapon = player.get_inventory(defines.inventory.character_guns)[player.selected_gun_index] 22 | local ammo = player.get_inventory(defines.inventory.character_ammo)[player.selected_gun_index] 23 | if not weapon.valid_for_read or not ammo.valid_for_read then 24 | return 25 | end 26 | if weapon.name ~= 'pistol' then 27 | return 28 | end 29 | if ammo.name ~= 'firearm-magazine' and ammo.name ~= 'piercing-rounds-magazine' and ammo.name ~= 'uranium-rounds-magazine' then 30 | return 31 | end 32 | if not event.entity.valid then 33 | return 34 | end 35 | event.entity.damage(event.final_damage_amount * 3, player.force, 'impact', player) 36 | end 37 | 38 | Event.add(defines.events.on_entity_damaged, on_entity_damaged) 39 | -------------------------------------------------------------------------------- /modules/players_trample_paths.lua: -------------------------------------------------------------------------------- 1 | -- players trample paths, tiles change as players walk around 2 | 3 | local Event = require 'utils.event' 4 | local math_random = math.random 5 | 6 | local blacklisted_tiles = { 7 | ['concrete'] = true, 8 | ['deepwater'] = true, 9 | ['deepwater-green'] = true, 10 | ['dirt-1'] = true, 11 | ['hazard-concrete-left'] = true, 12 | ['hazard-concrete-right'] = true, 13 | ['lab-dark-1'] = true, 14 | ['lab-dark-2'] = true, 15 | ['lab-white'] = true, 16 | ['out-of-map'] = true, 17 | ['refined-concrete'] = true, 18 | ['refined-hazard-concrete-left'] = true, 19 | ['refined-hazard-concrete-right'] = true, 20 | ['stone-path'] = true, 21 | ['tutorial-grid'] = true, 22 | ['water'] = true, 23 | ['water-green'] = true 24 | } 25 | 26 | local replacement_tiles = { 27 | ['dirt-7'] = 'dirt-6', 28 | ['dirt-6'] = 'dirt-5', 29 | ['dirt-5'] = 'dirt-4', 30 | ['dirt-4'] = 'dirt-3', 31 | ['dirt-3'] = 'dirt-2', 32 | ['dirt-2'] = 'dirt-1' 33 | } 34 | 35 | local function on_player_changed_position(event) 36 | if math_random(1, 2) ~= 1 then 37 | return 38 | end 39 | local player = game.players[event.player_index] 40 | if not player.character then 41 | return 42 | end 43 | if player.character.driving then 44 | return 45 | end 46 | 47 | local tile = player.surface.get_tile(player.position) 48 | if not tile then 49 | return 50 | end 51 | if not tile.valid then 52 | return 53 | end 54 | 55 | if blacklisted_tiles[tile.name] then 56 | return 57 | end 58 | 59 | local new_tile = 'dirt-7' 60 | if replacement_tiles[tile.name] then 61 | new_tile = replacement_tiles[tile.name] 62 | end 63 | 64 | player.surface.set_tiles({{name = new_tile, position = tile.position}}, true) 65 | end 66 | 67 | Event.add(defines.events.on_player_changed_position, on_player_changed_position) 68 | -------------------------------------------------------------------------------- /modules/rocks_heal_over_time.lua: -------------------------------------------------------------------------------- 1 | -- rocks and other entities heal over time -- by mewmew 2 | local Event = require 'utils.event' 3 | 4 | local entity_whitelist = { 5 | ['big-rock'] = true, 6 | ['big-sand-rock'] = true, 7 | ['huge-rock'] = true, 8 | ['mineable-wreckage'] = true 9 | } 10 | 11 | local function process_entity(v, key) 12 | if not v.entity then 13 | storage.entities_regenerate_health[key] = nil 14 | return 15 | end 16 | if not v.entity.valid then 17 | storage.entities_regenerate_health[key] = nil 18 | return 19 | end 20 | 21 | if v.last_damage + 36000 < game.tick then 22 | v.entity.health = v.entity.health + math.floor(v.entity.max_health * 0.02) 23 | if v.entity.max_health == v.entity.health then 24 | storage.entities_regenerate_health[key] = nil 25 | end 26 | end 27 | end 28 | 29 | local function on_entity_damaged(event) 30 | if not event.entity.valid then 31 | return 32 | end 33 | if event.entity.force.index ~= 3 then 34 | return 35 | end 36 | if not entity_whitelist[event.entity.name] then 37 | return 38 | end 39 | storage.entities_regenerate_health[tostring(event.entity.position.x) .. '_' .. tostring(event.entity.position.y)] = { last_damage = game.tick, entity = event.entity } 40 | end 41 | 42 | local function tick() 43 | for key, entity in pairs(storage.entities_regenerate_health) do 44 | process_entity(entity, key) 45 | end 46 | end 47 | 48 | local function on_init() 49 | storage.entities_regenerate_health = {} 50 | end 51 | 52 | Event.on_nth_tick(1800, tick) 53 | Event.on_init(on_init) 54 | Event.add(defines.events.on_entity_damaged, on_entity_damaged) 55 | -------------------------------------------------------------------------------- /modules/rocks_yield_coins.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | 3 | local coin_yield = { 4 | ['big-rock'] = 3, 5 | ['huge-rock'] = 6, 6 | ['big-sand-rock'] = 3 7 | } 8 | 9 | local function on_player_mined_entity(event) 10 | if coin_yield[event.entity.name] then 11 | event.entity.surface.spill_item_stack( 12 | event.entity.position, 13 | { name = 'coin', count = math.random(math.ceil(coin_yield[event.entity.name] * 0.5), math.ceil(coin_yield[event.entity.name] * 2)) }, 14 | true 15 | ) 16 | end 17 | end 18 | 19 | Event.add(defines.events.on_player_mined_entity, on_player_mined_entity) 20 | -------------------------------------------------------------------------------- /modules/rpg/core.lua: -------------------------------------------------------------------------------- 1 | local Public = require 'modules.rpg.table' 2 | 3 | local Spells = require 'modules.rpg.spells' 4 | Public.spells = Spells 5 | 6 | local Bullets = require 'modules.rpg.explosive_gun_bullets' 7 | Public.explosive_bullet = Bullets 8 | 9 | local RangeBuffs = require 'modules.rpg.range_buffs' 10 | Public.range_buffs = RangeBuffs 11 | 12 | local Functions = require 'modules.rpg.functions' 13 | Public.functions = Functions 14 | 15 | local Gui = require 'modules.rpg.gui' 16 | Public.gui = Gui 17 | 18 | local Settings = require 'modules.rpg.settings' 19 | Public.settings = Settings 20 | 21 | local Commands = require 'modules.rpg.commands' 22 | Public.commands = Commands 23 | 24 | return Public 25 | -------------------------------------------------------------------------------- /modules/shotgun_buff.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | 3 | local function on_research_finished(event) 4 | local research = event.research 5 | if string.sub(research.name, 0, 26) ~= 'physical-projectile-damage' then 6 | return 7 | end 8 | local multiplier = 4 9 | if storage.shotgun_shell_damage_research_multiplier then 10 | multiplier = storage.shotgun_shell_damage_research_multiplier 11 | end 12 | 13 | local modifier = game.forces[research.force.name].get_ammo_damage_modifier('shotgun-shell') 14 | 15 | local proto = prototypes.technology[research.name] 16 | 17 | modifier = modifier - proto.effects[3].modifier 18 | modifier = modifier + proto.effects[3].modifier * multiplier 19 | 20 | game.forces[research.force.name].set_ammo_damage_modifier('shotgun-shell', modifier) 21 | end 22 | 23 | Event.add(defines.events.on_research_finished, on_research_finished) 24 | -------------------------------------------------------------------------------- /modules/spawners_contain_acid.lua: -------------------------------------------------------------------------------- 1 | local Event = require 'utils.event' 2 | local radius = 16 3 | 4 | local targets = {} 5 | for x = radius * -1, radius, 1 do 6 | for y = radius * -1, radius, 1 do 7 | if math.sqrt(x ^ 2 + y ^ 2) <= radius then 8 | targets[#targets + 1] = {x = x, y = y} 9 | end 10 | end 11 | end 12 | 13 | local function on_entity_died(event) 14 | if not event.entity.valid then 15 | return 16 | end 17 | if event.entity.type ~= 'unit-spawner' then 18 | return 19 | end 20 | for _ = 1, math.random(64, 128) do 21 | local i = math.random(1, #targets) 22 | event.entity.surface.create_entity( 23 | { 24 | name = 'acid-stream-worm-medium', 25 | position = event.entity.position, 26 | force = event.entity.force.name, 27 | source = event.entity.position, 28 | target = {x = event.entity.position.x + targets[i].x, y = event.entity.position.y + targets[i].y}, 29 | max_range = radius, 30 | speed = 0.001 31 | } 32 | ) 33 | end 34 | end 35 | 36 | Event.add(defines.events.on_entity_died, on_entity_died) 37 | -------------------------------------------------------------------------------- /modules/spawners_contain_biters.lua: -------------------------------------------------------------------------------- 1 | -- spawners release biters on death -- by mewmew 2 | 3 | local Event = require 'utils.event' 4 | local math_random = math.random 5 | 6 | local biter_building_inhabitants = { 7 | [1] = { { 'small-biter', 8, 16 } }, 8 | [2] = { { 'small-biter', 12, 24 } }, 9 | [3] = { { 'small-biter', 8, 16 }, { 'medium-biter', 1, 2 } }, 10 | [4] = { { 'small-biter', 4, 8 }, { 'medium-biter', 4, 8 } }, 11 | [5] = { { 'small-biter', 3, 5 }, { 'medium-biter', 8, 12 } }, 12 | [6] = { { 'small-biter', 3, 5 }, { 'medium-biter', 5, 7 }, { 'big-biter', 1, 2 } }, 13 | [7] = { { 'medium-biter', 6, 8 }, { 'big-biter', 3, 5 } }, 14 | [8] = { { 'medium-biter', 2, 4 }, { 'big-biter', 6, 8 } }, 15 | [9] = { { 'medium-biter', 2, 3 }, { 'big-biter', 7, 9 } }, 16 | [10] = { { 'big-biter', 4, 8 }, { 'behemoth-biter', 3, 4 } } 17 | } 18 | 19 | local function on_entity_died(event) 20 | if not event.entity.valid then 21 | return 22 | end 23 | local entity = event.entity 24 | if entity.type ~= 'unit-spawner' then 25 | return 26 | end 27 | if entity.force.index == 1 then 28 | return 29 | end 30 | local evo = entity.force.get_evolution_factor(entity.surface.index) 31 | 32 | local e = math.ceil(evo * 10) 33 | if e < 1 then 34 | e = 1 35 | end 36 | for _, t in pairs(biter_building_inhabitants[e]) do 37 | for _ = 1, math_random(t[2], t[3]), 1 do 38 | local p = entity.surface.find_non_colliding_position(t[1], entity.position, 6, 1) 39 | if p then 40 | entity.surface.create_entity { name = t[1], position = p, force = entity.force.name } 41 | end 42 | end 43 | end 44 | end 45 | 46 | Event.add(defines.events.on_entity_died, on_entity_died) 47 | -------------------------------------------------------------------------------- /modules/spitters_spit_biters.lua: -------------------------------------------------------------------------------- 1 | -- spitters spit biters, because why not -- by mewmew 2 | 3 | local Event = require 'utils.event' 4 | 5 | local radius = 3 6 | local max_biters_in_radius = 3 7 | 8 | local biters = { 9 | ['big-spitter'] = 'small-biter', 10 | ['behemoth-spitter'] = 'medium-biter' 11 | } 12 | 13 | local function on_entity_damaged(event) 14 | if not event.cause then 15 | return 16 | end 17 | if not event.cause.valid then 18 | return 19 | end 20 | if not biters[event.cause.name] then 21 | return 22 | end 23 | local area = {{event.entity.position.x - radius, event.entity.position.y - radius}, {event.entity.position.x + radius, event.entity.position.y + radius}} 24 | if event.cause.surface.count_entities_filtered({area = area, name = biters[event.cause.name], limit = 3}) >= max_biters_in_radius then 25 | return 26 | end 27 | local pos = event.cause.surface.find_non_colliding_position(biters[event.cause.name], event.entity.position, radius, 0.5) 28 | if pos then 29 | event.cause.surface.create_entity({name = biters[event.cause.name], position = pos}) 30 | end 31 | end 32 | 33 | Event.add(defines.events.on_entity_damaged, on_entity_damaged) 34 | -------------------------------------------------------------------------------- /modules/splice.lua: -------------------------------------------------------------------------------- 1 | -- biter splicing -- storage.splice_modifier can be increased for increased difficulty -- by mewmew 2 | 3 | local Event = require 'utils.event' 4 | 5 | local biter_fragmentation = { 6 | ['medium-biter'] = { 'small-biter', 1 }, 7 | ['big-biter'] = { 'medium-biter', 1 }, 8 | ['behemoth-biter'] = { 'big-biter', 1 } 9 | } 10 | 11 | local function on_entity_died(event) 12 | if not event.entity.valid then 13 | return 14 | end 15 | if biter_fragmentation[event.entity.name] then 16 | local entity = event.entity 17 | local amount = 1 18 | if storage.splice_modifier then 19 | amount = math.ceil(storage.splice_modifier * biter_fragmentation[entity.name][2]) 20 | end 21 | if amount < 1 then 22 | return 23 | end 24 | for _ = 1, amount, 1 do 25 | local p = entity.surface.find_non_colliding_position(biter_fragmentation[entity.name][1], entity.position, 3, 0.5) 26 | if p then 27 | entity.surface.create_entity({ name = biter_fragmentation[entity.name][1], position = p }) 28 | end 29 | end 30 | end 31 | end 32 | 33 | Event.add(defines.events.on_entity_died, on_entity_died) 34 | -------------------------------------------------------------------------------- /modules/splice_double.lua: -------------------------------------------------------------------------------- 1 | -- biters splice into two -- by mewmew 2 | 3 | local Event = require 'utils.event' 4 | 5 | local biter_fragmentation = { 6 | ['medium-biter'] = 'small-biter', 7 | ['big-biter'] = 'medium-biter', 8 | ['behemoth-biter'] = 'big-biter' 9 | } 10 | 11 | local function on_entity_died(event) 12 | if not event.entity.valid then 13 | return 14 | end 15 | if biter_fragmentation[event.entity.name] then 16 | local entity = event.entity 17 | for _ = 1, 2, 1 do 18 | local p = entity.surface.find_non_colliding_position(biter_fragmentation[entity.name], entity.position, 3, 0.5) 19 | if p then 20 | entity.surface.create_entity({name = biter_fragmentation[entity.name], position = p}) 21 | end 22 | end 23 | return 24 | end 25 | end 26 | 27 | Event.add(defines.events.on_entity_died, on_entity_died) 28 | -------------------------------------------------------------------------------- /modules/teleporting_worms.lua: -------------------------------------------------------------------------------- 1 | -- worms will teleport to where they shoot -- by mewmew 2 | 3 | local Event = require 'utils.event' 4 | 5 | local function on_entity_damaged(event) 6 | if not event.cause then 7 | return 8 | end 9 | local cause = event.cause 10 | if cause.type ~= 'turret' then 11 | return 12 | end 13 | if cause.health <= 0 then 14 | return 15 | end 16 | local new_position = { 17 | x = (cause.position.x + event.entity.position.x) * 0.5, 18 | y = (cause.position.y + event.entity.position.y) * 0.5 19 | } 20 | new_position = { 21 | x = (cause.position.x + new_position.x) * 0.5, 22 | y = (cause.position.y + new_position.y) * 0.5 23 | } 24 | local new_turret = cause.surface.create_entity({name = cause.name, force = cause.force, position = new_position}) 25 | cause.surface.create_entity({name = 'blood-explosion-big', position = new_position}) 26 | cause.surface.create_entity({name = 'blood-explosion-big', position = cause.position}) 27 | new_turret.health = cause.health 28 | cause.destroy() 29 | end 30 | 31 | Event.add(defines.events.on_entity_damaged, on_entity_damaged) 32 | -------------------------------------------------------------------------------- /modules/towny/combat_balance.lua: -------------------------------------------------------------------------------- 1 | local Public = {} 2 | local string_sub = string.sub 3 | 4 | local balance_functions = { 5 | ['land-mine'] = function(force_name) 6 | game.forces[force_name].set_ammo_damage_modifier('landmine', -0.6) 7 | end, 8 | ['stronger-explosives'] = function(force_name) 9 | game.forces[force_name].set_ammo_damage_modifier('landmine', -0.6) 10 | end 11 | } 12 | 13 | function Public.research(event) 14 | local research_name = event.research.name 15 | local force_name = event.research.force.name 16 | local key 17 | for b = 1, string.len(research_name), 1 do 18 | key = string_sub(research_name, 0, b) 19 | if balance_functions[key] then 20 | balance_functions[key](force_name) 21 | return 22 | end 23 | end 24 | end 25 | 26 | function Public.fish(event) 27 | if event.item.name ~= 'raw-fish' then 28 | return 29 | end 30 | local player = game.players[event.player_index] 31 | player.character.health = player.character.health - 80 32 | end 33 | 34 | return Public 35 | -------------------------------------------------------------------------------- /modules/towny/table.lua: -------------------------------------------------------------------------------- 1 | -- one table to rule them all! 2 | local Global = require 'utils.global' 3 | local Event = require 'utils.event' 4 | 5 | local townytable = {} 6 | local Public = {} 7 | 8 | Global.register( 9 | townytable, 10 | function(tbl) 11 | townytable = tbl 12 | end 13 | ) 14 | 15 | function Public.reset_table() 16 | for k, _ in pairs(townytable) do 17 | townytable[k] = nil 18 | end 19 | townytable.requests = {} 20 | townytable.request_cooldowns = {} 21 | townytable.town_centers = {} 22 | townytable.cooldowns = {} 23 | townytable.size_of_town_centers = 0 24 | townytable.swarms = {} 25 | townytable.town_buttons = {} 26 | end 27 | 28 | function Public.get_table() 29 | return townytable 30 | end 31 | 32 | local on_init = function() 33 | Public.reset_table() 34 | end 35 | 36 | Event.on_init(on_init) 37 | 38 | return Public 39 | -------------------------------------------------------------------------------- /modules/wave_defense/core.lua: -------------------------------------------------------------------------------- 1 | local Public = require 'modules.wave_defense.table' 2 | 3 | local Enemy_states = require 'modules.wave_defense.enemy_states' 4 | Public.enemy_states = Enemy_states 5 | 6 | local Biter_Rolls = require 'modules.wave_defense.biter_rolls' 7 | Public.biter_rolls = Biter_Rolls 8 | 9 | local Buried_enemies = require 'modules.wave_defense.buried_enemies' 10 | Public.buried_enemies = Buried_enemies 11 | 12 | local Commands = require 'modules.wave_defense.commands' 13 | Public.commands = Commands 14 | 15 | local Pause_Waves = require 'modules.wave_defense.pause_waves' 16 | Public.pause_waves = Pause_Waves 17 | 18 | local Gui = require 'modules.wave_defense.gui' 19 | Public.gui = Gui 20 | 21 | local Side_targets = require 'modules.wave_defense.side_targets' 22 | Public.side_targets = Side_targets 23 | 24 | local Threat_events = require 'modules.wave_defense.threat_events' 25 | Public.threat_events = Threat_events 26 | 27 | return Public 28 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |