mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-25 21:29:06 +02:00
removed mirrored units
This commit is contained in:
parent
2c45c0a42b
commit
98dfc2cc86
@ -27,7 +27,7 @@ local function get_active_biter_count(biter_force_name)
|
||||
return count
|
||||
end
|
||||
|
||||
function set_biter_raffle_table(surface, biter_force_name)
|
||||
local function set_biter_raffle_table(surface, biter_force_name)
|
||||
local biters = surface.find_entities_filtered({type = "unit", force = biter_force_name})
|
||||
if not biters[1] then return end
|
||||
global.biter_raffle[biter_force_name] = {}
|
||||
@ -175,7 +175,7 @@ local function send_group(unit_group, force_name, nearest_player_unit)
|
||||
type = defines.command.attack_area,
|
||||
destination = target,
|
||||
radius = 32,
|
||||
distraction=defines.distraction.by_enemy
|
||||
distraction = defines.distraction.by_enemy
|
||||
},
|
||||
{
|
||||
type = defines.command.attack,
|
||||
@ -280,7 +280,7 @@ ai.raise_evo = function()
|
||||
for _, f in pairs({"north_biters", "south_biters"}) do
|
||||
set_evo_and_threat(amount, "automation-science-pack", f)
|
||||
end
|
||||
global.evo_raise_counter = global.evo_raise_counter + 1
|
||||
global.evo_raise_counter = global.evo_raise_counter + (1 * 0.50)
|
||||
end
|
||||
|
||||
--Prevent Players from damaging Rocket Silos
|
||||
|
@ -6,7 +6,7 @@ bb_config = {
|
||||
["blueprint_string_importing"] = false, --Allow the importing of blueprints via blueprint strings?
|
||||
|
||||
--MAP PREGENERATION
|
||||
["map_pregeneration_radius"] = 31, --Radius in chunks to pregenerate at the start of the map.
|
||||
["map_pregeneration_radius"] = 32, --Radius in chunks to pregenerate at the start of the map.
|
||||
["fast_pregen"] = false, --Force fast pregeneration.
|
||||
|
||||
--TEAM SETTINGS
|
||||
|
@ -26,6 +26,11 @@ end
|
||||
|
||||
local function poll_difficulty(player)
|
||||
if player.gui.center["difficulty_poll"] then player.gui.center["difficulty_poll"].destroy() return end
|
||||
|
||||
if bb_config.only_admins_vote then
|
||||
if not player.admin then return end
|
||||
end
|
||||
|
||||
if game.tick > timeout then
|
||||
if player.online_time ~= 0 then
|
||||
local t = math.abs(math.floor((timeout - game.tick) / 3600))
|
||||
@ -59,30 +64,45 @@ local function set_difficulty()
|
||||
a = a + d
|
||||
vote_count = vote_count + 1
|
||||
end
|
||||
if vote_count == 0 then return end
|
||||
a = a / vote_count
|
||||
local new_index = math.round(a, 0)
|
||||
if global.difficulty_vote_index ~= new_index then
|
||||
game.print(">>> Map difficulty has changed to " .. difficulties[new_index].name .. " difficulty!", difficulties[new_index].print_color)
|
||||
local message = table.concat({">> Map difficulty has changed to ", difficulties[new_index].name, " difficulty!"})
|
||||
game.print(message, difficulties[new_index].print_color)
|
||||
server_commands.to_discord_embed(message)
|
||||
end
|
||||
global.difficulty_vote_index = new_index
|
||||
global.difficulty_vote_value = difficulties[new_index].value
|
||||
end
|
||||
|
||||
local function on_player_joined_game(event)
|
||||
local player = game.players[event.player_index]
|
||||
if player.online_time == 0 then
|
||||
if bb_config.only_admins_vote then
|
||||
if player.admin then poll_difficulty(player) end
|
||||
else
|
||||
poll_difficulty(player)
|
||||
end
|
||||
end
|
||||
if not global.difficulty_vote_value then global.difficulty_vote_value = 1 end
|
||||
if not global.difficulty_vote_index then global.difficulty_vote_index = 4 end
|
||||
if not global.difficulty_player_votes then global.difficulty_player_votes = {} end
|
||||
|
||||
local player = game.players[event.player_index]
|
||||
if game.tick < timeout then
|
||||
if not global.difficulty_player_votes[player.name] then
|
||||
if bb_config.only_admins_vote then
|
||||
if player.admin then poll_difficulty(player) end
|
||||
else
|
||||
poll_difficulty(player)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
difficulty_gui()
|
||||
end
|
||||
|
||||
local function on_player_left_game(event)
|
||||
if game.tick > timeout then return end
|
||||
local player = game.players[event.player_index]
|
||||
if not global.difficulty_player_votes[player.name] then return end
|
||||
global.difficulty_player_votes[player.name] = nil
|
||||
set_difficulty()
|
||||
end
|
||||
|
||||
local function on_gui_click(event)
|
||||
if not event then return end
|
||||
if not event.element then return end
|
||||
@ -104,4 +124,5 @@ local function on_gui_click(event)
|
||||
end
|
||||
|
||||
event.add(defines.events.on_gui_click, on_gui_click)
|
||||
event.add(defines.events.on_player_left_game, on_player_left_game)
|
||||
event.add(defines.events.on_player_joined_game, on_player_joined_game)
|
@ -35,7 +35,22 @@ local cliff_orientation_translation = {
|
||||
["none-to-west"] = "none-to-east"
|
||||
}
|
||||
|
||||
local valid_types = {
|
||||
["tree"] = true,
|
||||
["simple-entity"] = true,
|
||||
["cliff"] = true,
|
||||
["resource"] = true,
|
||||
["unit-spawner"] = true,
|
||||
["turret"] = true,
|
||||
["rocket-silo"] = true,
|
||||
["character"] = true,
|
||||
["ammo-turret"] = true,
|
||||
["wall"] = true,
|
||||
["fish"] = true,
|
||||
}
|
||||
|
||||
local function process_entity(surface, entity)
|
||||
if not valid_types[entity.type] then return end
|
||||
local new_pos = {x = entity.position.x * -1, y = entity.position.y * -1}
|
||||
if entity.type == "tree" then
|
||||
if not surface.can_place_entity({name = entity.name, position = new_pos}) then return end
|
||||
@ -59,7 +74,8 @@ local function process_entity(surface, entity)
|
||||
surface.create_entity({name = entity.name, position = new_pos, amount = entity.amount})
|
||||
return
|
||||
end
|
||||
if entity.type == "unit-spawner" or entity.type == "unit" or entity.type == "turret" then
|
||||
--if entity.type == "unit-spawner" or entity.type == "unit" or entity.type == "turret" then
|
||||
if entity.type == "unit-spawner" or entity.type == "turret" then
|
||||
local new_e = {name = entity.name, position = new_pos, direction = direction_translation[entity.direction], force = "south_biters"}
|
||||
if not surface.can_place_entity(new_e) then return end
|
||||
surface.create_entity(new_e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user