mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2024-12-30 23:17:53 +02:00
mtn fortress fixes
This commit is contained in:
parent
3bd965ce3b
commit
80736a24d5
@ -18,7 +18,7 @@ local Alert = require 'utils.alert'
|
||||
local Task = require 'utils.task'
|
||||
local Score = require 'comfy_panel.score'
|
||||
local Token = require 'utils.token'
|
||||
local HS = require 'maps.mountain_fortress_v3.highscore'
|
||||
-- local HS = require 'maps.mountain_fortress_v3.highscore'
|
||||
local Discord = require 'utils.discord'
|
||||
local Core = require "utils.core"
|
||||
local Diff = require "modules.difficulty_vote_by_amount"
|
||||
@ -100,13 +100,13 @@ local reset_game =
|
||||
local this = data.this
|
||||
local Reset_map = data.reset_map
|
||||
if this.soft_reset then
|
||||
HS.set_scores()
|
||||
-- HS.set_scores()
|
||||
this.game_reset_tick = nil
|
||||
Reset_map()
|
||||
return
|
||||
end
|
||||
if this.restart then
|
||||
HS.set_scores()
|
||||
-- HS.set_scores()
|
||||
local message = ({'entity.reset_game'})
|
||||
Server.to_discord_bold(message, true)
|
||||
Server.start_scenario('Mountain_Fortress_v3')
|
||||
@ -114,7 +114,7 @@ local reset_game =
|
||||
return
|
||||
end
|
||||
if this.shutdown then
|
||||
HS.set_scores()
|
||||
-- HS.set_scores()
|
||||
local message = ({'entity.shutdown_game'})
|
||||
Server.to_discord_bold(message, true)
|
||||
Server.stop_scenario()
|
||||
@ -1210,17 +1210,20 @@ local function show_mvps(player)
|
||||
local tier = WPT.get("pickaxe_tier")
|
||||
local pick_tier = pickaxe_tiers[tier]
|
||||
|
||||
Server.to_discord_named_embed(send_ping_to_channel, '**Statistics!**\\n\\n'
|
||||
.. 'Time played: '..time_played..'\\n'
|
||||
.. 'Game Difficulty: '..diff.name..'\\n'
|
||||
.. 'Highest wave: '..format_number(wave, true)..'\\n'
|
||||
.. 'Total connected players: '..total_players..'\\n'
|
||||
.. 'Threat: '..format_number(threat, true)..'\\n'
|
||||
.. 'Pickaxe Upgrade: '..pick_tier..' (' ..tier.. ')\\n'
|
||||
.. 'Collapse Speed: '..collapse_speed..'\\n'
|
||||
.. 'Collapse Amount: '..collapse_amount..'\\n'
|
||||
)
|
||||
WPT.set('sent_to_discord', true)
|
||||
local server_name = Server.check_server_name('Mtn Fortress')
|
||||
if server_name then
|
||||
Server.to_discord_named_embed(send_ping_to_channel, '**Statistics!**\\n\\n'
|
||||
.. 'Time played: '..time_played..'\\n'
|
||||
.. 'Game Difficulty: '..diff.name..'\\n'
|
||||
.. 'Highest wave: '..format_number(wave, true)..'\\n'
|
||||
.. 'Total connected players: '..total_players..'\\n'
|
||||
.. 'Threat: '..format_number(threat, true)..'\\n'
|
||||
.. 'Pickaxe Upgrade: '..pick_tier..' (' ..tier.. ')\\n'
|
||||
.. 'Collapse Speed: '..collapse_speed..'\\n'
|
||||
.. 'Collapse Amount: '..collapse_amount..'\\n'
|
||||
)
|
||||
WPT.set('sent_to_discord', true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -13,6 +13,10 @@ local function validate_entity(entity)
|
||||
return false
|
||||
end
|
||||
|
||||
if type(entity) == 'boolean' then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
@ -896,6 +900,10 @@ function Public.use_door_with_entity(ic, player, door)
|
||||
return
|
||||
end
|
||||
|
||||
if not validate_entity(car.entity) then
|
||||
return
|
||||
end
|
||||
|
||||
local owner = game.players[car.owner]
|
||||
local list = get_trusted_system(ic, owner)
|
||||
if owner and owner.valid and owner.index ~= player.index and player.connected then
|
||||
|
@ -94,6 +94,10 @@ local function transfer_player_table(player, new_player)
|
||||
end
|
||||
|
||||
local function remove_main_frame(main_frame)
|
||||
if not main_frame or not main_frame.valid then
|
||||
return
|
||||
end
|
||||
|
||||
Gui.remove_data_recursively(main_frame)
|
||||
main_frame.destroy()
|
||||
end
|
||||
|
@ -144,7 +144,17 @@ local set_loco_tiles =
|
||||
end
|
||||
end
|
||||
|
||||
MapFunctions.draw_noise_tile_circle(position, 'blue-refined-concrete', surface, 15)
|
||||
if random(1, 6) == 1 then
|
||||
MapFunctions.draw_noise_tile_circle(position, 'blue-refined-concrete', surface, 18)
|
||||
elseif random(1, 5) == 1 then
|
||||
MapFunctions.draw_noise_tile_circle(position, 'black-refined-concrete', surface, 18)
|
||||
elseif random(1, 4) == 1 then
|
||||
MapFunctions.draw_noise_tile_circle(position, 'cyan-refined-concrete', surface, 18)
|
||||
elseif random(1, 3) == 1 then
|
||||
MapFunctions.draw_noise_tile_circle(position, 'hazard-concrete-right', surface, 18)
|
||||
else
|
||||
MapFunctions.draw_noise_tile_circle(position, 'blue-refined-concrete', surface, 18)
|
||||
end
|
||||
|
||||
for i = 1, #cargo_boxes, 1 do
|
||||
if not p[i] then
|
||||
|
@ -3,7 +3,7 @@ require 'modules.rpg.main'
|
||||
local Functions = require 'maps.mountain_fortress_v3.functions'
|
||||
local BuriedEnemies = require 'maps.mountain_fortress_v3.buried_enemies'
|
||||
|
||||
local HS = require 'maps.mountain_fortress_v3.highscore'
|
||||
-- local HS = require 'maps.mountain_fortress_v3.highscore'
|
||||
local Discord = require 'utils.discord'
|
||||
local IC = require 'maps.mountain_fortress_v3.ic.table'
|
||||
local ICMinimap = require 'maps.mountain_fortress_v3.ic.minimap'
|
||||
@ -110,6 +110,16 @@ local is_position_near_tbl = function(position, tbl)
|
||||
return status
|
||||
end
|
||||
|
||||
local announce_new_map =
|
||||
Token.register(
|
||||
function()
|
||||
local server_name = Server.check_server_name('Mtn Fortress')
|
||||
if server_name then
|
||||
Server.to_discord_named_raw(send_ping_to_channel, role_to_mention .. ' ** Mtn Fortress was just reset! **')
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
function Public.reset_map()
|
||||
local Diff = Difficulty.get()
|
||||
local this = WPT.get()
|
||||
@ -253,7 +263,7 @@ function Public.reset_map()
|
||||
Task.start_queue()
|
||||
Task.set_queue_speed(16)
|
||||
|
||||
HS.get_scores()
|
||||
-- HS.get_scores()
|
||||
|
||||
if is_game_modded() then
|
||||
game.difficulty_settings.technology_price_multiplier = 0.5
|
||||
@ -264,7 +274,7 @@ function Public.reset_map()
|
||||
this.market_announce = game.tick + 1200
|
||||
this.game_lost = false
|
||||
|
||||
Server.to_discord_named_raw(send_ping_to_channel, role_to_mention .. ' ** Mtn Fortress was just reset! **')
|
||||
Task.set_timeout_in_ticks(25, announce_new_map)
|
||||
end
|
||||
|
||||
local is_locomotive_valid = function()
|
||||
@ -314,18 +324,18 @@ local has_the_game_ended = function()
|
||||
game.print(({'main.reset_in', cause_msg, this.game_reset_tick / 60}), {r = 0.22, g = 0.88, b = 0.22})
|
||||
end
|
||||
|
||||
local diff_name = Difficulty.get('name')
|
||||
-- local diff_name = Difficulty.get('name')
|
||||
|
||||
if this.soft_reset and this.game_reset_tick == 0 then
|
||||
this.game_reset_tick = nil
|
||||
HS.set_scores(diff_name)
|
||||
-- HS.set_scores(diff_name)
|
||||
Public.reset_map()
|
||||
return
|
||||
end
|
||||
|
||||
if this.restart and this.game_reset_tick == 0 then
|
||||
if not this.announced_message then
|
||||
HS.set_scores(diff_name)
|
||||
-- HS.set_scores(diff_name)
|
||||
game.print(({'entity.notify_restart'}), {r = 0.22, g = 0.88, b = 0.22})
|
||||
local message = 'Soft-reset is disabled! Server will restart from scenario to load new changes.'
|
||||
Server.to_discord_bold(table.concat {'*** ', message, ' ***'})
|
||||
@ -336,7 +346,7 @@ local has_the_game_ended = function()
|
||||
end
|
||||
if this.shutdown and this.game_reset_tick == 0 then
|
||||
if not this.announced_message then
|
||||
HS.set_scores(diff_name)
|
||||
-- HS.set_scores(diff_name)
|
||||
game.print(({'entity.notify_shutdown'}), {r = 0.22, g = 0.88, b = 0.22})
|
||||
local message = 'Soft-reset is disabled! Server will shutdown. Most likely because of updates.'
|
||||
Server.to_discord_bold(table.concat {'*** ', message, ' ***'})
|
||||
|
@ -2350,6 +2350,7 @@ end
|
||||
local function border_chunk(data)
|
||||
local entities = data.entities
|
||||
local decoratives = data.decoratives
|
||||
local tiles = data.tiles
|
||||
|
||||
local x, y = Public.increment_value(data)
|
||||
|
||||
@ -2358,6 +2359,13 @@ local function border_chunk(data)
|
||||
if random(1, ceil(pos.y + pos.y) + 64) == 1 then
|
||||
entities[#entities + 1] = {name = trees[random(1, #trees)], position = pos}
|
||||
end
|
||||
|
||||
if random(1, 10) == 1 then
|
||||
tiles[#tiles + 1] = {name = 'red-desert-' .. random(1, 3), position = pos}
|
||||
else
|
||||
tiles[#tiles + 1] = {name = 'dirt-' .. math.random(1, 6), position = pos}
|
||||
end
|
||||
|
||||
local scrap_mineable_entities, scrap_mineable_entities_index = get_scrap_mineable_entities()
|
||||
|
||||
if not is_out_of_map(pos) then
|
||||
|
Loading…
Reference in New Issue
Block a user