Skip to content

Commit

Permalink
Merge pull request #433 from ComfyFactory/mtn_fixes
Browse files Browse the repository at this point in the history
Mtn v3
  • Loading branch information
Gerkiz authored Nov 8, 2023
2 parents 28c3765 + 737bb02 commit d83bc8d
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 44 deletions.
1 change: 1 addition & 0 deletions locale/en/mtn_fortress_v3.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ first_to_reach=[color=blue]Mapkeeper:[/color]\n__1__ was the first to reach zone
artillery_warning=[color=blue]Mapkeeper:[/color]\nWarning, Artillery have been spotted north!
cheating_through=[color=blue]Mapkeeper:[/color] __1__ tried to cheat their way north with their spidertron!
hinder=[color=blue]Mapkeeper:[/color] You are too far away from the main locomotive. You cannot go beyond this point.
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__ wants to go north, but was given a last chance to rethink their choice. The next player that does this will trigger collapse!

Expand Down
27 changes: 20 additions & 7 deletions maps/mountain_fortress_v3/breached_wall.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,19 +153,17 @@ local check_distance_between_player_and_locomotive = function(player)
return
end

local gap_between_locomotive = Public.get('gap_between_locomotive')

if not gap_between_locomotive.highest_pos then
gap_between_locomotive.highest_pos = locomotive.position
end
local collapse_position = Collapse.get_position()

local gap_between_locomotive = Public.get('gap_between_locomotive')
gap_between_locomotive.highest_pos = locomotive.position
gap_between_locomotive = Public.get('gap_between_locomotive')

local c_y = position.y
local p_y = position.y
local t_y = gap_between_locomotive.highest_pos.y
local c_y = collapse_position.y

if c_y - t_y <= gap_between_locomotive.neg_gap then
if p_y - t_y <= gap_between_locomotive.neg_gap then
player.teleport({position.x, locomotive.position.y + gap_between_locomotive.neg_gap + 2}, surface)
player.print(({'breached_wall.hinder'}), Color.warning)
if player.driving then
Expand All @@ -179,6 +177,21 @@ local check_distance_between_player_and_locomotive = function(player)
end
end
end

if p_y - c_y <= gap_between_locomotive.neg_gap_collapse then
player.teleport({position.x, c_y + gap_between_locomotive.neg_gap_collapse + 2}, surface)
player.print(({'breached_wall.hinder_collapse'}), Color.warning)
if player.driving then
player.driving = false
end
if player.character then
player.character.health = player.character.health - 5
player.character.surface.create_entity({name = 'water-splash', position = position})
if player.character.health <= 0 then
player.character.die('enemy')
end
end
end
end

local compare_player_pos = function(player)
Expand Down
84 changes: 49 additions & 35 deletions maps/mountain_fortress_v3/icw/linked_chests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -660,50 +660,64 @@ local function built_entity_robot(event)
return
end

local active_surface_index = WPT.get('active_surface_index')
local disable_link_chest_cheese_mode = WPT.get('disable_link_chest_cheese_mode')

local net_point = robot.logistic_network
if net_point and net_point.storage_points and net_point.storage_points[1] and net_point.storage_points[1].owner and net_point.storage_points[1].owner.valid then
if (net_point.storage_points[1].owner.name == 'character') then
local player = net_point.storage_points[1].owner.player
if not player or not player.valid then
return
end
if net_point and net_point.storage_points then
for _, point in pairs(net_point.storage_points) do
if point then
if point.owner and point.owner.valid and point.owner.name == 'character' then
local player = point.owner.player
if not player or not player.valid then
return
end

local active_surface_index = WPT.get('active_surface_index')
if player.surface.index ~= active_surface_index then
if entity.type ~= 'entity-ghost' then
player.insert({name = 'linked-chest', count = 1})
end
entity.destroy()
player.print(module_name .. 'Linked chests only work on the main surface.', Color.warning)
return
end

if player.surface.index ~= active_surface_index then
if entity.type ~= 'entity-ghost' then
player.insert({name = 'linked-chest', count = 1})
end
entity.destroy()
player.print(module_name .. 'Linked chests only work on the main surface.', Color.warning)
return
end
if not WPT.locomotive.is_around_train(entity) then
if entity.type ~= 'entity-ghost' then
player.insert({name = 'linked-chest', count = 1})
end
entity.destroy()
player.print(module_name .. 'Linked chests only work inside the locomotive aura.', Color.warning)
return
end

if not WPT.locomotive.is_around_train(entity) then
if entity.type ~= 'entity-ghost' then
player.insert({name = 'linked-chest', count = 1})
end
entity.destroy()
player.print(module_name .. 'Linked chests only work inside the locomotive aura.', Color.warning)
return
end
local trusted_player = Session.get_trusted_player(player)

local trusted_player = Session.get_trusted_player(player)
if not trusted_player then
if entity.type ~= 'entity-ghost' then
player.insert({name = 'linked-chest', count = 1})
end
entity.destroy()
player.print('[Antigrief] You have not grown accustomed to this technology yet.', Color.warning)
return
end

if not trusted_player then
if entity.type ~= 'entity-ghost' then
player.insert({name = 'linked-chest', count = 1})
local s = create_chest(entity)
if s then
gui_opened(event)
end
else
local created = event.created_entity
if created and created.valid then
local inventory = robot.get_inventory(defines.inventory.robot_cargo)
inventory.insert({name = created.name, count = 1})
created.destroy()
end
end
entity.destroy()
player.print('[Antigrief] You have not grown accustomed to this technology yet.', Color.warning)
return
end
end

local s = create_chest(entity)
if s then
gui_opened(event)
end
else
if disable_link_chest_cheese_mode then
local created = event.created_entity
if created and created.valid then
local inventory = robot.get_inventory(defines.inventory.robot_cargo)
Expand Down
2 changes: 1 addition & 1 deletion maps/mountain_fortress_v3/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ local compare_collapse_and_train = function()
Public.set_difficulty()
else
Collapse.set_speed(1)
Collapse.set_amount(4)
Collapse.set_amount(40)
end
end

Expand Down
6 changes: 5 additions & 1 deletion maps/mountain_fortress_v3/stateful/table.lua
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ local function get_random_buff()
modifier = 'starting_items',
limit = nil,
items = {
{name = 'assembling-machine', count = 1}
{name = 'assembling-machine-1', count = 1}
}
},
{
Expand Down Expand Up @@ -708,6 +708,10 @@ local apply_settings_token =
return
end

if not settings.current_date then
settings.current_date = tonumber(current_time)
end

this.current_date = settings.current_date
this.buffs = settings.buffs

Expand Down
1 change: 1 addition & 0 deletions maps/mountain_fortress_v3/table.lua
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ function Public.reset_main_table()
hinders = {},
gap = 900,
neg_gap = -3520, -- earlier 2112 (3 zones, whereas 704 is one zone)
neg_gap_collapse = -5520, -- earlier 2112 (3 zones, whereas 704 is one zone)
highest_pos = nil
}
this.force_chunk = false
Expand Down

0 comments on commit d83bc8d

Please sign in to comment.