1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2024-12-26 22:56:43 +02:00
This commit is contained in:
MewMew 2019-05-10 12:57:53 +02:00
parent 04c56edba7
commit c08bf9ee6e
4 changed files with 107 additions and 34 deletions

View File

@ -42,6 +42,34 @@ local function create_spectate_confirmation(player)
frame.add({type = "button", name = "cancel_spectate", caption = "Cancel"}) frame.add({type = "button", name = "cancel_spectate", caption = "Cancel"})
end end
local button_colors = {
[1] = {r = 0.0, g = 0.0, b = 0.38},
[2] = {r = 0.38, g = 0.0, b = 0.0},
[3] = {r = 0.0, g = 0.38, b = 0.0},
[4] = {r = 0.25, g = 0.0, b = 0.35}
}
function create_lane_buttons(player)
for i = 1, 4, 1 do
if player.gui.top["button_lane_" .. i] then player.gui.top["button_lane_" .. i].destroy() end
local caption = "Wave #" .. global.wod_lane[i].current_wave - 1
if global.wod_lane[i].game_lost == true then caption = "Out" end
local button = player.gui.top.add({type = "button", name = "button_lane_" .. i, caption = caption, tooltip = "Lane " .. i .. " stats"})
button.style.font = "default-bold"
button.style.font_color = button_colors[i]
button.style.minimal_height = 38
button.style.minimal_width = 70
button.style.top_padding = 2
button.style.left_padding = 4
button.style.right_padding = 4
button.style.bottom_padding = 2
end
end
local function create_lane_info_frame(player, lane_number)
end
local function autojoin_lane(player) local function autojoin_lane(player)
local lowest_player_count = 256 local lowest_player_count = 256
local lane_number local lane_number
@ -68,6 +96,8 @@ local function on_player_joined_game(event)
local player = game.players[event.player_index] local player = game.players[event.player_index]
spectate_button(player) spectate_button(player)
create_lane_buttons(player)
if player.online_time == 0 then autojoin_lane(player) return end if player.online_time == 0 then autojoin_lane(player) return end
if global.wod_lane[tonumber(player.force.name)].game_lost == true then if global.wod_lane[tonumber(player.force.name)].game_lost == true then
@ -123,6 +153,25 @@ local function on_gui_click(event)
end end
end end
--Flamethrower Turret Nerf
local function on_research_finished(event)
local research = event.research
local force_name = research.force.name
if research.name == "flamethrower" then
if not global.flamethrower_damage then global.flamethrower_damage = {} end
global.flamethrower_damage[force_name] = -0.25
game.forces[force_name].set_turret_attack_modifier("flamethrower-turret", global.flamethrower_damage[force_name])
game.forces[force_name].set_ammo_damage_modifier("flamethrower", global.flamethrower_damage[force_name])
end
if string.sub(research.name, 0, 18) == "refined-flammables" then
global.flamethrower_damage[force_name] = global.flamethrower_damage[force_name] + 0.05
game.forces[force_name].set_turret_attack_modifier("flamethrower-turret", global.flamethrower_damage[force_name])
game.forces[force_name].set_ammo_damage_modifier("flamethrower", global.flamethrower_damage[force_name])
end
end
event.add(defines.events.on_research_finished, on_research_finished)
event.add(defines.events.on_gui_click, on_gui_click) event.add(defines.events.on_gui_click, on_gui_click)
event.add(defines.events.on_tick, on_tick) event.add(defines.events.on_tick, on_tick)
event.add(defines.events.on_chunk_generated, on_chunk_generated) event.add(defines.events.on_chunk_generated, on_chunk_generated)

View File

@ -45,7 +45,16 @@ ai.spawn_wave = function(surface, lane_number, wave_number, amount_modifier)
if is_spread_wave then return end if is_spread_wave then return end
global.wod_lane[lane_number].current_wave = global.wod_lane[lane_number].current_wave + 1 global.wod_lane[lane_number].current_wave = global.wod_lane[lane_number].current_wave + 1
global.biter_evasion_health_increase_factor = global.biter_evasion_health_increase_factor + 0.005
local m = 0.005
if global.wod_lane[lane_number].current_wave > #biter_waves then
m = 0.25
end
global.biter_evasion_health_increase_factor = global.biter_evasion_health_increase_factor + m
for _, player in pairs(game.connected_players) do
create_lane_buttons(player)
end
end end
--on_entity_died event --on_entity_died event

View File

@ -1,35 +1,44 @@
local waves = { local waves = {
[1] = {{name = "small-biter", amount = 10}}, {{name = "small-biter", amount = 10}},
[2] = {{name = "small-biter", amount = 20}}, {{name = "small-biter", amount = 20}},
[3] = {{name = "small-biter", amount = 40}}, {{name = "small-biter", amount = 40}},
[4] = {{name = "small-biter", amount = 80}, {name = "small-spitter", amount = 10}}, {{name = "small-biter", amount = 80}, {name = "small-spitter", amount = 10}},
[5] = {{name = "small-biter", amount = 80}, {name = "small-spitter", amount = 20}}, {{name = "small-biter", amount = 80}, {name = "small-spitter", amount = 20}},
[6] = {{name = "small-biter", amount = 80}, {name = "small-spitter", amount = 40}}, {{name = "small-biter", amount = 80}, {name = "small-spitter", amount = 40}},
[7] = {{name = "small-biter", amount = 80}, {name = "small-spitter", amount = 80}}, {{name = "medium-biter", amount = 1}, {name = "small-biter", amount = 80}, {name = "small-spitter", amount = 80}},
[8] = {{name = "medium-biter", amount = 10}, {name = "small-spitter", amount = 80}}, {{name = "medium-biter", amount = 10}, {name = "small-spitter", amount = 80}},
[9] = {{name = "medium-biter", amount = 20}, {name = "small-spitter", amount = 80}}, {{name = "medium-biter", amount = 20}, {name = "small-spitter", amount = 80}},
[10] = {{name = "medium-biter", amount = 40}, {name = "small-spitter", amount = 80}}, {{name = "medium-biter", amount = 40}, {name = "small-spitter", amount = 80}},
[11] = {{name = "medium-biter", amount = 80}, {name = "small-spitter", amount = 80}}, {{name = "medium-biter", amount = 80}, {name = "small-spitter", amount = 80}},
[12] = {{name = "medium-biter", amount = 80}, {name = "medium-spitter", amount = 10}}, {{name = "medium-biter", amount = 80}, {name = "medium-spitter", amount = 10}},
[13] = {{name = "medium-biter", amount = 80}, {name = "medium-spitter", amount = 20}}, {{name = "medium-biter", amount = 80}, {name = "medium-spitter", amount = 20}},
[14] = {{name = "medium-biter", amount = 80}, {name = "medium-spitter", amount = 40}}, {{name = "medium-biter", amount = 80}, {name = "medium-spitter", amount = 40}},
[15] = {{name = "medium-biter", amount = 80}, {name = "medium-spitter", amount = 80}}, {{name = "big-biter", amount = 1},{name = "medium-biter", amount = 80}, {name = "medium-spitter", amount = 80}},
[16] = {{name = "big-biter", amount = 10}, {name = "medium-spitter", amount = 80}}, {{name = "big-biter", amount = 10}, {name = "medium-spitter", amount = 80}},
[17] = {{name = "big-biter", amount = 20}, {name = "medium-spitter", amount = 80}}, {{name = "big-biter", amount = 20}, {name = "medium-spitter", amount = 80}},
[18] = {{name = "big-biter", amount = 40}, {name = "medium-spitter", amount = 80}}, {{name = "big-biter", amount = 40}, {name = "medium-spitter", amount = 80}},
[19] = {{name = "big-biter", amount = 80}, {name = "medium-spitter", amount = 80}}, {{name = "big-biter", amount = 80}, {name = "medium-spitter", amount = 80}},
[20] = {{name = "big-biter", amount = 80}, {name = "big-spitter", amount = 10}}, {{name = "big-biter", amount = 80}, {name = "big-spitter", amount = 10}},
[21] = {{name = "big-biter", amount = 80}, {name = "big-spitter", amount = 20}}, {{name = "big-biter", amount = 80}, {name = "big-spitter", amount = 20}},
[22] = {{name = "big-biter", amount = 80}, {name = "big-spitter", amount = 40}}, {{name = "big-biter", amount = 80}, {name = "big-spitter", amount = 40}},
[23] = {{name = "big-biter", amount = 80}, {name = "big-spitter", amount = 80}}, {{name = "behemoth-biter", amount = 1},{name = "big-biter", amount = 80}, {name = "big-spitter", amount = 80}},
[24] = {{name = "behemoth-biter", amount = 10}, {name = "big-spitter", amount = 80}}, {{name = "behemoth-biter", amount = 10}, {name = "big-spitter", amount = 80}},
[25] = {{name = "behemoth-biter", amount = 20}, {name = "big-spitter", amount = 80}}, {{name = "behemoth-biter", amount = 20}, {name = "big-spitter", amount = 80}},
[26] = {{name = "behemoth-biter", amount = 40}, {name = "big-spitter", amount = 80}}, {{name = "behemoth-biter", amount = 40}, {name = "big-spitter", amount = 80}},
[27] = {{name = "behemoth-biter", amount = 80}, {name = "big-spitter", amount = 80}}, {{name = "behemoth-biter", amount = 80}, {name = "big-spitter", amount = 80}},
[28] = {{name = "behemoth-biter", amount = 80}, {name = "behemoth-spitter", amount = 10}}, {{name = "behemoth-biter", amount = 80}, {name = "behemoth-spitter", amount = 10}},
[29] = {{name = "behemoth-biter", amount = 80}, {name = "behemoth-spitter", amount = 20}}, {{name = "behemoth-biter", amount = 80}, {name = "behemoth-spitter", amount = 20}},
[30] = {{name = "behemoth-biter", amount = 80}, {name = "behemoth-spitter", amount = 40}}, {{name = "behemoth-biter", amount = 80}, {name = "behemoth-spitter", amount = 40}},
[31] = {{name = "behemoth-biter", amount = 80}, {name = "behemoth-spitter", amount = 80}} {{name = "behemoth-biter", amount = 80}, {name = "behemoth-spitter", amount = 60}},
{{name = "behemoth-biter", amount = 100}, {name = "behemoth-spitter", amount = 70}},
{{name = "behemoth-biter", amount = 125}, {name = "behemoth-spitter", amount = 80}},
{{name = "behemoth-biter", amount = 150}, {name = "behemoth-spitter", amount = 90}},
{{name = "behemoth-biter", amount = 175}, {name = "behemoth-spitter", amount = 95}},
{{name = "behemoth-biter", amount = 200}, {name = "behemoth-spitter", amount = 100}},
{{name = "behemoth-biter", amount = 225}, {name = "behemoth-spitter", amount = 110}},
{{name = "behemoth-biter", amount = 250}, {name = "behemoth-spitter", amount = 125}},
{{name = "behemoth-biter", amount = 275}, {name = "behemoth-spitter", amount = 135}},
{{name = "behemoth-biter", amount = 300}, {name = "behemoth-spitter", amount = 150}}
} }
return waves return waves

View File

@ -49,7 +49,7 @@ game_status.has_lane_lost = function(event)
end end
end end
game.print(">> Lane " .. lane_number .. " has been defeated!", {r = 120, g = 60, b = 0}) game.print(">> Lane " .. lane_number .. " has been defeated!", {r = 120, g = 60, b = 0})
--determine winner and restart the server --determine winner and restart the server
local lanes_alive = 0 local lanes_alive = 0
for i = 1, 4, 1 do for i = 1, 4, 1 do
@ -57,7 +57,13 @@ game_status.has_lane_lost = function(event)
lanes_alive = lanes_alive + 1 lanes_alive = lanes_alive + 1
end end
end end
if lanes_alive ~= 1 then return end if lanes_alive ~= 1 then
for _, player in pairs(game.connected_players) do
create_lane_buttons(player)
player.play_sound{path="utility/game_lost", volume_modifier=0.5}
end
return
end
for i = 1, 4, 1 do for i = 1, 4, 1 do
if global.wod_lane[i].game_lost == false then if global.wod_lane[i].game_lost == false then