1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-03 13:12:11 +02:00

more random terrain, gui tweaks

This commit is contained in:
MewMew 2019-09-09 22:41:25 +02:00
parent 3310ed00ba
commit cc86abe9c1
5 changed files with 81 additions and 45 deletions

View File

@ -11,18 +11,26 @@ local event = require 'utils.event'
local function init_surface()
local map_gen_settings = {}
map_gen_settings.water = "0.15"
map_gen_settings.water = math.random(40, 60) * 0.01
map_gen_settings.starting_area = "2.5"
--map_gen_settings.cliff_settings = {cliff_elevation_interval = 12, cliff_elevation_0 = 32}
map_gen_settings.cliff_settings = {cliff_elevation_interval = 38, cliff_elevation_0 = 38}
--map_gen_settings.property_expression_names = {
-- ["moisture"] = math.random(1, 100) * 0.01,
-- ["aux"] = math.random(1, 100) * 0.01,
-- ["temperature"] = math.random(1, 100) * 0.01,
--}
map_gen_settings.terrain_segmentation = math.random(50, 100) * 0.1
--map_gen_settings.terrain_segmentation = 10
map_gen_settings.cliff_settings = {cliff_elevation_interval = math.random(8, 48), cliff_elevation_0 = math.random(8, 48)}
map_gen_settings.autoplace_controls = {
["coal"] = {frequency = "2", size = "1", richness = "1"},
["stone"] = {frequency = "2", size = "1", richness = "1"},
["copper-ore"] = {frequency = "2", size = "1", richness = "1"},
["iron-ore"] = {frequency = "2.5", size = "1.1", richness = "1"},
["uranium-ore"] = {frequency = "2", size = "1", richness = "1"},
["crude-oil"] = {frequency = "2.5", size = "1", richness = "1.5"},
["trees"] = {frequency = "1.25", size = "0.6", richness = "0.5"},
["coal"] = {frequency = math.random(10, 30) * 0.1, size = math.random(5, 15) * 0.1, richness = math.random(5, 15) * 0.1},
["stone"] = {frequency = math.random(10, 30) * 0.1, size = math.random(5, 15) * 0.1, richness = math.random(5, 15) * 0.1},
["copper-ore"] = {frequency = math.random(10, 30) * 0.1, size = math.random(5, 15) * 0.1, richness = math.random(5, 15) * 0.1},
["iron-ore"] = {frequency = math.random(10, 30) * 0.1, size = math.random(5, 15) * 0.1, richness = math.random(5, 15) * 0.1},
["uranium-ore"] = {frequency = math.random(10, 20) * 0.1, size = math.random(5, 15) * 0.1, richness = math.random(5, 15) * 0.1},
["crude-oil"] = {frequency = math.random(15, 30) * 0.1, size = math.random(5, 15) * 0.1, richness = math.random(10, 20) * 0.1},
["trees"] = {frequency = math.random(5, 25) * 0.1, size = math.random(5, 15) * 0.1, richness = math.random(3, 10) * 0.1},
["enemy-base"] = {frequency = "256", size = "0.61", richness = "1"}
}
game.create_surface("biter_battles", map_gen_settings)

View File

@ -1,9 +1,16 @@
-- biters will landfill a tile on death within a certain radius
local r = 5
local r = 6
local vectors = {{0,0}, {1,0}, {0,1}, {-1,0}, {0,-1}}
local math_random = math.random
local whitelist = {
["big-spitter"] = true,
["big-biter"] = true,
["behemoth-biter"] = true,
["behemoth-spitter"] = true,
}
local function create_particles(surface, position)
local m = math_random(8, 12)
local m2 = m * 0.005
@ -54,7 +61,8 @@ end
local function on_entity_died(event)
local entity = event.entity
if not entity.valid then return end
if entity.type ~= "unit" then return end
if entity.type ~= "unit" then return end
if not whitelist[entity.name] then return end
landfill(entity.surface, entity)
end

View File

@ -1,26 +1,28 @@
--BITER BATTLES CONFIG FILE--
--BITER BATTLES CONFIG--
bb_config = {
--GENERAL SETTINGS
--TEAM SETTINGS--
["team_balancing"] = true, --Should players only be able to join a team that has less or equal members than the opposing team?
["only_admins_vote"] = false, --Are only admins able to vote on the global difficulty?
--Optional custom team names:
["north_side_team_name"] = "Team North",
["south_side_team_name"] = "Team South",
--GENERAL SETTINGS--
["blueprint_library_importing"] = false, --Allow the importing of blueprints from the blueprint library?
["blueprint_string_importing"] = false, --Allow the importing of blueprints via blueprint strings?
--MAP PREGENERATION
--MAP PREGENERATION--
["map_pregeneration_radius"] = 32, --Radius in chunks to pregenerate at the start of the map.
["fast_pregen"] = false, --Force fast pregeneration.
--TEAM SETTINGS
["north_side_team_name"] = "North", --Name in the GUI of Team North.
["south_side_team_name"] = "South", --Name in the GUI of Team South.
["team_balancing"] = true, --Should players only be able to join a team that has less or equal members than the opposing team?
["only_admins_vote"] = false, --Are only admins able to vote on the global difficulty?
--TERRAIN OPTIONS
--TERRAIN OPTIONS--
["border_river_width"] = 29, --Approximate width of the horizontal impassable river seperating the teams. (values up to 100)
["builders_area"] = true, --Grant each side a peaceful direction with no nests and biters?
["random_scrap"] = true, --Generate harvestable scrap around worms randomly?
--BITER SETTINGS
--BITER SETTINGS--
["max_active_biters"] = 2500, --Maximum total amount of attacking units per side.
["max_group_size"] = 256, --Maximum unit group size.
["biter_timeout"] = 54000, --Time it takes in ticks for an attacking unit to be deleted. This prevents perma stuck units.

View File

@ -13,10 +13,10 @@ local food_names = {
}
local gui_values = {
["north"] = {force = "north", biter_force = "north_biters", c1 = "Team " .. bb_config.north_side_team_name, c2 = "JOIN " .. string.upper(bb_config.north_side_team_name), n1 = "join_north_button",
["north"] = {force = "north", biter_force = "north_biters", c1 = bb_config.north_side_team_name, c2 = "JOIN ", n1 = "join_north_button",
t1 = "Evolution of the North side biters. Can go beyond 100% for endgame modifiers.",
t2 = "Threat causes biters to attack. Reduces when biters are slain.", color1 = {r = 0.55, g = 0.55, b = 0.99}, color2 = {r = 0.66, g = 0.66, b = 0.99}},
["south"] = {force = "south", biter_force = "south_biters", c1 = "Team " .. bb_config.south_side_team_name, c2 = "JOIN " .. string.upper(bb_config.south_side_team_name), n1 = "join_south_button",
["south"] = {force = "south", biter_force = "south_biters", c1 = bb_config.south_side_team_name, c2 = "JOIN ", n1 = "join_south_button",
t1 = "Evolution of the South side biters. Can go beyond 100% for endgame modifiers.",
t2 = "Threat causes biters to attack. Reduces when biters are slain.", color1 = {r = 0.99, g = 0.33, b = 0.33}, color2 = {r = 0.99, g = 0.44, b = 0.44}}
}
@ -53,17 +53,20 @@ local function create_first_join_gui(player)
local b = frame.add { type = "label", caption = "Feed the enemy team's biters to gain advantage!" }
b.style.font = "heading-2"
b.style.font_color = {r=0.98, g=0.66, b=0.22}
frame.add { type = "label", caption = "-----------------------------------------------------------"}
for _, gui_value in pairs(gui_values) do
local t = frame.add { type = "table", column_count = 3 }
local l = t.add { type = "label", caption = gui_value.c1}
l.style.font = "heading-2"
l.style.font_color = gui_value.color1
l.style.single_line = false
l.style.maximal_width = 290
local l = t.add { type = "label", caption = " - "}
local l = t.add { type = "label", caption = #game.forces[gui_value.force].connected_players .. " Players "}
l.style.font_color = { r=0.22, g=0.88, b=0.22}
frame.add { type = "label", caption = "-----------------------------------------------------------"}
local c = gui_value.c2
local font_color = gui_value.color1
if global.game_lobby_active then
@ -82,6 +85,7 @@ local function create_first_join_gui(player)
b.style.font = "default-large-bold"
b.style.font_color = font_color
b.style.minimal_width = 350
frame.add { type = "label", caption = "-----------------------------------------------------------"}
end
end
@ -107,8 +111,8 @@ local function create_main_gui(player)
for _, f in pairs(foods) do
local s = t.add { type = "sprite-button", name = f, sprite = "item/" .. f }
s.tooltip = {"",food_tooltips[x]}
s.style.minimal_height = 42
s.style.minimal_width = 42
s.style.minimal_height = 41
s.style.minimal_width = 41
s.style.top_padding = 0
s.style.left_padding = 0
s.style.right_padding = 0
@ -118,16 +122,22 @@ local function create_main_gui(player)
end
for _, gui_value in pairs(gui_values) do
local t = frame.add { type = "table", column_count = 3 }
local t = frame.add { type = "table", column_count = 3 }
local l = t.add { type = "label", caption = gui_value.c1}
l.style.font = "default-bold"
l.style.font_color = gui_value.color1
local l = t.add { type = "label", caption = " - "}
local l = t.add { type = "label", caption = #game.forces[gui_value.force].connected_players .. " Players "}
l.style.font_color = { r=0.22, g=0.88, b=0.22}
l.style.single_line = false
--l.style.minimal_width = 100
l.style.maximal_width = 102
local l = t.add { type = "label", caption = " - "}
local c = #game.forces[gui_value.force].connected_players .. " Player"
if #game.forces[gui_value.force].connected_players ~= 1 then c = c .. "s" end
local l = t.add { type = "label", caption = c}
l.style.font = "default"
l.style.font_color = { r=0.22, g=0.88, b=0.22}
if global.bb_view_players[player.name] == true then
if global.bb_view_players[player.name] == true then
local t = frame.add { type = "table", column_count = 4 }
for _, p in pairs(game.forces[gui_value.force].connected_players) do
local l = t.add { type = "label", caption = p.name }
@ -154,7 +164,8 @@ local function create_main_gui(player)
l.style.font = "default-bold"
l.style.minimal_width = 25
l.tooltip = gui_value.t2
frame.add { type = "label", caption = "-----------------------------"}
frame.add { type = "label", caption = string.rep("-", 29)}
end
local t = frame.add { type = "table", column_count = 2 }
@ -349,7 +360,7 @@ local function on_player_joined_game(event)
if #game.connected_players > 1 then
global.game_lobby_timeout = math.ceil(36000 / #game.connected_players)
else
global.game_lobby_timeout = 5999940
global.game_lobby_timeout = 599940
end
--if not global.chosen_team[player.name] then

View File

@ -115,7 +115,9 @@ local function generate_circle_spawn(event)
end
if distance_to_center < 9.5 then tile = "refined-concrete" end
if distance_to_center < 7 then tile = "sand-1" end
if distance_to_center + noise < r - 24 and distance_to_center > spawn_circle_size and not is_horizontal_border_river(pos) then
if distance_to_center + noise < r - r * 0.5 and distance_to_center > spawn_circle_size 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 = "grass-2", position = pos}}, true)
@ -129,6 +131,7 @@ local function generate_circle_spawn(event)
end
end
end
if tile then surface.set_tiles({{name = tile, position = pos}}, true) end
if surface.can_place_entity({name = "coal", position = pos}) then
@ -185,6 +188,10 @@ local function generate_silos(event)
create_tile_chain(surface, {name = "stone-path", position = global.rocket_silo["north"].position}, 32, 10)
end
for i = 1, 4, 1 do
create_tile_chain(surface, {name = "stone-path", position = global.rocket_silo["north"].position}, 48, 50)
end
end
local function generate_river(event)
@ -221,14 +228,14 @@ local function rainbow_ore_and_ponds(event)
if i == 0 then i = 4 end
surface.create_entity({name = ores[i], position = pos, amount = amount})
end
if noise < -0.79 then
if noise < -0.85 then
surface.set_tiles({{name = "deepwater", position = pos}})
else
surface.set_tiles({{name = "water", position = pos}})
end
if math_random(1, 48) == 1 then surface.create_entity({name = "fish", position = pos}) end
end
--if noise < -0.79 then
-- if noise < -0.85 then
-- surface.set_tiles({{name = "deepwater", position = pos}})
-- else
-- surface.set_tiles({{name = "water", position = pos}})
-- end
-- if math_random(1, 48) == 1 then surface.create_entity({name = "fish", position = pos}) end
--end
end
end
end