diff --git a/locale/en/mtn_fortress_v3.cfg b/locale/en/mtn_fortress_v3.cfg index d22360d8..7a071184 100644 --- a/locale/en/mtn_fortress_v3.cfg +++ b/locale/en/mtn_fortress_v3.cfg @@ -15,7 +15,7 @@ hinder=[color=blue]Mapkeeper:[/color] You are too far away from the main locomot hinder_collapse=[color=blue]Mapkeeper:[/color] Collapse is too far away. You cannot go beyond this point. warning=Breaching the far side wall will start collapse. warning_teleport=[color=blue]Mapkeeper:[/color] __1__ wanted to advance, but was given a last chance to rethink their choice. The next player that does this will trigger collapse! - +warning_not_trusted_teleport=[color=blue]Mapkeeper:[/color] __1__ wanted to advance, but was not trusted.\nNon-trusted players will not trigger collapse. [entity] treasure_1=[color=blue]Mapkeeper:[/color] You notice an old crate within the rubble. It's filled with treasure! treasure_2=[color=blue]Mapkeeper:[/color] You find a chest underneath the broken rocks. It's filled with goodies! diff --git a/maps/mountain_fortress_v3/breached_wall.lua b/maps/mountain_fortress_v3/breached_wall.lua index 2eab2dff..08bb8db5 100644 --- a/maps/mountain_fortress_v3/breached_wall.lua +++ b/maps/mountain_fortress_v3/breached_wall.lua @@ -354,13 +354,14 @@ local function distance(player) end local breach_wall_warning = Public.get('breach_wall_warning') + local block_non_trusted_trigger_collapse = Public.get('block_non_trusted_trigger_collapse') local max = zone_settings.zone_depth * bonus local breach_max = zone_settings.zone_depth * breached_wall local breach_max_times = distance_to_center >= breach_max local max_times = distance_to_center >= max if max_times then - if not Session.get_trusted_player(player) then + if block_non_trusted_trigger_collapse and not Session.get_trusted_player(player) then if breach_wall_warning_teleport(player, true) then return end diff --git a/maps/mountain_fortress_v3/functions.lua b/maps/mountain_fortress_v3/functions.lua index 92484c53..0c772436 100644 --- a/maps/mountain_fortress_v3/functions.lua +++ b/maps/mountain_fortress_v3/functions.lua @@ -295,6 +295,9 @@ local artillery_target_callback = local art_table = this.art_table local outpost = art_table[index] + if not outpost then + return + end if not entity.valid then outpost.last_fire_tick = 0 diff --git a/maps/mountain_fortress_v3/locomotive.lua b/maps/mountain_fortress_v3/locomotive.lua index b84c8b19..160452cb 100644 --- a/maps/mountain_fortress_v3/locomotive.lua +++ b/maps/mountain_fortress_v3/locomotive.lua @@ -237,64 +237,63 @@ local function give_passive_xp(data) local rpg = data.rpg local loco = locomotive.position - for _, player in pairs(game.connected_players) do - if not player or not player.valid then - goto pre_exit - end - local position = player.position - local inside = ((position.x - loco.x) ^ 2 + (position.y - loco.y) ^ 2) < upgrades.locomotive_aura_radius ^ 2 - if player.afk_time < 200 and not RPG.get_last_spell_cast(player) then - if inside or player.surface.index == loco_surface.index then - if player.surface.index == loco_surface.index then - Public.add_player_to_permission_group(player, 'limited') - elseif ICFunctions.get_player_surface(player) then - Public.add_player_to_permission_group(player, 'limited') - goto pre_exit + Core.iter_connected_players( + function(player) + local position = player.position + local inside = ((position.x - loco.x) ^ 2 + (position.y - loco.y) ^ 2) < upgrades.locomotive_aura_radius ^ 2 + if player.afk_time < 200 and not RPG.get_last_spell_cast(player) then + if inside or player.surface.index == loco_surface.index then + if player.surface.index == loco_surface.index then + Public.add_player_to_permission_group(player, 'limited') + elseif ICFunctions.get_player_surface(player) then + Public.add_player_to_permission_group(player, 'limited') + goto pre_exit + else + Public.add_player_to_permission_group(player, 'near_locomotive') + end + + rpg[player.index].inside_aura = true + Modifiers.update_single_modifier(player, 'character_crafting_speed_modifier', 'aura', 1) + Modifiers.update_player_modifiers(player) + + local pos = player.position + RPG.gain_xp(player, 0.5 * (rpg[player.index].bonus + upgrades.xp_points)) + + player.create_local_flying_text { + text = '+' .. '', + position = {x = pos.x, y = pos.y - 2}, + color = xp_floating_text_color, + time_to_live = 60, + speed = 3 + } + rpg[player.index].xp_since_last_floaty_text = 0 + rpg[player.index].last_floaty_text = game.tick + visuals_delay + RPG.set_last_spell_cast(player, player.position) + if player.gui.screen[rpg_main_frame] then + local f = player.gui.screen[rpg_main_frame] + local d = Gui.get_data(f) + if d and d.exp_gui and d.exp_gui.valid then + d.exp_gui.caption = floor(rpg[player.index].xp) + end + end else - Public.add_player_to_permission_group(player, 'near_locomotive') - end - - rpg[player.index].inside_aura = true - Modifiers.update_single_modifier(player, 'character_crafting_speed_modifier', 'aura', 1) - Modifiers.update_player_modifiers(player) - - local pos = player.position - RPG.gain_xp(player, 0.5 * (rpg[player.index].bonus + upgrades.xp_points)) - - player.create_local_flying_text { - text = '+' .. '', - position = {x = pos.x, y = pos.y - 2}, - color = xp_floating_text_color, - time_to_live = 60, - speed = 3 - } - rpg[player.index].xp_since_last_floaty_text = 0 - rpg[player.index].last_floaty_text = game.tick + visuals_delay - RPG.set_last_spell_cast(player, player.position) - if player.gui.screen[rpg_main_frame] then - local f = player.gui.screen[rpg_main_frame] - local d = Gui.get_data(f) - if d and d.exp_gui and d.exp_gui.valid then - d.exp_gui.caption = floor(rpg[player.index].xp) - end - end - else - rpg[player.index].inside_aura = false - Modifiers.update_single_modifier(player, 'character_crafting_speed_modifier', 'aura', 0) - Modifiers.update_player_modifiers(player) - local active_surface_index = Public.get('active_surface_index') - local surface = game.surfaces[active_surface_index] - if surface and surface.valid then - if player.surface.index == surface.index then - Public.add_player_to_permission_group(player, 'main_surface') + rpg[player.index].inside_aura = false + Modifiers.update_single_modifier(player, 'character_crafting_speed_modifier', 'aura', 0) + Modifiers.update_player_modifiers(player) + local active_surface_index = Public.get('active_surface_index') + local surface = game.surfaces[active_surface_index] + if surface and surface.valid then + if player.surface.index == surface.index then + Public.add_player_to_permission_group(player, 'main_surface') + end end end + elseif player.afk_time > 1800 and player.character and player.surface.index == loco_surface.index then + player.character_personal_logistic_requests_enabled = false end - elseif player.afk_time > 600 and player.character and player.surface.index == loco_surface.index then - player.character_personal_logistic_requests_enabled = false + ::pre_exit:: end - ::pre_exit:: - end + ) end local function fish_tag() diff --git a/maps/mountain_fortress_v3/table.lua b/maps/mountain_fortress_v3/table.lua index 840cdec9..54b4cd3a 100644 --- a/maps/mountain_fortress_v3/table.lua +++ b/maps/mountain_fortress_v3/table.lua @@ -156,6 +156,7 @@ function Public.reset_main_table() } this.allow_decon = true this.block_non_trusted_opening_trains = true + this.block_non_trusted_trigger_collapse = true this.allow_decon_main_surface = true this.flamethrower_damage = {} this.mined_scrap = 0