mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-11 14:49:24 +02:00
removed unused functions and fixed so water is not generated near spawn
This commit is contained in:
parent
4f484de35a
commit
fbda17b3aa
@ -1,11 +1,17 @@
|
||||
--luacheck:ignore
|
||||
local Functions = require 'maps.biter_battles_v2.functions'
|
||||
local Gui = require 'maps.biter_battles_v2.gui'
|
||||
local Init = require 'maps.biter_battles_v2.init'
|
||||
local Score = require 'comfy_panel.score'
|
||||
local Server = require 'utils.server'
|
||||
local Discord = require 'utils.discord'
|
||||
|
||||
local math_random = math.random
|
||||
-- Use these settings for live
|
||||
local send_ping_to_channel = Discord.channel_names.bb_channel
|
||||
local role_to_mention = Discord.role_mentions.biter_battles
|
||||
-- Use these settings for testing
|
||||
-- bot-lounge
|
||||
-- local send_ping_to_channel = Discord.channel_names.bot_quarters
|
||||
-- local role_to_mention = Discord.role_mentions.test_role
|
||||
|
||||
local Public = {}
|
||||
|
||||
@ -14,15 +20,6 @@ local gui_values = {
|
||||
['south'] = {c1 = 'Team South', color1 = {r = 0.99, g = 0.33, b = 0.33}}
|
||||
}
|
||||
|
||||
local function shuffle(tbl)
|
||||
local size = #tbl
|
||||
for i = size, 1, -1 do
|
||||
local rand = math.random(size)
|
||||
tbl[i], tbl[rand] = tbl[rand], tbl[i]
|
||||
end
|
||||
return tbl
|
||||
end
|
||||
|
||||
function Public.reveal_map()
|
||||
for _, f in pairs({'north', 'south', 'player', 'spectator'}) do
|
||||
local r = 768
|
||||
@ -80,7 +77,7 @@ local function silo_kaboom(entity)
|
||||
end
|
||||
|
||||
local function get_sorted_list(column_name, score_list)
|
||||
for x = 1, #score_list, 1 do
|
||||
for _ = 1, #score_list, 1 do
|
||||
for y = 1, #score_list, 1 do
|
||||
if not score_list[y + 1] then
|
||||
break
|
||||
@ -280,6 +277,8 @@ function Public.server_restart()
|
||||
local message = 'Map is restarting! '
|
||||
Server.to_discord_bold(table.concat {'*** ', message, ' ***'})
|
||||
|
||||
Server.to_discord_named_raw(send_ping_to_channel, role_to_mention .. ' ** Biter Battles was just reset! **')
|
||||
|
||||
Init.tables()
|
||||
Init.forces()
|
||||
Init.load_spawn()
|
||||
|
@ -125,6 +125,7 @@ function Public.source_surface()
|
||||
surface.request_to_generate_chunks({x = 0, y = -256}, 8)
|
||||
surface.force_generate_chunk_requests()
|
||||
|
||||
Terrain.fill_water_tiles(surface)
|
||||
Terrain.draw_spawn_area(surface)
|
||||
Terrain.generate_additional_spawn_ore(surface)
|
||||
Terrain.generate_additional_rocks(surface)
|
||||
|
@ -1,4 +1,3 @@
|
||||
--luacheck:ignore
|
||||
-- Biter Battles v2 -- by MewMew
|
||||
|
||||
local Ai = require 'maps.biter_battles_v2.ai'
|
||||
@ -16,7 +15,6 @@ require 'maps.biter_battles_v2.commands'
|
||||
require 'modules.spawners_contain_biters'
|
||||
|
||||
local function on_player_joined_game(event)
|
||||
local surface = game.surfaces['biter_battles']
|
||||
local player = game.players[event.player_index]
|
||||
if player.online_time == 0 or player.force.name == 'player' then
|
||||
Functions.init_player(player)
|
||||
@ -136,11 +134,6 @@ local function on_player_built_tile(event)
|
||||
Terrain.restrict_landfill(player.surface, player, event.tiles)
|
||||
end
|
||||
|
||||
local function on_player_built_tile(event)
|
||||
local player = game.players[event.player_index]
|
||||
Terrain.restrict_landfill(player.surface, player, event.tiles)
|
||||
end
|
||||
|
||||
local function on_player_mined_entity(event)
|
||||
Terrain.minable_wrecks(event)
|
||||
end
|
||||
@ -170,7 +163,6 @@ Event.add(defines.events.on_player_joined_game, on_player_joined_game)
|
||||
Event.add(defines.events.on_player_mined_entity, on_player_mined_entity)
|
||||
Event.add(defines.events.on_research_finished, on_research_finished)
|
||||
Event.add(defines.events.on_robot_built_entity, on_robot_built_entity)
|
||||
Event.add(defines.events.on_robot_built_tile, on_robot_built_tile)
|
||||
Event.add(defines.events.on_tick, on_tick)
|
||||
Event.on_init(on_init)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
--luacheck:ignore
|
||||
--luacheck: ignore
|
||||
local Public = {}
|
||||
local LootRaffle = require 'functions.loot_raffle'
|
||||
local BiterRaffle = require 'functions.biter_raffle'
|
||||
@ -567,6 +567,24 @@ function Public.draw_spawn_circle(surface)
|
||||
end
|
||||
end
|
||||
|
||||
function Public.fill_water_tiles(surface)
|
||||
local chunk_r = 8
|
||||
local r = chunk_r * 32
|
||||
|
||||
for x = r * -1, r, 1 do
|
||||
for y = r * -1, -4, 1 do
|
||||
local pos = {x = x, y = y}
|
||||
local distance_to_center = math_sqrt(pos.x ^ 2 + pos.y ^ 2)
|
||||
if distance_to_center < 550 and not is_horizontal_border_river(pos) then
|
||||
local tile_name = surface.get_tile(pos).name
|
||||
if tile_name == 'water' or tile_name == 'deepwater' then
|
||||
surface.set_tiles({{name = get_replacement_tile(surface, pos), position = pos}}, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Public.draw_spawn_area(surface)
|
||||
local chunk_r = 4
|
||||
local r = chunk_r * 32
|
||||
|
Loading…
x
Reference in New Issue
Block a user