You've already forked ComfyFactorio
							
							
				mirror of
				https://github.com/ComfyFactory/ComfyFactorio.git
				synced 2025-10-30 23:47:41 +02:00 
			
		
		
		
	Try fix desync issue on FD2
This commit is contained in:
		| @@ -4,7 +4,7 @@ | ||||
|  | ||||
| local Public = require 'maps.fish_defender_v2.core' | ||||
| local Gui = require 'utils.gui' | ||||
| require 'modules.launch_fish_to_win' | ||||
| local LFTW = require 'modules.launch_fish_to_win' | ||||
| require 'modules.biters_yield_coins' | ||||
| require 'modules.custom_death_messages' | ||||
| local Unit_health_booster = require 'modules.biter_health_booster_v2' | ||||
| @@ -26,7 +26,6 @@ local enable_start_grace_period = true | ||||
|  | ||||
| Gui.mod_gui_button_enabled = true | ||||
| Gui.button_style = 'mod_gui_button' | ||||
| Gui.set_toggle_button(true) | ||||
| Gui.set_mod_gui_top_frame(true) | ||||
| local button_id = 'fd-stats-button' | ||||
| local fish_button_id = 'fish_defense_waves' | ||||
| @@ -908,137 +907,141 @@ local function get_mvps() | ||||
|     return mvp | ||||
| end | ||||
|  | ||||
| local function show_mvps(t, mvp) | ||||
|     if mvp then | ||||
|         local time_played = Core.format_time(game.ticks_played) | ||||
|         local wave = Public.get('wave_count') | ||||
|  | ||||
|         local mvp_defender_label = t.add({ type = 'label', caption = 'MVP Defender >> ' }) | ||||
|         mvp_defender_label.style.font = 'default-listbox' | ||||
|         mvp_defender_label.style.font_color = { r = 0.22, g = 0.77, b = 0.44 } | ||||
|  | ||||
|         local mvp_killscore_label = t.add({ type = 'label', caption = mvp.killscore.name .. ' with a score of ' .. mvp.killscore.score }) | ||||
|         mvp_killscore_label.style.font = 'default-bold' | ||||
|         mvp_killscore_label.style.font_color = { r = 0.33, g = 0.66, b = 0.9 } | ||||
|  | ||||
|         local mvp_builder_label = t.add({ type = 'label', caption = 'MVP Builder >> ' }) | ||||
|         mvp_builder_label.style.font = 'default-listbox' | ||||
|         mvp_builder_label.style.font_color = { r = 0.22, g = 0.77, b = 0.44 } | ||||
|  | ||||
|         local mvp_built_ent_label = | ||||
|             t.add( | ||||
|                 { | ||||
|                     type = 'label', | ||||
|                     caption = mvp.built_entities.name .. ' built ' .. mvp.built_entities.score .. ' things' | ||||
|                 } | ||||
|             ) | ||||
|         mvp_built_ent_label.style.font = 'default-bold' | ||||
|         mvp_built_ent_label.style.font_color = { r = 0.33, g = 0.66, b = 0.9 } | ||||
|  | ||||
|         local mvp_deaths_label = t.add({ type = 'label', caption = 'MVP Deaths >> ' }) | ||||
|         mvp_deaths_label.style.font = 'default-listbox' | ||||
|         mvp_deaths_label.style.font_color = { r = 0.22, g = 0.77, b = 0.44 } | ||||
|  | ||||
|         local mvp_deaths_name_label = t.add({ type = 'label', caption = mvp.deaths.name .. ' died ' .. mvp.deaths.score .. ' times' }) | ||||
|         mvp_deaths_name_label.style.font = 'default-bold' | ||||
|         mvp_deaths_name_label.style.font_color = { r = 0.33, g = 0.66, b = 0.9 } | ||||
|  | ||||
|         local wave_lasted_label = t.add({ type = 'label', caption = 'Wave reached >> ' }) | ||||
|         wave_lasted_label.style.font = 'default-listbox' | ||||
|         wave_lasted_label.style.font_color = { r = 0.22, g = 0.77, b = 0.44 } | ||||
|  | ||||
|         local wave_lasted_name_label = t.add({ type = 'label', caption = tonumber(format_number(wave, true)) }) | ||||
|         wave_lasted_name_label.style.font = 'default-bold' | ||||
|         wave_lasted_name_label.style.font_color = { r = 0.33, g = 0.66, b = 0.9 } | ||||
|  | ||||
|         local results_sent = Public.get('results_sent') | ||||
|         if not results_sent then | ||||
|             local result = {} | ||||
|             insert(result, 'MVP Defender: \\n') | ||||
|             insert(result, mvp.killscore.name .. ' with a score of ' .. mvp.killscore.score .. '\\n') | ||||
|             insert(result, '\\n') | ||||
|             insert(result, 'MVP Builder: \\n') | ||||
|             insert(result, mvp.built_entities.name .. ' built ' .. mvp.built_entities.score .. ' things\\n') | ||||
|             insert(result, '\\n') | ||||
|             insert(result, 'MVP Deaths: \\n') | ||||
|             insert(result, mvp.deaths.name .. ' died ' .. mvp.deaths.score .. ' times\\n') | ||||
|             insert(result, '\\n') | ||||
|             insert(result, 'Time Played: \\n') | ||||
|             insert(result, time_played .. '\\n') | ||||
|             insert(result, '\\n') | ||||
|             insert(result, 'Wave reached: \\n') | ||||
|             insert(result, tonumber(format_number(wave, true))) | ||||
|             local message = table.concat(result) | ||||
|             Server.to_discord_embed(message) | ||||
|             Public.set('results_sent', true) | ||||
|         end | ||||
|     end | ||||
| end | ||||
|  | ||||
| local function is_game_lost() | ||||
|     local game_has_ended = Public.get('game_has_ended') | ||||
|     if not game_has_ended then | ||||
|         return | ||||
|     end | ||||
|  | ||||
|     local mvp = get_mvps() | ||||
|  | ||||
|     local players = game.connected_players | ||||
|     for i = 1, #players do | ||||
|         local player = players[i] | ||||
|  | ||||
|         if player.gui.left['fish_defense_game_lost'] then | ||||
|             return | ||||
|         end | ||||
|         local f = | ||||
|             player.gui.left.add( | ||||
|                 { | ||||
|                     type = 'frame', | ||||
|                     name = 'fish_defense_game_lost', | ||||
|                     caption = 'The fish market was overrun! The biters are having a feast :3', | ||||
|                     direction = 'vertical' | ||||
|                 } | ||||
|             ) | ||||
|         f.style.font_color = { r = 0.65, g = 0.1, b = 0.99 } | ||||
|  | ||||
|         local t = f.add({ type = 'table', column_count = 2 }) | ||||
|  | ||||
|         local survival_time_label = t.add({ type = 'label', caption = 'Survival Time >> ' }) | ||||
|         survival_time_label.style.font = 'default-listbox' | ||||
|         survival_time_label.style.font_color = { r = 0.22, g = 0.77, b = 0.44 } | ||||
|  | ||||
|         local market_age_label | ||||
|  | ||||
|         local market_age = Public.get('market_age') | ||||
|         if not market_age then | ||||
|             return | ||||
|         end | ||||
|  | ||||
|         if market_age then | ||||
|             if market_age >= 216000 then | ||||
|                 market_age_label = | ||||
|                     t.add( | ||||
|                         { | ||||
|                             type = 'label', | ||||
|                             caption = math.floor(((market_age / 60) / 60) / 60) .. ' hours ' .. math.ceil((market_age % 216000 / 60) / 60) .. ' minutes' | ||||
|                         } | ||||
|                     ) | ||||
|                 market_age_label.style.font = 'default-bold' | ||||
|                 market_age_label.style.font_color = { r = 0.33, g = 0.66, b = 0.9 } | ||||
|             else | ||||
|                 market_age_label = t.add({ type = 'label', caption = math.ceil((market_age % 216000 / 60) / 60) .. ' minutes' }) | ||||
|                 market_age_label.style.font = 'default-bold' | ||||
|                 market_age_label.style.font_color = { r = 0.33, g = 0.66, b = 0.9 } | ||||
|             end | ||||
|         end | ||||
|  | ||||
|         local mvp = get_mvps() | ||||
|         if mvp then | ||||
|             local time_played = Core.format_time(game.ticks_played) | ||||
|             local wave = Public.get('wave_count') | ||||
|  | ||||
|             local mvp_defender_label = t.add({ type = 'label', caption = 'MVP Defender >> ' }) | ||||
|             mvp_defender_label.style.font = 'default-listbox' | ||||
|             mvp_defender_label.style.font_color = { r = 0.22, g = 0.77, b = 0.44 } | ||||
|  | ||||
|             local mvp_killscore_label = t.add({ type = 'label', caption = mvp.killscore.name .. ' with a score of ' .. mvp.killscore.score }) | ||||
|             mvp_killscore_label.style.font = 'default-bold' | ||||
|             mvp_killscore_label.style.font_color = { r = 0.33, g = 0.66, b = 0.9 } | ||||
|  | ||||
|             local mvp_builder_label = t.add({ type = 'label', caption = 'MVP Builder >> ' }) | ||||
|             mvp_builder_label.style.font = 'default-listbox' | ||||
|             mvp_builder_label.style.font_color = { r = 0.22, g = 0.77, b = 0.44 } | ||||
|  | ||||
|             local mvp_built_ent_label = | ||||
|                 t.add( | ||||
|         local frame = player.gui.left['fish_defense_game_lost'] | ||||
|         if not frame or not frame.valid then | ||||
|             local f = | ||||
|                 player.gui.left.add( | ||||
|                     { | ||||
|                         type = 'label', | ||||
|                         caption = mvp.built_entities.name .. ' built ' .. mvp.built_entities.score .. ' things' | ||||
|                         type = 'frame', | ||||
|                         name = 'fish_defense_game_lost', | ||||
|                         caption = 'The fish market was overrun! The biters are having a feast :3', | ||||
|                         direction = 'vertical' | ||||
|                     } | ||||
|                 ) | ||||
|             mvp_built_ent_label.style.font = 'default-bold' | ||||
|             mvp_built_ent_label.style.font_color = { r = 0.33, g = 0.66, b = 0.9 } | ||||
|             f.style.font_color = { r = 0.65, g = 0.1, b = 0.99 } | ||||
|  | ||||
|             local mvp_deaths_label = t.add({ type = 'label', caption = 'MVP Deaths >> ' }) | ||||
|             mvp_deaths_label.style.font = 'default-listbox' | ||||
|             mvp_deaths_label.style.font_color = { r = 0.22, g = 0.77, b = 0.44 } | ||||
|             local t = f.add({ type = 'table', column_count = 2 }) | ||||
|  | ||||
|             local mvp_deaths_name_label = t.add({ type = 'label', caption = mvp.deaths.name .. ' died ' .. mvp.deaths.score .. ' times' }) | ||||
|             mvp_deaths_name_label.style.font = 'default-bold' | ||||
|             mvp_deaths_name_label.style.font_color = { r = 0.33, g = 0.66, b = 0.9 } | ||||
|             local survival_time_label = t.add({ type = 'label', caption = 'Survival Time >> ' }) | ||||
|             survival_time_label.style.font = 'default-listbox' | ||||
|             survival_time_label.style.font_color = { r = 0.22, g = 0.77, b = 0.44 } | ||||
|  | ||||
|             local wave_lasted_label = t.add({ type = 'label', caption = 'Wave reached >> ' }) | ||||
|             wave_lasted_label.style.font = 'default-listbox' | ||||
|             wave_lasted_label.style.font_color = { r = 0.22, g = 0.77, b = 0.44 } | ||||
|             local market_age_label | ||||
|  | ||||
|             local wave_lasted_name_label = t.add({ type = 'label', caption = tonumber(format_number(wave, true)) }) | ||||
|             wave_lasted_name_label.style.font = 'default-bold' | ||||
|             wave_lasted_name_label.style.font_color = { r = 0.33, g = 0.66, b = 0.9 } | ||||
|  | ||||
|             local results_sent = Public.get('results_sent') | ||||
|             if not results_sent then | ||||
|                 local result = {} | ||||
|                 insert(result, 'MVP Defender: \\n') | ||||
|                 insert(result, mvp.killscore.name .. ' with a score of ' .. mvp.killscore.score .. '\\n') | ||||
|                 insert(result, '\\n') | ||||
|                 insert(result, 'MVP Builder: \\n') | ||||
|                 insert(result, mvp.built_entities.name .. ' built ' .. mvp.built_entities.score .. ' things\\n') | ||||
|                 insert(result, '\\n') | ||||
|                 insert(result, 'MVP Deaths: \\n') | ||||
|                 insert(result, mvp.deaths.name .. ' died ' .. mvp.deaths.score .. ' times\\n') | ||||
|                 insert(result, '\\n') | ||||
|                 insert(result, 'Time Played: \\n') | ||||
|                 insert(result, time_played .. '\\n') | ||||
|                 insert(result, '\\n') | ||||
|                 insert(result, 'Wave reached: \\n') | ||||
|                 insert(result, tonumber(format_number(wave, true))) | ||||
|                 local message = table.concat(result) | ||||
|                 Server.to_discord_embed(message) | ||||
|                 Public.set('results_sent', true) | ||||
|             local market_age = Public.get('market_age') | ||||
|             if not market_age then | ||||
|                 return | ||||
|             end | ||||
|  | ||||
|             if market_age then | ||||
|                 if market_age >= 216000 then | ||||
|                     market_age_label = | ||||
|                         t.add( | ||||
|                             { | ||||
|                                 type = 'label', | ||||
|                                 caption = math.floor(((market_age / 60) / 60) / 60) .. ' hours ' .. math.ceil((market_age % 216000 / 60) / 60) .. ' minutes' | ||||
|                             } | ||||
|                         ) | ||||
|                     market_age_label.style.font = 'default-bold' | ||||
|                     market_age_label.style.font_color = { r = 0.33, g = 0.66, b = 0.9 } | ||||
|                 else | ||||
|                     market_age_label = t.add({ type = 'label', caption = math.ceil((market_age % 216000 / 60) / 60) .. ' minutes' }) | ||||
|                     market_age_label.style.font = 'default-bold' | ||||
|                     market_age_label.style.font_color = { r = 0.33, g = 0.66, b = 0.9 } | ||||
|                 end | ||||
|             end | ||||
|  | ||||
|             show_mvps(t, mvp) | ||||
|  | ||||
|             if player.gui.top.fish_in_space_toggle and player.gui.top.fish_in_space_toggle.valid then | ||||
|                 player.gui.top.fish_in_space_toggle.destroy() | ||||
|             end | ||||
|  | ||||
|             if player.gui.center['level_up_popup'] and player.gui.center['level_up_popup'].valid then | ||||
|                 player.gui.center['level_up_popup'].destroy() | ||||
|             end | ||||
|  | ||||
|             player.play_sound { path = 'utility/game_lost', volume_modifier = 0.75 } | ||||
|         end | ||||
|  | ||||
|         player.play_sound { path = 'utility/game_lost', volume_modifier = 0.75 } | ||||
|     end | ||||
|  | ||||
|     local map_settings = game.map_settings | ||||
|     map_settings.enemy_expansion.enabled = true | ||||
|     map_settings.enemy_expansion.max_expansion_distance = 15 | ||||
|     map_settings.enemy_expansion.settler_group_min_size = 15 | ||||
|     map_settings.enemy_expansion.settler_group_max_size = 30 | ||||
|     map_settings.enemy_expansion.min_expansion_cooldown = 600 | ||||
|     map_settings.enemy_expansion.max_expansion_cooldown = 600 | ||||
| end | ||||
|  | ||||
| local function damage_entities_in_radius(surface, position, radius, damage) | ||||
| @@ -1162,7 +1165,6 @@ local function on_entity_died(event) | ||||
|         Public.set('market', nil) | ||||
|         Public.set('market_age', game.tick - last_reset) | ||||
|         Public.set('game_has_ended', true) | ||||
|         is_game_lost() | ||||
|  | ||||
|         local surface = event.entity.surface | ||||
|         for _, entity in pairs(surface.find_entities_filtered { type = { 'logistic-robot', 'construction-robot', 'roboport' } }) do | ||||
| @@ -1211,10 +1213,6 @@ local function on_player_joined_game(event) | ||||
|  | ||||
|     create_wave_gui(player) | ||||
|     add_fd_stats_button(player) | ||||
|  | ||||
|     if game.tick > 900 then | ||||
|         is_game_lost() | ||||
|     end | ||||
| end | ||||
|  | ||||
| local function deny_building(event) | ||||
| @@ -1408,22 +1406,21 @@ local function on_player_respawned(event) | ||||
| end | ||||
|  | ||||
| local function has_the_game_ended() | ||||
|     local market_age = Public.get('market_age') | ||||
|     if market_age then | ||||
|         local game_restart_timer = Public.get('game_restart_timer') | ||||
|         if not game_restart_timer then | ||||
|             Public.set('game_restart_timer', 5400) | ||||
|     local this = Public.get() | ||||
|     if this.market_age then | ||||
|         if not this.game_restart_timer then | ||||
|             this.game_restart_timer = 5400 | ||||
|         else | ||||
|             if game_restart_timer < 0 then | ||||
|             if this.game_restart_timer < 0 then | ||||
|                 return | ||||
|             end | ||||
|             Public.set('game_restart_timer', game_restart_timer - 30) | ||||
|             this.game_restart_timer = this.game_restart_timer - 30 | ||||
|         end | ||||
|         game_restart_timer = Public.get('game_restart_timer') | ||||
|  | ||||
|         local cause_msg | ||||
|         local restart = Public.get('restart') | ||||
|         local shutdown = Public.get('shutdown') | ||||
|         local soft_reset = Public.get('soft_reset') | ||||
|         local restart = this.restart | ||||
|         local shutdown = this.shutdown | ||||
|         local soft_reset = this.soft_reset | ||||
|         if restart then | ||||
|             cause_msg = 'restart' | ||||
|         elseif shutdown then | ||||
| @@ -1432,20 +1429,19 @@ local function has_the_game_ended() | ||||
|             cause_msg = 'soft-reset' | ||||
|         end | ||||
|  | ||||
|         if game_restart_timer % 1800 == 0 then | ||||
|             if game_restart_timer > 0 then | ||||
|                 Public.set('game_reset', true) | ||||
|                 game.print('Game will ' .. cause_msg .. ' in ' .. game_restart_timer / 60 .. ' seconds!', { r = 0.22, g = 0.88, b = 0.22 }) | ||||
|         if this.game_restart_timer % 1800 == 0 then | ||||
|             if this.game_restart_timer > 0 then | ||||
|                 this.game_reset = true | ||||
|                 game.print('Game will ' .. cause_msg .. ' in ' .. this.game_restart_timer / 60 .. ' seconds!', { r = 0.22, g = 0.88, b = 0.22 }) | ||||
|             end | ||||
|             if soft_reset and game_restart_timer == 0 then | ||||
|                 Public.set('game_reset_tick', nil) | ||||
|                 -- Server.start_scenario('Fish_Defender') | ||||
|             if soft_reset and this.game_restart_timer == 0 then | ||||
|                 this.game_reset_tick = nil | ||||
|                 Public.reset_game() | ||||
|                 return | ||||
|             end | ||||
|  | ||||
|             local announced_message = Public.get('announced_message') | ||||
|             if restart and game_restart_timer == 0 then | ||||
|             if restart and this.game_restart_timer == 0 then | ||||
|                 if not announced_message then | ||||
|                     game.print('Soft-reset is disabled. Server will restart!', { r = 0.22, g = 0.88, b = 0.22 }) | ||||
|                     local message = 'Soft-reset is disabled. Server will restart!' | ||||
| @@ -1455,7 +1451,7 @@ local function has_the_game_ended() | ||||
|                     return | ||||
|                 end | ||||
|             end | ||||
|             if shutdown and game_restart_timer == 0 then | ||||
|             if shutdown and this.game_restart_timer == 0 then | ||||
|                 if not announced_message then | ||||
|                     game.print('Soft-reset is disabled. Server is shutting down!', { r = 0.22, g = 0.88, b = 0.22 }) | ||||
|                     local message = 'Soft-reset is disabled. Server is shutting down!' | ||||
| @@ -1471,6 +1467,7 @@ end | ||||
|  | ||||
| function Public.reset_game() | ||||
|     Public.reset_table() | ||||
|     Unit_health_booster.reset_table() | ||||
|     local get_score = Score.get_table() | ||||
|     Poll.reset() | ||||
|  | ||||
| @@ -1539,9 +1536,19 @@ function Public.reset_game() | ||||
|         if player.gui.left['fish_defense_game_lost'] then | ||||
|             player.gui.left['fish_defense_game_lost'].destroy() | ||||
|         end | ||||
|  | ||||
|         if player.gui.left['fish_in_space'] then | ||||
|             player.gui.left['fish_in_space'].destroy() | ||||
|         end | ||||
|  | ||||
|         local lftw_button = LFTW.get_top_frame(player) | ||||
|         if lftw_button and lftw_button.valid then | ||||
|             lftw_button.destroy() | ||||
|         end | ||||
|  | ||||
|         if player.gui.center['level_up_popup'] and player.gui.center['level_up_popup'].valid then | ||||
|             player.gui.center['level_up_popup'].destroy() | ||||
|         end | ||||
|     end | ||||
|  | ||||
|     local offline_players = game.players | ||||
| @@ -1550,18 +1557,9 @@ function Public.reset_game() | ||||
|         Session.clear_player(player) | ||||
|     end | ||||
|  | ||||
|     --test idea | ||||
|     --local spawn_poses = { | ||||
|     --	{x = 0, y = 0}, | ||||
|     --    {x = -512, y = 0}, | ||||
|     --	{x = -512, y = 192}, | ||||
|     --	{x = -512, y = -192} | ||||
|     --} | ||||
|  | ||||
|     local map_gen_settings = {} | ||||
|     map_gen_settings.seed = random(10000, 99999) | ||||
|     map_gen_settings.starting_area = 0.1 | ||||
|     --map_gen_settings.starting_points = spawn_poses | ||||
|  | ||||
|     map_gen_settings.width = 4000 | ||||
|     map_gen_settings.height = 1800 | ||||
| @@ -1641,85 +1639,8 @@ function Public.reset_game() | ||||
|     game.forces.player.technologies['spidertron'].researched = false | ||||
|     game.reset_time_played() | ||||
|  | ||||
|     if not storage.catplanet_goals then | ||||
|         storage.catplanet_goals = | ||||
|         { | ||||
|             { goal = 0, rank = false, achieved = true }, | ||||
|             { | ||||
|                 goal = 100, | ||||
|                 rank = 'Copper', | ||||
|                 color = { r = 201, g = 133, b = 6 }, | ||||
|                 msg = 'You have saved the first container of fish!', | ||||
|                 msg2 = 'However, this is only the beginning.', | ||||
|                 achieved = false | ||||
|             }, | ||||
|             { | ||||
|                 goal = 1000, | ||||
|                 rank = 'Bronze', | ||||
|                 color = { r = 186, g = 115, b = 39 }, | ||||
|                 msg = 'Thankful for the fish, they sent back a toy mouse made of solid bronze!', | ||||
|                 msg2 = 'They are demanding more.', | ||||
|                 achieved = false | ||||
|             }, | ||||
|             { | ||||
|                 goal = 10000, | ||||
|                 rank = 'Silver', | ||||
|                 color = { r = 186, g = 178, b = 171 }, | ||||
|                 msg = 'In gratitude for the fish, they left you a silver furball!', | ||||
|                 msg2 = 'They are still longing for more.', | ||||
|                 achieved = false | ||||
|             }, | ||||
|             { | ||||
|                 goal = 25000, | ||||
|                 rank = 'Gold', | ||||
|                 color = { r = 255, g = 214, b = 33 }, | ||||
|                 msg = 'Pleased about the delivery, they sent back a golden audiotape with cat purrs.', | ||||
|                 msg2 = 'They still demand more.', | ||||
|                 achieved = false | ||||
|             }, | ||||
|             { | ||||
|                 goal = 50000, | ||||
|                 rank = 'Platinum', | ||||
|                 color = { r = 224, g = 223, b = 215 }, | ||||
|                 msg = 'To express their infinite love, they sent back a yarnball made of shiny material.', | ||||
|                 msg2 = 'Defying all logic, they still demand more fish.', | ||||
|                 achieved = false | ||||
|             }, | ||||
|             { | ||||
|                 goal = 100000, | ||||
|                 rank = 'Diamond', | ||||
|                 color = { r = 237, g = 236, b = 232 }, | ||||
|                 msg = 'A box arrives with a mewing kitten, it a has a diamond collar.', | ||||
|                 msg2 = 'More fish? Why? What..', | ||||
|                 achieved = false | ||||
|             }, | ||||
|             { | ||||
|                 goal = 250000, | ||||
|                 rank = 'Anti-matter', | ||||
|                 color = { r = 100, g = 100, b = 245 }, | ||||
|                 msg = 'The obese cat collapses and forms a black hole!', | ||||
|                 msg2 = ':obese:', | ||||
|                 achieved = false | ||||
|             }, | ||||
|             { | ||||
|                 goal = 500000, | ||||
|                 rank = 'Black Hole', | ||||
|                 color = { r = 100, g = 100, b = 245 }, | ||||
|                 msg = 'A letter arrives, it reads: Go to bed hooman!', | ||||
|                 msg2 = 'Not yet...', | ||||
|                 achieved = false | ||||
|             }, | ||||
|             { | ||||
|                 goal = 1000000, | ||||
|                 rank = 'Blue Screen', | ||||
|                 color = { r = 100, g = 100, b = 245 }, | ||||
|                 msg = 'Cat error #4721', | ||||
|                 msg2 = '....', | ||||
|                 achieved = false | ||||
|             }, | ||||
|             { goal = 10000000, rank = 'Blue Screen', color = { r = 100, g = 100, b = 245 }, msg = '....', msg2 = '....', achieved = false } | ||||
|         } | ||||
|     end | ||||
|     storage.fish_in_space = 0 | ||||
|     storage.rocket_silos = {} | ||||
| end | ||||
|  | ||||
| function Public.on_init() | ||||
| @@ -1737,9 +1658,16 @@ local function on_tick() | ||||
|     if not surface or not surface.valid then | ||||
|         return | ||||
|     end | ||||
|  | ||||
|     local tick = game.tick | ||||
|     if tick % 30 == 0 then | ||||
|         has_the_game_ended() | ||||
|         local game_has_ended = Public.get('game_has_ended') | ||||
|         if not game_has_ended then | ||||
|             is_game_lost() | ||||
|             return | ||||
|         end | ||||
|  | ||||
|         local market = Public.get('market') | ||||
|         game.forces.player.set_surface_hidden(surface.name, true) | ||||
|         if market and market.valid then | ||||
|   | ||||
| @@ -48,62 +48,73 @@ function Public.reset_table() | ||||
|     -- this.wave_grace_period = game.tick + 3600 | ||||
|     this.boss_biters = {} | ||||
|     this.acid_lines_delay = {} | ||||
|     this.entity_limits = { | ||||
|     this.entity_limits = | ||||
|     { | ||||
|         ['ammo-turret'] = { placed = 1, limit = 6, str = 'gun turret', slot_price = 70 }, | ||||
|         ['electric-turret'] = { placed = 0, limit = 1, str = 'laser turret', slot_price = 300 }, | ||||
|         ['artillery-turret'] = { placed = 0, limit = 1, str = 'artillery turret', slot_price = 500 }, | ||||
|         ['fluid-turret'] = { placed = 0, limit = 0, str = 'flamethrower turret', slot_price = 50000 }, | ||||
|         ['land-mine'] = { placed = 0, limit = 1, str = 'mine', slot_price = 20 } | ||||
|     } | ||||
|     this.difficulties_votes = { | ||||
|         [1] = { | ||||
|     this.difficulties_votes = | ||||
|     { | ||||
|         [1] = | ||||
|         { | ||||
|             wave_interval = 5000, | ||||
|             amount_modifier = 0.90, | ||||
|             strength_modifier = 0.90, | ||||
|             boss_modifier = 5.0 | ||||
|         }, | ||||
|         [2] = { | ||||
|         [2] = | ||||
|         { | ||||
|             wave_interval = 3500, | ||||
|             amount_modifier = 1.00, | ||||
|             strength_modifier = 1.00, | ||||
|             boss_modifier = 6.0 | ||||
|         }, | ||||
|         [3] = { | ||||
|         [3] = | ||||
|         { | ||||
|             wave_interval = 3400, | ||||
|             amount_modifier = 1.10, | ||||
|             strength_modifier = 1.30, | ||||
|             boss_modifier = 7.0 | ||||
|         }, | ||||
|         [4] = { | ||||
|         [4] = | ||||
|         { | ||||
|             wave_interval = 3200, | ||||
|             amount_modifier = 1.20, | ||||
|             strength_modifier = 1.60, | ||||
|             boss_modifier = 8.0 | ||||
|         }, | ||||
|         [5] = { | ||||
|         [5] = | ||||
|         { | ||||
|             wave_interval = 3000, | ||||
|             amount_modifier = 1.40, | ||||
|             strength_modifier = 2.20, | ||||
|             boss_modifier = 9.0 | ||||
|         } | ||||
|     } | ||||
|     this.boss_waves = { | ||||
|     this.boss_waves = | ||||
|     { | ||||
|         [50] = { { name = 'big-biter', count = 3 } }, | ||||
|         [100] = { { name = 'behemoth-biter', count = 1 } }, | ||||
|         [150] = { { name = 'behemoth-spitter', count = 4 }, { name = 'big-spitter', count = 16 } }, | ||||
|         [200] = { | ||||
|             { name = 'behemoth-biter',   count = 4 }, | ||||
|         [200] = | ||||
|         { | ||||
|             { name = 'behemoth-biter', count = 4 }, | ||||
|             { name = 'behemoth-spitter', count = 2 }, | ||||
|             { name = 'big-biter',        count = 32 } | ||||
|             { name = 'big-biter', count = 32 } | ||||
|         }, | ||||
|         [250] = { | ||||
|             { name = 'behemoth-biter',   count = 8 }, | ||||
|         [250] = | ||||
|         { | ||||
|             { name = 'behemoth-biter', count = 8 }, | ||||
|             { name = 'behemoth-spitter', count = 4 }, | ||||
|             { name = 'big-spitter',      count = 32 } | ||||
|             { name = 'big-spitter', count = 32 } | ||||
|         }, | ||||
|         [300] = { { name = 'behemoth-biter', count = 16 }, { name = 'behemoth-spitter', count = 8 } } | ||||
|     } | ||||
|     this.comfylatron_habitat = { | ||||
|     this.comfylatron_habitat = | ||||
|     { | ||||
|         left_top = { x = -1500, y = -1500 }, | ||||
|         right_bottom = { x = -80, y = 1500 } | ||||
|     } | ||||
|   | ||||
| @@ -9,6 +9,8 @@ local Task = require 'utils.task_token' | ||||
| local Difficulty = require 'modules.difficulty_vote_by_amount' | ||||
| local Server = require 'utils.server' | ||||
| local MGS = require 'maps.infestation_islands.island_settings' | ||||
| local AntiGrief = require 'utils.antigrief' | ||||
| local Poll = require 'utils.gui.poll' | ||||
|  | ||||
| local this = {} | ||||
|  | ||||
| @@ -401,6 +403,8 @@ function Public.on_init() | ||||
|     BottomFrame.activate_custom_buttons(true) | ||||
|     Autostash.bottom_button(true) | ||||
|     Autostash.insert_into_furnace(true) | ||||
|     AntiGrief.reset_tables() | ||||
|     Poll.reset() | ||||
|  | ||||
|     this.soft_reset = true | ||||
|  | ||||
|   | ||||
| @@ -57,7 +57,6 @@ local abs = math.abs | ||||
| RPG.disable_cooldowns_on_spells() | ||||
| Gui.mod_gui_button_enabled = true | ||||
| Gui.button_style = 'mod_gui_button' | ||||
| Gui.set_toggle_button(true) | ||||
| Gui.set_mod_gui_top_frame(true) | ||||
|  | ||||
| if not script.active_mods['MtnFortressAddons'] then | ||||
|   | ||||
| @@ -43,7 +43,6 @@ local JailData = require 'utils.datastore.jail_data' | ||||
|  | ||||
| Gui.mod_gui_button_enabled = true | ||||
| Gui.button_style = 'mod_gui_button' | ||||
| Gui.set_toggle_button(true) | ||||
|  | ||||
| local function spairs(t) | ||||
|     local keys = {} | ||||
|   | ||||
| @@ -1,69 +1,72 @@ | ||||
| local Event = require 'utils.event' | ||||
| local Global = require 'utils.global' | ||||
|  | ||||
| local this = { | ||||
| local this = | ||||
| { | ||||
|     player_floaty_chat = {} | ||||
| } | ||||
|  | ||||
| Global.register( | ||||
|     this, | ||||
| Global.register(this, | ||||
|     function (tbl) | ||||
|         this = tbl | ||||
|     end | ||||
| ) | ||||
|     end) | ||||
|  | ||||
| ---@param event table | ||||
| local function on_console_chat(event) | ||||
|     if not event.message then | ||||
|         return | ||||
|     end | ||||
|     if not event.player_index then | ||||
|         return | ||||
|     end | ||||
|     local player = game.players[event.player_index] | ||||
|     if not player.character then | ||||
|     local msg = event.message | ||||
|     local player_index = event.player_index | ||||
|     if not msg or not player_index then | ||||
|         return | ||||
|     end | ||||
|  | ||||
|     local y_offset = -4 | ||||
|     local player = game.get_player(player_index) | ||||
|     if not (player and player.valid and player.character) then | ||||
|         return | ||||
|     end | ||||
|  | ||||
|     if this.player_floaty_chat[player.index] then | ||||
|         this.player_floaty_chat[player.index].destroy() | ||||
|         this.player_floaty_chat[player.index] = nil | ||||
|     if player.character.surface.index ~= player.physical_surface.index then | ||||
|         return | ||||
|     end | ||||
|  | ||||
|     local prev_text = this.player_floaty_chat[player_index] | ||||
|     if prev_text and rendering.is_valid(prev_text) then | ||||
|         rendering.destroy(prev_text) | ||||
|     end | ||||
|  | ||||
|     local players = {} | ||||
|     for _, p in pairs(game.connected_players) do | ||||
|         if player.force.index == p.force.index then | ||||
|         if p.force == player.force then | ||||
|             players[#players + 1] = p | ||||
|         end | ||||
|     end | ||||
|  | ||||
|     if #players == 0 then | ||||
|         return | ||||
|     end | ||||
|  | ||||
|     if player.character.surface.index ~= player.physical_surface.index then return end | ||||
|  | ||||
|     this.player_floaty_chat[player.index] = | ||||
|         rendering.draw_text { | ||||
|             text = event.message, | ||||
|     -- Draw new floaty chat text | ||||
|     local color = player.color | ||||
|     local text_id = rendering.draw_text | ||||
|         { | ||||
|             text = msg, | ||||
|             surface = player.physical_surface, | ||||
|             target = { | ||||
|                 entity = player.character, | ||||
|                 offset = { -0.05, y_offset }, | ||||
|             }, | ||||
|             color = { | ||||
|                 r = player.color.r * 0.6 + 0.25, | ||||
|                 g = player.color.g * 0.6 + 0.25, | ||||
|                 b = player.color.b * 0.6 + 0.25, | ||||
|             target = { entity = player.character, offset = { -0.05, -4 } }, | ||||
|             color = | ||||
|             { | ||||
|                 r = color.r * 0.6 + 0.25, | ||||
|                 g = color.g * 0.6 + 0.25, | ||||
|                 b = color.b * 0.6 + 0.25, | ||||
|                 a = 1 | ||||
|             }, | ||||
|             players = players, | ||||
|             time_to_live = 600, | ||||
|             scale = 1.50, | ||||
|             scale = 1.5, | ||||
|             font = 'default-game', | ||||
|             alignment = 'center', | ||||
|             scale_with_zoom = false | ||||
|         } | ||||
|  | ||||
|     this.player_floaty_chat[player_index] = text_id | ||||
| end | ||||
|  | ||||
| Event.add(defines.events.on_console_chat, on_console_chat) | ||||
|   | ||||
| @@ -3,85 +3,102 @@ | ||||
| local Event = require 'utils.event' | ||||
| local Gui = require 'utils.gui' | ||||
|  | ||||
| local function goals() | ||||
|     if not storage.catplanet_goals then | ||||
|         storage.catplanet_goals = { | ||||
|             { goal = 0,        rank = false,         achieved = true }, | ||||
|             { | ||||
|                 goal = 100, | ||||
|                 rank = 'Copper', | ||||
|                 color = { r = 201, g = 133, b = 6 }, | ||||
|                 msg = 'You have saved the first container of fish!', | ||||
|                 msg2 = 'However, this is only the beginning.', | ||||
|                 achieved = false | ||||
|             }, | ||||
|             { | ||||
|                 goal = 1000, | ||||
|                 rank = 'Bronze', | ||||
|                 color = { r = 186, g = 115, b = 39 }, | ||||
|                 msg = 'Thankful for the fish, they sent back a toy mouse made of solid bronze!', | ||||
|                 msg2 = 'They are demanding more.', | ||||
|                 achieved = false | ||||
|             }, | ||||
|             { | ||||
|                 goal = 10000, | ||||
|                 rank = 'Silver', | ||||
|                 color = { r = 186, g = 178, b = 171 }, | ||||
|                 msg = 'In gratitude for the fish, they left you a silver furball!', | ||||
|                 msg2 = 'They are still longing for more.', | ||||
|                 achieved = false | ||||
|             }, | ||||
|             { | ||||
|                 goal = 25000, | ||||
|                 rank = 'Gold', | ||||
|                 color = { r = 255, g = 214, b = 33 }, | ||||
|                 msg = 'Pleased about the delivery, they sent back a golden audiotape with cat purrs.', | ||||
|                 msg2 = 'They still demand more.', | ||||
|                 achieved = false | ||||
|             }, | ||||
|             { | ||||
|                 goal = 50000, | ||||
|                 rank = 'Platinum', | ||||
|                 color = { r = 224, g = 223, b = 215 }, | ||||
|                 msg = 'To express their infinite love, they sent back a yarnball made of shiny material.', | ||||
|                 msg2 = 'Defying all logic, they still demand more fish.', | ||||
|                 achieved = false | ||||
|             }, | ||||
|             { | ||||
|                 goal = 100000, | ||||
|                 rank = 'Diamond', | ||||
|                 color = { r = 237, g = 236, b = 232 }, | ||||
|                 msg = 'A box arrives with a mewing kitten, it a has a diamond collar.', | ||||
|                 msg2 = 'More fish? Why? What..', | ||||
|                 achieved = false | ||||
|             }, | ||||
|             { | ||||
|                 goal = 250000, | ||||
|                 rank = 'Anti-matter', | ||||
|                 color = { r = 100, g = 100, b = 245 }, | ||||
|                 msg = 'The obese cat colapses and forms a black hole!', | ||||
|                 msg2 = ':obese:', | ||||
|                 achieved = false | ||||
|             }, | ||||
|             { | ||||
|                 goal = 500000, | ||||
|                 rank = 'Black Hole', | ||||
|                 color = { r = 100, g = 100, b = 245 }, | ||||
|                 msg = 'A letter arrives, it reads: Go to bed hooman!', | ||||
|                 msg2 = 'Not yet...', | ||||
|                 achieved = false | ||||
|             }, | ||||
|             { | ||||
|                 goal = 1000000, | ||||
|                 rank = 'Blue Screen', | ||||
|                 color = { r = 100, g = 100, b = 245 }, | ||||
|                 msg = 'Cat error #4721', | ||||
|                 msg2 = '....', | ||||
|                 achieved = false | ||||
|             }, | ||||
|             { goal = 10000000, rank = 'Blue Screen', color = { r = 100, g = 100, b = 245 }, msg = '....', msg2 = '....', achieved = false } | ||||
|         } | ||||
| local Public = {} | ||||
|  | ||||
| Gui.mod_gui_button_enabled = true | ||||
| Gui.button_style = 'mod_gui_button' | ||||
| Gui.set_mod_gui_top_frame(true) | ||||
|  | ||||
| local function get_top_frame(player, id) | ||||
|     if not id then | ||||
|         id = 'fish_in_space_toggle' | ||||
|     end | ||||
|  | ||||
|     if Gui.get_mod_gui_top_frame() then | ||||
|         return Gui.get_button_flow(player)[id] | ||||
|     else | ||||
|         return player.gui.top[id] | ||||
|     end | ||||
| end | ||||
|  | ||||
| local function goals() | ||||
|     storage.catplanet_goals = | ||||
|     { | ||||
|         { goal = 0, rank = false, achieved = true }, | ||||
|         { | ||||
|             goal = 100, | ||||
|             rank = 'Copper', | ||||
|             color = { r = 201, g = 133, b = 6 }, | ||||
|             msg = 'You have saved the first container of fish!', | ||||
|             msg2 = 'However, this is only the beginning.', | ||||
|             achieved = false | ||||
|         }, | ||||
|         { | ||||
|             goal = 1000, | ||||
|             rank = 'Bronze', | ||||
|             color = { r = 186, g = 115, b = 39 }, | ||||
|             msg = 'Thankful for the fish, they sent back a toy mouse made of solid bronze!', | ||||
|             msg2 = 'They are demanding more.', | ||||
|             achieved = false | ||||
|         }, | ||||
|         { | ||||
|             goal = 10000, | ||||
|             rank = 'Silver', | ||||
|             color = { r = 186, g = 178, b = 171 }, | ||||
|             msg = 'In gratitude for the fish, they left you a silver furball!', | ||||
|             msg2 = 'They are still longing for more.', | ||||
|             achieved = false | ||||
|         }, | ||||
|         { | ||||
|             goal = 25000, | ||||
|             rank = 'Gold', | ||||
|             color = { r = 255, g = 214, b = 33 }, | ||||
|             msg = 'Pleased about the delivery, they sent back a golden audiotape with cat purrs.', | ||||
|             msg2 = 'They still demand more.', | ||||
|             achieved = false | ||||
|         }, | ||||
|         { | ||||
|             goal = 50000, | ||||
|             rank = 'Platinum', | ||||
|             color = { r = 224, g = 223, b = 215 }, | ||||
|             msg = 'To express their infinite love, they sent back a yarnball made of shiny material.', | ||||
|             msg2 = 'Defying all logic, they still demand more fish.', | ||||
|             achieved = false | ||||
|         }, | ||||
|         { | ||||
|             goal = 100000, | ||||
|             rank = 'Diamond', | ||||
|             color = { r = 237, g = 236, b = 232 }, | ||||
|             msg = 'A box arrives with a mewing kitten, it a has a diamond collar.', | ||||
|             msg2 = 'More fish? Why? What..', | ||||
|             achieved = false | ||||
|         }, | ||||
|         { | ||||
|             goal = 250000, | ||||
|             rank = 'Anti-matter', | ||||
|             color = { r = 100, g = 100, b = 245 }, | ||||
|             msg = 'The obese cat colapses and forms a black hole!', | ||||
|             msg2 = ':obese:', | ||||
|             achieved = false | ||||
|         }, | ||||
|         { | ||||
|             goal = 500000, | ||||
|             rank = 'Black Hole', | ||||
|             color = { r = 100, g = 100, b = 245 }, | ||||
|             msg = 'A letter arrives, it reads: Go to bed hooman!', | ||||
|             msg2 = 'Not yet...', | ||||
|             achieved = false | ||||
|         }, | ||||
|         { | ||||
|             goal = 1000000, | ||||
|             rank = 'Blue Screen', | ||||
|             color = { r = 100, g = 100, b = 245 }, | ||||
|             msg = 'Cat error #4721', | ||||
|             msg2 = '....', | ||||
|             achieved = false | ||||
|         }, | ||||
|         { goal = 10000000, rank = 'Blue Screen', color = { r = 100, g = 100, b = 245 }, msg = '....', msg2 = '....', achieved = false } | ||||
|     } | ||||
| end | ||||
|  | ||||
| local function get_rank() | ||||
| @@ -96,12 +113,20 @@ local function get_rank() | ||||
| end | ||||
|  | ||||
| local function fish_in_space_toggle_button(player) | ||||
|     if player.gui.top['fish_in_space_toggle'] then | ||||
|     local button = get_top_frame(player) | ||||
|     if button then | ||||
|         return | ||||
|     end | ||||
|     local button = player.gui.top.add { name = 'fish_in_space_toggle', type = 'sprite-button', sprite = 'item/raw-fish', tooltip = 'Fish in Space', style = Gui.button_style } | ||||
|     button.style.minimal_height = 38 | ||||
|     button.style.maximal_height = 38 | ||||
|  | ||||
|     if Gui.get_mod_gui_top_frame() then | ||||
|         button = Gui.add_mod_button(player, { name = 'fish_in_space_toggle', type = 'sprite-button', sprite = 'item/raw-fish', tooltip = 'Fish in Space', style = Gui.button_style }) | ||||
|     else | ||||
|         button = player.gui.top.add { name = 'fish_in_space_toggle', type = 'sprite-button', sprite = 'item/raw-fish', tooltip = 'Fish in Space', style = Gui.button_style } | ||||
|     end | ||||
|     if button then | ||||
|         button.style.minimal_height = 36 | ||||
|         button.style.maximal_height = 36 | ||||
|     end | ||||
| end | ||||
|  | ||||
| local function level_up_popup(player) | ||||
| @@ -143,6 +168,7 @@ local function fish_in_space_gui(player) | ||||
|         progress = 1 | ||||
|     end | ||||
|     local progressbar = frame.add({ type = 'progressbar', value = progress }) | ||||
|     ---@class LuaGuiElementStyle | ||||
|     progressbar.style = 'achievement_progressbar' | ||||
|     progressbar.style.minimal_width = 96 | ||||
|     progressbar.style.maximal_width = 96 | ||||
| @@ -190,6 +216,10 @@ local function on_rocket_launched(event) | ||||
|         end | ||||
|     end | ||||
|  | ||||
|     if storage.fish_in_space == 0 then | ||||
|         goals() | ||||
|     end | ||||
|  | ||||
|     rocket_inventory.clear() | ||||
|     rocket_inventory.insert({ name = 'space-science-pack', count = 200 }) | ||||
|  | ||||
| @@ -291,3 +321,11 @@ Event.on_init(on_init) | ||||
| 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_rocket_launch_ordered, on_rocket_launched) | ||||
|  | ||||
| Public.get_top_frame = get_top_frame | ||||
| Public.fish_in_space_toggle_button = fish_in_space_toggle_button | ||||
| Public.level_up_popup = level_up_popup | ||||
| Public.fish_in_space_gui = fish_in_space_gui | ||||
| Public.fireworks = fireworks | ||||
|  | ||||
| return Public | ||||
|   | ||||
| @@ -1,10 +1,10 @@ | ||||
|  | ||||
| local Global = require 'utils.global' | ||||
| local Event = require 'utils.event' | ||||
|  | ||||
| local Module = {} | ||||
|  | ||||
| local settings = { | ||||
| local settings = | ||||
| { | ||||
|     enabled = true, | ||||
|     registered_forces = {}, | ||||
|     roboport_limit = 100, | ||||
| @@ -14,20 +14,21 @@ local settings = { | ||||
| } | ||||
| Global.register( | ||||
|     settings, | ||||
|     function(tbl) | ||||
|     function (tbl) | ||||
|         settings = tbl | ||||
|     end | ||||
| ) | ||||
|  | ||||
| local function alert(entity) | ||||
|     local messages = { | ||||
|     local messages = | ||||
|     { | ||||
|         ['roboport'] = 'Too many roboports in the network, they start to deteriorate!', | ||||
|         ['logistic-robot'] = 'Too many logistic robots in same network, they collide with each other often!', | ||||
|         ['construction-robot'] = 'Too many construction robots in same network, they collide with each other often!', | ||||
|     } | ||||
|     for _, player in pairs(game.connected_players) do | ||||
|         player.add_custom_alert(entity, {type = 'virtual', name = 'signal-deny'}, messages[entity.type], true) | ||||
|         player.play_sound({path = 'utility/alert_destroyed'}) | ||||
|         player.add_custom_alert(entity, { type = 'virtual', name = 'signal-deny' }, messages[entity.type], true) | ||||
|         player.play_sound({ path = 'utility/alert_destroyed' }) | ||||
|     end | ||||
| end | ||||
|  | ||||
| @@ -56,8 +57,6 @@ local function restrict_roboports(custom_force) | ||||
|     end | ||||
| end | ||||
|  | ||||
|  | ||||
|  | ||||
| local function restrict_robots(custom_force) | ||||
|     local force = custom_force or game.forces.player | ||||
|     local surface_networks = force.logistic_networks | ||||
| @@ -85,8 +84,9 @@ end | ||||
|  | ||||
| local function do_tick() | ||||
|     if not settings.enabled then return end | ||||
|     for _, force in pairs(settings.registered_forces) do | ||||
|         if force.enabled then | ||||
|     for _, force_data in pairs(settings.registered_forces) do | ||||
|         local force = game.forces[force_data.force_id] | ||||
|         if force and force.enabled then | ||||
|             restrict_roboports(force.force) | ||||
|             restrict_robots(force.force) | ||||
|         end | ||||
| @@ -147,7 +147,7 @@ end | ||||
| ---@param force LuaForce | ||||
| ---@param enabled boolean | ||||
| function Module.register_force(force, enabled) | ||||
|     settings.registered_forces[force.index] = {force = force, enabled = enabled} | ||||
|     settings.registered_forces[force.index] = { force_id = force.index, enabled = enabled, force_name = force.name } | ||||
| end | ||||
|  | ||||
| local function on_init() | ||||
|   | ||||
| @@ -3,30 +3,7 @@ local inspect = | ||||
|     _VERSION = 'inspect.lua 3.1.0', | ||||
|     _URL = 'http://github.com/kikito/inspect.lua', | ||||
|     _DESCRIPTION = 'human-readable representations of tables', | ||||
|     _LICENSE = [[ | ||||
|     MIT LICENSE | ||||
|  | ||||
|     Copyright (c) 2013 Enrique García Cota | ||||
|  | ||||
|     Permission is hereby granted, free of charge, to any person obtaining a | ||||
|     copy of this software and associated documentation files (the | ||||
|     "Software"), to deal in the Software without restriction, including | ||||
|     without limitation the rights to use, copy, modify, merge, publish, | ||||
|     distribute, sublicense, and/or sell copies of the Software, and to | ||||
|     permit persons to whom the Software is furnished to do so, subject to | ||||
|     the following conditions: | ||||
|  | ||||
|     The above copyright notice and this permission notice shall be included | ||||
|     in all copies or substantial portions of the Software. | ||||
|  | ||||
|     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||||
|     OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||||
|     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||||
|     IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||||
|     CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||||
|     TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||||
|     SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||
|   ]] | ||||
|     _LICENSE = 'https://github.com/kikito/inspect.lua/blob/master/MIT-LICENSE.txt' | ||||
| } | ||||
|  | ||||
| local tostring = tostring | ||||
|   | ||||
| @@ -7,11 +7,10 @@ local Event = require 'utils.event' | ||||
|  | ||||
| Gui.mod_gui_button_enabled = true | ||||
| Gui.button_style = 'mod_gui_button' | ||||
| Gui.set_toggle_button(true) | ||||
| Gui.set_mod_gui_top_frame(true) | ||||
|  | ||||
| Event.on_init(function () | ||||
| 	Freeplay.set_enabled(true) | ||||
| 	Autostash.set_enabled(true) | ||||
| 	Misc.set_enabled(true) | ||||
|     Freeplay.set_enabled(true) | ||||
|     Autostash.set_enabled(true) | ||||
|     Misc.set_enabled(true) | ||||
| end) | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user