mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2024-12-26 22:56:43 +02:00
Mtn: rework map generation logic
This commit is contained in:
parent
42b9762812
commit
fa2a607bc5
@ -1861,6 +1861,8 @@ stds.factorio_defines = {
|
|||||||
'cancel_craft',
|
'cancel_craft',
|
||||||
'change_picking_state',
|
'change_picking_state',
|
||||||
'set_inventory_bar',
|
'set_inventory_bar',
|
||||||
|
'gui_leave',
|
||||||
|
'gui_hover',
|
||||||
'gui_selected_tab_changed',
|
'gui_selected_tab_changed',
|
||||||
'open_logistic_gui',
|
'open_logistic_gui',
|
||||||
'cursor_split',
|
'cursor_split',
|
||||||
|
@ -692,7 +692,7 @@ local function biter_attack_wave()
|
|||||||
evolution = 1
|
evolution = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
game.forces.enemy.set_evolution_factor(evolution, surface)
|
game.forces.enemy.set_evolution_factor(evolution, surface.name)
|
||||||
|
|
||||||
local y_raffle = get_y_coord_raffle_table()
|
local y_raffle = get_y_coord_raffle_table()
|
||||||
|
|
||||||
|
@ -82,6 +82,11 @@ local function on_entity_died(event)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local current_task = Public.get('current_task')
|
||||||
|
if not current_task.done then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local cause = event.cause
|
local cause = event.cause
|
||||||
|
@ -446,6 +446,11 @@ local function on_player_changed_position(event)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local current_task = Public.get('current_task')
|
||||||
|
if not current_task.done then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local player = game.get_player(event.player_index)
|
local player = game.get_player(event.player_index)
|
||||||
if not player or not player.valid then
|
if not player or not player.valid then
|
||||||
return
|
return
|
||||||
@ -487,6 +492,11 @@ local function on_player_driving_changed_state(event)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local current_task = Public.get('current_task')
|
||||||
|
if not current_task.done then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local player = game.get_player(event.player_index)
|
local player = game.get_player(event.player_index)
|
||||||
if not (player and player.valid) then
|
if not (player and player.valid) then
|
||||||
return
|
return
|
||||||
|
@ -84,7 +84,7 @@ Commands.new('scenario', 'Usable only for admins - controls the scenario!')
|
|||||||
game.print(mapkeeper .. ' server, has reset the game!', { r = 0.98, g = 0.66, b = 0.22 })
|
game.print(mapkeeper .. ' server, has reset the game!', { r = 0.98, g = 0.66, b = 0.22 })
|
||||||
Discord.send_notification_raw(Public.discord_name, 'Server has reset the game!')
|
Discord.send_notification_raw(Public.discord_name, 'Server has reset the game!')
|
||||||
end
|
end
|
||||||
Public.reset_map()
|
Public.set_task('move_players', 'Init')
|
||||||
player.print('Game has been reset!')
|
player.print('Game has been reset!')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -124,7 +124,7 @@ Commands.new('mtn_reverse_map', 'Usable only for admins - reverses the map!')
|
|||||||
local reversed = Public.get_stateful_settings('reversed')
|
local reversed = Public.get_stateful_settings('reversed')
|
||||||
Public.set_stateful_settings('reversed', not reversed)
|
Public.set_stateful_settings('reversed', not reversed)
|
||||||
Discord.send_notification_raw(Public.discord_name, player.name .. ' reversed the map.')
|
Discord.send_notification_raw(Public.discord_name, player.name .. ' reversed the map.')
|
||||||
Public.reset_map()
|
Public.set_task('move_players', 'Init')
|
||||||
game.print(mapkeeper .. player.name .. ', has reverse the map and reset the game!',
|
game.print(mapkeeper .. player.name .. ', has reverse the map and reset the game!',
|
||||||
{ r = 0.98, g = 0.66, b = 0.22 })
|
{ r = 0.98, g = 0.66, b = 0.22 })
|
||||||
player.print('Map reversed.')
|
player.print('Map reversed.')
|
||||||
|
@ -89,7 +89,7 @@ local reset_game =
|
|||||||
if this.soft_reset then
|
if this.soft_reset then
|
||||||
Public.set_scores()
|
Public.set_scores()
|
||||||
this.game_reset_tick = nil
|
this.game_reset_tick = nil
|
||||||
Public.reset_map()
|
Public.set_task('move_players', 'Init')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if this.restart then
|
if this.restart then
|
||||||
@ -743,6 +743,11 @@ local function on_player_mined_entity(event)
|
|||||||
if not entity.valid then
|
if not entity.valid then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local current_task = Public.get('current_task')
|
||||||
|
if not current_task.done then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local rpg_char = RPG.get_value_from_player(player.index)
|
local rpg_char = RPG.get_value_from_player(player.index)
|
||||||
if not rpg_char then return end
|
if not rpg_char then return end
|
||||||
|
|
||||||
@ -797,6 +802,11 @@ local function on_robot_mined_entity(event)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local current_task = Public.get('current_task')
|
||||||
|
if not current_task.done then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if string.sub(entity.surface.name, 0, #scenario_name) ~= scenario_name then
|
if string.sub(entity.surface.name, 0, #scenario_name) ~= scenario_name then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -1342,6 +1352,8 @@ function Public.loco_died(invalid_locomotive)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not Public.is_task_done() then return end
|
||||||
|
|
||||||
local announced_message = Public.get('announced_message')
|
local announced_message = Public.get('announced_message')
|
||||||
if announced_message then
|
if announced_message then
|
||||||
return
|
return
|
||||||
@ -1482,7 +1494,12 @@ end
|
|||||||
|
|
||||||
local function on_built_entity(event)
|
local function on_built_entity(event)
|
||||||
local entity = event.entity
|
local entity = event.entity
|
||||||
if not entity.valid then
|
if not entity or not entity.valid then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if string.sub(entity.surface.name, 0, #scenario_name) == Public.init_name then
|
||||||
|
entity.destroy()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1235,18 +1235,19 @@ function Public.render_direction(surface, reversed)
|
|||||||
Task.set_timeout_in_ticks(50, do_season_fix_token, {})
|
Task.set_timeout_in_ticks(50, do_season_fix_token, {})
|
||||||
|
|
||||||
if counter then
|
if counter then
|
||||||
rendering.draw_text {
|
Public.set('counter',
|
||||||
text = text .. '\nRun: ' .. counter,
|
rendering.draw_text {
|
||||||
surface = surface,
|
text = text .. '\nRun: ' .. counter,
|
||||||
target = { -0, 10 },
|
surface = surface,
|
||||||
color = { r = 0.98, g = 0.66, b = 0.22 },
|
target = { -0, 10 },
|
||||||
scale = 3,
|
color = { r = 0.98, g = 0.66, b = 0.22 },
|
||||||
font = 'heading-1',
|
scale = 3,
|
||||||
alignment = 'center',
|
font = 'heading-1',
|
||||||
scale_with_zoom = false
|
alignment = 'center',
|
||||||
}
|
scale_with_zoom = false
|
||||||
|
})
|
||||||
else
|
else
|
||||||
rendering.draw_text {
|
Public.set('counter', rendering.draw_text {
|
||||||
text = text,
|
text = text,
|
||||||
surface = surface,
|
surface = surface,
|
||||||
target = { -0, 10 },
|
target = { -0, 10 },
|
||||||
@ -1255,7 +1256,7 @@ function Public.render_direction(surface, reversed)
|
|||||||
font = 'heading-1',
|
font = 'heading-1',
|
||||||
alignment = 'center',
|
alignment = 'center',
|
||||||
scale_with_zoom = false
|
scale_with_zoom = false
|
||||||
}
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
local x_min = -zone_settings.zone_width / 2
|
local x_min = -zone_settings.zone_width / 2
|
||||||
@ -1263,20 +1264,21 @@ function Public.render_direction(surface, reversed)
|
|||||||
|
|
||||||
if reversed then
|
if reversed then
|
||||||
local inc = 0
|
local inc = 0
|
||||||
for _ = 1, 5 do
|
for i = 1, 5 do
|
||||||
rendering.draw_text {
|
Public.set('direction_' .. i,
|
||||||
text = '▲',
|
rendering.draw_text {
|
||||||
surface = surface,
|
text = '▲',
|
||||||
target = { -0, -20 - inc },
|
surface = surface,
|
||||||
color = { r = 0.98, g = 0.66, b = 0.22 },
|
target = { -0, -20 - inc },
|
||||||
scale = 3,
|
color = { r = 0.98, g = 0.66, b = 0.22 },
|
||||||
font = 'heading-1',
|
scale = 3,
|
||||||
alignment = 'center',
|
font = 'heading-1',
|
||||||
scale_with_zoom = false
|
alignment = 'center',
|
||||||
}
|
scale_with_zoom = false
|
||||||
|
})
|
||||||
inc = inc + 10
|
inc = inc + 10
|
||||||
end
|
end
|
||||||
rendering.draw_text {
|
Public.set('direction_attack', rendering.draw_text {
|
||||||
text = 'Biters will attack this area.',
|
text = 'Biters will attack this area.',
|
||||||
surface = surface,
|
surface = surface,
|
||||||
target = { -0, -70 },
|
target = { -0, -70 },
|
||||||
@ -1285,13 +1287,13 @@ function Public.render_direction(surface, reversed)
|
|||||||
font = 'heading-1',
|
font = 'heading-1',
|
||||||
alignment = 'center',
|
alignment = 'center',
|
||||||
scale_with_zoom = false
|
scale_with_zoom = false
|
||||||
}
|
})
|
||||||
surface.create_entity({ name = 'electric-beam', position = { x_min, -74 }, source = { x_min, -74 }, target = { x_max, -74 } })
|
surface.create_entity({ name = 'electric-beam', position = { x_min, -74 }, source = { x_min, -74 }, target = { x_max, -74 } })
|
||||||
surface.create_entity({ name = 'electric-beam', position = { x_min, -74 }, source = { x_min, -74 }, target = { x_max, -74 } })
|
surface.create_entity({ name = 'electric-beam', position = { x_min, -74 }, source = { x_min, -74 }, target = { x_max, -74 } })
|
||||||
else
|
else
|
||||||
local inc = 0
|
local inc = 0
|
||||||
for _ = 1, 5 do
|
for i = 1, 5 do
|
||||||
rendering.draw_text {
|
Public.set('direction_' .. i, rendering.draw_text {
|
||||||
text = '▼',
|
text = '▼',
|
||||||
surface = surface,
|
surface = surface,
|
||||||
target = { -0, 20 + inc },
|
target = { -0, 20 + inc },
|
||||||
@ -1300,10 +1302,10 @@ function Public.render_direction(surface, reversed)
|
|||||||
font = 'heading-1',
|
font = 'heading-1',
|
||||||
alignment = 'center',
|
alignment = 'center',
|
||||||
scale_with_zoom = false
|
scale_with_zoom = false
|
||||||
}
|
})
|
||||||
inc = inc + 10
|
inc = inc + 10
|
||||||
end
|
end
|
||||||
rendering.draw_text {
|
Public.set('direction_attack', rendering.draw_text {
|
||||||
text = 'Biters will attack this area.',
|
text = 'Biters will attack this area.',
|
||||||
surface = surface,
|
surface = surface,
|
||||||
target = { -0, 70 },
|
target = { -0, 70 },
|
||||||
@ -1312,7 +1314,7 @@ function Public.render_direction(surface, reversed)
|
|||||||
font = 'heading-1',
|
font = 'heading-1',
|
||||||
alignment = 'center',
|
alignment = 'center',
|
||||||
scale_with_zoom = false
|
scale_with_zoom = false
|
||||||
}
|
})
|
||||||
surface.create_entity({ name = 'electric-beam', position = { x_min, 74 }, source = { x_min, 74 }, target = { x_max, 74 } })
|
surface.create_entity({ name = 'electric-beam', position = { x_min, 74 }, source = { x_min, 74 }, target = { x_max, 74 } })
|
||||||
surface.create_entity({ name = 'electric-beam', position = { x_min, 74 }, source = { x_min, 74 }, target = { x_max, 74 } })
|
surface.create_entity({ name = 'electric-beam', position = { x_min, 74 }, source = { x_min, 74 }, target = { x_max, 74 } })
|
||||||
end
|
end
|
||||||
@ -1475,20 +1477,21 @@ function Public.set_spawn_position()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Public.on_player_joined_game(event)
|
function Public.on_player_joined_game(event)
|
||||||
local active_surface_index = Public.get('active_surface_index')
|
|
||||||
if not active_surface_index then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local players = Public.get('players')
|
local players = Public.get('players')
|
||||||
local player = game.players[event.player_index]
|
local player = game.players[event.player_index]
|
||||||
local surface = game.surfaces[active_surface_index]
|
|
||||||
|
|
||||||
Public.set_difficulty()
|
|
||||||
|
|
||||||
ICW_Func.is_minimap_valid(player, surface)
|
|
||||||
|
|
||||||
Modifiers.update_player_modifiers(player)
|
Modifiers.update_player_modifiers(player)
|
||||||
|
local active_surface_index = Public.get('active_surface_index')
|
||||||
|
local surface = game.surfaces[active_surface_index or 'nauvis']
|
||||||
|
|
||||||
|
local current_task = Public.get('current_task')
|
||||||
|
if not current_task.done then
|
||||||
|
local init_surface = game.get_surface('Init')
|
||||||
|
if init_surface and init_surface.valid then
|
||||||
|
surface = init_surface
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if player.online_time < 1 then
|
if player.online_time < 1 then
|
||||||
if not players[player.index] then
|
if not players[player.index] then
|
||||||
@ -1506,6 +1509,8 @@ function Public.on_player_joined_game(event)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
ICW_Func.is_minimap_valid(player, surface)
|
||||||
|
|
||||||
if player.online_time < 1 then
|
if player.online_time < 1 then
|
||||||
local pos = surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0)
|
local pos = surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0)
|
||||||
if pos then
|
if pos then
|
||||||
|
@ -489,6 +489,7 @@ local map_gen_action_token = Task.register(map_gen_action)
|
|||||||
-- @param event <table> the event table from on_chunk_generated
|
-- @param event <table> the event table from on_chunk_generated
|
||||||
local function schedule_chunk(event)
|
local function schedule_chunk(event)
|
||||||
local surface = event.surface
|
local surface = event.surface
|
||||||
|
if surface.name == 'Init' then return end
|
||||||
local shape = generate_map
|
local shape = generate_map
|
||||||
|
|
||||||
if event.tick < 1 then
|
if event.tick < 1 then
|
||||||
@ -534,6 +535,7 @@ end
|
|||||||
-- @param event <table> the event table from on_chunk_generated
|
-- @param event <table> the event table from on_chunk_generated
|
||||||
local function force_do_chunk(event)
|
local function force_do_chunk(event)
|
||||||
local surface = event.surface
|
local surface = event.surface
|
||||||
|
if surface.name == 'Init' then return end
|
||||||
local shape = generate_map
|
local shape = generate_map
|
||||||
|
|
||||||
if not surface.valid then
|
if not surface.valid then
|
||||||
@ -584,6 +586,10 @@ local function on_chunk(event)
|
|||||||
if final_battle then
|
if final_battle then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
-- local current_task = Public.get('current_task')
|
||||||
|
-- if not current_task or not current_task.done then
|
||||||
|
-- return
|
||||||
|
-- end
|
||||||
|
|
||||||
local force_chunk = Public.get('force_chunk')
|
local force_chunk = Public.get('force_chunk')
|
||||||
local stop_chunk = Public.get('stop_chunk')
|
local stop_chunk = Public.get('stop_chunk')
|
||||||
|
@ -122,6 +122,10 @@ local reconstruct_all_trains =
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
-- local ICW = require 'maps.mountain_fortress_v3.icw.functions'
|
||||||
|
-- local icw_table = require 'maps.mountain_fortress_v3.icw.table'.get()
|
||||||
|
-- ICW.reconstruct_all_trains(icw_table)
|
||||||
|
|
||||||
local remove_non_migrated_doors_token =
|
local remove_non_migrated_doors_token =
|
||||||
Task.register(
|
Task.register(
|
||||||
function (data)
|
function (data)
|
||||||
|
@ -551,6 +551,8 @@ local function on_player_changed_surface(event)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not Public.is_task_done() then return end
|
||||||
|
|
||||||
local active_surface = Public.get('active_surface_index')
|
local active_surface = Public.get('active_surface_index')
|
||||||
local surface = game.surfaces[active_surface]
|
local surface = game.surfaces[active_surface]
|
||||||
if not surface or not surface.valid then
|
if not surface or not surface.valid then
|
||||||
|
@ -1519,6 +1519,10 @@ local function gui_closed(event)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not Public.is_task_done() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local type = event.gui_type
|
local type = event.gui_type
|
||||||
|
|
||||||
if type == defines.gui_type.custom then
|
if type == defines.gui_type.custom then
|
||||||
|
@ -8,6 +8,7 @@ local required_playtime = 5184000 -- 24 hours
|
|||||||
local valid_groups = {
|
local valid_groups = {
|
||||||
['default'] = true,
|
['default'] = true,
|
||||||
['limited'] = true,
|
['limited'] = true,
|
||||||
|
['init_island'] = true,
|
||||||
['main_surface'] = true,
|
['main_surface'] = true,
|
||||||
['near_locomotive'] = true,
|
['near_locomotive'] = true,
|
||||||
['not_trusted'] = true
|
['not_trusted'] = true
|
||||||
@ -18,15 +19,18 @@ function Public.add_player_to_permission_group(player, group, forced)
|
|||||||
local session = Session.get_session_table()
|
local session = Session.get_session_table()
|
||||||
local AG = Antigrief.get()
|
local AG = Antigrief.get()
|
||||||
if not AG then
|
if not AG then
|
||||||
|
log('Antigrief not found.')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local default_group = game.permissions.get_group('Default')
|
local default_group = game.permissions.get_group('Default')
|
||||||
if not default_group then
|
if not default_group then
|
||||||
|
log('Default group not found.')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not valid_groups[string.lower(player.permission_group.name)] then
|
if not valid_groups[string.lower(player.permission_group.name)] then
|
||||||
|
log('Invalid group.')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -57,6 +61,29 @@ function Public.add_player_to_permission_group(player, group, forced)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not game.permissions.get_group('init_island') then
|
||||||
|
local init_island = game.permissions.create_group('init_island')
|
||||||
|
if not init_island then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
init_island.set_allows_action(defines.input_action.cancel_craft, false)
|
||||||
|
init_island.set_allows_action(defines.input_action.drop_item, false)
|
||||||
|
init_island.set_allows_action(defines.input_action.gui_click, false)
|
||||||
|
init_island.set_allows_action(defines.input_action.deconstruct, false)
|
||||||
|
init_island.set_allows_action(defines.input_action.gui_checked_state_changed, false)
|
||||||
|
init_island.set_allows_action(defines.input_action.gui_click, false)
|
||||||
|
init_island.set_allows_action(defines.input_action.gui_confirmed, false)
|
||||||
|
init_island.set_allows_action(defines.input_action.gui_elem_changed, false)
|
||||||
|
init_island.set_allows_action(defines.input_action.gui_hover, false)
|
||||||
|
init_island.set_allows_action(defines.input_action.gui_leave, false)
|
||||||
|
init_island.set_allows_action(defines.input_action.gui_location_changed, false)
|
||||||
|
init_island.set_allows_action(defines.input_action.gui_selected_tab_changed, false)
|
||||||
|
init_island.set_allows_action(defines.input_action.gui_selection_state_changed, false)
|
||||||
|
init_island.set_allows_action(defines.input_action.gui_switch_state_changed, false)
|
||||||
|
init_island.set_allows_action(defines.input_action.gui_text_changed, false)
|
||||||
|
init_island.set_allows_action(defines.input_action.gui_value_changed, false)
|
||||||
|
end
|
||||||
|
|
||||||
if not game.permissions.get_group('near_locomotive') then
|
if not game.permissions.get_group('near_locomotive') then
|
||||||
local near_locomotive_group = game.permissions.create_group('near_locomotive')
|
local near_locomotive_group = game.permissions.create_group('near_locomotive')
|
||||||
if not near_locomotive_group then
|
if not near_locomotive_group then
|
||||||
@ -115,11 +142,7 @@ function Public.add_player_to_permission_group(player, group, forced)
|
|||||||
|
|
||||||
if not AG.enabled then
|
if not AG.enabled then
|
||||||
default_group.add_player(player)
|
default_group.add_player(player)
|
||||||
return
|
log('Antigrief is not enabled. Default group added to player.')
|
||||||
end
|
|
||||||
|
|
||||||
if forced then
|
|
||||||
default_group.add_player(player)
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -177,9 +200,10 @@ function Public.add_player_to_permission_group(player, group, forced)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if playtime < required_playtime then
|
if playtime < required_playtime and not forced then
|
||||||
local not_trusted = game.permissions.get_group('not_trusted')
|
local not_trusted = game.permissions.get_group('not_trusted')
|
||||||
if not not_trusted then
|
if not not_trusted then
|
||||||
|
log('Not trusted group not found.')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -200,6 +224,13 @@ function Public.add_player_to_permission_group(player, group, forced)
|
|||||||
end
|
end
|
||||||
|
|
||||||
main_surface_group_inner.add_player(player)
|
main_surface_group_inner.add_player(player)
|
||||||
|
elseif group == 'init_island' then
|
||||||
|
local init_island = game.permissions.get_group('init_island')
|
||||||
|
if not init_island then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
init_island.add_player(player)
|
||||||
elseif group == 'near_locomotive' then
|
elseif group == 'near_locomotive' then
|
||||||
local near_locomotive_group_inner = game.permissions.get_group('near_locomotive')
|
local near_locomotive_group_inner = game.permissions.get_group('near_locomotive')
|
||||||
if not near_locomotive_group_inner then
|
if not near_locomotive_group_inner then
|
||||||
|
@ -44,31 +44,19 @@ local OfflinePlayers = require 'modules.clear_vacant_players'
|
|||||||
local Beam = require 'modules.render_beam'
|
local Beam = require 'modules.render_beam'
|
||||||
local Commands = require 'utils.commands'
|
local Commands = require 'utils.commands'
|
||||||
|
|
||||||
-- Use these settings for live
|
|
||||||
local send_ping_to_channel = Discord.channel_names.mtn_channel
|
local send_ping_to_channel = Discord.channel_names.mtn_channel
|
||||||
local role_to_mention = Discord.role_mentions.mtn_fortress
|
local role_to_mention = Discord.role_mentions.mtn_fortress
|
||||||
-- Use these settings for testing
|
local mapkeeper = '[color=blue]Mapkeeper:[/color]'
|
||||||
-- bot-lounge
|
|
||||||
-- local send_ping_to_channel = Discord.channel_names.bot_quarters
|
|
||||||
-- local role_to_mention = Discord.role_mentions.test_role
|
|
||||||
|
|
||||||
local floor = math.floor
|
local floor = math.floor
|
||||||
local remove = table.remove
|
local remove = table.remove
|
||||||
local abs = math.abs
|
local abs = math.abs
|
||||||
local partial_reset
|
|
||||||
RPG.disable_cooldowns_on_spells()
|
RPG.disable_cooldowns_on_spells()
|
||||||
Gui.mod_gui_button_enabled = true
|
Gui.mod_gui_button_enabled = true
|
||||||
Gui.button_style = 'mod_gui_button'
|
Gui.button_style = 'mod_gui_button'
|
||||||
Gui.set_toggle_button(true)
|
Gui.set_toggle_button(true)
|
||||||
Gui.set_mod_gui_top_frame(true)
|
Gui.set_mod_gui_top_frame(true)
|
||||||
|
|
||||||
local partial_reset_token =
|
|
||||||
Task.register(
|
|
||||||
function ()
|
|
||||||
partial_reset()
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
local collapse_kill = {
|
local collapse_kill = {
|
||||||
entities = {
|
entities = {
|
||||||
['laser-turret'] = true,
|
['laser-turret'] = true,
|
||||||
@ -114,126 +102,27 @@ local is_position_near_tbl = function (position, tbl)
|
|||||||
return status
|
return status
|
||||||
end
|
end
|
||||||
|
|
||||||
local announce_new_map =
|
local function preinit_task()
|
||||||
Task.register(
|
local this = Public.get()
|
||||||
function ()
|
game.speed = 1
|
||||||
local server_name = Server.check_server_name(Public.discord_name)
|
|
||||||
if server_name then
|
if this.health_text and this.health_text.valid then this.health_text.destroy() end
|
||||||
Server.to_discord_named_raw(send_ping_to_channel, role_to_mention .. ' ** Mtn Fortress was just reset! **')
|
if this.caption and this.caption.valid then this.caption.destroy() end
|
||||||
end
|
if this.circle and this.circle.valid then this.circle.destroy() end
|
||||||
|
if this.current_season and this.current_season.valid then this.current_season.destroy() end
|
||||||
|
if this.counter and this.counter.valid then this.counter.destroy() end
|
||||||
|
if this.direction_attack and this.direction_attack.valid then this.direction_attack.destroy() end
|
||||||
|
if this.zone1_text1 and this.zone1_text1.valid then this.zone1_text1.destroy() end
|
||||||
|
if this.zone1_text2 and this.zone1_text2.valid then this.zone1_text2.destroy() end
|
||||||
|
if this.zone1_text3 and this.zone1_text3.valid then this.zone1_text3.destroy() end
|
||||||
|
|
||||||
|
for i = 1, 5 do
|
||||||
|
if this['direction_' .. i] and this['direction_' .. i].valid then
|
||||||
|
this['direction_' .. i].destroy()
|
||||||
end
|
end
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
partial_reset = function ()
|
|
||||||
local this = Public.get()
|
|
||||||
local surface = game.surfaces[this.active_surface_index]
|
|
||||||
|
|
||||||
if this.adjusted_zones.reversed then
|
|
||||||
Explosives.check_growth_below_void(false)
|
|
||||||
this.spawn_near_collapse.compare = abs(this.spawn_near_collapse.compare)
|
|
||||||
Collapse.set_position({ 0, -130 })
|
|
||||||
Collapse.set_direction('south')
|
|
||||||
Public.locomotive_spawn(surface, { x = -18, y = -25 }, this.adjusted_zones.reversed)
|
|
||||||
else
|
|
||||||
Explosives.check_growth_below_void(true)
|
|
||||||
this.spawn_near_collapse.compare = abs(this.spawn_near_collapse.compare) * -1
|
|
||||||
Collapse.set_position({ 0, 130 })
|
|
||||||
Collapse.set_direction('north')
|
|
||||||
Public.locomotive_spawn(surface, { x = -18, y = 25 }, this.adjusted_zones.reversed)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
init_bonus_drill_force()
|
WD.set('game_lost', true)
|
||||||
|
|
||||||
Public.init_enemy_weapon_damage()
|
|
||||||
|
|
||||||
game.forces.player.manual_mining_speed_modifier = 0
|
|
||||||
game.forces.player.set_ammo_damage_modifier('artillery-shell', -0.95)
|
|
||||||
game.forces.player.worker_robots_battery_modifier = 4
|
|
||||||
game.forces.player.worker_robots_storage_bonus = 15
|
|
||||||
|
|
||||||
Public.render_train_hp()
|
|
||||||
Public.render_direction(surface, this.adjusted_zones.reversed)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Public.reset_map()
|
|
||||||
rendering.clear()
|
|
||||||
local this = Public.get()
|
|
||||||
this.active_surface_index = Public.create_surface()
|
|
||||||
|
|
||||||
game.forces.player.reset()
|
|
||||||
Public.reset_main_table()
|
|
||||||
|
|
||||||
Difficulty.show_gui(false)
|
|
||||||
|
|
||||||
local wave_defense_table = WD.get_table()
|
|
||||||
Misc.reset()
|
|
||||||
Misc.bottom_button(true)
|
|
||||||
|
|
||||||
LinkedChests.reset()
|
|
||||||
|
|
||||||
Public.stateful.clear_all_frames()
|
|
||||||
|
|
||||||
Autostash.insert_into_furnace(true)
|
|
||||||
Autostash.insert_into_wagon(true)
|
|
||||||
Autostash.bottom_button(true)
|
|
||||||
BottomFrame.reset()
|
|
||||||
BottomFrame.activate_custom_buttons(true)
|
|
||||||
Public.reset_buried_biters()
|
|
||||||
Poll.reset()
|
|
||||||
ICW.reset()
|
|
||||||
IC.reset()
|
|
||||||
IC.allowed_surface(game.surfaces[this.active_surface_index].name)
|
|
||||||
Public.reset_func_table()
|
|
||||||
game.reset_time_played()
|
|
||||||
|
|
||||||
OfflinePlayers.init(this.active_surface_index)
|
|
||||||
OfflinePlayers.set_enabled(true)
|
|
||||||
-- OfflinePlayers.set_offline_players_surface_removal(true)
|
|
||||||
|
|
||||||
Group.reset_groups()
|
|
||||||
Group.alphanumeric_only(false)
|
|
||||||
|
|
||||||
Public.disable_tech()
|
|
||||||
|
|
||||||
local surface = game.surfaces[this.active_surface_index]
|
|
||||||
|
|
||||||
if this.winter_mode then
|
|
||||||
surface.daytime = 0.45
|
|
||||||
end
|
|
||||||
|
|
||||||
-- surface.brightness_visual_weights = {0.7, 0.7, 0.7}
|
|
||||||
|
|
||||||
JailData.set_valid_surface(tostring(surface.name))
|
|
||||||
JailData.reset_vote_table()
|
|
||||||
|
|
||||||
Explosives.set_surface_whitelist({ [surface.name] = true })
|
|
||||||
Explosives.disable(false)
|
|
||||||
Explosives.slow_explode(true)
|
|
||||||
|
|
||||||
Beam.reset_valid_targets()
|
|
||||||
|
|
||||||
BiterHealthBooster.set_active_surface(tostring(surface.name))
|
|
||||||
BiterHealthBooster.acid_nova(true)
|
|
||||||
BiterHealthBooster.check_on_entity_died(true)
|
|
||||||
BiterHealthBooster.boss_spawns_projectiles(true)
|
|
||||||
BiterHealthBooster.enable_boss_loot(false)
|
|
||||||
BiterHealthBooster.enable_randomize_stun_and_slowdown_sticker(true)
|
|
||||||
|
|
||||||
|
|
||||||
-- AntiGrief.whitelist_types('tree', true)
|
|
||||||
AntiGrief.enable_capsule_warning(false)
|
|
||||||
AntiGrief.enable_capsule_cursor_warning(false)
|
|
||||||
AntiGrief.enable_jail(true)
|
|
||||||
AntiGrief.damage_entity_threshold(20)
|
|
||||||
AntiGrief.decon_surface_blacklist(surface.name)
|
|
||||||
AntiGrief.filtered_types_on_decon({ 'tree', 'simple-entity', 'fish' })
|
|
||||||
AntiGrief.set_limit_per_table(2000)
|
|
||||||
|
|
||||||
PL.show_roles_in_list(true)
|
|
||||||
PL.rpg_enabled(true)
|
|
||||||
|
|
||||||
Score.reset_tbl()
|
|
||||||
|
|
||||||
local players = game.connected_players
|
local players = game.connected_players
|
||||||
for i = 1, #players do
|
for i = 1, #players do
|
||||||
@ -245,132 +134,19 @@ function Public.reset_map()
|
|||||||
if player.gui.left['mvps'] then
|
if player.gui.left['mvps'] then
|
||||||
player.gui.left['mvps'].destroy()
|
player.gui.left['mvps'].destroy()
|
||||||
end
|
end
|
||||||
|
WD.destroy_wave_gui(player)
|
||||||
ICMinimap.kill_minimap(player)
|
ICMinimap.kill_minimap(player)
|
||||||
Event.raise(Public.events.reset_map, { player_index = player.index })
|
Event.raise(Public.events.reset_map, { player_index = player.index })
|
||||||
end
|
Public.add_player_to_permission_group(player, 'init_island', true)
|
||||||
|
player.print(mapkeeper .. ' Map is resetting, please wait a moment. All GUI buttons are disabled at the moment.')
|
||||||
Difficulty.reset_difficulty_poll({ closing_timeout = game.tick + 36000 })
|
|
||||||
Difficulty.set_gui_width(20)
|
|
||||||
|
|
||||||
Collapse.set_kill_entities(false)
|
|
||||||
Collapse.set_kill_specific_entities(collapse_kill)
|
|
||||||
Collapse.set_speed(8)
|
|
||||||
Collapse.set_amount(1)
|
|
||||||
-- Collapse.set_max_line_size(zone_settings.zone_width)
|
|
||||||
Collapse.set_max_line_size(540, true)
|
|
||||||
Collapse.set_surface_index(surface.index)
|
|
||||||
|
|
||||||
Collapse.start_now(false)
|
|
||||||
|
|
||||||
RPG.reset_table()
|
|
||||||
|
|
||||||
Public.stateful.enable(true)
|
|
||||||
Public.stateful.reset_stateful(true, true)
|
|
||||||
Public.stateful.increase_enemy_damage_and_health()
|
|
||||||
Public.stateful.apply_startup_settings()
|
|
||||||
|
|
||||||
this.locomotive_health = 10000
|
|
||||||
this.locomotive_max_health = 10000
|
|
||||||
|
|
||||||
WD.reset_wave_defense()
|
|
||||||
wave_defense_table.surface_index = this.active_surface_index
|
|
||||||
wave_defense_table.target = this.locomotive
|
|
||||||
wave_defense_table.nest_building_density = 32
|
|
||||||
wave_defense_table.game_lost = false
|
|
||||||
wave_defense_table.spawn_position = { x = 0, y = 84 }
|
|
||||||
WD.alert_boss_wave(true)
|
|
||||||
WD.enable_side_target(false)
|
|
||||||
WD.remove_entities(true)
|
|
||||||
WD.enable_threat_log(false) -- creates waaaay to many entries in the global table
|
|
||||||
WD.check_collapse_position(true)
|
|
||||||
WD.set_disable_threat_below_zero(true)
|
|
||||||
WD.increase_boss_health_per_wave(true)
|
|
||||||
WD.increase_damage_per_wave(true)
|
|
||||||
WD.increase_health_per_wave(true)
|
|
||||||
WD.increase_average_unit_group_size(true)
|
|
||||||
WD.increase_max_active_unit_groups(true)
|
|
||||||
WD.enable_random_spawn_positions(true)
|
|
||||||
WD.set_track_bosses_only(true)
|
|
||||||
WD.set_pause_waves_custom_callback(Public.pause_waves_custom_callback_token)
|
|
||||||
WD.set_threat_event_custom_callback(Public.check_if_spawning_near_train_custom_callback)
|
|
||||||
-- WD.set_es_unit_limit(400) -- moved to stateful
|
|
||||||
Event.raise(WD.events.on_game_reset, {})
|
|
||||||
|
|
||||||
Public.set_difficulty()
|
|
||||||
Public.disable_creative()
|
|
||||||
Public.boost_difficulty()
|
|
||||||
Commands.restore_states()
|
|
||||||
|
|
||||||
if this.adjusted_zones.reversed then
|
|
||||||
if not surface.is_chunk_generated({ x = -20, y = -22 }) then
|
|
||||||
surface.request_to_generate_chunks({ x = -20, y = -22 }, 1)
|
|
||||||
surface.force_generate_chunk_requests()
|
|
||||||
end
|
|
||||||
game.forces.player.set_spawn_position({ x = -27, y = -25 }, surface)
|
|
||||||
WD.set_spawn_position({ x = -16, y = -80 })
|
|
||||||
WD.enable_inverted(true)
|
|
||||||
else
|
|
||||||
if not surface.is_chunk_generated({ x = -20, y = 22 }) then
|
|
||||||
surface.request_to_generate_chunks({ x = -20, y = 22 }, 1)
|
|
||||||
surface.force_generate_chunk_requests()
|
|
||||||
end
|
|
||||||
game.forces.player.set_spawn_position({ x = -27, y = 25 }, surface)
|
|
||||||
WD.set_spawn_position({ x = -16, y = 80 })
|
|
||||||
WD.enable_inverted(false)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Public.sr_reset_forces()
|
Public.sr_reset_forces()
|
||||||
Public.sr_teleport_players()
|
WD.set('wave_interval', 4500)
|
||||||
|
|
||||||
game.speed = 1
|
|
||||||
if this.space_age then
|
|
||||||
surface.destroy_decoratives({ name = "brown-cup", invert = true })
|
|
||||||
surface.destroy_decoratives({ name = "small-sand-rock", invert = true })
|
|
||||||
end
|
|
||||||
|
|
||||||
Task.set_queue_speed(16)
|
|
||||||
|
|
||||||
Public.get_scores()
|
|
||||||
|
|
||||||
this.chunk_load_tick = game.tick + 400
|
|
||||||
this.force_chunk = true
|
|
||||||
this.market_announce = game.tick + 1200
|
|
||||||
this.game_lost = false
|
|
||||||
|
|
||||||
RPG.rpg_reset_all_players()
|
|
||||||
RPG.set_surface_name({ game.surfaces[this.active_surface_index].name })
|
|
||||||
RPG.enable_health_and_mana_bars(true)
|
|
||||||
RPG.enable_wave_defense(true)
|
|
||||||
RPG.enable_mana(true)
|
|
||||||
RPG.personal_tax_rate(0.4)
|
|
||||||
RPG.enable_stone_path(true)
|
|
||||||
RPG.enable_aoe_punch(true)
|
|
||||||
RPG.enable_aoe_punch_globally(false)
|
|
||||||
RPG.enable_range_buffs(true)
|
|
||||||
RPG.enable_auto_allocate(true)
|
|
||||||
RPG.enable_explosive_bullets_globally(true)
|
|
||||||
RPG.enable_explosive_bullets(false)
|
|
||||||
RPG_Progression.toggle_module(false)
|
|
||||||
RPG_Progression.set_dataset('mtn_v3_rpg_prestige')
|
|
||||||
|
|
||||||
if Public.get('prestige_system_enabled') then
|
|
||||||
RPG_Progression.restore_xp_on_reset()
|
|
||||||
end
|
|
||||||
|
|
||||||
if _DEBUG then
|
|
||||||
Collapse.start_now(false)
|
|
||||||
WD.disable_spawning_biters(true)
|
|
||||||
end
|
|
||||||
|
|
||||||
if not this.disable_startup_notification then
|
|
||||||
Task.set_timeout_in_ticks(25, announce_new_map)
|
|
||||||
end
|
|
||||||
|
|
||||||
Public.equip_players(nil, false)
|
|
||||||
|
|
||||||
Task.set_timeout_in_ticks(100, partial_reset_token, {})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local is_locomotive_valid = function ()
|
local is_locomotive_valid = function ()
|
||||||
local locomotive = Public.get('locomotive')
|
local locomotive = Public.get('locomotive')
|
||||||
if game.ticks_played < 1000 then return end
|
if game.ticks_played < 1000 then return end
|
||||||
@ -418,7 +194,7 @@ local has_the_game_ended = function ()
|
|||||||
if this.soft_reset and this.game_reset_tick == 0 then
|
if this.soft_reset and this.game_reset_tick == 0 then
|
||||||
this.game_reset_tick = nil
|
this.game_reset_tick = nil
|
||||||
Public.set_scores()
|
Public.set_scores()
|
||||||
Public.reset_map()
|
Public.set_task('move_players', 'Init')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -587,6 +363,29 @@ local handle_changes = function ()
|
|||||||
print('Received new changes from backend.')
|
print('Received new changes from backend.')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local scenario_manager = function ()
|
||||||
|
local current_task = Public.get('current_task')
|
||||||
|
if not current_task then return end
|
||||||
|
|
||||||
|
if current_task.delay then
|
||||||
|
if game.tick < current_task.delay then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if Public[current_task.state] then
|
||||||
|
local old_task = current_task.state
|
||||||
|
current_task.state = 'idle'
|
||||||
|
current_task.step = current_task.step + 1
|
||||||
|
Public[old_task](current_task)
|
||||||
|
if current_task.message and current_task.show_messages then
|
||||||
|
game.print(mapkeeper .. ' ' .. current_task.message)
|
||||||
|
else
|
||||||
|
game.print(mapkeeper .. ' Generating map... Current task: ' .. current_task.step)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local nth_40_tick = function ()
|
local nth_40_tick = function ()
|
||||||
if game.tick < 30 then return end
|
if game.tick < 30 then return end
|
||||||
local update_gui = Public.update_gui
|
local update_gui = Public.update_gui
|
||||||
@ -616,15 +415,351 @@ local nth_1000_tick = function ()
|
|||||||
Public.is_creativity_mode_on()
|
Public.is_creativity_mode_on()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Public.create_locomotive(current_task)
|
||||||
|
if Public.get('disable_startup_notification') then return end
|
||||||
|
local adjusted_zones = Public.get('adjusted_zones')
|
||||||
|
local spawn_near_collapse = Public.get('spawn_near_collapse')
|
||||||
|
local surface_index = Public.get('active_surface_index')
|
||||||
|
local surface = game.surfaces[surface_index]
|
||||||
|
if not surface or not surface.valid then return end
|
||||||
|
|
||||||
|
if adjusted_zones.reversed then
|
||||||
|
Explosives.check_growth_below_void(false)
|
||||||
|
spawn_near_collapse.compare = abs(spawn_near_collapse.compare)
|
||||||
|
Collapse.set_position({ 0, -130 })
|
||||||
|
Collapse.set_direction('south')
|
||||||
|
Public.locomotive_spawn(surface, { x = -18, y = -25 }, adjusted_zones.reversed)
|
||||||
|
else
|
||||||
|
Explosives.check_growth_below_void(true)
|
||||||
|
spawn_near_collapse.compare = abs(spawn_near_collapse.compare) * -1
|
||||||
|
Collapse.set_position({ 0, 130 })
|
||||||
|
Collapse.set_direction('north')
|
||||||
|
Public.locomotive_spawn(surface, { x = -18, y = 25 }, adjusted_zones.reversed)
|
||||||
|
end
|
||||||
|
|
||||||
|
Public.render_train_hp()
|
||||||
|
Public.render_direction(surface, adjusted_zones.reversed)
|
||||||
|
|
||||||
|
current_task.message = 'Created locomotive!'
|
||||||
|
current_task.delay = game.tick + 60
|
||||||
|
current_task.state = 'announce_new_map'
|
||||||
|
end
|
||||||
|
|
||||||
|
function Public.announce_new_map(current_task)
|
||||||
|
if Public.get('disable_startup_notification') then return end
|
||||||
|
local server_name = Server.check_server_name(Public.discord_name)
|
||||||
|
if server_name then
|
||||||
|
Server.to_discord_named_raw(send_ping_to_channel, role_to_mention .. ' ** Mtn Fortress was just reset! **')
|
||||||
|
end
|
||||||
|
current_task.message = 'Announced new map!'
|
||||||
|
current_task.state = 'move_players_to_nauvis'
|
||||||
|
current_task.surface_name = 'nauvis'
|
||||||
|
current_task.delay = game.tick + 200
|
||||||
|
current_task.done = true
|
||||||
|
end
|
||||||
|
|
||||||
|
function Public.move_players(current_task)
|
||||||
|
local surface = game.get_surface(current_task.surface_name)
|
||||||
|
if not surface or not surface.valid then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
current_task.done = nil
|
||||||
|
current_task.step = 1
|
||||||
|
|
||||||
|
preinit_task()
|
||||||
|
|
||||||
|
for _, player in pairs(game.players) do
|
||||||
|
local pos = surface.find_non_colliding_position("character", { x = 0, y = 0 }, 3, 0)
|
||||||
|
if pos then
|
||||||
|
player.teleport(pos, surface)
|
||||||
|
else
|
||||||
|
player.teleport({ x = 0, y = 0 }, surface)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
current_task.message = 'Moved players to initial surface!'
|
||||||
|
current_task.delay = game.tick + 200
|
||||||
|
current_task.state = 'init_stateful'
|
||||||
|
end
|
||||||
|
|
||||||
|
function Public.move_players_to_nauvis(current_task)
|
||||||
|
local surface = game.get_surface(current_task.surface_name)
|
||||||
|
if not surface or not surface.valid then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local adjusted_zones = Public.get('adjusted_zones')
|
||||||
|
local position
|
||||||
|
|
||||||
|
WD.set('game_lost', false)
|
||||||
|
|
||||||
|
if adjusted_zones.reversed then
|
||||||
|
game.forces.player.set_spawn_position({ -27, -25 }, surface)
|
||||||
|
position = game.forces.player.get_spawn_position(surface)
|
||||||
|
|
||||||
|
if not position then
|
||||||
|
game.forces.player.set_spawn_position({ -27, -25 }, surface)
|
||||||
|
position = game.forces.player.get_spawn_position(surface)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
game.forces.player.set_spawn_position({ -27, 25 }, surface)
|
||||||
|
position = game.forces.player.get_spawn_position(surface)
|
||||||
|
|
||||||
|
if not position then
|
||||||
|
game.forces.player.set_spawn_position({ -27, 25 }, surface)
|
||||||
|
position = game.forces.player.get_spawn_position(surface)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, player in pairs(game.connected_players) do
|
||||||
|
Public.add_player_to_permission_group(player, 'near_locomotive', true)
|
||||||
|
local pos = surface.find_non_colliding_position('character', position, 3, 0)
|
||||||
|
if pos then
|
||||||
|
player.teleport({ x = pos.x, y = pos.y }, surface)
|
||||||
|
else
|
||||||
|
player.teleport({ x = position.x, y = position.y }, surface)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
current_task.message = 'Moved players back to nauvis!'
|
||||||
|
if current_task.done then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
current_task.state = 'clear_nauvis'
|
||||||
|
end
|
||||||
|
|
||||||
|
function Public.init_stateful(current_task)
|
||||||
|
Public.reset_main_table()
|
||||||
|
Public.stateful.enable(true)
|
||||||
|
Public.stateful.reset_stateful(false, true)
|
||||||
|
Public.stateful.increase_enemy_damage_and_health()
|
||||||
|
Public.stateful.apply_startup_settings()
|
||||||
|
current_task.message = 'Initialized stateful!'
|
||||||
|
current_task.state = 'clear_nauvis'
|
||||||
|
end
|
||||||
|
|
||||||
|
function Public.create_custom_nauvis_surface(current_task)
|
||||||
|
local nauvis = game.surfaces['nauvis']
|
||||||
|
if nauvis then
|
||||||
|
nauvis.clear()
|
||||||
|
end
|
||||||
|
Public.set('active_surface_index', Public.create_surface())
|
||||||
|
current_task.message = 'Created custom nauvis surface!'
|
||||||
|
current_task.delay = game.tick + 300
|
||||||
|
current_task.state = 'reset_map'
|
||||||
|
end
|
||||||
|
|
||||||
|
function Public.clear_nauvis(current_task)
|
||||||
|
local surface = game.surfaces['nauvis']
|
||||||
|
surface.clear()
|
||||||
|
|
||||||
|
surface.request_to_generate_chunks({ x = -20, y = -22 }, 1)
|
||||||
|
surface.force_generate_chunk_requests()
|
||||||
|
|
||||||
|
current_task.state = 'create_custom_nauvis_surface'
|
||||||
|
current_task.delay = game.tick + 50
|
||||||
|
current_task.message = 'Cleared nauvis!'
|
||||||
|
end
|
||||||
|
|
||||||
|
function Public.reset_map(current_task)
|
||||||
|
local this = Public.get()
|
||||||
|
|
||||||
|
Difficulty.show_gui(false)
|
||||||
|
|
||||||
|
local wave_defense_table = WD.get_table()
|
||||||
|
Misc.reset()
|
||||||
|
|
||||||
|
|
||||||
|
LinkedChests.reset()
|
||||||
|
|
||||||
|
Public.stateful.clear_all_frames()
|
||||||
|
|
||||||
|
BottomFrame.reset()
|
||||||
|
Public.reset_buried_biters()
|
||||||
|
Poll.reset()
|
||||||
|
ICW.reset()
|
||||||
|
IC.reset()
|
||||||
|
IC.allowed_surface(game.surfaces[this.active_surface_index].name)
|
||||||
|
Public.reset_func_table()
|
||||||
|
game.reset_time_played()
|
||||||
|
|
||||||
|
OfflinePlayers.init(this.active_surface_index)
|
||||||
|
OfflinePlayers.set_enabled(true)
|
||||||
|
-- OfflinePlayers.set_offline_players_surface_removal(true)
|
||||||
|
|
||||||
|
Group.reset_groups()
|
||||||
|
Group.alphanumeric_only(false)
|
||||||
|
|
||||||
|
Public.disable_tech()
|
||||||
|
|
||||||
|
local surface = game.surfaces[this.active_surface_index]
|
||||||
|
|
||||||
|
if this.winter_mode then
|
||||||
|
surface.daytime = 0.45
|
||||||
|
end
|
||||||
|
|
||||||
|
-- surface.brightness_visual_weights = {0.7, 0.7, 0.7}
|
||||||
|
|
||||||
|
JailData.set_valid_surface(tostring(surface.name))
|
||||||
|
JailData.reset_vote_table()
|
||||||
|
Explosives.set_surface_whitelist({ [surface.name] = true })
|
||||||
|
Beam.reset_valid_targets()
|
||||||
|
BiterHealthBooster.set_active_surface(tostring(surface.name))
|
||||||
|
|
||||||
|
-- AntiGrief.whitelist_types('tree', true)
|
||||||
|
|
||||||
|
AntiGrief.decon_surface_blacklist(surface.name)
|
||||||
|
|
||||||
|
Score.reset_tbl()
|
||||||
|
|
||||||
|
Difficulty.reset_difficulty_poll({ closing_timeout = game.tick + 36000 })
|
||||||
|
Collapse.set_max_line_size(540, true)
|
||||||
|
Collapse.set_speed(8)
|
||||||
|
Collapse.set_amount(1)
|
||||||
|
Collapse.set_surface_index(surface.index)
|
||||||
|
Collapse.start_now(false)
|
||||||
|
|
||||||
|
RPG.reset_table()
|
||||||
|
|
||||||
|
init_bonus_drill_force()
|
||||||
|
|
||||||
|
Public.init_enemy_weapon_damage()
|
||||||
|
|
||||||
|
game.forces.player.manual_mining_speed_modifier = 0
|
||||||
|
game.forces.player.set_ammo_damage_modifier('artillery-shell', -0.95)
|
||||||
|
game.forces.player.worker_robots_battery_modifier = 4
|
||||||
|
game.forces.player.worker_robots_storage_bonus = 15
|
||||||
|
|
||||||
|
WD.reset_wave_defense()
|
||||||
|
wave_defense_table.surface_index = this.active_surface_index
|
||||||
|
wave_defense_table.target = this.locomotive
|
||||||
|
wave_defense_table.nest_building_density = 32
|
||||||
|
wave_defense_table.game_lost = false
|
||||||
|
wave_defense_table.spawn_position = { x = 0, y = 84 }
|
||||||
|
|
||||||
|
-- WD.set_es_unit_limit(400) -- moved to stateful
|
||||||
|
Event.raise(WD.events.on_game_reset, {})
|
||||||
|
|
||||||
|
Public.set_difficulty()
|
||||||
|
Public.disable_creative()
|
||||||
|
Public.boost_difficulty()
|
||||||
|
Commands.restore_states()
|
||||||
|
|
||||||
|
if this.adjusted_zones.reversed then
|
||||||
|
if not surface.is_chunk_generated({ x = -20, y = -22 }) then
|
||||||
|
surface.request_to_generate_chunks({ x = -20, y = -22 }, 1)
|
||||||
|
surface.force_generate_chunk_requests()
|
||||||
|
end
|
||||||
|
game.forces.player.set_spawn_position({ x = -27, y = -25 }, surface)
|
||||||
|
WD.set_spawn_position({ x = -16, y = -80 })
|
||||||
|
WD.enable_inverted(true)
|
||||||
|
else
|
||||||
|
if not surface.is_chunk_generated({ x = -20, y = 22 }) then
|
||||||
|
surface.request_to_generate_chunks({ x = -20, y = 22 }, 1)
|
||||||
|
surface.force_generate_chunk_requests()
|
||||||
|
end
|
||||||
|
game.forces.player.set_spawn_position({ x = -27, y = 25 }, surface)
|
||||||
|
WD.set_spawn_position({ x = -16, y = 80 })
|
||||||
|
WD.enable_inverted(false)
|
||||||
|
end
|
||||||
|
|
||||||
|
if this.space_age then
|
||||||
|
surface.destroy_decoratives({ name = "brown-cup", invert = true })
|
||||||
|
surface.destroy_decoratives({ name = "small-sand-rock", invert = true })
|
||||||
|
end
|
||||||
|
|
||||||
|
Task.set_queue_speed(16)
|
||||||
|
|
||||||
|
Public.get_scores()
|
||||||
|
|
||||||
|
this.chunk_load_tick = game.tick + 400
|
||||||
|
this.force_chunk = true
|
||||||
|
this.market_announce = game.tick + 1200
|
||||||
|
this.game_lost = false
|
||||||
|
|
||||||
|
RPG.enable_health_and_mana_bars(true)
|
||||||
|
RPG.enable_wave_defense(true)
|
||||||
|
RPG.enable_mana(true)
|
||||||
|
RPG.personal_tax_rate(0.4)
|
||||||
|
RPG.enable_stone_path(true)
|
||||||
|
RPG.enable_aoe_punch(true)
|
||||||
|
RPG.enable_aoe_punch_globally(false)
|
||||||
|
RPG.enable_range_buffs(true)
|
||||||
|
RPG.enable_auto_allocate(true)
|
||||||
|
RPG.enable_explosive_bullets_globally(true)
|
||||||
|
RPG.enable_explosive_bullets(false)
|
||||||
|
RPG.rpg_reset_all_players()
|
||||||
|
RPG.set_surface_name({ game.surfaces[this.active_surface_index].name })
|
||||||
|
|
||||||
|
|
||||||
|
if _DEBUG then
|
||||||
|
Collapse.start_now(false)
|
||||||
|
WD.disable_spawning_biters(true)
|
||||||
|
end
|
||||||
|
|
||||||
|
Public.equip_players(nil, false)
|
||||||
|
|
||||||
|
current_task.message = 'Reset map done!'
|
||||||
|
current_task.delay = game.tick + 60
|
||||||
|
current_task.state = 'create_locomotive'
|
||||||
|
end
|
||||||
|
|
||||||
function Public.init_mtn()
|
function Public.init_mtn()
|
||||||
Public.reset_map()
|
Misc.bottom_button(true)
|
||||||
|
BottomFrame.activate_custom_buttons(true)
|
||||||
|
Autostash.bottom_button(true)
|
||||||
|
Autostash.insert_into_furnace(true)
|
||||||
|
Autostash.insert_into_wagon(true)
|
||||||
|
Difficulty.set_gui_width(20)
|
||||||
|
|
||||||
|
|
||||||
|
RPG_Progression.toggle_module(false)
|
||||||
|
RPG_Progression.set_dataset('mtn_v3_rpg_prestige')
|
||||||
|
|
||||||
|
if Public.get('prestige_system_enabled') then
|
||||||
|
RPG_Progression.restore_xp_on_reset()
|
||||||
|
end
|
||||||
|
|
||||||
|
WD.alert_boss_wave(true)
|
||||||
|
WD.enable_side_target(false)
|
||||||
|
WD.remove_entities(true)
|
||||||
|
WD.enable_threat_log(false) -- creates waaaay to many entries in the global table
|
||||||
|
WD.check_collapse_position(true)
|
||||||
|
WD.set_disable_threat_below_zero(true)
|
||||||
|
WD.increase_boss_health_per_wave(true)
|
||||||
|
WD.increase_damage_per_wave(true)
|
||||||
|
WD.increase_health_per_wave(true)
|
||||||
|
WD.increase_average_unit_group_size(true)
|
||||||
|
WD.increase_max_active_unit_groups(true)
|
||||||
|
WD.enable_random_spawn_positions(true)
|
||||||
|
WD.set_track_bosses_only(true)
|
||||||
|
WD.set_pause_waves_custom_callback(Public.pause_waves_custom_callback_token)
|
||||||
|
WD.set_threat_event_custom_callback(Public.check_if_spawning_near_train_custom_callback)
|
||||||
|
|
||||||
|
Explosives.disable(false)
|
||||||
|
Explosives.slow_explode(true)
|
||||||
|
BiterHealthBooster.acid_nova(true)
|
||||||
|
BiterHealthBooster.check_on_entity_died(true)
|
||||||
|
BiterHealthBooster.boss_spawns_projectiles(true)
|
||||||
|
BiterHealthBooster.enable_boss_loot(false)
|
||||||
|
BiterHealthBooster.enable_randomize_stun_and_slowdown_sticker(true)
|
||||||
|
AntiGrief.enable_capsule_warning(false)
|
||||||
|
AntiGrief.enable_capsule_cursor_warning(false)
|
||||||
|
AntiGrief.enable_jail(true)
|
||||||
|
AntiGrief.damage_entity_threshold(20)
|
||||||
|
AntiGrief.filtered_types_on_decon({ 'tree', 'simple-entity', 'fish' })
|
||||||
|
AntiGrief.set_limit_per_table(2000)
|
||||||
|
PL.show_roles_in_list(true)
|
||||||
|
PL.rpg_enabled(true)
|
||||||
|
Collapse.set_kill_entities(false)
|
||||||
|
Collapse.set_kill_specific_entities(collapse_kill)
|
||||||
|
|
||||||
|
Public.create_landing_surface()
|
||||||
|
|
||||||
local tooltip = {
|
local tooltip = {
|
||||||
[1] = ({ 'main.diff_tooltip', '500', '50%', '15%', '15%', '1', '12', '50', '10000', '100%', '15', '10' }),
|
[1] = ({ 'main.diff_tooltip', '500', '50%', '15%', '15%', '1', '12', '50', '10000', '100%', '15', '10' }),
|
||||||
[2] = ({ 'main.diff_tooltip', '300', '25%', '10%', '10%', '2', '10', '50', '7000', '75%', '8', '8' }),
|
[2] = ({ 'main.diff_tooltip', '300', '25%', '10%', '10%', '2', '10', '50', '7000', '75%', '8', '8' }),
|
||||||
[3] = ({ 'main.diff_tooltip', '50', '0%', '0%', '0%', '4', '3', '10', '5000', '50%', '5', '6' })
|
[3] = ({ 'main.diff_tooltip', '50', '0%', '0%', '0%', '4', '3', '10', '5000', '50%', '5', '6' })
|
||||||
}
|
}
|
||||||
|
|
||||||
Difficulty.set_tooltip(tooltip)
|
Difficulty.set_tooltip(tooltip)
|
||||||
|
|
||||||
local T = Map.Pop_info()
|
local T = Map.Pop_info()
|
||||||
@ -658,26 +793,10 @@ Server.on_scenario_changed(
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Event.add(defines.events.on_tick, scenario_manager)
|
||||||
Event.on_nth_tick(40, nth_40_tick)
|
Event.on_nth_tick(40, nth_40_tick)
|
||||||
Event.on_nth_tick(250, nth_250_tick)
|
Event.on_nth_tick(250, nth_250_tick)
|
||||||
Event.on_nth_tick(1000, nth_1000_tick)
|
Event.on_nth_tick(1000, nth_1000_tick)
|
||||||
|
Event.on_init(Public.init_mtn)
|
||||||
Event.add(
|
|
||||||
defines.events.on_player_created,
|
|
||||||
function (event)
|
|
||||||
if event.player_index == 1 then
|
|
||||||
if not game.is_multiplayer() then
|
|
||||||
Public.init_mtn()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
Event.on_init(function ()
|
|
||||||
local nauvis = game.surfaces.nauvis
|
|
||||||
nauvis.clear(true)
|
|
||||||
nauvis.request_to_generate_chunks({ 0, 0 }, 3)
|
|
||||||
nauvis.force_generate_chunk_requests()
|
|
||||||
end)
|
|
||||||
|
|
||||||
return Public
|
return Public
|
||||||
|
@ -818,6 +818,8 @@ main_frame = function (player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function update_data()
|
local function update_data()
|
||||||
|
if not Public.is_task_done() then return end
|
||||||
|
|
||||||
local players = game.connected_players
|
local players = game.connected_players
|
||||||
local stateful = Public.get_stateful()
|
local stateful = Public.get_stateful()
|
||||||
local breached_wall = Public.get('breached_wall')
|
local breached_wall = Public.get('breached_wall')
|
||||||
@ -1000,6 +1002,8 @@ local function update_raw()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not Public.is_task_done() then return end
|
||||||
|
|
||||||
local stateful = Public.get_stateful()
|
local stateful = Public.get_stateful()
|
||||||
if not stateful or not stateful.objectives then
|
if not stateful or not stateful.objectives then
|
||||||
return
|
return
|
||||||
|
@ -1361,7 +1361,6 @@ local apply_settings_token =
|
|||||||
|
|
||||||
this.objectives = {}
|
this.objectives = {}
|
||||||
|
|
||||||
Public.reset_stateful()
|
|
||||||
Public.increase_enemy_damage_and_health()
|
Public.increase_enemy_damage_and_health()
|
||||||
Public.init_mtn()
|
Public.init_mtn()
|
||||||
end
|
end
|
||||||
@ -1679,9 +1678,6 @@ function Public.reset_stateful(refresh_gui, clear_buffs)
|
|||||||
end
|
end
|
||||||
|
|
||||||
this.objectives = t
|
this.objectives = t
|
||||||
|
|
||||||
Public.reset_main_table()
|
|
||||||
|
|
||||||
clear_all_stats()
|
clear_all_stats()
|
||||||
|
|
||||||
apply_buffs()
|
apply_buffs()
|
||||||
|
@ -68,6 +68,72 @@ function Public.create_surface()
|
|||||||
return this.active_surface_index
|
return this.active_surface_index
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Public.create_landing_surface()
|
||||||
|
local map_gen_settings = {
|
||||||
|
autoplace_controls = {
|
||||||
|
['coal'] = { frequency = 25, size = 3, richness = 3 },
|
||||||
|
['stone'] = { frequency = 25, size = 3, richness = 3 },
|
||||||
|
['copper-ore'] = { frequency = 25, size = 3, richness = 3 },
|
||||||
|
['iron-ore'] = { frequency = 35, size = 3, richness = 3 },
|
||||||
|
['uranium-ore'] = { frequency = 25, size = 3, richness = 3 },
|
||||||
|
['crude-oil'] = { frequency = 80, size = 3, richness = 1 },
|
||||||
|
['trees'] = { frequency = 0.75, size = 3, richness = 0.1 },
|
||||||
|
['enemy-base'] = { frequency = 15, size = 0, richness = 1 }
|
||||||
|
},
|
||||||
|
cliff_settings = { cliff_elevation_0 = 1024, cliff_elevation_interval = 10, name = 'cliff' },
|
||||||
|
height = 64,
|
||||||
|
width = 256,
|
||||||
|
peaceful_mode = false,
|
||||||
|
seed = 1337,
|
||||||
|
starting_area = 'very-low',
|
||||||
|
starting_points = { { x = 0, y = 0 } },
|
||||||
|
terrain_segmentation = 'normal',
|
||||||
|
water = 'normal'
|
||||||
|
}
|
||||||
|
|
||||||
|
local surface
|
||||||
|
if not this.landing_surface_index then
|
||||||
|
surface = game.create_surface('Init', map_gen_settings)
|
||||||
|
end
|
||||||
|
|
||||||
|
this.landing_surface_index = surface.index
|
||||||
|
surface.always_day = true
|
||||||
|
surface.request_to_generate_chunks({ 0, 0 }, 1)
|
||||||
|
surface.force_generate_chunk_requests()
|
||||||
|
|
||||||
|
local walls = {}
|
||||||
|
local tiles = {}
|
||||||
|
|
||||||
|
local area = { left_top = { x = -128, y = -32 }, right_bottom = { x = 128, y = 32 } }
|
||||||
|
for x = area.left_top.x, area.right_bottom.x, 1 do
|
||||||
|
for y = area.left_top.y, area.right_bottom.y, 1 do
|
||||||
|
tiles[#tiles + 1] = { name = 'black-refined-concrete', position = { x = x, y = y } }
|
||||||
|
if x == area.left_top.x or x == area.right_bottom.x or y == area.left_top.y or y == area.right_bottom.y then
|
||||||
|
walls[#walls + 1] = { name = 'stone-wall', force = 'neutral', position = { x = x, y = y } }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
surface.set_tiles(tiles)
|
||||||
|
for _, entity in pairs(walls) do
|
||||||
|
local e = surface.create_entity(entity)
|
||||||
|
e.destructible = false
|
||||||
|
e.minable = false
|
||||||
|
end
|
||||||
|
|
||||||
|
rendering.draw_text {
|
||||||
|
text = '♦ Landing zone ♦',
|
||||||
|
surface = surface,
|
||||||
|
target = { 0, -50 },
|
||||||
|
color = { r = 0.98, g = 0.66, b = 0.22 },
|
||||||
|
scale = 10,
|
||||||
|
font = 'heading-1',
|
||||||
|
alignment = 'center',
|
||||||
|
scale_with_zoom = false
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.landing_surface_index
|
||||||
|
end
|
||||||
|
|
||||||
--- Returns the surface index.
|
--- Returns the surface index.
|
||||||
function Public.get_active_surface()
|
function Public.get_active_surface()
|
||||||
return this.active_surface
|
return this.active_surface
|
||||||
|
@ -17,6 +17,14 @@ local this = {
|
|||||||
operation = nil,
|
operation = nil,
|
||||||
next_operation = nil
|
next_operation = nil
|
||||||
},
|
},
|
||||||
|
-- new initializer for scenario management because the old one sucked hard
|
||||||
|
current_task = {
|
||||||
|
state = 'move_players',
|
||||||
|
surface_name = 'Init',
|
||||||
|
default_task = 'move_players',
|
||||||
|
show_messages = true,
|
||||||
|
step = 1
|
||||||
|
},
|
||||||
adjusted_zones = {
|
adjusted_zones = {
|
||||||
scrap = {},
|
scrap = {},
|
||||||
forest = {},
|
forest = {},
|
||||||
@ -42,6 +50,8 @@ Public.events = {
|
|||||||
on_locomotive_cargo_missing = Event.generate_event_name('on_locomotive_cargo_missing'),
|
on_locomotive_cargo_missing = Event.generate_event_name('on_locomotive_cargo_missing'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local init_name = 'Init'
|
||||||
|
Public.init_name = init_name
|
||||||
local scenario_name = 'nauvis'
|
local scenario_name = 'nauvis'
|
||||||
Public.scenario_name = scenario_name
|
Public.scenario_name = scenario_name
|
||||||
local discord_name = 'Mtn Fortress'
|
local discord_name = 'Mtn Fortress'
|
||||||
@ -136,7 +146,7 @@ Public.pickaxe_upgrades = {
|
|||||||
|
|
||||||
function Public.reset_main_table()
|
function Public.reset_main_table()
|
||||||
-- @start
|
-- @start
|
||||||
this.space_age = has_space_age()
|
this.space_age = script.active_mods['space-age'] or false
|
||||||
-- these 3 are in case of stop/start/reloading the instance.
|
-- these 3 are in case of stop/start/reloading the instance.
|
||||||
this.soft_reset = true
|
this.soft_reset = true
|
||||||
this.restart = false
|
this.restart = false
|
||||||
@ -401,6 +411,19 @@ function Public.set_stateful_settings(key, value)
|
|||||||
Public.save_stateful_settings()
|
Public.save_stateful_settings()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Public.set_task(task, surface_name)
|
||||||
|
this.current_task.state = task
|
||||||
|
this.current_task.surface_name = surface_name or 'Init'
|
||||||
|
end
|
||||||
|
|
||||||
|
function Public.is_task_done()
|
||||||
|
return this.current_task and this.current_task.done or false
|
||||||
|
end
|
||||||
|
|
||||||
|
function Public.set_show_messages(state)
|
||||||
|
this.current_task.show_messages = state or false
|
||||||
|
end
|
||||||
|
|
||||||
function Public.remove(key, sub_key)
|
function Public.remove(key, sub_key)
|
||||||
if key and sub_key then
|
if key and sub_key then
|
||||||
if this[key] and this[key][sub_key] then
|
if this[key] and this[key][sub_key] then
|
||||||
|
@ -641,7 +641,7 @@ local function auto_stash(player, event)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local furnaceList = {
|
local furnace_list = {
|
||||||
['coal'] = 0,
|
['coal'] = 0,
|
||||||
['iron-ore'] = 0,
|
['iron-ore'] = 0,
|
||||||
['copper-ore'] = 0,
|
['copper-ore'] = 0,
|
||||||
@ -659,7 +659,7 @@ local function auto_stash(player, event)
|
|||||||
if ctrl and this.insert_into_furnace then
|
if ctrl and this.insert_into_furnace then
|
||||||
if button == defines.mouse_button_type.right then
|
if button == defines.mouse_button_type.right then
|
||||||
if is_resource then
|
if is_resource then
|
||||||
furnaceList[name] = (furnaceList[name] or 0) + inventory[i].count
|
furnace_list[name] = (furnace_list[name] or 0) + inventory[i].count
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif shift and this.insert_into_wagon then -- insert into wagon
|
elseif shift and this.insert_into_wagon then -- insert into wagon
|
||||||
@ -684,7 +684,7 @@ local function auto_stash(player, event)
|
|||||||
end
|
end
|
||||||
::continue::
|
::continue::
|
||||||
end
|
end
|
||||||
for furnaceName, furnaceCount in pairs(furnaceList) do
|
for furnaceName, furnaceCount in pairs(furnace_list) do
|
||||||
insert_to_furnace(inventory, chests, furnaceName, furnaceCount, floaty_text_list)
|
insert_to_furnace(inventory, chests, furnaceName, furnaceCount, floaty_text_list)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -87,12 +87,16 @@ local function get_threat_gain()
|
|||||||
return gain
|
return gain
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Public.destroy_wave_gui(player)
|
||||||
|
if get_top_frame_custom(player, 'wave_defense') and get_top_frame_custom(player, 'wave_defense').valid then
|
||||||
|
get_top_frame_custom(player, 'wave_defense').destroy()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function Public.update_gui(player)
|
function Public.update_gui(player)
|
||||||
local final_battle = Public.get('final_battle')
|
local final_battle = Public.get('final_battle')
|
||||||
if final_battle then
|
if final_battle then
|
||||||
if get_top_frame_custom(player, 'wave_defense') and get_top_frame_custom(player, 'wave_defense').valid then
|
Public.destroy_wave_gui(player)
|
||||||
get_top_frame_custom(player, 'wave_defense').destroy()
|
|
||||||
end
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -574,14 +574,20 @@ end
|
|||||||
|
|
||||||
Public.new('get', 'Hover over an object to get its name.')
|
Public.new('get', 'Hover over an object to get its name.')
|
||||||
:require_admin()
|
:require_admin()
|
||||||
|
:add_parameter('die', true, 'string')
|
||||||
:add_alias('entity')
|
:add_alias('entity')
|
||||||
:callback(
|
:callback(
|
||||||
function (player)
|
function (player, action)
|
||||||
local entity = player.selected
|
local entity = player.selected
|
||||||
if not entity or not entity.valid then
|
if not entity or not entity.valid then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if action and action == 'die' then
|
||||||
|
entity.die()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
player.print('[color=orange]Name:[/color] ' .. entity.name)
|
player.print('[color=orange]Name:[/color] ' .. entity.name)
|
||||||
player.print('[color=orange]Type:[/color] ' .. entity.type)
|
player.print('[color=orange]Type:[/color] ' .. entity.type)
|
||||||
player.print('[color=orange]Force:[/color] ' .. entity.force.name)
|
player.print('[color=orange]Force:[/color] ' .. entity.force.name)
|
||||||
|
@ -502,6 +502,7 @@ function Public.reset()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Public.bottom_button(value)
|
function Public.bottom_button(value)
|
||||||
|
print('Setting bottom button.')
|
||||||
this.bottom_button = value or false
|
this.bottom_button = value or false
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -512,6 +513,8 @@ Event.add(
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
print('Player joined game.')
|
||||||
|
|
||||||
local player = game.players[event.player_index]
|
local player = game.players[event.player_index]
|
||||||
on_player_joined_game(player)
|
on_player_joined_game(player)
|
||||||
create_clear_corpse_frame(player)
|
create_clear_corpse_frame(player)
|
||||||
|
@ -305,7 +305,7 @@ local function create_gulag_surface()
|
|||||||
surface = game.create_surface('Gulag', { width = 40, height = 40 })
|
surface = game.create_surface('Gulag', { width = 40, height = 40 })
|
||||||
end
|
end
|
||||||
surface.always_day = true
|
surface.always_day = true
|
||||||
surface.request_to_generate_chunks({ 0, 0 }, 9)
|
surface.request_to_generate_chunks({ 0, 0 }, 1)
|
||||||
surface.force_generate_chunk_requests()
|
surface.force_generate_chunk_requests()
|
||||||
local area = { left_top = { x = -128, y = -32 }, right_bottom = { x = 128, y = 32 } }
|
local area = { left_top = { x = -128, y = -32 }, right_bottom = { x = 128, y = 32 } }
|
||||||
for x = area.left_top.x, area.right_bottom.x, 1 do
|
for x = area.left_top.x, area.right_bottom.x, 1 do
|
||||||
|
@ -89,5 +89,4 @@ function has_space_age()
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
return ServerCommands
|
return ServerCommands
|
||||||
|
Loading…
Reference in New Issue
Block a user