mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-17 20:58:13 +02:00
tweaks and fixes
This commit is contained in:
parent
98dfc2cc86
commit
cd56dd2693
@ -19,7 +19,7 @@ local function teleport_players(surface)
|
||||
surface.request_to_generate_chunks(spawn, 2)
|
||||
surface.force_generate_chunk_requests()
|
||||
end
|
||||
local pos = surface.find_non_colliding_position("character", spawn, 1, 0.5)
|
||||
local pos = surface.find_non_colliding_position("character", spawn, 3, 0.5)
|
||||
player.teleport(pos, surface)
|
||||
end
|
||||
end
|
||||
|
@ -8,7 +8,7 @@ local function on_entity_died(event)
|
||||
local entity = event.entity
|
||||
if not entity.valid then return end
|
||||
if entity.name ~= "stone-wall" then return end
|
||||
if math_random(1,3) == 1 then return end
|
||||
if math_random(1,4) == 1 then return end
|
||||
entity.surface.create_entity({name = rock_raffle[math_random(1, #rock_raffle)], position = entity.position, force = "player"})
|
||||
end
|
||||
|
||||
|
@ -859,13 +859,15 @@ end
|
||||
local function damage_entities_in_radius(surface, position, radius, damage)
|
||||
local entities_to_damage = surface.find_entities_filtered({area = {{position.x - radius, position.y - radius},{position.x + radius, position.y + radius}}})
|
||||
for _, entity in pairs(entities_to_damage) do
|
||||
if entity.health and entity.name ~= "land-mine" then
|
||||
if entity.force.name ~= "enemy" then
|
||||
if entity.name == "character" then
|
||||
entity.damage(damage, "enemy")
|
||||
else
|
||||
entity.health = entity.health - damage
|
||||
if entity.health <= 0 then entity.die("enemy") end
|
||||
if entity.valid then
|
||||
if entity.health and entity.name ~= "land-mine" then
|
||||
if entity.force.name ~= "enemy" then
|
||||
if entity.name == "character" then
|
||||
entity.damage(damage, "enemy")
|
||||
else
|
||||
entity.health = entity.health - damage
|
||||
if entity.health <= 0 then entity.die("enemy") end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -959,6 +961,7 @@ local function on_player_joined_game(event)
|
||||
["stone"] = {frequency = "3", size = "2", richness = "1"},
|
||||
["copper-ore"] = {frequency = "3", size = "2", richness = "1"},
|
||||
["iron-ore"] = {frequency = "3", size = "2", richness = "1"},
|
||||
["uranium-ore"] = {frequency = "2", size = "1", richness = "1"},
|
||||
["crude-oil"] = {frequency = "4", size = "1", richness = "1"},
|
||||
["trees"] = {frequency = "1.5", size = "1.5", richness = "1"},
|
||||
["enemy-base"] = {frequency = "none", size = "none", richness = "none"}
|
||||
@ -1148,9 +1151,8 @@ local function on_chunk_generated(event)
|
||||
map_functions.draw_oil_circle(ore_positions[5], "crude-oil", surface, 8, 200000)
|
||||
|
||||
local pos = surface.find_non_colliding_position("market",{spawn_position_x, 0}, 50, 1)
|
||||
global.market = surface.create_entity({name = "market", position = pos, force = "player"})
|
||||
global.market.minable = false
|
||||
|
||||
global.market = place_fish_market(surface, pos)
|
||||
|
||||
local pos = surface.find_non_colliding_position("gun-turret",{spawn_position_x + 5, 1}, 50, 1)
|
||||
local turret = surface.create_entity({name = "gun-turret", position = pos, force = "player"})
|
||||
turret.insert({name = "firearm-magazine", count = 32})
|
||||
@ -1335,6 +1337,18 @@ local function on_robot_built_entity(event)
|
||||
end
|
||||
end
|
||||
|
||||
local function market_light()
|
||||
if not global.market_light then return end
|
||||
local color = rendering.get_color(global.market_light)
|
||||
for k, c in pairs(color) do
|
||||
color[k] = color[k] + ((-1 + math_random(0, 2)) * 0.01)
|
||||
if color[k] < 0 then color[k] = 0 end
|
||||
if color[k] > 1 then color[k] = 1 end
|
||||
end
|
||||
color.a = 1
|
||||
rendering.set_color(global.market_light, color)
|
||||
end
|
||||
|
||||
local function on_tick()
|
||||
if game.tick % 30 == 0 then
|
||||
if global.market then
|
||||
@ -1373,6 +1387,8 @@ local function on_tick()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
market_light()
|
||||
end
|
||||
|
||||
if game.tick % global.wave_interval == global.wave_interval - 1 then
|
||||
|
@ -16,7 +16,7 @@ local function init_surface()
|
||||
map_gen_settings.starting_area = "2.5"
|
||||
map_gen_settings.cliff_settings = {cliff_elevation_interval = 40, cliff_elevation_0 = 40}
|
||||
map_gen_settings.autoplace_controls = {
|
||||
["coal"] = {frequency = "10", size = "7", richness = "1"},
|
||||
["coal"] = {frequency = "8", size = "4", richness = "1"},
|
||||
["stone"] = {frequency = "0.3", size = "2.0", richness = "0.5"},
|
||||
["iron-ore"] = {frequency = "0.3", size = "2.0", richness = "0.5"},
|
||||
["copper-ore"] = {frequency = "0.3", size = "2.0", richness = "0.5"},
|
||||
|
@ -399,7 +399,7 @@ local function on_entity_damaged(event)
|
||||
end
|
||||
|
||||
local function on_tick()
|
||||
if game.tick % 900 == 450 then
|
||||
if game.tick % 1200 == 600 then
|
||||
heartbeat()
|
||||
end
|
||||
end
|
||||
|
@ -56,6 +56,7 @@ 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
|
||||
@ -81,15 +82,25 @@ end
|
||||
|
||||
local function on_player_joined_game(event)
|
||||
local player = game.players[event.player_index]
|
||||
if player.online_time == 0 then
|
||||
poll_difficulty(player)
|
||||
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
|
||||
if game.tick < global.difficulty_poll_closing_timeout then
|
||||
if not global.difficulty_player_votes[player.name] then
|
||||
poll_difficulty(player)
|
||||
end
|
||||
end
|
||||
difficulty_gui()
|
||||
end
|
||||
|
||||
local function on_player_left_game(event)
|
||||
if game.tick > global.difficulty_poll_closing_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
|
||||
@ -110,5 +121,6 @@ local function on_gui_click(event)
|
||||
event.element.parent.destroy()
|
||||
end
|
||||
|
||||
event.add(defines.events.on_gui_click, on_gui_click)
|
||||
event.add(defines.events.on_player_joined_game, on_player_joined_game)
|
||||
event.add(defines.events.on_player_joined_game, on_player_joined_game)
|
||||
event.add(defines.events.on_player_left_game, on_player_left_game)
|
||||
event.add(defines.events.on_gui_click, on_gui_click)
|
Loading…
x
Reference in New Issue
Block a user