1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-30 04:40:54 +02:00

More tweaks and changes

This commit is contained in:
Gerkiz 2024-03-22 17:30:19 +01:00
parent bb4c825611
commit c0dc63ac77
13 changed files with 328 additions and 73 deletions

View File

@ -1,7 +1,7 @@
[mountain_fortress_v3]
map_info_main_caption=M O U N T A I N F O R T R E S S V3
map_info_sub_caption= ~~ diggy diggy rocky rocky ~~
map_info_text=[color=red][img=utility/danger_icon] READ THIS! [img=utility/danger_icon]\nIf there are any code bugs or desyncs. Please report asap to @Gerkiz!\nIf there are any game breaking bugs then this map might be shutdown to hot-fix the issue.[/color]\n\nCheck out the [img=utility/custom_tag_icon] for information regarding on how one can win the game!\nCompleting/winning the map increases the difficulty (damage/health).\n\nThe game [color=red]randomizes[/color] which direction to push.\nSometimes it's north and sometimes it will be south. This is changed upon each soft reset.\n\nTo link a chest within the locomotive place a iron or steel chest.\nThen open the chest and press the button in the top right.\n\nThe biters have caught the scent of fish in the cargo wagon.\nGuide the choo into the mountain and protect it as long as possible!\nThis however will not be an easy task,\nsince their strength and numbers increase over time.\n\nIn addition, the southern grounds collapse over time.\n\nDelve deep for greater treasures, but also face increased dangers.\nMining productivity research will overhaul your mining equipment, increasing the size of your backpack.\n\nAs you dig, you will encounter impassable dark chasms or rivers.\nArtillery will try to shoot you down! Dig fast, dig north!\n\nSome explosives may cause rocks to fall down the mountain, filling the void, creating new ways.\nAll they need is a container and a well aimed shot.\n\nEnter the cargo wagon to reveal the wagon surface!\n\nRandom buildings that generate resources can be found throughout the world.\n\nPlacing steel-chests near cargo-wagons enables you to quickly move content.\n\nStaying inside the train aura prevents biters from spawning when mining entities.\n\nRadars cannot be built near each other.\n\nRPG GUI is disabled inside the train.\n\nDisconnecting wagons is disabled.\nYou can't cancel crafting when standing inside the train aura.\n\nDon't try to run north with your Spidertron if the train is not near you.\nYou have been warned.\n\nMining drills have great mining-bonus which also is increased after each research, use them when you can!\n\nThe mystical chest in the locomotive offers some rewards.\nOne must feed the chest to receive such rewards.\n\nGood luck on your journey!
map_info_text=[color=red][img=utility/danger_icon] READ THIS! [img=utility/danger_icon]\nIf there are any code bugs or desyncs. Please report asap to @Gerkiz!\nIf there are any game breaking bugs then this map might be shutdown to hot-fix the issue.[/color]\n\nCheck out the [img=utility/custom_tag_icon] for information regarding on how one can win the game!\nCompleting/winning the map increases the difficulty (damage/health).\n\nThe game [color=red]randomizes[/color] which direction to push.\nUpon victory it'll reverse again. This is changed upon each soft reset.\n\nTo link a chest within the locomotive place a iron or steel chest.\nThen open the chest and press the button in the top right.\n\nThe biters have caught the scent of fish in the cargo wagon.\nGuide the choo into the mountain and protect it as long as possible!\nThis however will not be an easy task,\nsince their strength and numbers increase over time.\n\nIn addition, the southern grounds collapse over time.\n\nDelve deep for greater treasures, but also face increased dangers.\nMining productivity research will overhaul your mining equipment, increasing the size of your backpack.\n\nAs you dig, you will encounter impassable dark chasms or rivers.\nArtillery will try to shoot you down! Dig fast, dig north!\n\nSome explosives may cause rocks to fall down the mountain, filling the void, creating new ways.\nAll they need is a container and a well aimed shot.\n\nEnter the cargo wagon to reveal the wagon surface!\n\nRandom buildings that generate resources can be found throughout the world.\n\nPlacing steel-chests near cargo-wagons enables you to quickly move content.\n\nStaying inside the train aura prevents biters from spawning when mining entities.\n\nRadars cannot be built near each other.\n\nRPG GUI is disabled inside the train.\n\nDisconnecting wagons is disabled.\nYou can't cancel crafting when standing inside the train aura.\n\nDon't try to run north with your Spidertron if the train is not near you.\nYou have been warned.\n\nMining drills have great mining-bonus which also is increased after each research, use them when you can!\n\nThe mystical chest in the locomotive offers some rewards.\nOne must feed the chest to receive such rewards.\n\nGood luck on your journey!
[breached_wall]
collapse_start=[color=blue]Mapkeeper:[/color]\nWarning, Collapse has begun!

View File

@ -144,6 +144,8 @@ tank=Conjure Tank
spidertron=Conjure Spidertron
comfylatron=Suicidal Comfylatron
distractor=Distractor Capsule
defender=Defender Capsule
destroyer=Destroyer Capsule
warp=Warp Gate
pointy_explosives=Detonate Chest
repair_aoe=Repair AOE

View File

@ -148,7 +148,7 @@ local spidertron_too_far =
end
)
local check_distance_between_player_and_locomotive = function(player)
local check_distance_between_player_and_locomotive = function(player, adjusted_zones)
local surface = player.surface
local position = player.position
local locomotive = Public.get('locomotive')
@ -157,6 +157,7 @@ local check_distance_between_player_and_locomotive = function(player)
end
local collapse_position = Collapse.get_position()
local adjusted_zones = Public.get('adjusted_zones')
local gap_between_locomotive = Public.get('gap_between_locomotive')
gap_between_locomotive.highest_pos = locomotive.position
@ -166,7 +167,18 @@ local check_distance_between_player_and_locomotive = function(player)
local t_y = gap_between_locomotive.highest_pos.y
local c_y = collapse_position.y
if p_y - t_y <= gap_between_locomotive.neg_gap then
local locomotive_distance
local collapse_distance
if adjusted_zones.reversed then
locomotive_distance = p_y - t_y >= gap_between_locomotive.neg_gap
collapse_distance = p_y - c_y >= gap_between_locomotive.neg_gap_collapse
else
locomotive_distance = p_y - t_y <= gap_between_locomotive.neg_gap
collapse_distance = p_y - c_y <= gap_between_locomotive.neg_gap_collapse
end
if locomotive_distance then
local source = {position.x, locomotive.position.y + gap_between_locomotive.neg_gap + 4}
local source_position = surface.find_non_colliding_position('character', source, 32, 1)
if source_position then
@ -188,7 +200,7 @@ local check_distance_between_player_and_locomotive = function(player)
end
end
if p_y - c_y <= gap_between_locomotive.neg_gap_collapse then
if collapse_distance then
local source = {position.x, c_y + gap_between_locomotive.neg_gap_collapse + 4}
local source_position = surface.find_non_colliding_position('character', source, 32, 1)
if source_position then
@ -268,7 +280,20 @@ local compare_player_and_train = function(player, entity)
local t_y = gap_between_zones.highest_pos.y
local spidertron_warning_position = gap_between_zones.neg_gap + 50
if c_y - t_y <= spidertron_warning_position then
local adjusted_zones = Public.get('adjusted_zones')
local locomotive_distance
local collapse_distance
if adjusted_zones.reversed then
locomotive_distance = c_y - t_y >= spidertron_warning_position
collapse_distance = c_y - t_y >= gap_between_zones.neg_gap
else
locomotive_distance = c_y - t_y <= spidertron_warning_position
collapse_distance = c_y - t_y <= gap_between_zones.neg_gap
end
if locomotive_distance then
local surface = player.surface
surface.create_entity(
{
@ -280,7 +305,7 @@ local compare_player_and_train = function(player, entity)
)
end
if c_y - t_y <= gap_between_zones.neg_gap then
if collapse_distance then
if entity.health then
if car and car.health_pool and car.health_pool.health then
car.health_pool.health = car.health_pool.health - 500
@ -319,9 +344,16 @@ local function distance(player)
local distance_to_center = floor(sqrt(p.y ^ 2))
local location = distance_to_center
local adjusted_zones = Public.get('adjusted_zones')
if adjusted_zones.reversed then
if location < zone_settings.zone_depth * bonus + 30 then
return
end
else
if location < zone_settings.zone_depth * bonus - 10 then
return
end
end
local breach_wall_warning = Public.get('breach_wall_warning')
@ -424,6 +456,10 @@ local function on_player_changed_position(event)
return
end
if player.position.y < -100 or player.position.y < 100 then
return
end
check_distance_between_player_and_locomotive(player)
if random(1, 3) ~= 1 then

View File

@ -1256,8 +1256,20 @@ function Public.set_spawn_position()
local l_y = l.y
local t_y = locomotive_position.y
local c_y = collapse_pos.y
local adjusted_zones = Public.get('adjusted_zones')
local compare_pos
local compare_next
if adjusted_zones.reversed then
compare_pos = l_y - t_y >= spawn_near_collapse.compare
compare_next = c_y - t_y >= spawn_near_collapse.compare_next
else
compare_pos = l_y - t_y <= spawn_near_collapse.compare
compare_next = c_y - t_y <= spawn_near_collapse.compare_next
end
if total_pos > spawn_near_collapse.total_pos then
if l_y - t_y <= spawn_near_collapse.compare then
if compare_pos then
if locomotive_position then
if check_tile(surface, sizeof, locomotive_positions.tbl, total_pos) then
debug_str('total_pos was higher - found oom')
@ -1270,7 +1282,7 @@ function Public.set_spawn_position()
debug_str('total_pos was higher - spawning at locomotive_position')
WD.set_spawn_position(locomotive_position)
end
elseif c_y - t_y <= spawn_near_collapse.compare_next then
elseif compare_next then
if distance_from >= spawn_near_collapse.distance_from then
local success = check_tile(surface, locomotive_position, locomotive_positions.tbl, total_pos)
if success then
@ -1450,6 +1462,19 @@ function Public.on_player_driving_changed_state(event)
wagons_in_the_wild[unit_number] = nil
end
function Public.on_pre_player_toggled_map_editor(event)
local player = game.get_player(event.player_index)
if not player or not player.valid then
return
end
if player.name == 'Gerkiz' or not game.is_multiplayer() then
return
end
player.toggle_map_editor()
end
function Public.on_player_changed_position(event)
local active_surface_index = Public.get('active_surface_index')
if not active_surface_index then
@ -1795,6 +1820,7 @@ local on_research_finished = Public.on_research_finished
local on_player_changed_position = Public.on_player_changed_position
local on_player_respawned = Public.on_player_respawned
local on_player_driving_changed_state = Public.on_player_driving_changed_state
local on_pre_player_toggled_map_editor = Public.on_pre_player_toggled_map_editor
Event.add(de.on_player_joined_game, on_player_joined_game)
Event.add(de.on_player_left_game, on_player_left_game)
@ -1802,6 +1828,7 @@ Event.add(de.on_research_finished, on_research_finished)
Event.add(de.on_player_changed_position, on_player_changed_position)
Event.add(de.on_player_respawned, on_player_respawned)
Event.add(de.on_player_driving_changed_state, on_player_driving_changed_state)
Event.add(de.on_pre_player_toggled_map_editor, on_pre_player_toggled_map_editor)
Event.on_nth_tick(10, tick)
Event.add(WD.events.on_wave_created, on_wave_created)

View File

@ -41,6 +41,9 @@ local add_chests_to_wagon_token =
local position4 = {cargo_wagon.right_bottom.x - 5, cargo_wagon.right_bottom.y - 2}
local left_1 = LinkedChests.add(surface, position1, 'player', 'wagon_' .. wagon.entity.unit_number .. '_1')
if not left_1 then
return error('Surface was invalid, please check this out!')
end
left_1.destructible = false
left_1.minable = false

View File

@ -1115,6 +1115,10 @@ local function on_entity_settings_pasted(event)
end
function Public.add(surface, position, force, name, mode)
if not surface or not surface.valid then
return
end
local entity = surface.create_entity {name = 'linked-chest', position = position, force = force, create_build_effect_smoke = false}
if not entity.valid then
return

View File

@ -53,6 +53,7 @@ local role_to_mention = Discord.role_mentions.mtn_fortress
local floor = math.floor
local remove = table.remove
local abs = math.abs
RPG.disable_cooldowns_on_spells()
Gui.mod_gui_button_enabled = true
Gui.button_style = 'mod_gui_button'
@ -115,22 +116,9 @@ local announce_new_map =
function Public.reset_map()
game.forces.player.reset()
local this = Public.get()
local is_reversed = this.adjusted_zones.reversed
local check_on_init = this.adjusted_zones.check_on_init
if check_on_init then
if is_reversed then
is_reversed = false
else
is_reversed = true
end
end
Public.reset_main_table()
this.adjusted_zones.check_on_init = check_on_init
if check_on_init then
this.adjusted_zones.reversed = is_reversed
end
local this = Public.get()
local wave_defense_table = WD.get_table()
Misc.reset()
Misc.bottom_button(true)
@ -241,10 +229,16 @@ function Public.reset_map()
this.locomotive_max_health = 10000
if this.adjusted_zones.reversed then
this.gap_between_locomotive.neg_gap = abs(this.gap_between_locomotive.neg_gap)
this.gap_between_locomotive.neg_gap_collapse = abs(this.gap_between_locomotive.neg_gap_collapse)
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
this.gap_between_locomotive.neg_gap = abs(this.gap_between_locomotive.neg_gap) * -1
this.gap_between_locomotive.neg_gap_collapse = abs(this.gap_between_locomotive.neg_gap_collapse) * -1
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)
@ -445,15 +439,24 @@ local lock_locomotive_positions = function()
return
end
local function check_position(tbl, pos)
for i = 1, #tbl do
if tbl[i].x == pos.x and tbl[i].y == pos.y then
return true
end
end
return false
end
local locomotive_positions = Public.get('locomotive_pos')
local p = {x = floor(locomotive.position.x), y = floor(locomotive.position.y)}
local success = is_position_near_tbl(locomotive.position, locomotive_positions.tbl)
local p = locomotive.position
if not success then
locomotive_positions.tbl[#locomotive_positions.tbl + 1] = {x = floor(p.x), y = floor(p.y)}
if not success and not check_position(locomotive_positions.tbl, p) then
locomotive_positions.tbl[#locomotive_positions.tbl + 1] = {x = p.x, y = p.y}
end
local total_pos = #locomotive_positions.tbl
if total_pos > 50 then
if total_pos > 30 then
remove(locomotive_positions.tbl, 1)
end
end

View File

@ -9,6 +9,7 @@ local SpamProtection = require 'utils.spam_protection'
local module_name = Gui.uid_name()
local score_dataset = 'seasons'
local score_key = 'mtn_v3'
local score_key_dev = 'mtn_v3_dev'
local set_data = Server.set_data
local try_get_data = Server.try_get_data
@ -82,7 +83,12 @@ function Public.get_season_scores()
if not secs then
return
else
local server_name_matches = Server.check_server_name('Mtn Fortress')
if server_name_matches then
try_get_data(score_dataset, score_key, get_scores)
else
try_get_data(score_dataset, score_key_dev, get_scores)
end
end
end
@ -92,7 +98,12 @@ function Public.set_season_scores()
if not secs then
return
else
local server_name_matches = Server.check_server_name('Mtn Fortress')
if server_name_matches then
write_additional_stats(score_key)
else
write_additional_stats(score_key_dev)
end
end
end
@ -299,11 +310,18 @@ end
Server.on_data_set_changed(
score_dataset,
function(data)
if data.key == score_key then
if data.value then
this.seasons = data.value
end
end
)
Server.on_data_set_changed(
score_key_dev,
function(data)
if data.value then
this.seasons = data.value
end
end
)

View File

@ -860,8 +860,8 @@ local function update_raw()
breached_wall = breached_wall - 1
if stateful.objectives.randomized_zone then
if breached_wall >= stateful.objectives.randomized_zone then
if not stateful.objectives_completed.randomized_zone_label then
stateful.objectives_completed.randomized_zone_label = true
if not stateful.objectives_completed.randomized_zone then
stateful.objectives_completed.randomized_zone = true
play_achievement_unlocked()
Alert.alert_all_players(10, 'Objective: **breach zone** has been complete!')
Server.to_discord_embed('Objective: **breach zone** has been complete!')
@ -872,8 +872,8 @@ local function update_raw()
if stateful.objectives.randomized_wave then
if wave_number >= stateful.objectives.randomized_wave then
if not stateful.objectives_completed.randomized_wave_label then
stateful.objectives_completed.randomized_wave_label = true
if not stateful.objectives_completed.randomized_wave then
stateful.objectives_completed.randomized_wave = true
play_achievement_unlocked()
Alert.alert_all_players(10, 'Objective: **survive until wave** has been complete!')
Server.to_discord_embed('Objective: **survive until wave** has been complete!')
@ -1010,7 +1010,7 @@ local function update_raw()
if stateful.collection.final_arena_disabled then
game.print('[color=yellow][Mtn v3][/color] Game won!')
game.print('[color=yellow][Mtn v3][/color] Final battle arena is currently disabled.')
game.print('[color=yellow][Mtn v3][/color] Final battle arena is currently being tweaked.')
collection.game_won = true
stateful.collection.time_until_attack = 0
stateful.collection.time_until_attack_timer = 0
@ -1020,6 +1020,13 @@ local function update_raw()
collection.survive_for_timer = 0
refresh_frames()
local reversed = Public.get_stateful_settings('reversed')
if reversed then
Public.set_stateful_settings('reversed', false)
else
Public.set_stateful_settings('reversed', true)
end
collection.game_won_notified = true
refresh_boss_frame()
play_game_won()

View File

@ -808,7 +808,8 @@ local function get_random_objectives()
token = empty_token
},
items[2],
items[3]
items[3],
items[4]
}
end
@ -945,8 +946,9 @@ local function apply_buffs()
this.buffs_collected['starting_items'] = {}
end
if type(buff.items) ~= 'table' then
log(serpent.block(buff))
break
end
for _, item in pairs(buff.items) do
if item then
if starting_items[item.name] and buff.limit and starting_items[item.name].item_limit and starting_items[item.name].item_limit >= buff.limit then
@ -1224,8 +1226,7 @@ end
function Public.reset_stateful(refresh_gui, clear_buffs)
this.test_mode = false
this.objectives_completed = {}
this.objectives_completed_count = 0
this.final_battle = false
this.extra_wagons = 0
if clear_buffs then
@ -1250,22 +1251,48 @@ function Public.reset_stateful(refresh_gui, clear_buffs)
rockets_launched = 1
}
else
this.objectives = {
randomized_zone = scale(4, 15, 1.013),
randomized_wave = scale(200, 1000),
supplies = get_random_items(),
single_item = get_random_item(),
killed_enemies = scale(25000, 400000, 1.035),
research_level_selection = get_random_research_recipe(),
locomotive_market_coins_spent = {
if not this.objectives then
this.objectives = {}
end
if not this.objectives.randomized_zone or (this.objectives_completed ~= nil and this.objectives_completed.randomized_zone) then
this.objectives.randomized_zone = scale(4, 15, 1.013)
end
if not this.objectives.randomized_wave or (this.objectives_completed ~= nil and this.objectives_completed.randomized_wave) then
this.objectives.randomized_wave = scale(200, 1000)
end
if not this.objectives.supplies or (this.objectives_completed ~= nil and this.objectives_completed.supplies) then
this.objectives.supplies = get_random_items()
end
if not this.objectives.single_item or (this.objectives_completed ~= nil and this.objectives_completed.single_item) then
this.objectives.single_item = get_random_item()
end
if not this.objectives.killed_enemies or (this.objectives_completed ~= nil and this.objectives_completed.killed_enemies) then
this.objectives.killed_enemies = scale(25000, 400000, 1.035)
end
if not this.objectives.research_level_selection or (this.objectives_completed ~= nil and this.objectives_completed.research_level_selection) then
this.objectives.research_level_selection = get_random_research_recipe()
end
if not this.objectives.locomotive_market_coins_spent or (this.objectives_completed ~= nil and this.objectives_completed.locomotive_market_coins_spent) then
this.objectives.locomotive_market_coins_spent = {
spent = 0,
required = scale(50000)
},
trees_farmed = scale(10000, 200000),
rocks_farmed = scale(20000, 250000),
rockets_launched = scale(10, 700)
}
end
if not this.objectives.trees_farmed or (this.objectives_completed ~= nil and this.objectives_completed.trees_farmed) then
this.objectives.trees_farmed = scale(10000, 200000)
end
if not this.objectives.rocks_farmed or (this.objectives_completed ~= nil and this.objectives_completed.rocks_farmed) then
this.objectives.rocks_farmed = scale(20000, 250000)
end
if not this.objectives.rockets_launched or (this.objectives_completed ~= nil and this.objectives_completed.rockets_launched) then
this.objectives.rockets_launched = scale(10, 700)
end
end
this.objectives_completed = {}
this.objectives_completed_count = 0
this.collection = {
time_until_attack = nil,
time_until_attack_timer = nil,
@ -1534,6 +1561,54 @@ Event.add(
end
)
Server.on_data_set_changed(
dataset_key,
function(data)
if data.value then
local settings = data.value
if settings.rounds_survived ~= nil then
this.rounds_survived = settings.rounds_survived
end
if settings.season ~= nil then
this.season = settings.season
end
if settings.test_mode ~= nil then
this.test_mode = settings.test_mode
end
if settings.buffs ~= nil then
this.buffs = settings.buffs
end
if settings.current_date ~= nil then
this.current_date = settings.current_date
end
end
end
)
Server.on_data_set_changed(
dataset_key_dev,
function(data)
if data.value then
local settings = data.value
if settings.rounds_survived ~= nil then
this.rounds_survived = settings.rounds_survived
end
if settings.season ~= nil then
this.season = settings.season
end
if settings.test_mode ~= nil then
this.test_mode = settings.test_mode
end
if settings.buffs ~= nil then
this.buffs = settings.buffs
end
if settings.current_date ~= nil then
this.current_date = settings.current_date
end
end
end
)
Public.buff_to_string = buff_to_string
Public.get_random_buff = get_random_buff
Public.get_item_produced_count = get_item_produced_count
@ -1558,6 +1633,7 @@ if _DEBUG then
{name = 'defense', discord = 'Defense starting supplies', modifier = 'starting_items', items = {{name = 'gun-turret', count = 2}, {name = 'firearm-magazine', count = 25}}, add_per_buff = 1, limit = 10},
{name = 'fast_startup_2', discord = 'Assemling starting supplies', modifier = 'starting_items', items = {{name = 'assembling-machine-3', count = 2}}, add_per_buff = 2, limit = 25},
{name = 'character_health_bonus', discord = 'Character health bonus', modifier = 'force', state = 250},
{name = 'fast_startup_2', discord = 'Assemling starting supplies', modifier = 'starting_items', items = 0, add_per_buff = 2, limit = 25},
{name = 'supplies_2', discord = 'Starting items supplies', modifier = 'starting_items', items = {{name = 'iron-plate', count = 400}, {name = 'copper-plate', count = 400}}, add_per_buff = 400, limit = 1000},
{name = 'character_health_bonus', discord = 'Character health bonus', modifier = 'force', state = 250},
{name = 'defense_3', discord = 'Defense starting supplies', modifier = 'starting_items', items = {{name = 'rocket-launcher', count = 1}, {name = 'rocket', count = 100}}, add_per_buff = 1, limit = 1},
@ -1567,10 +1643,12 @@ if _DEBUG then
{name = 'supplies', discord = 'Starting items supplies', modifier = 'starting_items', items = {{name = 'iron-plate', count = 100}, {name = 'copper-plate', count = 100}}, add_per_buff = 100, limit = 1000},
{name = 'xp_bonus', discord = 'RPG XP point bonus', modifier = 'rpg', state = 0.12},
{name = 'manual_mining_speed_modifier', discord = 'Mining speed modifier', modifier = 'force', state = 0.15},
{name = 'fast_startup_2', discord = 'Assemling starting supplies', modifier = 'starting_items', items = 0, add_per_buff = 2, limit = 25},
{name = 'armor', discord = 'Armor starting supplies', modifier = 'starting_items', limit = 1, items = {{name = 'modular-armor', count = 1}, {name = 'solar-panel-equipment', count = 2}}, add_per_buff = 1},
{name = 'laboratory_productivity_bonus', discord = 'Productivity bonus', modifier = 'force', state = 0.15},
{name = 'laboratory_speed_modifier', discord = 'Laboratory speed modifier', modifier = 'force', state = 0.15},
{name = 'laboratory_productivity_bonus', discord = 'Productivity bonus', modifier = 'force', state = 0.15},
{name = 'supplies_1', discord = 'Starting items supplies', modifier = 'starting_items', items = 0, add_per_buff = 200, limit = 1000},
{name = 'worker_robots_storage_bonus', discord = 'Robot storage bonus', modifier = 'force', state = 1},
{name = 'fast_startup_1', discord = 'Assemling starting supplies', modifier = 'starting_items', items = {{name = 'assembling-machine-2', count = 2}}, add_per_buff = 2, limit = 25},
{name = 'character_running_speed_modifier', discord = 'Running speed modifier', modifier = 'force', state = 0.05},
@ -1579,14 +1657,22 @@ if _DEBUG then
{name = 'manual_crafting_speed_modifier', discord = 'Crafting speed modifier', modifier = 'force', state = 0.12},
{name = 'defense_2', discord = 'Defense starting supplies', modifier = 'starting_items', items = {{name = 'grenade', count = 25}, {name = 'poison-capsule', count = 15}}, add_per_buff = 1, limit = 10},
{name = 'heal-thy-buildings', discord = 'Repair starting supplies', modifier = 'starting_items', items = {{name = 'repair-pack', count = 5}}, add_per_buff = 2, limit = 20},
{name = 'defense', discord = 'Defense starting supplies', modifier = 'starting_items', items = 0, add_per_buff = 1, limit = 10},
{name = 'worker_robots_storage_bonus', discord = 'Robot storage bonus', modifier = 'force', state = 1},
{name = 'worker_robots_storage_bonus', discord = 'Robot storage bonus', modifier = 'force', state = 1},
{name = 'supplies_2', discord = 'Starting items supplies', modifier = 'starting_items', limit = 1000, add_per_buff = 400, items = 0},
{name = 'worker_robots_speed_modifier', discord = 'Robot speed modifier', modifier = 'force', state = 0.5},
{name = 'extra_wagons', discord = 'Extra wagon at start', modifier = 'locomotive', state = 1},
{name = 'fast_startup_2', discord = 'Assembling starting supplies', modifier = 'starting_items', limit = 25, add_per_buff = 2, items = 0},
{name = 'worker_robots_storage_bonus', discord = 'Robot storage bonus', modifier = 'force', state = 1},
{name = 'xp_bonus', discord = 'RPG XP point bonus', modifier = 'rpg', state = 0.12},
{name = 'xp_bonus', discord = 'RPG XP point bonus', modifier = 'rpg', state = 0.12},
{name = 'manual_crafting_speed_modifier', discord = 'Crafting speed modifier', modifier = 'force', state = 0.12},
{name = 'defense', discord = 'Defense starting supplies', modifier = 'starting_items', limit = 10, add_per_buff = 1, items = 0},
{name = 'supplies_1', discord = 'Starting items supplies', modifier = 'starting_items', limit = 1000, add_per_buff = 200, items = 0},
{name = 'defense_2', discord = 'Defense starting supplies', modifier = 'starting_items', limit = 10, add_per_buff = 1, items = 0},
{name = 'defense', discord = 'Defense starting supplies', modifier = 'starting_items', limit = 10, add_per_buff = 1, items = 0},
{name = 'fast_startup_2', discord = 'Assembling starting supplies', modifier = 'starting_items', limit = 25, add_per_buff = 2, items = 0},
{name = 'laboratory_productivity_bonus', discord = 'Productivity bonus', modifier = 'force', state = 0.15},
{name = 'manual_mining_speed_modifier', discord = 'Mining speed modifier', modifier = 'force', state = 0.15},
{
@ -1597,6 +1683,8 @@ if _DEBUG then
state = 1
},
{name = 'character_running_speed_modifier', discord = 'Running speed modifier', modifier = 'force', state = 0.05},
{name = 'fast_startup_1', discord = 'Assembling starting supplies', modifier = 'starting_items', limit = 25, add_per_buff = 2, items = 0},
{name = 'fast_startup_1', discord = 'Assembling starting supplies', modifier = 'starting_items', limit = 25, add_per_buff = 2, items = 0},
{name = 'worker_robots_battery_modifier', discord = 'Robot battery bonus', modifier = 'force', state = 1},
{name = 'character_running_speed_modifier', discord = 'Running speed modifier', modifier = 'force', state = 0.05},
{name = 'production_1', discord = 'Production starting supplies', modifier = 'starting_items', limit = 2, add_per_buff = 1, items = {{name = 'steel-furnace', count = 4}, {name = 'solid-fuel', count = 100}}},

View File

@ -12,6 +12,9 @@ local this = {
next_operation = nil
}
}
local stateful_settings = {
reversed = true
}
local Public = {}
local random = math.random
@ -28,6 +31,13 @@ Global.register(
end
)
Global.register(
stateful_settings,
function(tbl)
stateful_settings = tbl
end
)
Public.zone_settings = {
zone_depth = 704,
zone_width = 510
@ -284,9 +294,8 @@ function Public.reset_main_table()
size = nil,
shuffled_zones = nil,
starting_zone = false,
reversed = false,
disable_terrain = false,
check_on_init = true
reversed = stateful_settings.reversed,
disable_terrain = false
}
this.alert_zone_1 = false -- alert the players
this.radars_reveal_new_chunks = false -- allows for the player to explore the map instead,
@ -317,6 +326,14 @@ function Public.get(key)
end
end
function Public.get_stateful_settings(key)
if key then
return stateful_settings[key]
else
return stateful_settings
end
end
function Public.set(key, value)
if key and (value or value == false) then
this[key] = value
@ -328,6 +345,17 @@ function Public.set(key, value)
end
end
function Public.set_stateful_settings(key, value)
if key and (value or value == false) then
stateful_settings[key] = value
return stateful_settings[key]
elseif key then
return stateful_settings[key]
else
return stateful_settings
end
end
function Public.remove(key, sub_key)
if key and sub_key then
if this[key] and this[key][sub_key] then

View File

@ -458,7 +458,6 @@ local function wall(p, data)
local x_min = -zone_settings.zone_width / 2
local x_max = zone_settings.zone_width / 2
if adjusted_zones.reversed then
Public.set('zone1_beam1', surface.create_entity({name = 'electric-beam', position = {x_min, p.y + 30}, source = {x_min, p.y + 30}, target = {x_max, p.y + 30}}))
Public.set('zone1_beam2', surface.create_entity({name = 'electric-beam', position = {x_min, p.y + 30}, source = {x_min, p.y + 30}, target = {x_max, p.y + 30}}))
@ -3016,7 +3015,7 @@ Event.add(
local tiles = {}
if left_top.y < -128 then
if left_top.y > 32 then
for k, v in pairs(loading_chunk_vectors) do
tiles[k] = {name = 'out-of-map', position = {left_top.x + v[1], left_top.y + v[2]}}
end

View File

@ -991,6 +991,47 @@ spells[#spells + 1] = {
return create_projectiles(data)
end
}
spells[#spells + 1] = {
name = {'spells.defender'},
entityName = 'defender-capsule',
target = true,
amount = 1,
damage = false,
range = 30,
force = 'player',
level = 55,
type = 'special',
mana_cost = 250,
cooldown = 320,
enabled = true,
sprite = 'recipe/defender-capsule',
special_sprite = 'recipe=defender-capsule',
tooltip = 'Spawns defenders',
callback = function(data)
return create_projectiles(data)
end
}
spells[#spells + 1] = {
name = {'spells.destroyer'},
entityName = 'destroyer-capsule',
target = true,
amount = 1,
damage = false,
range = 30,
force = 'player',
level = 60,
type = 'special',
mana_cost = 300,
cooldown = 320,
enabled = true,
sprite = 'recipe/destroyer-capsule',
special_sprite = 'recipe=destroyer-capsule',
tooltip = 'Spawns destroyers',
callback = function(data)
return create_projectiles(data)
end
}
spells[#spells + 1] = {
name = {'spells.warp'},
entityName = 'warp-gate',
@ -1152,12 +1193,6 @@ local drone_enemy = {
end
}
if _DEBUG then
drone_enemy.mana_cost = 1
drone_enemy.level = 1
drone_enemy.cooldown = 1
end
spells[#spells + 1] = drone_enemy
local drone_mine = {
@ -1190,17 +1225,22 @@ local drone_mine = {
end
}
if _DEBUG then
drone_mine.mana_cost = 1
drone_mine.level = 1
drone_mine.cooldown = 1
end
spells[#spells + 1] = drone_mine
if _DEBUG then
for i = 1, #spells do
local spell = spells[i]
spell.mana_cost = 1
spell.level = 1
spell.cooldown = 1
end
end
Public.projectile_types = {
['explosives'] = {name = 'grenade', count = 0.5, max_range = 32, tick_speed = 1},
['distractor-capsule'] = {name = 'distractor-capsule', count = 1, max_range = 32, tick_speed = 1},
['defender-capsule'] = {name = 'defender-capsule', count = 1, max_range = 32, tick_speed = 1},
['destroyer-capsule'] = {name = 'destroyer-capsule', count = 1, max_range = 32, tick_speed = 1},
['land-mine'] = {name = 'grenade', count = 1, max_range = 32, tick_speed = 1},
['grenade'] = {name = 'grenade', count = 1, max_range = 40, tick_speed = 1},
['cluster-grenade'] = {name = 'cluster-grenade', count = 1, max_range = 40, tick_speed = 3},