1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2024-12-26 22:56:43 +02:00

Move folders to utils

This commit is contained in:
Gerkiz 2024-01-28 20:42:28 +01:00
parent 4de16c2bab
commit a8538ebd67
105 changed files with 4052 additions and 3770 deletions

View File

@ -251,14 +251,14 @@ require 'utils.remote_chunks'
---------------------------------------------------------------
---------------- MOSTLY TERRAIN LAYOUTS HERE ----------------
--require 'terrain_layouts.winter'
--require 'terrain_layouts.caves'
--require 'terrain_layouts.cone_to_east'
--require 'terrain_layouts.biters_and_resources_east'
--require 'terrain_layouts.scrap_01'
--require 'terrain_layouts.scrap_02'
--require 'terrain_layouts.watery_world'
--require 'terrain_layouts.tree_01'
--require 'utils.terrain_layouts.winter'
--require 'utils.terrain_layouts.caves'
--require 'utils.terrain_layouts.cone_to_east'
--require 'utils.terrain_layouts.biters_and_resources_east'
--require 'utils.terrain_layouts.scrap_01'
--require 'utils.terrain_layouts.scrap_02'
--require 'utils.terrain_layouts.watery_world'
--require 'utils.terrain_layouts.tree_01'
---------------------------------------------------------------
--- this file exists only for the panel to sync and start from within the panel

View File

@ -6,7 +6,7 @@ require 'modules.dynamic_player_spawn'
local Event = require 'utils.event'
local math_random = math.random
local map_functions = require 'tools.map_functions'
local map_functions = require 'utils.tools.map_functions'
local function on_player_joined_game(event)
local player = game.players[event.player_index]

View File

@ -1,5 +1,5 @@
--luacheck:ignore
local simplex_noise = require 'tools.simplex_noise'
local simplex_noise = require 'utils.tools.simplex_noise'
local Event = require 'utils.event'
biter_battles_terrain = {}
@ -471,10 +471,7 @@ function biter_battles_terrain.generate_spawn_ores(ore_layout)
end
end
surface.set_tiles(tiles, true)
local entities =
surface.find_entities(
{{(rocket_silo.position.x - 4) - size / 2, (rocket_silo.position.y - 5) - size / 2}, {rocket_silo.position.x + 4 + size / 2, rocket_silo.position.y + 5 + size / 2}}
)
local entities = surface.find_entities({{(rocket_silo.position.x - 4) - size / 2, (rocket_silo.position.y - 5) - size / 2}, {rocket_silo.position.x + 4 + size / 2, rocket_silo.position.y + 5 + size / 2}})
for _, entity in pairs(entities) do
if entity.type == 'simple-entity' or entity.type == 'tree' or entity.type == 'resource' then
entity.destroy()

View File

@ -1,7 +1,7 @@
--luacheck: ignore
local Public = {}
local LootRaffle = require 'functions.loot_raffle'
local BiterRaffle = require 'functions.biter_raffle'
local LootRaffle = require 'utils.functions.loot_raffle'
local BiterRaffle = require 'utils.functions.biter_raffle'
local bb_config = require 'maps.biter_battles_v2.config'
local table_insert = table.insert
@ -646,9 +646,7 @@ function Public.generate_silo(surface)
for _, t in pairs(surface.find_tiles_filtered({area = {{pos.x - 6, pos.y - 6}, {pos.x + 6, pos.y + 6}}, name = {'water', 'deepwater'}})) do
surface.set_tiles({{name = get_replacement_tile(surface, t.position), position = t.position}})
end
for _, t in pairs(
surface.find_tiles_filtered({area = {{mirror_position.x - 6, mirror_position.y - 6}, {mirror_position.x + 6, mirror_position.y + 6}}, name = {'water', 'deepwater'}})
) do
for _, t in pairs(surface.find_tiles_filtered({area = {{mirror_position.x - 6, mirror_position.y - 6}, {mirror_position.x + 6, mirror_position.y + 6}}, name = {'water', 'deepwater'}})) do
surface.set_tiles({{name = get_replacement_tile(surface, t.position), position = t.position}})
end

View File

@ -4,12 +4,12 @@
require 'modules.dynamic_landfill'
require 'modules.satellite_score'
require 'modules.spawners_contain_biters'
require 'functions.create_entity_chain'
require 'functions.create_tile_chain'
require 'utils.functions.create_entity_chain'
require 'utils.functions.create_tile_chain'
local unearthing_worm = require 'functions.unearthing_worm'
local unearthing_biters = require 'functions.unearthing_biters'
local tick_tack_trap = require 'functions.tick_tack_trap'
local unearthing_worm = require 'utils.functions.unearthing_worm'
local unearthing_biters = require 'utils.functions.unearthing_biters'
local tick_tack_trap = require 'utils.functions.tick_tack_trap'
local Module = require 'infinity_chest'
local Simplex = require 'utils.simplex_noise'.d2
local Event = require 'utils.event'

View File

@ -3,8 +3,8 @@ local Public = {}
local GetNoise = require 'utils.get_noise'
local Constants = require 'maps.cave_miner_v2.constants'
local BiterRaffle = require 'functions.biter_raffle'
local LootRaffle = require 'functions.loot_raffle'
local BiterRaffle = require 'utils.functions.biter_raffle'
local LootRaffle = require 'utils.functions.loot_raffle'
local Esq = require 'modules.entity_spawn_queue'
local Pets = require 'modules.biter_pets'

View File

@ -3,7 +3,7 @@ local Public = {}
local Constants = require 'maps.cave_miner_v2.constants'
local Functions = require 'maps.cave_miner_v2.functions'
local LootRaffle = require 'functions.loot_raffle'
local LootRaffle = require 'utils.functions.loot_raffle'
local math_floor = math.floor
local math_random = math.random

View File

@ -5,17 +5,17 @@ require 'modules.dynamic_landfill'
require 'modules.satellite_score'
require 'modules.spawners_contain_biters'
local Map = require 'modules.map_info'
local unearthing_worm = require 'functions.unearthing_worm'
local unearthing_biters = require 'functions.unearthing_biters'
local tick_tack_trap = require 'functions.tick_tack_trap'
local create_entity_chain = require 'functions.create_entity_chain'
local create_tile_chain = require 'functions.create_tile_chain'
local unearthing_worm = require 'utils.functions.unearthing_worm'
local unearthing_biters = require 'utils.functions.unearthing_biters'
local tick_tack_trap = require 'utils.functions.tick_tack_trap'
local create_entity_chain = require 'utils.functions.create_entity_chain'
local create_tile_chain = require 'utils.functions.create_tile_chain'
local simplex_noise = require 'utils.simplex_noise'.d2
local event = require 'utils.event'
local table_insert = table.insert
local math_random = math.random
local map_functions = require 'tools.map_functions'
local map_functions = require 'utils.tools.map_functions'
local disabled_for_deconstruction = {
['fish'] = true,
@ -164,9 +164,7 @@ local function process_tile(surface, pos, tile, seed)
surface.create_entity({name = 'tree-01', position = pos})
end
end
surface.create_decoratives(
{check_collision = false, decoratives = {{name = decos_inside_forest[math_random(1, #decos_inside_forest)], position = pos, amount = math_random(1, 2)}}}
)
surface.create_decoratives({check_collision = false, decoratives = {{name = decos_inside_forest[math_random(1, #decos_inside_forest)], position = pos, amount = math_random(1, 2)}}})
return
end
@ -180,9 +178,7 @@ local function process_tile(surface, pos, tile, seed)
surface.create_entity({name = 'tree-02-red', position = pos})
end
end
surface.create_decoratives(
{check_collision = false, decoratives = {{name = decos_inside_forest[math_random(1, #decos_inside_forest)], position = pos, amount = math_random(1, 2)}}}
)
surface.create_decoratives({check_collision = false, decoratives = {{name = decos_inside_forest[math_random(1, #decos_inside_forest)], position = pos, amount = math_random(1, 2)}}})
return
end
@ -387,11 +383,7 @@ local function on_entity_died(event)
return
end
if event.entity.type == 'tree' then
for _, entity in pairs(
event.entity.surface.find_entities_filtered(
{area = {{event.entity.position.x - 4, event.entity.position.y - 4}, {event.entity.position.x + 4, event.entity.position.y + 4}}, name = 'fire-flame-on-tree'}
)
) do
for _, entity in pairs(event.entity.surface.find_entities_filtered({area = {{event.entity.position.x - 4, event.entity.position.y - 4}, {event.entity.position.x + 4, event.entity.position.y + 4}}, name = 'fire-flame-on-tree'})) do
if entity.valid then
entity.destroy()
end

View File

@ -4,17 +4,17 @@
require 'modules.satellite_score'
require 'modules.spawners_contain_biters'
require 'functions.create_entity_chain'
require 'functions.create_tile_chain'
require 'tools.map_functions'
require 'utils.functions.create_entity_chain'
require 'utils.functions.create_tile_chain'
require 'utils.tools.map_functions'
require 'modules.surrounded_by_worms'
require 'modules.biter_noms_you'
local Map = require 'modules.map_info'
local unearthing_worm = require 'functions.unearthing_worm'
local unearthing_biters = require 'functions.unearthing_biters'
local tick_tack_trap = require 'functions.tick_tack_trap'
local unearthing_worm = require 'utils.functions.unearthing_worm'
local unearthing_biters = require 'utils.functions.unearthing_biters'
local tick_tack_trap = require 'utils.functions.tick_tack_trap'
local simplex_noise = require 'utils.simplex_noise'.d2
local Event = require 'utils.event'

View File

@ -5,9 +5,9 @@ local Chrono = require 'maps.chronosphere.chrono'
local Upgrades = require 'maps.chronosphere.upgrades'
local Public = {}
local tick_tack_trap = require 'functions.tick_tack_trap'
local unearthing_worm = require 'functions.unearthing_worm'
local unearthing_biters = require 'functions.unearthing_biters'
local tick_tack_trap = require 'utils.functions.tick_tack_trap'
local unearthing_worm = require 'utils.functions.unearthing_worm'
local unearthing_biters = require 'utils.functions.unearthing_biters'
local math_random = math.random
local math_floor = math.floor
@ -162,10 +162,7 @@ function Public.shred_simple_entities(entity)
if game.forces.enemy.evolution_factor < 0.25 then
return
end
local simple_entities =
entity.surface.find_entities_filtered(
{type = {'simple-entity', 'tree'}, area = {{entity.position.x - 3, entity.position.y - 3}, {entity.position.x + 3, entity.position.y + 3}}}
)
local simple_entities = entity.surface.find_entities_filtered({type = {'simple-entity', 'tree'}, area = {{entity.position.x - 3, entity.position.y - 3}, {entity.position.x + 3, entity.position.y + 3}}})
for _, simple_entity in pairs(simple_entities) do
if simple_entity.valid then
simple_entity.destroy()
@ -447,10 +444,7 @@ end
function Public.check_if_overstayed()
local objective = Chrono_table.get_table()
if
objective.passivetimer * objective.passive_chronocharge_rate > (objective.chronochargesneeded * 0.75) and
objective.chronojumps >= Balance.jumps_until_overstay_is_on(Difficulty.get().difficulty_vote_value)
then
if objective.passivetimer * objective.passive_chronocharge_rate > (objective.chronochargesneeded * 0.75) and objective.chronojumps >= Balance.jumps_until_overstay_is_on(Difficulty.get().difficulty_vote_value) then
objective.overstaycount = objective.overstaycount + 1
end
end

View File

@ -19,7 +19,7 @@ local Locomotive = require 'maps.chronosphere.locomotive'
local Map = require 'modules.map_info'
local Minimap = require 'maps.chronosphere.minimap'
local On_Event = require 'maps.chronosphere.on_event'
local Reset = require 'functions.soft_reset'
local Reset = require 'utils.functions.soft_reset'
local Tick_functions = require 'maps.chronosphere.tick_functions'
local Upgrades = require 'maps.chronosphere.upgrades'
local Worlds = require 'maps.chronosphere.world_list'
@ -92,12 +92,7 @@ local function chronojump(choice)
end
if objective.chronojumps <= 24 then
Locomotive.award_coins(
Balance.coin_reward_per_second_jumped_early(
objective.chronochargesneeded / objective.passive_chronocharge_rate + 180 - objective.passivetimer,
Difficulty.get().difficulty_vote_value
)
)
Locomotive.award_coins(Balance.coin_reward_per_second_jumped_early(objective.chronochargesneeded / objective.passive_chronocharge_rate + 180 - objective.passivetimer, Difficulty.get().difficulty_vote_value))
end
Chrono.process_jump()
@ -180,7 +175,7 @@ local function do_tick()
local objective = Chrono_table.get_table()
local tick = game.tick
Ai.Tick_actions(tick)
if objective.passivetimer < 160 then
if objective.passivetimer < 160 then
Tick_functions.request_chunks()
end
if tick % 30 == 20 then

View File

@ -14,7 +14,7 @@ local Session = require 'utils.datastore.session_data'
local Difficulty = require 'modules.difficulty_vote'
local Map = require 'modules.map_info'
local Event = require 'utils.event'
local Reset = require 'functions.soft_reset'
local Reset = require 'utils.functions.soft_reset'
local Server = require 'utils.server'
local Poll = require 'utils.gui.poll'
local boss_biter = require 'maps.crab_defender.boss_biters'

View File

@ -1,6 +1,6 @@
local Event = require 'utils.event'
local Builder = require 'maps.crab_defender.b'
local map_functions = require 'tools.map_functions'
local map_functions = require 'utils.tools.map_functions'
local simplex_noise = require 'utils.simplex_noise'.d2
local FDT = require 'maps.crab_defender.table'
local math_random = math.random

View File

@ -12,7 +12,7 @@ local math_floor = math.floor
local math_abs = math.abs
local math_sqrt = math.sqrt
local LootRaffle = require 'functions.loot_raffle'
local LootRaffle = require 'utils.functions.loot_raffle'
local function get_noise(name, pos)
local seed = game.surfaces[1].map_gen_settings.seed

View File

@ -1,7 +1,7 @@
-- crossing -- by mewmew --
local Event = require 'utils.event'
local map_functions = require 'tools.map_functions'
local map_functions = require 'utils.tools.map_functions'
local simplex_noise = require 'utils.simplex_noise'.d2
local function on_player_joined_game(event)

View File

@ -6,7 +6,7 @@ require 'modules.flashlight_toggle_button'
require 'maps.deep_jungle.generate'
local Event = require 'utils.event'
local map_functions = require 'tools.map_functions'
local map_functions = require 'utils.tools.map_functions'
local Task = require 'utils.task'
local DPT = require 'maps.deep_jungle.table'
local random = math.random

View File

@ -1,5 +1,5 @@
local Functions = require 'maps.dungeons.functions'
local BiterRaffle = require 'functions.biter_raffle'
local BiterRaffle = require 'utils.functions.biter_raffle'
local DungeonsTable = require 'maps.dungeons.table'
local table_shuffle_table = table.shuffle_table

View File

@ -1,5 +1,5 @@
local Functions = require 'maps.dungeons.functions'
local BiterRaffle = require 'functions.biter_raffle'
local BiterRaffle = require 'utils.functions.biter_raffle'
local DungeonsTable = require 'maps.dungeons.table'
local table_shuffle_table = table.shuffle_table

View File

@ -7,8 +7,8 @@ local LOOT_EVOLUTION_SCALE_FACTOR = 0.9
local LOOT_MULTIPLIER = 3000
local EVOLUTION_PER_FLOOR = 0.06
local BiterRaffle = require 'functions.biter_raffle'
local LootRaffle = require 'functions.loot_raffle'
local BiterRaffle = require 'utils.functions.biter_raffle'
local LootRaffle = require 'utils.functions.loot_raffle'
local Get_noise = require 'utils.get_noise'
local DungeonsTable = require 'maps.dungeons.table'
@ -22,28 +22,30 @@ local math_floor = math.floor
-- floor 4 = 8512 .. 9024
-- floor 9 = 16512 .. 17024
-- floor 19 = 32512 .. 33024
LootRaffle.TweakItemWorth({
['modular-armor'] = 512, -- floors 1-5 from research.lua
['power-armor'] = 4096, -- floors 8-13 from research.lua
['personal-laser-defense-equipment'] = 1536, -- floors 10-14 from research.lua
['power-armor-mk2'] = 24576, -- floors 14-21 from research.lua
-- reduce ammo/follower rates
['firearm-magazine'] = 8,
['piercing-rounds-magazine'] = 16,
['uranium-rounds-magazine'] = 128,
['shotgun-shell'] = 8,
['piercing-shotgun-shell'] = 64,
['flamethrower-ammo'] = 128,
['rocket'] = 16,
['explosive-rocket'] = 128,
['grenade'] = 32,
['cluster-grenade'] = 128,
['poison-capsule'] = 64,
['slowdown-capsule'] = 32,
['defender-capsule'] = 96,
['distractor-capsule'] = 512,
['destroyer-capsule'] = 2048,
})
LootRaffle.TweakItemWorth(
{
['modular-armor'] = 512, -- floors 1-5 from research.lua
['power-armor'] = 4096, -- floors 8-13 from research.lua
['personal-laser-defense-equipment'] = 1536, -- floors 10-14 from research.lua
['power-armor-mk2'] = 24576, -- floors 14-21 from research.lua
-- reduce ammo/follower rates
['firearm-magazine'] = 8,
['piercing-rounds-magazine'] = 16,
['uranium-rounds-magazine'] = 128,
['shotgun-shell'] = 8,
['piercing-shotgun-shell'] = 64,
['flamethrower-ammo'] = 128,
['rocket'] = 16,
['explosive-rocket'] = 128,
['grenade'] = 32,
['cluster-grenade'] = 128,
['poison-capsule'] = 64,
['slowdown-capsule'] = 32,
['defender-capsule'] = 96,
['distractor-capsule'] = 512,
['destroyer-capsule'] = 2048
}
)
function Public.get_dungeon_evolution_factor(surface_index)
local dungeontable = DungeonsTable.get_dungeontable()
@ -62,8 +64,8 @@ local function blacklist(surface_index, special)
local dungeontable = DungeonsTable.get_dungeontable()
local evolution_factor = Public.get_loot_evolution_factor(surface_index)
if special then
-- treasure rooms act as if they are 3 levels farther down.
evolution_factor = evolution_factor + 3 * EVOLUTION_PER_FLOOR
-- treasure rooms act as if they are 3 levels farther down.
evolution_factor = evolution_factor + 3 * EVOLUTION_PER_FLOOR
end
local blacklists = {}
--general unused items on dungeons
@ -74,7 +76,7 @@ local function blacklist(surface_index, special)
blacklists['power-armor-mk2'] = true
blacklists['fusion-reactor-equipment'] = true
blacklists['rocket-silo'] = true
blacklists['atomic-bomb'] = true
blacklists['atomic-bomb'] = true
end
if evolution_factor < 0.7 then -- floor 14
blacklists['energy-shield-mk2-equipment'] = true
@ -85,11 +87,11 @@ local function blacklist(surface_index, special)
blacklists['artillery-wagon'] = true
blacklists['power-armor'] = true
end
if evolution_factor < 0.55 then -- floor 11
if evolution_factor < 0.55 then -- floor 11
blacklists['discharge-defense-equipment'] = true
blacklists['discharge-defense-remote'] = true
blacklists['nuclear-reactor'] = true
end
end
if evolution_factor < 0.4 then -- floor 8
blacklists['steam-turbine'] = true
blacklists['heat-exchanger'] = true
@ -144,10 +146,10 @@ function Public.get_common_resource_amount(surface_index)
if dungeontable.tiered then
amount = amount / 8
local floor = surface_index - dungeontable.original_surface_index
-- rocks stop going up here, so more than make up for it in resources on ground
if floor > FLOOR_FOR_MAX_ROCK_ORE then
amount = amount * (1+(floor - FLOOR_FOR_MAX_ROCK_ORE)/10)
end
-- rocks stop going up here, so more than make up for it in resources on ground
if floor > FLOOR_FOR_MAX_ROCK_ORE then
amount = amount * (1 + (floor - FLOOR_FOR_MAX_ROCK_ORE) / 10)
end
end
return amount
end
@ -191,7 +193,7 @@ function Public.epic_loot_crate(surface, position, special)
local dungeontable = DungeonsTable.get_dungeontable()
local loot_value = get_loot_value(surface.index, 8) + math_random(512, 1024)
if special then
loot_value = loot_value * 1.5
loot_value = loot_value * 1.5
end
local bonus_loot = nil
if dungeontable.tiered and loot_value > 32000 and Public.get_dungeon_evolution_factor(surface.index) > 1 then
@ -409,10 +411,10 @@ function Public.on_marked_for_deconstruction(event)
end
local function get_ore_amount(surface_index)
local floor = surface_index - DungeonsTable.get_dungeontable().original_surface_index
local floor = surface_index - DungeonsTable.get_dungeontable().original_surface_index
local amount = FLOOR_ZERO_ROCK_ORE + ROCK_ORE_INCREASE_PER_FLOOR * math.min(FLOOR_FOR_MAX_ROCK_ORE, floor)
return math_random(math_floor(amount * 0.7), math_floor(amount * 1.3))
local amount = FLOOR_ZERO_ROCK_ORE + ROCK_ORE_INCREASE_PER_FLOOR * math.min(FLOOR_FOR_MAX_ROCK_ORE, floor)
return math_random(math_floor(amount * 0.7), math_floor(amount * 1.3))
end
local function reward_ores(amount, mined_loot, surface, player, entity)
@ -470,15 +472,15 @@ function Public.rocky_loot(event)
local player = game.players[event.player_index]
local amount = math.ceil(get_ore_amount(player.surface.index))
local rock_mining
local floor = player.surface.index - DungeonsTable.get_dungeontable().original_surface_index;
local floor = player.surface.index - DungeonsTable.get_dungeontable().original_surface_index
if floor < 10 then
-- early game science uses less copper and more iron/stone
rock_mining = {'iron-ore', 'iron-ore', 'iron-ore', 'iron-ore', 'copper-ore', 'copper-ore', 'stone', 'stone', 'coal', 'coal', 'coal'}
-- early game science uses less copper and more iron/stone
rock_mining = {'iron-ore', 'iron-ore', 'iron-ore', 'iron-ore', 'copper-ore', 'copper-ore', 'stone', 'stone', 'coal', 'coal', 'coal'}
else
-- end game prod 3 base uses (for all-sciences) 1 stone : 2 coal : 3.5 copper : 4.5 iron
-- this is a decent approximation which will still require some modest amount of mining setup
-- coal gets 3 to compensate for coal-based power generation
rock_mining = {'iron-ore', 'iron-ore', 'iron-ore', 'iron-ore', 'copper-ore', 'copper-ore', 'copper-ore', 'stone', 'coal', 'coal', 'coal'}
-- end game prod 3 base uses (for all-sciences) 1 stone : 2 coal : 3.5 copper : 4.5 iron
-- this is a decent approximation which will still require some modest amount of mining setup
-- coal gets 3 to compensate for coal-based power generation
rock_mining = {'iron-ore', 'iron-ore', 'iron-ore', 'iron-ore', 'copper-ore', 'copper-ore', 'copper-ore', 'stone', 'coal', 'coal', 'coal'}
end
local mined_loot = rock_mining[math_random(1, #rock_mining)]
local text = '+' .. amount .. ' [item=' .. mined_loot .. ']'

View File

@ -4,10 +4,10 @@ require 'modules.mineable_wreckage_yields_scrap'
require 'modules.satellite_score'
local MapInfo = require 'modules.map_info'
local Room_generator = require 'functions.room_generator'
local Room_generator = require 'utils.functions.room_generator'
require 'modules.rpg'
local BiterHealthBooster = require 'modules.biter_health_booster'
local BiterRaffle = require 'functions.biter_raffle'
local BiterRaffle = require 'utils.functions.biter_raffle'
local Functions = require 'maps.dungeons.functions'
local Get_noise = require 'utils.get_noise'
local DungeonsTable = require 'maps.dungeons.table'

View File

@ -8,10 +8,10 @@ require 'modules.charging_station'
local MIN_ROOMS_TO_DESCEND = 100
local MapInfo = require 'modules.map_info'
local Room_generator = require 'functions.room_generator'
local Room_generator = require 'utils.functions.room_generator'
local RPG = require 'modules.rpg.main'
local BiterHealthBooster = require 'modules.biter_health_booster_v2'
local BiterRaffle = require 'functions.biter_raffle'
local BiterRaffle = require 'utils.functions.biter_raffle'
local Functions = require 'maps.dungeons.functions'
local Get_noise = require 'utils.get_noise'
local Alert = require 'utils.alert'
@ -51,9 +51,9 @@ local function enable_hard_rooms(position, surface_index)
-- 140 puts hard rooms halfway between the only dirtlands and the edge
local floor_mindist = 140 - floor * 10
if floor_mindist < 80 then -- all dirtlands within this
return true
return true
end
return position.x ^ 2 + position.y ^ 2 > floor_mindist^2
return position.x ^ 2 + position.y ^ 2 > floor_mindist ^ 2
end
local function get_biome(position, surface_index)
@ -70,20 +70,20 @@ local function get_biome(position, surface_index)
return 'glitch'
end
if enable_hard_rooms(position, surface_index) then
a = a + 1
if Get_noise('dungeons', position, seed + seed_addition * a) > 0.60 then
return 'doom'
end
a = a + 1
if Get_noise('dungeons', position, seed + seed_addition * a) > 0.62 then
return 'acid_zone'
end
a = a + 1
if Get_noise('dungeons', position, seed + seed_addition * a) > 0.60 then
return 'concrete'
end
a = a + 1
if Get_noise('dungeons', position, seed + seed_addition * a) > 0.60 then
return 'doom'
end
a = a + 1
if Get_noise('dungeons', position, seed + seed_addition * a) > 0.62 then
return 'acid_zone'
end
a = a + 1
if Get_noise('dungeons', position, seed + seed_addition * a) > 0.60 then
return 'concrete'
end
else
a = a + 3
a = a + 3
end
a = a + 1
if Get_noise('dungeons', position, seed + seed_addition * a) > 0.71 then
@ -179,7 +179,7 @@ local function expand(surface, position)
end
local treasure_room_one_in = 30 + 15 * dungeontable.treasures[surface.index]
if dungeontable.surface_size[surface.index] >= 225 and math.random(1, treasure_room_one_in) == 1 and room.room_tiles[1] then
log('Found treasure room, change was 1 in ' .. treasure_room_one_in)
log('Found treasure room, change was 1 in ' .. treasure_room_one_in)
Biomes['treasure'](surface, room)
if room.room_tiles[1] then
dungeontable.treasures[surface.index] = dungeontable.treasures[surface.index] + 1
@ -266,19 +266,19 @@ end
local function init_player(player, surface)
if surface == game.surfaces['dungeons_floor0'] then
if player.character then
player.disassociate_character(player.character)
player.disassociate_character(player.character)
player.character.destroy()
end
if not player.connected then
log('BUG Player ' .. player.name .. ' is not connected; how did we get here?')
end
if not player.connected then
log('BUG Player ' .. player.name .. ' is not connected; how did we get here?')
end
player.set_controller({type = defines.controllers.god})
player.teleport(surface.find_non_colliding_position('character', {0, 0}, 50, 0.5), surface)
if not player.create_character() then
log('BUG: create_character for ' .. player.name .. ' failed')
end
log('BUG: create_character for ' .. player.name .. ' failed')
end
player.insert({name = 'raw-fish', count = 8})
player.set_quick_bar_slot(1, 'raw-fish')
@ -398,11 +398,11 @@ local function on_player_joined_game(event)
end
local player = game.players[event.player_index]
if player.online_time == 0 then
init_player(player, game.surfaces['dungeons_floor0'])
init_player(player, game.surfaces['dungeons_floor0'])
end
if player.character == nil and player.ticks_to_respawn == nil then
log('BUG: ' .. player.name .. ' is missing associated character and is not waiting to respawn')
init_player(player, game.surfaces['dungeons_floor0'])
log('BUG: ' .. player.name .. ' is missing associated character and is not waiting to respawn')
init_player(player, game.surfaces['dungeons_floor0'])
end
draw_light(player)
end
@ -472,7 +472,7 @@ local function on_player_mined_entity(event)
if size < math.abs(entity.position.y) or size < math.abs(entity.position.x) then
entity.surface.create_entity({name = entity.name, position = entity.position})
entity.destroy()
local player = game.players[event.player_index]
local player = game.players[event.player_index]
RPG.gain_xp(player, -10)
Alert.alert_player_warning(player, 30, {'dungeons_tiered.too_small'}, {r = 0.98, g = 0.22, b = 0})
event.buffer.clear()
@ -558,7 +558,7 @@ local function descend(player, button, shift)
end
local surface = game.surfaces[player.surface.index + 1]
if not surface then
if dungeontable.surface_size[player.surface.index] < 200 + MIN_ROOMS_TO_DESCEND/4 then
if dungeontable.surface_size[player.surface.index] < 200 + MIN_ROOMS_TO_DESCEND / 4 then
player.print({'dungeons_tiered.floor_size_required', MIN_ROOMS_TO_DESCEND})
return
end
@ -850,9 +850,13 @@ Event.add(defines.events.on_gui_click, on_gui_click)
Event.add(defines.events.on_player_changed_surface, on_player_changed_surface)
Event.add(defines.events.on_player_respawned, on_player_respawned)
Changelog.SetVersions({
{ ver = 'next', date = 'the future', desc = 'Make suggestions in the comfy #dungeons discord channel' },
{ ver = '1.1.1', date = '2022-04-10', desc = [[
Changelog.SetVersions(
{
{ver = 'next', date = 'the future', desc = 'Make suggestions in the comfy #dungeons discord channel'},
{
ver = '1.1.1',
date = '2022-04-10',
desc = [[
Balancing patch
* Evolution goes up faster with floor level 0.05/level -> 0.06/level; e.g. floor 20 now like floor 24 before
* Now require 100 open rooms to descend
@ -869,8 +873,12 @@ Balancing patch
* Require getting to room 100 before you can descend
* Science from rooms 40-160+2.5*floor to 60-300+2.5*floor
* Atomic bomb research moved to 40-50
]]},
{ ver = '1.1', date = '2022-03-13', desc = [[
]]
},
{
ver = '1.1',
date = '2022-03-13',
desc = [[
* All research is now found at random.
* Red science floors 0-1
* Green on floors 1-5
@ -891,6 +899,8 @@ Balancing patch
* Autostash and corpse clearing from Mountain Fortress enabled
* Harder rooms will occur somewhat farther out on the early floors.
* Spawners and worm counts bounded in early rooms.
]]},
{ ver = '1.0', date = 'past', desc = "Pre-changelog version of multi-floor dungeons" },
})
]]
},
{ver = '1.0', date = 'past', desc = 'Pre-changelog version of multi-floor dungeons'}
}
)

View File

@ -1,5 +1,5 @@
local Price_raffle = require 'maps.expanse.price_raffle'
local BiterRaffle = require 'functions.biter_raffle'
local BiterRaffle = require 'utils.functions.biter_raffle'
local Task = require 'utils.task'
local Token = require 'utils.token'
local Public = {}
@ -142,7 +142,8 @@ local function is_container_position_valid(expanse, position)
end
local function create_costs_render(entity, name, offset)
local id = rendering.draw_sprite{
local id =
rendering.draw_sprite {
sprite = 'virtual-signal/signal-grey',
surface = entity.surface,
target = entity,
@ -152,8 +153,9 @@ local function create_costs_render(entity, name, offset)
target_offset = {offset, -1.5},
only_in_alt_mode = true
}
local id2 = rendering.draw_sprite{
sprite = 'item/' ..name,
local id2 =
rendering.draw_sprite {
sprite = 'item/' .. name,
surface = entity.surface,
target = entity,
x_scale = 0.75,
@ -185,7 +187,7 @@ function Public.spawn_units(spawner)
local position = spawner.position
for i = 1, 4 + math.floor(8 * evolution), 1 do
local biter_roll = BiterRaffle.roll('mixed', evolution)
local free_pos = spawner.surface.find_non_colliding_position(biter_roll, {x = position.x + math.random(-8,8), y = position.y + math.random(-8,8)}, 12, 0.05)
local free_pos = spawner.surface.find_non_colliding_position(biter_roll, {x = position.x + math.random(-8, 8), y = position.y + math.random(-8, 8)}, 12, 0.05)
spawner.surface.create_entity({name = biter_roll, position = free_pos or position, force = 'enemy'})
end
end
@ -196,7 +198,7 @@ end
function Public.invasion_numbers()
local evo = game.forces.enemy.evolution_factor
return {candidates = 3 + math.floor(evo * 10), groups = 1 + math.floor(evo * 4)}
return {candidates = 3 + math.floor(evo * 10), groups = 1 + math.floor(evo * 4)}
end
function Public.invasion_warn(event)
@ -207,13 +209,13 @@ end
function Public.invasion_detonate(event)
local surface = event.surface
local position = event.position
local entities_close = surface.find_entities_filtered{position = position, radius = 8}
local entities_close = surface.find_entities_filtered {position = position, radius = 8}
for _, entity in pairs(entities_close) do
if entity.valid then
entity.die('enemy')
end
end
local entities_nearby = surface.find_entities_filtered{position = position, radius = 16}
local entities_nearby = surface.find_entities_filtered {position = position, radius = 16}
for _, entity in pairs(entities_nearby) do
if entity.valid and entity.is_entity_with_health then
entity.damage(entity.prototype.max_health * 0.75, 'enemy')
@ -230,10 +232,10 @@ function Public.invasion_trigger(event)
local biters = {}
for i = 1, 5 + math.floor(30 * evolution) + round * 5, 1 do
local biter_roll = BiterRaffle.roll('mixed', evolution)
local free_pos = surface.find_non_colliding_position(biter_roll, {x = position.x + math.random(-8,8), y = position.y + math.random(-8,8)}, 12, 0.05)
local free_pos = surface.find_non_colliding_position(biter_roll, {x = position.x + math.random(-8, 8), y = position.y + math.random(-8, 8)}, 12, 0.05)
biters[#biters + 1] = surface.create_entity({name = biter_roll, position = free_pos or position, force = 'enemy'})
end
local group = surface.create_unit_group{position = position, force = 'enemy'}
local group = surface.create_unit_group {position = position, force = 'enemy'}
for _, biter in pairs(biters) do
group.add_member(biter)
end
@ -241,7 +243,7 @@ function Public.invasion_trigger(event)
group.start_moving()
local worm_roll = BiterRaffle.roll('worm', evolution)
for i = 1, 3 + math.floor(7 * evolution), 1 do
local worm_pos = surface.find_non_colliding_position(worm_roll, {x = position.x + math.random(-12,12), y = position.y + math.random(-12,12)}, 12, 0.1)
local worm_pos = surface.find_non_colliding_position(worm_roll, {x = position.x + math.random(-12, 12), y = position.y + math.random(-12, 12)}, 12, 0.1)
if worm_pos then
surface.create_entity({name = worm_roll, position = worm_pos, force = 'enemy'})
end

View File

@ -19,7 +19,7 @@ local Session = require 'utils.datastore.session_data'
local Difficulty = require 'modules.difficulty_vote'
local Map = require 'modules.map_info'
local Event = require 'utils.event'
local Reset = require 'functions.soft_reset'
local Reset = require 'utils.functions.soft_reset'
local Server = require 'utils.server'
local Poll = require 'utils.gui.poll'
local boss_biter = require 'maps.fish_defender.boss_biters'

View File

@ -1,6 +1,6 @@
--luacheck: ignore
local Event = require 'utils.event'
local map_functions = require 'tools.map_functions'
local map_functions = require 'utils.tools.map_functions'
local simplex_noise = require 'utils.simplex_noise'.d2
local FDT = require 'maps.fish_defender.table'
local math_random = math.random

View File

@ -18,8 +18,8 @@ local event = require 'utils.event'
local Server = require 'utils.server'
local boss_biter = require 'maps.fish_defender.boss_biters'
local Score = require 'utils.gui.score'
require 'functions.boss_unit'
local map_functions = require 'tools.map_functions'
require 'utils.functions.boss_unit'
local map_functions = require 'utils.tools.map_functions'
local Difficulty = require 'modules.difficulty_vote'
local math_random = math.random
local insert = table.insert

View File

@ -12,7 +12,7 @@ local Unit_health_booster = require 'modules.biter_health_booster_v2'
local Difficulty = require 'modules.difficulty_vote'
local Map = require 'modules.map_info'
local Event = require 'utils.event'
local Reset = require 'functions.soft_reset'
local Reset = require 'utils.functions.soft_reset'
local Server = require 'utils.server'
local Session = require 'utils.datastore.session_data'
local Poll = require 'utils.gui.poll'

View File

@ -1,5 +1,5 @@
local Event = require 'utils.event'
local map_functions = require 'tools.map_functions'
local map_functions = require 'utils.tools.map_functions'
local simplex_noise = require 'utils.simplex_noise'.d2
local Public = require 'maps.fish_defender_v2.table'
local Task = require 'utils.task'

View File

@ -7,7 +7,7 @@ require 'modules.no_deconstruction_of_neutral_entities'
require 'modules.spawners_contain_biters'
local event = require 'utils.event'
local map_functions = require 'tools.map_functions'
local map_functions = require 'utils.tools.map_functions'
local simplex_noise = require 'utils.simplex_noise'.d2
local math_random = math.random
@ -358,12 +358,7 @@ local function draw_ores(surface, position)
end
local function draw_water(surface, position)
map_functions.draw_noise_tile_circle(
{x = position.x + labyrinth_cell_size * 0.5, y = position.y + labyrinth_cell_size * 0.5},
'water',
surface,
math.floor(labyrinth_cell_size * 0.3)
)
map_functions.draw_noise_tile_circle({x = position.x + labyrinth_cell_size * 0.5, y = position.y + labyrinth_cell_size * 0.5}, 'water', surface, math.floor(labyrinth_cell_size * 0.3))
for _, tile in pairs(surface.find_tiles_filtered({name = 'water', area = {{position.x, position.y}, {position.x + labyrinth_cell_size, position.y + labyrinth_cell_size}}})) do
if math_random(1, 12) == 1 then
surface.create_entity({name = 'fish', position = tile.position})
@ -406,21 +401,13 @@ end
local function draw_rocks(surface, position)
local r = math_random(0, 100)
if r < 50 then
surface.create_entity(
{name = rock_raffle[math_random(1, #rock_raffle)], position = {x = position.x + labyrinth_cell_size * 0.5, y = position.y + labyrinth_cell_size * 0.5}}
)
surface.create_entity({name = rock_raffle[math_random(1, #rock_raffle)], position = {x = position.x + labyrinth_cell_size * 0.5, y = position.y + labyrinth_cell_size * 0.5}})
return
end
if r <= 100 then
surface.create_entity(
{name = rock_raffle[math_random(1, #rock_raffle)], position = {x = position.x + labyrinth_cell_size * 0.5, y = position.y + labyrinth_cell_size * 0.25}}
)
surface.create_entity(
{name = rock_raffle[math_random(1, #rock_raffle)], position = {x = position.x + labyrinth_cell_size * 0.75, y = position.y + labyrinth_cell_size * 0.75}}
)
surface.create_entity(
{name = rock_raffle[math_random(1, #rock_raffle)], position = {x = position.x + labyrinth_cell_size * 0.25, y = position.y + labyrinth_cell_size * 0.75}}
)
surface.create_entity({name = rock_raffle[math_random(1, #rock_raffle)], position = {x = position.x + labyrinth_cell_size * 0.5, y = position.y + labyrinth_cell_size * 0.25}})
surface.create_entity({name = rock_raffle[math_random(1, #rock_raffle)], position = {x = position.x + labyrinth_cell_size * 0.75, y = position.y + labyrinth_cell_size * 0.75}})
surface.create_entity({name = rock_raffle[math_random(1, #rock_raffle)], position = {x = position.x + labyrinth_cell_size * 0.25, y = position.y + labyrinth_cell_size * 0.75}})
return
end
end
@ -545,11 +532,7 @@ local function on_entity_died(event)
return
end
if event.entity.type == 'tree' then
for _, entity in pairs(
event.entity.surface.find_entities_filtered(
{area = {{event.entity.position.x - 4, event.entity.position.y - 4}, {event.entity.position.x + 4, event.entity.position.y + 4}}, name = 'fire-flame-on-tree'}
)
) do
for _, entity in pairs(event.entity.surface.find_entities_filtered({area = {{event.entity.position.x - 4, event.entity.position.y - 4}, {event.entity.position.x + 4, event.entity.position.y + 4}}, name = 'fire-flame-on-tree'})) do
if entity.valid then
entity.destroy()
end

View File

@ -2,7 +2,7 @@
--map by mewmew and kyte
require 'maps.island_troopers.map_intro'
require 'functions.noise_vector_path'
require 'utils.functions.noise_vector_path'
require 'modules.shopping_chests'
require 'modules.no_turrets'
require 'modules.dangerous_goods'
@ -327,4 +327,4 @@ event.add(defines.events.on_tick, on_tick)
event.add(defines.events.on_entity_died, on_entity_died)
event.add(defines.events.on_player_joined_game, on_player_joined_game)
require 'functions.boss_unit'
require 'utils.functions.boss_unit'

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,37 @@
--luacheck: ignore 212/journey
local Get_noise = require 'utils.get_noise'
local BiterRaffle = require 'functions.biter_raffle'
local LootRaffle = require 'functions.loot_raffle'
local BiterRaffle = require 'utils.functions.biter_raffle'
local LootRaffle = require 'utils.functions.loot_raffle'
local math_random = math.random
local math_abs = math.abs
local math_floor = math.floor
local math_sqrt = math.sqrt
local rock_raffle = {'sand-rock-big', 'sand-rock-big', 'rock-big', 'rock-big', 'rock-big', 'rock-big', 'rock-big', 'rock-big', 'rock-big', 'rock-huge'}
local size_of_rock_raffle = #rock_raffle
local ore_raffle = {}
for i = 1, 25, 1 do table.insert(ore_raffle, 'iron-ore') end
for i = 1, 17, 1 do table.insert(ore_raffle, 'copper-ore') end
for i = 1, 15, 1 do table.insert(ore_raffle, 'coal') end
local ore_raffle = {}
for i = 1, 25, 1 do
table.insert(ore_raffle, 'iron-ore')
end
for i = 1, 17, 1 do
table.insert(ore_raffle, 'copper-ore')
end
for i = 1, 15, 1 do
table.insert(ore_raffle, 'coal')
end
local size_of_ore_raffle = #ore_raffle
local ore_raffle_2 = {}
for i = 1, 15, 1 do table.insert(ore_raffle_2, 'iron-ore') end
for i = 1, 9, 1 do table.insert(ore_raffle_2, 'copper-ore') end
for i = 1, 7, 1 do table.insert(ore_raffle_2, 'coal') end
for i = 1, 5, 1 do table.insert(ore_raffle_2, 'stone') end
local ore_raffle_2 = {}
for i = 1, 15, 1 do
table.insert(ore_raffle_2, 'iron-ore')
end
for i = 1, 9, 1 do
table.insert(ore_raffle_2, 'copper-ore')
end
for i = 1, 7, 1 do
table.insert(ore_raffle_2, 'coal')
end
for i = 1, 5, 1 do
table.insert(ore_raffle_2, 'stone')
end
local size_of_ore_raffle_2 = #ore_raffle_2
local rock_yield = {
['rock-big'] = 1,
@ -33,14 +47,14 @@ local solid_tiles = {
['refined-hazard-concrete-right'] = true,
['stone-path'] = true,
['lab-dark-1'] = true,
['lab-dark-2'] = true,
['lab-dark-2'] = true
}
local wrecks = {
'crash-site-spaceship-wreck-big-1',
'crash-site-spaceship-wreck-big-2',
'crash-site-spaceship-wreck-medium-1',
'crash-site-spaceship-wreck-medium-2',
'crash-site-spaceship-wreck-medium-3',
'crash-site-spaceship-wreck-medium-3'
}
local size_of_wrecks = #wrecks
@ -66,7 +80,7 @@ Public.eternal_day = {
clear = function(journey)
local surface = game.surfaces.nauvis
surface.freeze_daytime = false
end,
end
}
Public.eternal_night = {
@ -80,7 +94,7 @@ Public.eternal_night = {
local surface = game.surfaces.nauvis
surface.freeze_daytime = false
surface.solar_power_multiplier = 1
end,
end
}
Public.pitch_black = {
@ -98,35 +112,53 @@ Public.pitch_black = {
surface.solar_power_multiplier = 1
surface.min_brightness = 0.15
surface.brightness_visual_weights = {0, 0, 0, 1}
end,
end
}
Public.matter_anomaly = {
on_world_start = function(journey)
local force = game.forces.player
for i = 1, 4, 1 do force.technologies['mining-productivity-' .. i].researched = true end
for i = 1, 6, 1 do force.technologies['mining-productivity-4'].researched = true end
for i = 1, 4, 1 do
force.technologies['mining-productivity-' .. i].researched = true
end
for i = 1, 6, 1 do
force.technologies['mining-productivity-4'].researched = true
end
end,
on_robot_built_entity = function(event)
local entity = event.created_entity
if not entity.valid then return end
if entity.surface.index ~= 1 then return end
if entity.type == 'electric-turret' then entity.die() end
if not entity.valid then
return
end
if entity.surface.index ~= 1 then
return
end
if entity.type == 'electric-turret' then
entity.die()
end
end,
on_built_entity = function(event)
local entity = event.created_entity
if not entity.valid then return end
if entity.surface.index ~= 1 then return end
if entity.type == 'electric-turret' then entity.die() end
end,
if not entity.valid then
return
end
if entity.surface.index ~= 1 then
return
end
if entity.type == 'electric-turret' then
entity.die()
end
end
}
Public.quantum_anomaly = {
on_world_start = function(journey)
local force = game.forces.player
for i = 1, 6, 1 do force.technologies['research-speed-' .. i].researched = true end
for i = 1, 6, 1 do
force.technologies['research-speed-' .. i].researched = true
end
journey.world_specials['technology_price_multiplier'] = 0.5
end,
end
}
Public.mountainous = {
@ -136,8 +168,12 @@ Public.mountainous = {
end,
on_player_mined_entity = function(event)
local entity = event.entity
if not entity.valid then return end
if not rock_yield[entity.name] then return end
if not entity.valid then
return
end
if not rock_yield[entity.name] then
return
end
local surface = entity.surface
event.buffer.clear()
local ore = ore_raffle[math_random(1, size_of_ore_raffle)]
@ -167,52 +203,77 @@ Public.mountainous = {
end
end
end
end,
end
}
Public.replicant_fauna = {
on_entity_died = function(event)
local entity = event.entity
if not entity.valid then return end
if not entity.valid then
return
end
local cause = event.cause
if not cause then return end
if not cause.valid then return end
if cause.force.index == 2 then cause.surface.create_entity({name = BiterRaffle.roll('mixed', game.forces.enemy.evolution_factor), position = entity.position, force = 'enemy'}) end
end,
if not cause then
return
end
if not cause.valid then
return
end
if cause.force.index == 2 then
cause.surface.create_entity({name = BiterRaffle.roll('mixed', game.forces.enemy.evolution_factor), position = entity.position, force = 'enemy'})
end
end
}
Public.tarball = {
on_robot_built_entity = function(event)
local entity = event.created_entity
if not entity.valid then return end
if entity.surface.index ~= 1 then return end
if tarball_minable[entity.type] then return end
if not entity.valid then
return
end
if entity.surface.index ~= 1 then
return
end
if tarball_minable[entity.type] then
return
end
entity.minable = false
end,
on_built_entity = function(event)
local entity = event.created_entity
if not entity.valid then return end
if entity.surface.index ~= 1 then return end
if tarball_minable[entity.type] then return end
if not entity.valid then
return
end
if entity.surface.index ~= 1 then
return
end
if tarball_minable[entity.type] then
return
end
entity.minable = false
end,
on_chunk_generated = function(event, journey)
table.insert(journey.world_color_filters, rendering.draw_sprite(
{
sprite = 'tile/lab-dark-1',
x_scale = 32,
y_scale = 32,
target = event.area.left_top,
surface = event.surface,
tint = {r = 0.0, g = 0.0, b = 0.0, a = 0.45},
render_layer = 'ground'
}
))
end,
clear = function(journey)
for _, id in pairs(journey.world_color_filters) do rendering.destroy(id) end
journey.world_color_filters = {}
end,
table.insert(
journey.world_color_filters,
rendering.draw_sprite(
{
sprite = 'tile/lab-dark-1',
x_scale = 32,
y_scale = 32,
target = event.area.left_top,
surface = event.surface,
tint = {r = 0.0, g = 0.0, b = 0.0, a = 0.45},
render_layer = 'ground'
}
)
)
end,
clear = function(journey)
for _, id in pairs(journey.world_color_filters) do
rendering.destroy(id)
end
journey.world_color_filters = {}
end
}
Public.swamps = {
@ -234,7 +295,9 @@ Public.swamps = {
for y = 0, 31, 1 do
local position = {x = left_top_x + x, y = left_top_y + y}
local noise = Get_noise('journey_swamps', position, seed)
if noise > 0.45 or noise < -0.65 then table.insert(tiles, {name = 'water-shallow', position = {x = position.x, y = position.y}}) end
if noise > 0.45 or noise < -0.65 then
table.insert(tiles, {name = 'water-shallow', position = {x = position.x, y = position.y}})
end
end
end
surface.set_tiles(tiles, true, false, false, false)
@ -244,7 +307,7 @@ Public.swamps = {
surface.create_entity({name = 'fish', position = tile.position})
end
end
end,
end
}
Public.wasteland = {
@ -260,7 +323,9 @@ Public.wasteland = {
table.insert(tiles, {name = 'deepwater-green', position = tile.position})
end
surface.set_tiles(tiles, true, false, false, false)
if math_random(1, 3) ~= 1 then return end
if math_random(1, 3) ~= 1 then
return
end
for _ = 1, math_random(0, 5), 1 do
local name = wrecks[math_random(1, size_of_wrecks)]
local position = surface.find_non_colliding_position(name, {left_top_x + math_random(0, 31), left_top_y + math_random(0, 31)}, 16, 1)
@ -270,7 +335,9 @@ Public.wasteland = {
local slots = game.entity_prototypes[e.name].get_inventory_size(defines.inventory.chest)
local blacklist = LootRaffle.get_tech_blacklist(0.2)
local item_stacks = LootRaffle.roll(math_random(16, 64), slots, blacklist)
for _, item_stack in pairs(item_stacks) do e.insert(item_stack) end
for _, item_stack in pairs(item_stacks) do
e.insert(item_stack)
end
end
end
end
@ -288,7 +355,7 @@ Public.wasteland = {
local mgs = surface.map_gen_settings
mgs.water = mgs.water - 1
surface.map_gen_settings = mgs
end,
end
}
Public.oceanic = {
@ -302,42 +369,65 @@ Public.oceanic = {
end,
on_robot_built_entity = function(event)
local entity = event.created_entity
if not entity.valid then return end
if entity.surface.index ~= 1 then return end
if entity.type == 'fluid-turret' then entity.die() end
if not entity.valid then
return
end
if entity.surface.index ~= 1 then
return
end
if entity.type == 'fluid-turret' then
entity.die()
end
end,
on_built_entity = function(event)
local entity = event.created_entity
if not entity.valid then return end
if entity.surface.index ~= 1 then return end
if entity.type == 'fluid-turret' then entity.die() end
if not entity.valid then
return
end
if entity.surface.index ~= 1 then
return
end
if entity.type == 'fluid-turret' then
entity.die()
end
end,
clear = function(journey)
local surface = game.surfaces.nauvis
local mgs = surface.map_gen_settings
mgs.water = mgs.water - 6
surface.map_gen_settings = mgs
end,
end
}
Public.volcanic = {
on_chunk_generated = function(event, journey)
table.insert(journey.world_color_filters, rendering.draw_sprite({
sprite = 'tile/lab-dark-2',
x_scale = 32,
y_scale = 32,
target = event.area.left_top,
surface = event.surface,
tint = {r = 0.55, g = 0.0, b = 0.0, a = 0.25},
render_layer = 'ground'
}))
table.insert(
journey.world_color_filters,
rendering.draw_sprite(
{
sprite = 'tile/lab-dark-2',
x_scale = 32,
y_scale = 32,
target = event.area.left_top,
surface = event.surface,
tint = {r = 0.55, g = 0.0, b = 0.0, a = 0.25},
render_layer = 'ground'
}
)
)
end,
on_player_changed_position = function(event)
local player = game.players[event.player_index]
if player.driving then return end
if player.driving then
return
end
local surface = player.surface
if surface.index ~= 1 then return end
if solid_tiles[surface.get_tile(player.position).name] then return end
if surface.index ~= 1 then
return
end
if solid_tiles[surface.get_tile(player.position).name] then
return
end
surface.create_entity({name = 'fire-flame', position = player.position})
end,
on_world_start = function(journey)
@ -354,9 +444,11 @@ Public.volcanic = {
end
end,
clear = function(journey)
for _, id in pairs(journey.world_color_filters) do rendering.destroy(id) end
for _, id in pairs(journey.world_color_filters) do
rendering.destroy(id)
end
journey.world_color_filters = {}
end,
end
}
Public.chaotic_resources = {
@ -366,20 +458,25 @@ Public.chaotic_resources = {
surface.create_entity({name = ore_raffle_2[math_random(1, size_of_ore_raffle_2)], position = ore.position, amount = ore.amount})
ore.destroy()
end
end,
end
}
Public.infested = {
on_chunk_generated = function(event, journey)
table.insert(journey.world_color_filters, rendering.draw_sprite({
sprite = 'tile/lab-dark-2',
x_scale = 32,
y_scale = 32,
target = event.area.left_top,
surface = event.surface,
tint = {r = 0.8, g = 0.0, b = 0.8, a = 0.25},
render_layer = 'ground'
}))
table.insert(
journey.world_color_filters,
rendering.draw_sprite(
{
sprite = 'tile/lab-dark-2',
x_scale = 32,
y_scale = 32,
target = event.area.left_top,
surface = event.surface,
tint = {r = 0.8, g = 0.0, b = 0.8, a = 0.25},
render_layer = 'ground'
}
)
)
end,
set_specials = function(journey)
journey.world_specials['trees_size'] = 4
@ -387,111 +484,177 @@ Public.infested = {
journey.world_specials['trees_frequency'] = 2
end,
clear = function(journey)
for _, id in pairs(journey.world_color_filters) do rendering.destroy(id) end
for _, id in pairs(journey.world_color_filters) do
rendering.destroy(id)
end
journey.world_color_filters = {}
end,
on_entity_died = function(event)
local entity = event.entity
if not entity.valid then return end
if entity.force.index ~= 3 then return end
if entity.type ~= 'simple-entity' and entity.type ~= 'tree' then return end
if not entity.valid then
return
end
if entity.force.index ~= 3 then
return
end
if entity.type ~= 'simple-entity' and entity.type ~= 'tree' then
return
end
entity.surface.create_entity({name = BiterRaffle.roll('mixed', game.forces.enemy.evolution_factor + 0.1), position = entity.position, force = 'enemy'})
end,
on_player_mined_entity = function(event)
if math_random(1,2) == 1 then return end
if math_random(1, 2) == 1 then
return
end
local entity = event.entity
if not entity.valid then return end
if entity.force.index ~= 3 then return end
if entity.type ~= 'simple-entity' and entity.type ~= 'tree' then return end
if not entity.valid then
return
end
if entity.force.index ~= 3 then
return
end
if entity.type ~= 'simple-entity' and entity.type ~= 'tree' then
return
end
entity.surface.create_entity({name = BiterRaffle.roll('mixed', game.forces.enemy.evolution_factor + 0.1), position = entity.position, force = 'enemy'})
end,
on_robot_mined_entity = function(event)
local entity = event.entity
if not entity.valid then return end
if entity.force.index ~= 3 then return end
if entity.type ~= 'simple-entity' and entity.type ~= 'tree' then return end
if not entity.valid then
return
end
if entity.force.index ~= 3 then
return
end
if entity.type ~= 'simple-entity' and entity.type ~= 'tree' then
return
end
entity.surface.create_entity({name = BiterRaffle.roll('mixed', game.forces.enemy.evolution_factor + 0.1), position = entity.position, force = 'enemy'})
end,
end
}
Public.undead_plague = {
on_entity_died = function(event)
local entity = event.entity
if not entity.valid then return end
if entity.force.index ~= 2 then return end
if math_random(1,2) == 1 then return end
if entity.type ~= 'unit' then return end
if not entity.valid then
return
end
if entity.force.index ~= 2 then
return
end
if math_random(1, 2) == 1 then
return
end
if entity.type ~= 'unit' then
return
end
entity.surface.create_entity({name = entity.name, position = entity.position, force = 'enemy'})
end,
end
}
Public.low_mass = {
on_world_start = function(journey)
local force = game.forces.player
force.character_running_speed_modifier = 0.5
for i = 1, 6, 1 do force.technologies['worker-robots-speed-' .. i].researched = true end
end,
for i = 1, 6, 1 do
force.technologies['worker-robots-speed-' .. i].researched = true
end
end
}
Public.dense_atmosphere = {
on_robot_built_entity = function(event)
local entity = event.created_entity
if not entity.valid then return end
if entity.surface.index ~= 1 then return end
if entity.type == 'roboport' then entity.die() end
if not entity.valid then
return
end
if entity.surface.index ~= 1 then
return
end
if entity.type == 'roboport' then
entity.die()
end
end,
on_built_entity = function(event)
local entity = event.created_entity
if not entity.valid then return end
if entity.surface.index ~= 1 then return end
if entity.type == 'roboport' then entity.die() end
end,
if not entity.valid then
return
end
if entity.surface.index ~= 1 then
return
end
if entity.type == 'roboport' then
entity.die()
end
end
}
local function update_lazy_bastard(journey, count)
journey.lazy_bastard_machines = journey.lazy_bastard_machines + count
local speed = journey.lazy_bastard_machines * -0.1
if speed < -1 then speed = -1 end
if speed < -1 then
speed = -1
end
game.forces.player.manual_crafting_speed_modifier = speed
end
Public.lazy_bastard = {
on_robot_built_entity = function(event, journey)
local entity = event.created_entity
if not entity.valid then return end
if entity.surface.index ~= 1 then return end
if not entity.valid then
return
end
if entity.surface.index ~= 1 then
return
end
if entity.type == 'assembling-machine' then
update_lazy_bastard(journey, 1)
end
end,
on_built_entity = function(event, journey)
local entity = event.created_entity
if not entity.valid then return end
if entity.surface.index ~= 1 then return end
if not entity.valid then
return
end
if entity.surface.index ~= 1 then
return
end
if entity.type == 'assembling-machine' then
update_lazy_bastard(journey, 1)
end
end,
on_entity_died = function(event, journey)
local entity = event.entity
if not entity.valid then return end
if entity.surface.index ~= 1 then return end
if not entity.valid then
return
end
if entity.surface.index ~= 1 then
return
end
if entity.type == 'assembling-machine' then
update_lazy_bastard(journey, -1)
end
end,
on_player_mined_entity = function(event, journey)
local entity = event.entity
if not entity.valid then return end
if entity.surface.index ~= 1 then return end
if not entity.valid then
return
end
if entity.surface.index ~= 1 then
return
end
if entity.type == 'assembling-machine' then
update_lazy_bastard(journey, -1)
end
end,
on_robot_mined_entity = function(event, journey)
local entity = event.entity
if not entity.valid then return end
if entity.surface.index ~= 1 then return end
if not entity.valid then
return
end
if entity.surface.index ~= 1 then
return
end
if entity.type == 'assembling-machine' then
update_lazy_bastard(journey, -1)
end
@ -501,7 +664,7 @@ Public.lazy_bastard = {
end,
clear = function(journey)
game.forces.player.manual_crafting_speed_modifier = 0
end,
end
}
Public.ribbon = {
@ -509,8 +672,8 @@ Public.ribbon = {
local surface = event.surface
local left_top_x = event.area.left_top.x
local left_top_y = event.area.left_top.y
if (left_top_x + left_top_y)^2 <= 256 then
local oils = surface.count_entities_filtered{name = 'crude-oil', position = {x = 0,y =0}, radius = 256}
if (left_top_x + left_top_y) ^ 2 <= 256 then
local oils = surface.count_entities_filtered {name = 'crude-oil', position = {x = 0, y = 0}, radius = 256}
if math.random(1, 10 + oils * 10) == 1 then
local pos = surface.find_non_colliding_position_in_box('oil-refinery', event.area, 0.1, true)
if pos then
@ -531,7 +694,7 @@ Public.ribbon = {
local mgs = surface.map_gen_settings
mgs.height = nil
surface.map_gen_settings = mgs
end,
end
}
Public.abandoned_library = {
@ -542,7 +705,7 @@ Public.abandoned_library = {
clear = function(journey)
game.permissions.get_group('Default').set_allows_action(defines.input_action.open_blueprint_library_gui, true)
game.permissions.get_group('Default').set_allows_action(defines.input_action.import_blueprint_string, true)
end,
end
}
Public.railworld = {
@ -560,7 +723,7 @@ Public.railworld = {
journey.world_specials['enemy_base_richness'] = 2
journey.world_specials['water'] = 1.5
journey.world_specials['starting_area'] = 3
end,
end
}
local delivery_options = {
@ -584,7 +747,7 @@ Public.resupply_station = {
journey.mothership_cargo_space[journey.speedrun.item] = nil
journey.mothership_cargo[journey.speedrun.item] = 0
journey.speedrun.enabled = false
end,
end
}
Public.crazy_science = {
@ -604,8 +767,7 @@ Public.crazy_science = {
journey.world_specials[name] = math.max(0.1, journey.world_specials[name] * 0.95)
game.difficulty_settings.technology_price_multiplier = journey.world_modifiers[name] * (journey.world_specials[name] or 1)
force.laboratory_productivity_bonus = math.max(0.1, force.laboratory_productivity_bonus * 0.95)
end,
end
}
return Public

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ require 'modules.rocks_heal_over_time'
require 'maps.junkyard_pvp.share_chat'
require 'modules.mineable_wreckage_yields_scrap'
local Team = require 'maps.junkyard_pvp.team'
local Reset = require 'functions.soft_reset'
local Reset = require 'utils.functions.soft_reset'
local Map = require 'modules.map_info'
local math_random = math.random
local Public = {}

View File

@ -3,7 +3,7 @@ local math_abs = math.abs
local math_random = math.random
local math_floor = math.floor
local Treasure = require 'maps.junkyard_pvp.treasure'
local Map_functions = require 'tools.map_functions'
local Map_functions = require 'utils.tools.map_functions'
local simplex_noise = require 'utils.simplex_noise'.d2
local rock_raffle = {'sand-rock-big', 'sand-rock-big', 'rock-big', 'rock-big', 'rock-big', 'rock-big', 'rock-big', 'rock-big', 'rock-big', 'rock-huge'}
local spawner_raffle = {'biter-spawner', 'biter-spawner', 'biter-spawner', 'spitter-spawner'}
@ -96,11 +96,7 @@ function Public.create_mirror_surface()
end
end
end
for _, e in pairs(
surface.find_entities_filtered(
{area = {{cargo_wagon_position.x - r, cargo_wagon_position.y - r}, {cargo_wagon_position.x + r, cargo_wagon_position.y + r}}, force = {'neutral', 'enemy'}}
)
) do
for _, e in pairs(surface.find_entities_filtered({area = {{cargo_wagon_position.x - r, cargo_wagon_position.y - r}, {cargo_wagon_position.x + r, cargo_wagon_position.y + r}}, force = {'neutral', 'enemy'}})) do
if math.sqrt(e.position.x ^ 2 + e.position.y ^ 2) < r then
e.destroy()
end

View File

@ -8,11 +8,11 @@ require 'modules.satellite_score'
local Event = require 'utils.event'
local Server = require 'utils.server'
local Global = require 'utils.global'
local map_functions = require 'tools.map_functions'
local map_functions = require 'utils.tools.map_functions'
local simplex_noise = require 'utils.simplex_noise'.d2
local Score = require 'utils.gui.score'
local unique_rooms = require 'maps.labyrinth_unique_rooms'
local SoftReset = require 'functions.soft_reset'
local SoftReset = require 'utils.functions.soft_reset'
local Autostash = require 'modules.autostash'
local BottomFrame = require 'utils.gui.bottom_frame'
local this = {
@ -1022,7 +1022,9 @@ end
local function on_entity_died(event)
local entity = event.entity
if not entity or not entity.valid then return end
if not entity or not entity.valid then
return
end
local name = entity.name
local position = entity.position
local evolution = game.forces.enemy.evolution_factor
@ -1045,7 +1047,7 @@ local function on_entity_died(event)
for _ = 1, math.random(t[2], t[3]), 1 do
local p = surface.find_non_colliding_position(t[1], position, 6, 1)
if p then
surface.create_entity{name = t[1], position = p}
surface.create_entity {name = t[1], position = p}
end
end
end
@ -1235,7 +1237,9 @@ local loaders = {
['express-loader'] = true
}
local function on_built_entity(event)
if not event.created_entity or not event.created_entity.valid then return end
if not event.created_entity or not event.created_entity.valid then
return
end
local get_score = Score.get_table().score_table
local name = event.created_entity.name
if inserters[name] then

View File

@ -12,7 +12,7 @@ require 'modules.flashlight_toggle_button'
local simplex_noise = require 'utils.simplex_noise'.d2
local event = require 'utils.event'
local map_functions = require 'tools.map_functions'
local map_functions = require 'utils.tools.map_functions'
local math_random = math.random
require 'utils.table'

View File

@ -1,5 +1,5 @@
--luacheck: ignore
require 'functions.maze'
require 'utils.functions.maze'
local event = require 'utils.event'

View File

@ -1,7 +1,7 @@
--luacheck: ignore
local Public = {}
local LootRaffle = require "functions.loot_raffle"
local LootRaffle = require "utils.functions.loot_raffle"
local Get_noise = require "utils.get_noise"
local safe_zone_radius = 16

View File

@ -18,7 +18,7 @@ local difficulty_factor = 4
local event = require 'utils.event'
local math_random = math.random
local insert = table.insert
local map_functions = require 'tools.map_functions'
local map_functions = require 'utils.tools.map_functions'
local simplex_noise = require 'utils.simplex_noise'
local simplex_noise = simplex_noise.d2

View File

@ -4,8 +4,8 @@
global.offline_loot = true
local darkness = false
require 'functions.soft_reset'
require 'functions.basic_markets'
require 'utils.functions.soft_reset'
require 'utils.functions.basic_markets'
local Gui = require 'utils.gui'
local Map_score = require 'utils.gui.map_score'
@ -25,7 +25,7 @@ local Immersive_cargo_wagons = require 'modules.immersive_cargo_wagons.main'
require 'maps.mountain_fortress_v2.flamethrower_nerf'
local BiterRolls = require 'modules.wave_defense.biter_rolls'
local BiterHealthBooster = require 'modules.biter_health_booster'
local Reset = require 'functions.soft_reset'
local Reset = require 'utils.functions.soft_reset'
local Pets = require 'modules.biter_pets'
local Map = require 'modules.map_info'
local WD = require 'modules.wave_defense.table'

View File

@ -2,7 +2,7 @@
local Biters = require 'modules.wave_defense.biter_rolls'
local Immersive_cargo_wagons = require 'modules.immersive_cargo_wagons.main'
local Treasure = require 'maps.mountain_fortress_v2.treasure'
local Market = require 'functions.basic_markets'
local Market = require 'utils.functions.basic_markets'
local math_random = math.random
local math_floor = math.floor
local math_abs = math.abs

View File

@ -5,7 +5,7 @@ local math_random = math.random
local math_floor = math.floor
local math_abs = math.abs
local LootRaffle = require 'functions.loot_raffle'
local LootRaffle = require 'utils.functions.loot_raffle'
local blacklist = {
['cargo-wagon'] = true,

View File

@ -1,7 +1,7 @@
local Public = require 'maps.mountain_fortress_v3.table'
local ICW = require 'maps.mountain_fortress_v3.icw.main'
local Task = require 'utils.task_token'
local MapFunctions = require 'tools.map_functions'
local MapFunctions = require 'utils.tools.map_functions'
local random = math.random
local floor = math.floor

View File

@ -1,4 +1,4 @@
local LootRaffle = require 'functions.loot_raffle'
local LootRaffle = require 'utils.functions.loot_raffle'
local Public = require 'maps.mountain_fortress_v3.table'
local random = math.random
local abs = math.abs

View File

@ -3,7 +3,7 @@ local Public = {}
local math_random = math.random
local Immersive_cargo_wagons = require 'modules.immersive_cargo_wagons.main'
local GetNoise = require 'utils.get_noise'
local LootRaffle = require 'functions.loot_raffle'
local LootRaffle = require 'utils.functions.loot_raffle'
local wagon_raffle = {'cargo-wagon', 'cargo-wagon', 'cargo-wagon', 'locomotive', 'fluid-wagon'}
local rock_raffle = {'sand-rock-big', 'sand-rock-big', 'rock-big', 'rock-big', 'rock-big', 'rock-big', 'rock-big', 'rock-big', 'rock-big', 'rock-huge'}

View File

@ -10,7 +10,7 @@ local Team = require 'maps.native_war.team'
local Terrain = require 'maps.native_war.terrain'
local Init = require 'maps.native_war.init'
local Settings = require 'maps.native_war.settings'
local Reset = require 'functions.soft_reset'
local Reset = require 'utils.functions.soft_reset'
local Map = require 'maps.native_war.map_info'
local Team_manager = require 'maps.native_war.team_manager'
local math_random = math.random

View File

@ -1,7 +1,7 @@
--luacheck: ignore
local math_abs = math.abs
local math_random = math.random
local Map_functions = require 'tools.map_functions'
local Map_functions = require 'utils.tools.map_functions'
local simplex_noise = require 'utils.simplex_noise'.d2
local Public = {}
@ -86,8 +86,7 @@ local function create_markets(surface)
global.market1 = e
local energy_source = {type = 'electric', buffer_capacity = '10GJ', usage_priority = 'tertiary', input_flow_limit = '1GW', output_flow_limit = '0W', drain = '0W'}
local eei =
surface.create_entity({type = 'electric-energy-interface', name = 'electric-energy-interface', energy_source = energy_source, position = {-200, -2}, force = 'west'})
local eei = surface.create_entity({type = 'electric-energy-interface', name = 'electric-energy-interface', energy_source = energy_source, position = {-200, -2}, force = 'west'})
local ep = surface.create_entity({name = 'small-electric-pole', position = {-200, -5}, force = 'west'})
ep.destructible = false
@ -109,8 +108,7 @@ local function create_markets(surface)
global.market = f
local energy_source = {type = 'electric', buffer_capacity = '10GJ', usage_priority = 'tertiary', input_flow_limit = '1GW', output_flow_limit = '0W', drain = '0W'}
local eei2 =
surface.create_entity({type = 'electric-energy-interface', name = 'electric-energy-interface', energy_source = energy_source, position = {201, -2}, force = 'east'})
local eei2 = surface.create_entity({type = 'electric-energy-interface', name = 'electric-energy-interface', energy_source = energy_source, position = {201, -2}, force = 'east'})
local ep2 = surface.create_entity({name = 'small-electric-pole', position = {200, -5}, force = 'east'})
ep2.destructible = false
@ -346,12 +344,7 @@ local function out_of_map_area(event)
local p = {x = left_top.x + x, y = left_top.y + y}
if is_out_of_map(p) then
if
(p.x == -137 or p.x == -138 or p.x == -102 or p.x == -103 or p.x == -78 or p.x == -77 or p.x == -42 or p.x == -43 or p.x == -17 or p.x == -18 or p.x == 17 or
p.x == 18 or
p.x == 42 or
p.x == 43 or
p.x == 77 or
p.x == 78) and
(p.x == -137 or p.x == -138 or p.x == -102 or p.x == -103 or p.x == -78 or p.x == -77 or p.x == -42 or p.x == -43 or p.x == -17 or p.x == -18 or p.x == 17 or p.x == 18 or p.x == 42 or p.x == 43 or p.x == 77 or p.x == 78) and
(p.y == -32 or p.y == -33 or p.y == -95 or p.y == -96)
then
surface.set_tiles({{name = 'hazard-concrete-right', position = p}}, true)
@ -436,11 +429,7 @@ local function out_of_map_area(event)
e.minable = false
end
elseif
(p.x == 137 or p.x == 138 or p.x == 102 or p.x == 103 or p.x == 78 or p.x == 77 or p.x == 42 or p.x == 43 or p.x == 17 or p.x == 18 or p.x == -17 or p.x == -18 or
p.x == -42 or
p.x == -43 or
p.x == -77 or
p.x == -78) and
(p.x == 137 or p.x == 138 or p.x == 102 or p.x == 103 or p.x == 78 or p.x == 77 or p.x == 42 or p.x == 43 or p.x == 17 or p.x == 18 or p.x == -17 or p.x == -18 or p.x == -42 or p.x == -43 or p.x == -77 or p.x == -78) and
(p.y == 32 or p.y == 33 or p.y == 95 or p.y == 96)
then
surface.set_tiles({{name = 'hazard-concrete-right', position = p}}, true)

View File

@ -4,7 +4,7 @@
local event = require 'utils.event'
local math_random = math.random
local insert = table.insert
local map_functions = require 'tools.map_functions'
local map_functions = require 'utils.tools.map_functions'
local simplex_noise = require 'utils.simplex_noise'
local simplex_noise = simplex_noise.d2
require 'maps.nightfall_map_intro'
@ -420,14 +420,8 @@ local function generate_spawn_area(surface)
for y = -160, 160, 1 do
local pos = {x = x, y = y}
if pos.x > fort_size * -1 and pos.x < fort_size and pos.y > fort_size * -1 and pos.y < fort_size then
if
pos.x > (fort_size - fort_wall_width) * -1 and pos.x < fort_size - fort_wall_width and pos.y > (fort_size - fort_wall_width) * -1 and
pos.y < fort_size - fort_wall_width
then
if
pos.x <= (fort_size - fort_wall_width * 2) * -1 or pos.x >= (fort_size - fort_wall_width * 2) or pos.y <= (fort_size - fort_wall_width * 2) * -1 or
pos.y >= (fort_size - fort_wall_width * 2)
then
if pos.x > (fort_size - fort_wall_width) * -1 and pos.x < fort_size - fort_wall_width and pos.y > (fort_size - fort_wall_width) * -1 and pos.y < fort_size - fort_wall_width then
if pos.x <= (fort_size - fort_wall_width * 2) * -1 or pos.x >= (fort_size - fort_wall_width * 2) or pos.y <= (fort_size - fort_wall_width * 2) * -1 or pos.y >= (fort_size - fort_wall_width * 2) then
table.insert(turrets, {name = 'gun-turret', position = {x = pos.x, y = pos.y}, force = 'player'})
end
end
@ -440,10 +434,7 @@ local function generate_spawn_area(surface)
table.insert(tiles, {name = 'stone-path', position = {x = pos.x, y = pos.y}})
if
pos.x <= (fort_size - fort_wall_width) * -1 or pos.x >= (fort_size - fort_wall_width) or pos.y <= (fort_size - fort_wall_width) * -1 or
pos.y >= (fort_size - fort_wall_width)
then
if pos.x <= (fort_size - fort_wall_width) * -1 or pos.x >= (fort_size - fort_wall_width) or pos.y <= (fort_size - fort_wall_width) * -1 or pos.y >= (fort_size - fort_wall_width) then
if math_random(1, 3) ~= 1 then
table.insert(entities, {name = 'stone-wall', position = {x = pos.x, y = pos.y}, force = 'player'})
end

View File

@ -16,11 +16,11 @@ require 'modules.trees_randomly_die'
require 'maps.overgrowth_map_info'
local Reset = require 'functions.soft_reset'
local kaboom = require 'functions.omegakaboom'
local Reset = require 'utils.functions.soft_reset'
local kaboom = require 'utils.functions.omegakaboom'
local Difficulty = require 'modules.difficulty_vote'
local unearthing_biters = require 'functions.unearthing_biters'
local unearthing_biters = require 'utils.functions.unearthing_biters'
local event = require 'utils.event'
local math_random = math.random

View File

@ -13,7 +13,7 @@ local Session = require 'utils.datastore.session_data'
local Difficulty = require 'modules.difficulty_vote'
local Map = require 'modules.map_info'
local Event = require 'utils.event'
local Reset = require 'functions.soft_reset'
local Reset = require 'utils.functions.soft_reset'
local Server = require 'utils.server'
local Poll = require 'utils.gui.poll'
local boss_biter = require 'maps.pidgeotto.boss_biters'

View File

@ -1,6 +1,6 @@
local Event = require 'utils.event'
local Builder = require 'maps.pidgeotto.b'
local map_functions = require 'tools.map_functions'
local map_functions = require 'utils.tools.map_functions'
local simplex_noise = require 'utils.simplex_noise'.d2
local FDT = require 'maps.pidgeotto.table'
local math_random = math.random

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@ local Session = require 'utils.datastore.session_data'
local Event = require 'utils.event'
local Freeplay = require 'utils.freeplay'
local Server = require 'utils.server'
local MapFuntions = require 'tools.map_functions'
local MapFuntions = require 'utils.tools.map_functions'
local CommonFunctions = require 'utils.common'
local LayersFunctions = require 'maps.planet_prison.mod.layers'
local AIFunctions = require 'maps.planet_prison.ai'

View File

@ -14,7 +14,7 @@ local difficulties_votes = {
local Get_noise = require 'utils.get_noise'
local Immersive_cargo_wagons = require 'modules.immersive_cargo_wagons.main'
local LootRaffle = require 'functions.loot_raffle'
local LootRaffle = require 'utils.functions.loot_raffle'
local map_height = 64

View File

@ -1,8 +1,8 @@
--luacheck: ignore
local event = require 'utils.event'
local simplex_noise = require 'utils.simplex_noise'.d2
local rainbow_colors = require 'tools.rainbow_colors'
local map_functions = require 'tools.map_functions'
local rainbow_colors = require 'utils.tools.rainbow_colors'
local map_functions = require 'utils.tools.map_functions'
require 'modules.satellite_score'
local ore_spawn_raffle = {'iron-ore', 'iron-ore', 'iron-ore', 'iron-ore', 'copper-ore', 'copper-ore', 'copper-ore', 'coal', 'coal', 'coal', 'stone', 'uranium-ore', 'crude-oil'}

View File

@ -10,7 +10,7 @@ local event = require 'utils.event'
local table_insert = table.insert
local math_random = math.random
local simplex_noise = require 'utils.simplex_noise'.d2
local map_functions = require 'tools.map_functions'
local map_functions = require 'utils.tools.map_functions'
local disabled_for_deconstruction = {
['fish'] = true

View File

@ -163,8 +163,8 @@ local function on_player_joined_game(event)
end
end
local unearthing_worm = require 'functions.unearthing_worm'
local unearthing_biters = require 'functions.unearthing_biters'
local unearthing_worm = require 'utils.functions.unearthing_worm'
local unearthing_biters = require 'utils.functions.unearthing_biters'
local function on_player_mined_entity(event)
local entity = event.entity

View File

@ -2,7 +2,7 @@ require 'modules.no_deconstruction_of_neutral_entities'
require 'modules.satellite_score'
require 'modules.mineable_wreckage_yields_scrap'
local LootRaffle = require 'functions.loot_raffle'
local LootRaffle = require 'utils.functions.loot_raffle'
local Get_noise = require 'utils.get_noise'
local math_random = math.random
local math_floor = math.floor

View File

@ -1,7 +1,7 @@
local Event = require 'utils.event'
local Server = require 'utils.server'
local ScenarioTable = require 'maps.scrap_towny_ffa.table'
local SoftReset = require 'functions.soft_reset'
local SoftReset = require 'utils.functions.soft_reset'
local Token = require 'utils.token'
local math_random = math.random

View File

@ -2,9 +2,9 @@ local Event = require 'utils.event'
local Evolution = require 'maps.scrap_towny_ffa.evolution'
local Town_center = require 'maps.scrap_towny_ffa.town_center'
local Scrap = require 'maps.scrap_towny_ffa.scrap'
local unearthing_worm = require 'functions.unearthing_worm'
local unearthing_biters = require 'functions.unearthing_biters'
local tick_tack_trap = require 'functions.tick_tack_trap'
local unearthing_worm = require 'utils.functions.unearthing_worm'
local unearthing_biters = require 'utils.functions.unearthing_biters'
local tick_tack_trap = require 'utils.functions.tick_tack_trap'
local math_random = math.random

View File

@ -6,7 +6,7 @@ require 'modules.dynamic_landfill'
require 'modules.spawners_contain_biters'
require 'modules.satellite_score'
local map_functions = require 'tools.map_functions'
local map_functions = require 'utils.tools.map_functions'
--require "rewards"
local function shuffle(tbl)
@ -627,8 +627,7 @@ local function on_entity_died(event)
end
if entity_drop_amount[event.entity.name] then
if game.forces.enemy.evolution_factor < 0.5 then
local amount =
math.ceil(math.random(entity_drop_amount[event.entity.name].low, entity_drop_amount[event.entity.name].high) * (0.5 - game.forces.enemy.evolution_factor) * 2, 0)
local amount = math.ceil(math.random(entity_drop_amount[event.entity.name].low, entity_drop_amount[event.entity.name].high) * (0.5 - game.forces.enemy.evolution_factor) * 2, 0)
event.entity.surface.spill_item_stack(event.entity.position, {name = ore_spill_raffle[math.random(1, #ore_spill_raffle)], count = amount}, true)
end
end

View File

@ -18,9 +18,9 @@ require 'modules.rocks_broken_paint_tiles'
require 'modules.rpg'
require 'modules.hunger'
local shapes = require 'tools.shapes'
local shapes = require 'utils.tools.shapes'
local event = require 'utils.event'
local map_functions = require 'tools.map_functions'
local map_functions = require 'utils.tools.map_functions'
local simplex_noise = require 'utils.simplex_noise'
simplex_noise = simplex_noise.d2

View File

@ -1,5 +1,5 @@
--luacheck: ignore
local Basic_markets = require 'functions.basic_markets'
local Basic_markets = require 'utils.functions.basic_markets'
local Biter_pets = require 'modules.biter_pets'
local get_noise = require 'maps.stone_maze.noise'

View File

@ -1,5 +1,5 @@
--luacheck: ignore
local Basic_markets = require 'functions.basic_markets'
local Basic_markets = require 'utils.functions.basic_markets'
local get_noise = require 'maps.stone_maze.noise'
local room = {}

View File

@ -9,7 +9,7 @@ require 'modules.hunger'
require 'modules.no_turrets'
--essentials
require 'functions.maze'
require 'utils.functions.maze'
require 'modules.biters_yield_coins'
require 'modules.rocks_yield_ore'
require 'modules.mineable_wreckage_yields_scrap'
@ -35,7 +35,7 @@ local multirooms = {}
multirooms['2x2'] = require 'maps.stone_maze.2x2_rooms'
multirooms['3x3'] = require 'maps.stone_maze.3x3_rooms'
map_functions = require 'tools.map_functions'
map_functions = require 'utils.tools.map_functions'
grid_size = 24
--manual_mining_speed_modifier = 1
main_ground_tile = 'dirt-3'
@ -76,8 +76,7 @@ local function draw_depth_gui()
if player.gui.top.evolution_gui then
player.gui.top.evolution_gui.destroy()
end
local element =
player.gui.top.add({type = 'sprite-button', name = 'evolution_gui', caption = 'Depth: ' .. global.maze_depth, tooltip = 'Delve deep and face increased dangers.'})
local element = player.gui.top.add({type = 'sprite-button', name = 'evolution_gui', caption = 'Depth: ' .. global.maze_depth, tooltip = 'Delve deep and face increased dangers.'})
local style = element.style
style.minimal_height = 38
style.maximal_height = 38

View File

@ -20,7 +20,7 @@ require 'modules.evolution_extended'
local event = require 'utils.event'
local math_random = math.random
local insert = table.insert
local map_functions = require 'tools.map_functions'
local map_functions = require 'utils.tools.map_functions'
local simplex_noise = require 'utils.simplex_noise'
local simplex_noise = simplex_noise.d2

View File

@ -4,7 +4,7 @@
local event = require 'utils.event'
local table_insert = table.insert
local math_random = math.random
local map_functions = require 'tools.map_functions'
local map_functions = require 'utils.tools.map_functions'
local arena_size = 160
local function shuffle(tbl)

View File

@ -118,7 +118,7 @@ local table_of_slots = {
local table_of_ores = {'iron-ore', 'copper-ore', 'stone', 'coal'}
local map_functions = require 'tools.map_functions'
local map_functions = require 'utils.tools.map_functions'
local event = require 'utils.event'
@ -457,8 +457,7 @@ function draw_gui_status(player)
element_label.style.font_color = table_of_colors.white
local element_label =
element_frame.add({type = 'label', caption = math.floor(global.table_of_properties[global.table_of_properties[player.force.name].enemy].available_tickets)})
local element_label = element_frame.add({type = 'label', caption = math.floor(global.table_of_properties[global.table_of_properties[player.force.name].enemy].available_tickets)})
element_label.style.left_padding = 20
@ -836,10 +835,7 @@ function create_a_base(force_name, base_position)
end
if
object.name == 'infinity-chest' or object.name == 'substation' or object.name == 'big-electric-pole' or object.name == 'medium-electric-pole' or
object.name == 'inserter' or
object.name == 'accumulator' or
object.name == 'solar-panel' or
object.name == 'infinity-chest' or object.name == 'substation' or object.name == 'big-electric-pole' or object.name == 'medium-electric-pole' or object.name == 'inserter' or object.name == 'accumulator' or object.name == 'solar-panel' or
object.name == 'gun-turret'
then
entity.destructible = false
@ -896,14 +892,11 @@ function create_a_spot(spot_name, spot_position, spot_blueprint)
}
)
local draw_spot_force =
rendering.draw_text({text = spot.force.name, surface = surface, target = {spot.position.x, spot.position.y + 0.5}, color = spot.color, scale = 5, alignment = 'center'})
local draw_spot_force = rendering.draw_text({text = spot.force.name, surface = surface, target = {spot.position.x, spot.position.y + 0.5}, color = spot.color, scale = 5, alignment = 'center'})
local draw_spot_value =
rendering.draw_text({text = spot.value, surface = surface, target = {spot.position.x, spot.position.y - 4}, color = spot.color, scale = 5, alignment = 'center'})
local draw_spot_value = rendering.draw_text({text = spot.value, surface = surface, target = {spot.position.x, spot.position.y - 4}, color = spot.color, scale = 5, alignment = 'center'})
local draw_spot_name =
rendering.draw_text({text = spot.name, surface = surface, target = {spot.position.x, spot.position.y - 2}, color = spot.color, scale = 5, alignment = 'center'})
local draw_spot_name = rendering.draw_text({text = spot.name, surface = surface, target = {spot.position.x, spot.position.y - 2}, color = spot.color, scale = 5, alignment = 'center'})
local table_of_drawings = {name = draw_spot_name, value = draw_spot_value, force = draw_spot_force, border = draw_spot_border}
@ -957,10 +950,7 @@ function create_a_spot(spot_name, spot_position, spot_blueprint)
table.insert(table_of_entities, entity)
end
table.insert(
global.table_of_spots,
{properties = table_of_properties, drawings = table_of_drawings, players = table_of_players, positions = table_of_positions, entities = table_of_entities}
)
table.insert(global.table_of_spots, {properties = table_of_properties, drawings = table_of_drawings, players = table_of_players, positions = table_of_positions, entities = table_of_entities})
end
function create_a_point_of_interest(poi_blueprint, poi_position)
@ -1139,10 +1129,7 @@ function event_on_click_join(player)
-- draw_gui_spawn( player ) -- only for tests
for _, spot in pairs(global.table_of_spots) do
player.force.chart(
game.surfaces.tank_conquest,
{{x = spot.properties.position.x - 10, y = spot.properties.position.y - 10}, {x = spot.properties.position.x + 10, y = spot.properties.position.y + 10}}
)
player.force.chart(game.surfaces.tank_conquest, {{x = spot.properties.position.x - 10, y = spot.properties.position.y - 10}, {x = spot.properties.position.x + 10, y = spot.properties.position.y + 10}})
end
game.print(player.name .. ' joined ' .. global.table_of_properties[player.force.name].icon)
@ -1240,10 +1227,7 @@ local function on_tick(event)
for _, player in pairs(game.connected_players) do
if player.force.name == spot.properties.force.name and spot.properties.value > 0 then
player.force.chart(
game.surfaces.tank_conquest,
{{x = spot.properties.position.x - 10, y = spot.properties.position.y - 10}, {x = spot.properties.position.x + 10, y = spot.properties.position.y + 10}}
)
player.force.chart(game.surfaces.tank_conquest, {{x = spot.properties.position.x - 10, y = spot.properties.position.y - 10}, {x = spot.properties.position.x + 10, y = spot.properties.position.y + 10}})
end
end
@ -1294,10 +1278,7 @@ local function on_tick(event)
global.table_of_properties.countdown_in_seconds = global.table_of_properties.countdown_in_seconds - 1
end
if
global.table_of_properties.countdown_in_seconds < 0 or global.table_of_properties.force_player_one.available_tickets < 0 or
global.table_of_properties.force_player_two.available_tickets < 0
then
if global.table_of_properties.countdown_in_seconds < 0 or global.table_of_properties.force_player_one.available_tickets < 0 or global.table_of_properties.force_player_two.available_tickets < 0 then
if global.table_of_properties.force_player_one.available_tickets == global.table_of_properties.force_player_two.available_tickets then
game.print('The battle is over. The round ended in a draw.')
elseif global.table_of_properties.force_player_one.available_tickets > global.table_of_properties.force_player_two.available_tickets then
@ -1493,23 +1474,11 @@ local function on_tick(event)
if game.surfaces.tank_conquest ~= nil and #game.connected_players and #global.table_of_spots then
for _, player in pairs(game.connected_players) do
for _, spot in pairs(global.table_of_spots) do
if
player.force.is_chunk_charted(
game.surfaces.tank_conquest,
{x = math.floor(spot.properties.position.x / 32), y = math.floor(spot.properties.position.y / 32)}
)
then
local chart_tags =
player.force.find_chart_tags(
game.surfaces.tank_conquest,
{{spot.properties.position.x - 1, spot.properties.position.y - 1}, {spot.properties.position.x + 1, spot.properties.position.y + 1}}
)
if player.force.is_chunk_charted(game.surfaces.tank_conquest, {x = math.floor(spot.properties.position.x / 32), y = math.floor(spot.properties.position.y / 32)}) then
local chart_tags = player.force.find_chart_tags(game.surfaces.tank_conquest, {{spot.properties.position.x - 1, spot.properties.position.y - 1}, {spot.properties.position.x + 1, spot.properties.position.y + 1}})
if #chart_tags == 0 then
player.force.add_chart_tag(
game.surfaces.tank_conquest,
{icon = {type = 'virtual', name = 'signal-' .. spot.properties.name}, position = spot.properties.position}
)
player.force.add_chart_tag(game.surfaces.tank_conquest, {icon = {type = 'virtual', name = 'signal-' .. spot.properties.name}, position = spot.properties.position})
end
end
end
@ -1712,10 +1681,7 @@ local function on_player_changed_position(event)
end
for _, position in pairs(spot_item.positions) do
if
math.floor(player.position.x) == position.x and math.floor(player.position.y) == position.y or
math.ceil(player.position.x) == position.x and math.ceil(player.position.y) == position.y
then
if math.floor(player.position.x) == position.x and math.floor(player.position.y) == position.y or math.ceil(player.position.x) == position.x and math.ceil(player.position.y) == position.y then
if global.table_of_spots[spot_index].players[player.index] == nil then
global.table_of_spots[spot_index].players[player.index] = player
@ -1805,16 +1771,12 @@ local function on_player_died(event)
if event.cause and event.cause.valid then
if event.cause.name == 'character' then
player_death_message =
global.table_of_properties[player.force.name].icon ..
' ' .. player.name .. ' was killed by ' .. global.table_of_properties[event.cause.player.force.name].icon .. ' ' .. event.cause.player.name .. '.'
player_death_message = global.table_of_properties[player.force.name].icon .. ' ' .. player.name .. ' was killed by ' .. global.table_of_properties[event.cause.player.force.name].icon .. ' ' .. event.cause.player.name .. '.'
elseif event.cause.name == 'car' or event.cause.name == 'tank' or event.cause.name == 'train' then
local driver = event.cause.get_driver()
if driver.player then
player_death_message =
global.table_of_properties[player.force.name].icon ..
' ' .. player.name .. ' was killed with a vehicle by ' .. global.table_of_properties[driver.player.force.name].icon .. ' ' .. driver.player.name .. '.'
player_death_message = global.table_of_properties[player.force.name].icon .. ' ' .. player.name .. ' was killed with a vehicle by ' .. global.table_of_properties[driver.player.force.name].icon .. ' ' .. driver.player.name .. '.'
else
player_death_message = global.table_of_properties[player.force.name].icon .. ' ' .. player.name .. ' was killed by run over.'
end

View File

@ -15,12 +15,12 @@ require 'modules.rocks_yield_ore'
require 'modules.biters_yield_coins'
require 'modules.mineable_wreckage_yields_scrap'
local shapes = require 'tools.shapes'
local shapes = require 'utils.tools.shapes'
local Event = require 'utils.event'
local unearthing_worm = require 'functions.unearthing_worm'
local unearthing_biters = require 'functions.unearthing_biters'
local tick_tack_trap = require 'functions.tick_tack_trap'
local map_functions = require 'tools.map_functions'
local unearthing_worm = require 'utils.functions.unearthing_worm'
local unearthing_biters = require 'utils.functions.unearthing_biters'
local tick_tack_trap = require 'utils.functions.tick_tack_trap'
local map_functions = require 'utils.tools.map_functions'
local simplex_noise = require 'utils.simplex_noise'
simplex_noise = simplex_noise.d2

View File

@ -5,7 +5,7 @@
local event = require 'utils.event'
local bricks = require 'maps.tetris.bricks'
local connect_belts = require 'functions.connect_belts'
local connect_belts = require 'utils.functions.connect_belts'
local playfield_left_top = {x = -17, y = -18}
local playfield_width = 12
@ -219,10 +219,7 @@ local function add_score_points(amount)
end
local function move_lines_down(surface, y)
local entities =
surface.find_entities_filtered(
{area = {{playfield_area.left_top.x, playfield_area.left_top.y}, {playfield_area.left_top.x + playfield_width + 1, playfield_area.left_top.y + y + 1}}, force = 'enemy'}
)
local entities = surface.find_entities_filtered({area = {{playfield_area.left_top.x, playfield_area.left_top.y}, {playfield_area.left_top.x + playfield_width + 1, playfield_area.left_top.y + y + 1}}, force = 'enemy'})
for _, e in pairs(entities) do
if e.valid then
e.clone {position = {e.position.x, e.position.y + 1}, surface = surface, force = 'enemy'}
@ -419,14 +416,7 @@ local function move(surface, item)
return
end
for k, p in pairs(global.active_brick.positions) do
if
not global.tetris_grid[
coord_string(
math.floor(global.active_brick.positions[k].x + move_translations[item][1]),
math.floor(global.active_brick.positions[k].y + move_translations[item][2])
)
]
then
if not global.tetris_grid[coord_string(math.floor(global.active_brick.positions[k].x + move_translations[item][1]), math.floor(global.active_brick.positions[k].y + move_translations[item][2]))] then
return
end
end

View File

@ -2,8 +2,8 @@
local Event = require 'utils.event'
local unearthing_worm = require 'functions.unearthing_worm'
local unearthing_biters = require 'functions.unearthing_biters'
local unearthing_worm = require 'utils.functions.unearthing_worm'
local unearthing_biters = require 'utils.functions.unearthing_biters'
local immune_tiles = {
['concrete'] = true,
@ -33,9 +33,7 @@ local function on_player_changed_position(event)
return
end
for _, lamp in pairs(
player.surface.find_entities_filtered({area = {{player.position.x - 18, player.position.y - 18}, {player.position.x + 18, player.position.y + 18}}, name = 'small-lamp'})
) do
for _, lamp in pairs(player.surface.find_entities_filtered({area = {{player.position.x - 18, player.position.y - 18}, {player.position.x + 18, player.position.y + 18}}, name = 'small-lamp'})) do
local circuit = lamp.get_or_create_control_behavior()
if circuit then
if lamp.energy > 25 and circuit.disabled == false then

View File

@ -2,7 +2,7 @@
--[[
Exchange Strings:
for "terrain_layouts.scrap_01"
for "utils.terrain_layouts.scrap_01"
>>>eNpjYBBiEGQAgwYHBgYHBw6W5PzEHAaGA0Begz2I5krOLyhIL
dLNL0pFFuZMLipNSdXNz0RVnJqXmlupm5RYnAoRgmCOzKL8PHQTW
ItL8vNQRUqKUlOLQazVq1bZgUS5S4sS8zJLc9H1MjCeOHC8uKFFj

View File

@ -9,7 +9,7 @@ local Utils = require 'utils.core'
local Color = require 'utils.color_presets'
local Server = require 'utils.server'
local Jail = require 'utils.datastore.jail_data'
local FancyTime = require 'tools.fancy_time'
local FancyTime = require 'utils.tools.fancy_time'
local Task = require 'utils.task'
local Token = require 'utils.token'
local Discord = require 'utils.discord_handler'

View File

@ -498,6 +498,7 @@ local function create_admin_panel(data)
end
end
local listable_players = frame.add({type = 'checkbox', name = 'admin_listable_players', caption = 'Toggle between all players or connected players.', state = false})
local drop_down = frame.add({type = 'drop-down', name = 'admin_player_select', items = player_names, selected_index = selected_index})
drop_down.style.minimal_width = 326
drop_down.style.right_padding = 12

View File

@ -3,7 +3,7 @@ local math_random = math.random
local table_insert = table.insert
local table_remove = table.remove
local NoiseVector = require 'functions.noise_vector_path'
local NoiseVector = require 'utils.functions.noise_vector_path'
local function get_vector()
local x = 1000 - math_random(0, 2000)

Some files were not shown because too many files have changed in this diff Show More