1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-10-30 23:47:41 +02:00

Mtn v3 - fixes and tweaks

This commit is contained in:
Gerkiz
2023-11-21 00:35:47 +01:00
parent 5a9f6f8e23
commit 3e13c07ca5
12 changed files with 467 additions and 108 deletions

View File

@@ -325,6 +325,8 @@ local function distance(player)
rpg_extra.reward_new_players = bonus_xp_on_join * rpg_extra.breached_walls
Public.set('breached_wall', breached_wall + 1)
biters.amount = 0
-- local random_seed = Public.get('random_seed')
-- Public.set('random_seed', random_seed + (breached_wall + 1 * 2))
placed_trains_in_zone.randomized = false
Public.enemy_weapon_damage()
local spidertron_unlocked_enabled = Public.get('spidertron_unlocked_enabled')

View File

@@ -30,11 +30,21 @@ local this = {
magic_fluid_crafters = {index = 1},
art_table = {index = 1},
starting_items = {
['pistol'] = 1,
['firearm-magazine'] = 16,
['rail'] = 16,
['wood'] = 16,
['explosives'] = 32
['pistol'] = {
count = 1
},
['firearm-magazine'] = {
count = 16
},
['rail'] = {
count = 16
},
['wood'] = {
count = 16
},
['explosives'] = {
count = 32
}
}
}
@@ -1249,8 +1259,8 @@ function Public.on_player_joined_game(event)
local death_message = ({'main.death_mode_warning'})
Alert.alert_player(player, 15, death_message)
end
for item, amount in pairs(this.starting_items) do
player.insert({name = item, count = amount})
for item, data in pairs(this.starting_items) do
player.insert({name = item, count = data.count})
end
end
@@ -1611,11 +1621,21 @@ function Public.reset_func_table()
this.magic_crafters = {index = 1}
this.magic_fluid_crafters = {index = 1}
this.starting_items = {
['pistol'] = 1,
['firearm-magazine'] = 16,
['rail'] = 16,
['wood'] = 16,
['explosives'] = 32
['pistol'] = {
count = 1
},
['firearm-magazine'] = {
count = 16
},
['rail'] = {
count = 16
},
['wood'] = {
count = 16
},
['explosives'] = {
count = 32
}
}
end

View File

@@ -8,6 +8,7 @@ local RPG = require 'modules.rpg.main'
local Gui = require 'utils.gui'
local Alert = require 'utils.alert'
local Color = require 'utils.color_presets'
local Modifiers = require 'utils.player_modifiers'
local zone_settings = Public.zone_settings
@@ -256,6 +257,10 @@ local function give_passive_xp(data)
Public.add_player_to_permission_group(player, 'near_locomotive')
end
rpg[player.index].inside_aura = true
Modifiers.update_single_modifier(player, 'character_crafting_speed_modifier', 'aura', 1)
Modifiers.update_player_modifiers(player)
local pos = player.position
RPG.gain_xp(player, 0.5 * (rpg[player.index].bonus + upgrades.xp_points))
@@ -277,6 +282,9 @@ local function give_passive_xp(data)
end
end
else
rpg[player.index].inside_aura = false
Modifiers.update_single_modifier(player, 'character_crafting_speed_modifier', 'aura', 0)
Modifiers.update_player_modifiers(player)
local active_surface_index = Public.get('active_surface_index')
local surface = game.surfaces[active_surface_index]
if surface and surface.valid then
@@ -631,6 +639,14 @@ function Public.boost_players_around_train()
give_passive_xp(data)
end
function Public.is_around_train_simple(player)
if not player or not player.valid then
return
end
local inside_aura = RPG.get_value_from_player(player.index, 'inside_aura')
return inside_aura
end
function Public.is_around_train(entity)
local locomotive = Public.get('locomotive')
local active_surface_index = Public.get('active_surface_index')

View File

@@ -212,6 +212,27 @@ function Public.locomotive_spawn(surface, position)
surface = locomotive.surface
}
local extra_wagons = Public.stateful.get_stateful('extra_wagons')
if extra_wagons and extra_wagons > 0 then
local pos = this.locomotive_cargo.position
local inc = 6
local new_position = {x = pos.x, y = pos.y + inc}
for y = pos.y, new_position.y + (6 * extra_wagons), 2 do
surface.create_entity({name = 'straight-rail', position = {new_position.x, y}, force = 'player', direction = 0})
end
for _ = 1, extra_wagons do
local new_wagon = surface.create_entity({name = 'cargo-wagon', position = new_position, force = 'player', defines.direction.north})
if new_wagon and new_wagon.valid then
inc = inc + 7
new_position = {x = pos.x, y = pos.y + inc}
ICW.register_wagon(new_wagon)
end
end
end
Task.set_timeout_in_ticks(15, place_tiles_token, {surface = surface, position = position})
Task.set_timeout_in_ticks(300, place_tiles_token, {surface = surface, position = position})
Task.set_timeout_in_ticks(50, set_loco_cargo, data)

View File

@@ -5,9 +5,6 @@ Mountain Fortress v3 is maintained by Gerkiz and hosted by Comfy.
Want to host it? Ask Gerkiz#0001 at discord!
]]
-- develop setting
local _DEV_MODE = false
require 'modules.shotgun_buff'
require 'modules.no_deconstruction_of_neutral_entities'
require 'modules.spawners_contain_biters'
@@ -300,7 +297,7 @@ function Public.reset_map()
RPG_Progression.restore_xp_on_reset()
end
if _DEV_MODE then
if _DEBUG then
Collapse.disable_collapse(true)
WD.disable_spawning_biters(true)
end

View File

@@ -88,8 +88,8 @@ local function draw_chain(surface, count, ore, ore_entities, ore_positions)
end
end
local function ore_vein(event)
local surface = event.entity.surface
local function ore_vein(player, entity)
local surface = entity.surface
local size = size_raffle[random(1, #size_raffle)]
local ore = this.raffle[random(1, #this.raffle)]
local icon
@@ -99,45 +99,29 @@ local function ore_vein(event)
icon = ' '
end
local player = game.players[event.player_index]
for _, p in pairs(game.connected_players) do
if p.index == player.index then
p.print(
{
'rocks_yield_ore_veins.player_print',
{'rocks_yield_ore_veins_colors.' .. ore},
{'rocks_yield_ore_veins.' .. size[1]},
{'rocks_yield_ore_veins.' .. ore},
icon
},
{r = 0.80, g = 0.80, b = 0.80}
)
else
game.print(
{
'rocks_yield_ore_veins.game_print',
'[color=' .. player.chat_color.r .. ',' .. player.chat_color.g .. ',' .. player.chat_color.b .. ']' .. player.name .. '[/color]',
{'rocks_yield_ore_veins.' .. size[1]},
{'rocks_yield_ore_veins.' .. ore},
icon
},
{r = 0.80, g = 0.80, b = 0.80}
)
end
end
player.print(
{
'rocks_yield_ore_veins.player_print',
{'rocks_yield_ore_veins_colors.' .. ore},
{'rocks_yield_ore_veins.' .. size[1]},
{'rocks_yield_ore_veins.' .. ore},
icon
},
{r = 0.80, g = 0.80, b = 0.80}
)
local ore_entities = {{name = ore, position = {x = event.entity.position.x, y = event.entity.position.y}, amount = get_amount(event.entity.position)}}
local ore_entities = {{name = ore, position = {x = entity.position.x, y = entity.position.y}, amount = get_amount(entity.position)}}
if ore == 'mixed' then
ore_entities = {
{
name = this.mixed_ores[random(1, #this.mixed_ores)],
position = {x = event.entity.position.x, y = event.entity.position.y},
amount = get_amount(event.entity.position)
position = {x = entity.position.x, y = entity.position.y},
amount = get_amount(entity.position)
}
}
end
local ore_positions = {[event.entity.position.x .. '_' .. event.entity.position.y] = true}
local ore_positions = {[entity.position.x .. '_' .. entity.position.y] = true}
local count = random(size[2], size[3])
for _ = 1, 128, 1 do
@@ -170,10 +154,23 @@ local function on_player_mined_entity(event)
if not valid_entities[entity.type] then
return
end
if random(1, this.chance) ~= 1 then
local player = game.get_player(event.player_index)
if not player or not player.valid then
return
end
ore_vein(event)
local chance = this.chance
local is_around_train = Public.is_around_train_simple(player)
if is_around_train then
chance = chance / 2
end
if random(1, chance) ~= 1 then
return
end
ore_vein(player, entity)
end
local function on_init()

View File

@@ -60,8 +60,8 @@ local function equip_players(player_starting_items, data)
end
player.clear_items_inside()
Modifers.update_player_modifiers(player)
for item, amount in pairs(player_starting_items) do
player.insert({name = item, count = amount})
for item, item_data in pairs(player_starting_items) do
player.insert({name = item, count = item_data.count})
end
show_all_gui(player)
clear_spec_tag(player)

View File

@@ -12,6 +12,7 @@ local Server = require 'utils.server'
local LinkedChests = require 'maps.mountain_fortress_v3.icw.linked_chests'
local Discord = require 'utils.discord'
local format_number = require 'util'.format_number
local Explosives = require 'modules.explosives'
local send_ping_to_channel = Discord.channel_names.mtn_channel
local main_button_name = Gui.uid_name()
@@ -198,6 +199,7 @@ end
local function play_game_won()
Core.iter_connected_players(
function(player)
Explosives.detonate_entity(player)
player.play_sound {path = 'utility/game_won', volume_modifier = 0.75}
Task.set_timeout_in_ticks(10, spread_particles_token, {player_index = player.index, particle = 'iron-ore-particle'})
Task.set_timeout_in_ticks(15, spread_particles_token, {player_index = player.index, particle = 'branch-particle'})
@@ -498,24 +500,20 @@ main_frame = function(player)
if stateful.buffs_collected and next(stateful.buffs_collected) then
if stateful.buffs_collected.starting_items then
buffs = buffs .. 'Starting items:\n'
for _, item_data in pairs(stateful.buffs_collected) do
if type(item_data) == 'table' then
for item_name, item_count in pairs(item_data) do
buffs = buffs .. item_name .. ': ' .. item_count
buffs = buffs .. '\n'
end
end
for item_name, item_data in pairs(stateful.buffs_collected.starting_items) do
buffs = buffs .. item_name .. ': ' .. item_data.count
buffs = buffs .. '\n'
end
buffs = buffs .. '\n'
end
buffs = buffs .. 'Force buffs:\n'
for name, count in pairs(stateful.buffs_collected) do
if type(count) ~= 'table' then
for name, buff_data in pairs(stateful.buffs_collected) do
if type(buff_data.amount) ~= 'table' and name ~= 'starting_items' then
if name == 'xp_level' or name == 'character_health_bonus' then
buffs = buffs .. Stateful.buff_to_string[name] .. ': ' .. count
buffs = buffs .. Stateful.buff_to_string[name] .. ': ' .. buff_data.count
else
buffs = buffs .. Stateful.buff_to_string[name] .. ': ' .. (count * 100) .. '%'
buffs = buffs .. Stateful.buff_to_string[name] .. ': ' .. (buff_data.count * 100) .. '%'
end
buffs = buffs .. '\n'
end
@@ -888,7 +886,7 @@ local function update_raw()
collection.survive_for = game.tick + Stateful.scale(random(54000, 72000), 126000)
collection.survive_for_timer = collection.survive_for
collection.nuke_blueprint = true
Public.blueprints.nuke_blueprint()
Public.stateful_blueprints.nuke_blueprint()
WD.disable_spawning_biters(false)
Server.to_discord_embed('Final battle starts now!')
refresh_boss_frame()
@@ -991,7 +989,7 @@ local function update_raw()
play_achievement_unlocked()
WD.disable_spawning_biters(true)
Collapse.disable_collapse(true)
Public.blueprints.blueprint()
Public.stateful_blueprints.blueprint()
WD.nuke_wave_gui()
refresh_frames()

View File

@@ -149,7 +149,7 @@ local function get_random_buff()
{
name = 'xp_level',
modifier = 'rpg',
state = 8
state = 16
},
{
name = 'supplies',
@@ -160,6 +160,26 @@ local function get_random_buff()
{name = 'copper-plate', count = 100}
}
},
{
name = 'supplies_1',
modifier = 'starting_items',
limit = nil,
replaces = 'supplies',
items = {
{name = 'iron-plate', count = 200},
{name = 'copper-plate', count = 200}
}
},
{
name = 'supplies_2',
modifier = 'starting_items_1',
limit = nil,
replaces = 'supplies',
items = {
{name = 'iron-plate', count = 400},
{name = 'copper-plate', count = 400}
}
},
{
name = 'defense',
modifier = 'starting_items',
@@ -173,6 +193,7 @@ local function get_random_buff()
name = 'defense_2',
modifier = 'starting_items',
limit = nil,
replaces = 'defense',
items = {
{name = 'flamethrower', count = 1},
{name = 'flamethrower-ammo', count = 100}
@@ -182,6 +203,7 @@ local function get_random_buff()
name = 'defense_3',
modifier = 'starting_items',
limit = nil,
replaces = 'defense',
items = {
{name = 'grenade', count = 50},
{name = 'poison-capsule', count = 30}
@@ -190,6 +212,7 @@ local function get_random_buff()
{
name = 'defense_4',
modifier = 'starting_items',
replaces = 'defense_2',
limit = nil,
items = {
{name = 'rocket-launcher', count = 1},
@@ -208,6 +231,7 @@ local function get_random_buff()
name = 'armor_2',
modifier = 'starting_items',
limit = 1,
replaces = 'armor',
items = {
{name = 'modular-armor', count = 1},
{name = 'solar-panel-equipment', count = 2}
@@ -223,22 +247,41 @@ local function get_random_buff()
}
},
{
name = 'production_2',
name = 'production_1',
modifier = 'starting_items',
limit = nil,
replaces = 'production',
items = {
{name = 'stone-furnace', count = 4},
{name = 'coal', count = 100}
{name = 'steel-furnace', count = 4},
{name = 'solid-fuel', count = 100}
}
},
{
name = 'fast-startup',
name = 'fast_startup',
modifier = 'starting_items',
limit = nil,
items = {
{name = 'assembling-machine-1', count = 1}
}
},
{
name = 'fast_startup_1',
modifier = 'starting_items',
limit = nil,
replaces = 'fast_startup',
items = {
{name = 'assembling-machine-2', count = 1}
}
},
{
name = 'fast_startup_2',
modifier = 'starting_items',
limit = nil,
replaces = 'fast_startup_2',
items = {
{name = 'assembling-machine-3', count = 1}
}
},
{
name = 'heal-thy-buildings',
modifier = 'starting_items',
@@ -246,6 +289,11 @@ local function get_random_buff()
items = {
{name = 'repair-pack', count = 5}
}
},
{
name = 'extra_wagons',
modifier = 'locomotive',
state = 1
}
}
@@ -259,6 +307,14 @@ local function get_random_buff()
return buffs[1]
end
local function replace_buff(buffs, buff)
for name, data in pairs(buffs) do
if data.buff_type == buff then
buffs[name] = nil
end
end
end
local function get_item_produced_count(item_name)
local force = game.forces.player
@@ -471,19 +527,19 @@ end
local function get_random_items()
local items = {
{'iron-plate', random(5000000, 20000000)},
{'steel-plate', random(400000, 1500000)},
{'copper-plate', random(5000000, 20000000)},
{'iron-gear-wheel', random(400000, 1000000)},
{'iron-stick', random(100000, 300000)},
{'copper-cable', random(20000000, 50000000)},
{'electronic-circuit', random(5000000, 20000000)},
{'advanced-circuit', random(1000000, 2000000)},
{'processing-unit', random(100000, 400000)},
{'engine-unit', random(100000, 300000)},
{'electric-engine-unit', random(50000, 150000)},
{'rocket-control-unit', random(100000, 200000)},
{'explosives', random(1000000, 2000000)}
{'advanced-circuit', scale(1000000, 10000000)},
{'copper-cable', scale(20000000, 100000000)},
{'copper-plate', scale(5000000, 80000000)},
{'electric-engine-unit', scale(30000, 200000)},
{'electronic-circuit', scale(5000000, 50000000)},
{'engine-unit', scale(90000, 750000)},
{'explosives', scale(700000, 3000000)},
{'iron-gear-wheel', scale(400000, 3000000)},
{'iron-plate', scale(5000000, 80000000)},
{'iron-stick', scale(100000, 300000)},
{'processing-unit', scale(100000, 1500000)},
{'rocket-control-unit', scale(20000, 500000)},
{'steel-plate', scale(500000, 7000000)}
}
shuffle(items)
@@ -508,12 +564,15 @@ end
local function get_random_item()
local items = {
{'effectivity-module', random(500, 4000)},
{'effectivity-module-2', random(200, 1000)},
{'productivity-module', random(50000, 100000)},
{'productivity-module-2', random(5000, 20000)},
{'speed-module', random(50000, 200000)},
{'speed-module-2', random(5000, 25000)}
{'effectivity-module', scale(1000, 10000)},
{'effectivity-module-2', scale(200, 4000)},
{'effectivity-module-3', scale(50, 2000)},
{'productivity-module', scale(60000, 400000)},
{'productivity-module-2', scale(10000, 100000)},
{'productivity-module-3', scale(2000, 30000)},
{'speed-module', scale(100000, 1000000)},
{'speed-module-2', scale(10000, 150000)},
{'speed-module-3', scale(3000, 100000)}
}
shuffle(items)
@@ -528,7 +587,6 @@ local function get_random_research_recipe()
-- scale(10, 20)
local research_level_list = {
'energy-weapons-damage-7',
'physical-projectile-damage-7',
'stronger-explosives-7',
'mining-productivity-4',
'worker-robots-speed-6',
@@ -612,9 +670,11 @@ local function apply_buffs(starting_items)
force[buff_name] = force[buff_name] + buff.state
if not this.buffs_collected[buff_name] then
this.buffs_collected[buff_name] = buff.state
this.buffs_collected[buff_name] = {
count = buff.state
}
else
this.buffs_collected[buff_name] = this.buffs_collected[buff_name] + buff.state
this.buffs_collected[buff_name].count = this.buffs_collected[buff_name].count + buff.state
end
end
end
@@ -622,9 +682,23 @@ local function apply_buffs(starting_items)
force[buff.name] = force[buff.name] + buff.state
if not this.buffs_collected[buff.name] then
this.buffs_collected[buff.name] = buff.state
this.buffs_collected[buff.name] = {
count = buff.state
}
else
this.buffs_collected[buff.name] = this.buffs_collected[buff.name] + buff.state
this.buffs_collected[buff.name].count = this.buffs_collected[buff.name].count + buff.state
end
end
if buff.modifier == 'locomotive' then
local extra_wagons = Public.get('extra_wagons')
if not extra_wagons then
this.extra_wagons = buff.state
else
this.extra_wagons = this.extra_wagons + buff.state
end
if this.extra_wagons > 4 then
this.extra_wagons = 4
end
end
if buff.modifier == 'rpg' then
@@ -636,9 +710,11 @@ local function apply_buffs(starting_items)
rpg_extra.difficulty = rpg_extra.difficulty + buff.state
end
if not this.buffs_collected['xp_bonus'] then
this.buffs_collected['xp_bonus'] = buff.state
this.buffs_collected['xp_bonus'] = {
count = buff.state
}
else
this.buffs_collected['xp_bonus'] = this.buffs_collected['xp_bonus'] + buff.state
this.buffs_collected['xp_bonus'].count = this.buffs_collected['xp_bonus'].count + buff.state
end
end
if buff.name == 'xp_level' then
@@ -648,9 +724,11 @@ local function apply_buffs(starting_items)
rpg_extra.grant_xp_level = rpg_extra.grant_xp_level + buff.state
end
if not this.buffs_collected['xp_level'] then
this.buffs_collected['xp_level'] = buff.state
this.buffs_collected['xp_level'] = {
count = buff.state
}
else
this.buffs_collected['xp_level'] = this.buffs_collected['xp_level'] + buff.state
this.buffs_collected['xp_level'].count = this.buffs_collected['xp_level'].count + buff.state
end
end
end
@@ -660,19 +738,31 @@ local function apply_buffs(starting_items)
end
for _, item in pairs(buff.items) do
if item then
if starting_items[item.name] and item.limit and item.limit == 1 then
if starting_items[item.name] and buff.limit and buff.limit == 1 then
break -- break if the limit is 1
end
if buff.replaces then
replace_buff(starting_items, buff.replaces)
replace_buff(this.buffs_collected['starting_items'], buff.replaces)
end
if starting_items[item.name] then
starting_items[item.name] = starting_items[item.name] + item.count
starting_items[item.name].count = starting_items[item.name].count + item.count
starting_items[item.name].buff_type = buff.name
else
starting_items[item.name] = item.count
starting_items[item.name] = {
buff_type = buff.name,
count = item.count
}
end
if not this.buffs_collected['starting_items'][item.name] then
this.buffs_collected['starting_items'][item.name] = item.count
this.buffs_collected['starting_items'][item.name] = {
count = item.count,
buff_type = buff.name
}
else
this.buffs_collected['starting_items'][item.name] = starting_items[item.name] + item.count
this.buffs_collected['starting_items'][item.name].count = starting_items[item.name].count + item.count
this.buffs_collected['starting_items'][item.name].buff_type = buff.name
end
end
end
@@ -767,6 +857,78 @@ local apply_settings_token =
end
)
local function apply_startup_dev_settings(settings)
local current_date = {
year = 2023,
month = 10,
day = 20
}
if not current_date then
return
end
local current_time = 1600509719
if not current_time then
return
end
current_date = round(Utils.convert_date(current_date.year, current_date.month, current_date.day))
local server_name_matches = true
settings = settings or {}
local stored_date = this.current_date
if not stored_date then
return
end
local stored_date_raw = Server.get_current_date(false, true, stored_date)
local converted_stored_date = round(Utils.convert_date(stored_date_raw.year, stored_date_raw.month, stored_date_raw.day))
local time_to_reset = (current_date - converted_stored_date)
if time_to_reset and time_to_reset > this.reset_after then
settings.current_date = current_time
settings.test_mode = false
settings.rounds_survived = 0
settings.buffs = {}
this.buffs = {}
this.buffs_collected = {}
this.rounds_survived = 0
this.current_date = current_time
local message = ({'stateful.reset'})
local message_discord = ({'stateful.reset_discord'})
Task.set_timeout_in_ticks_text(60, {text = message})
Server.to_discord_embed(message_discord, true)
if server_name_matches then
Server.set_data(dataset, dataset_key, settings)
else
Server.set_data(dataset, dataset_key_dev, settings)
end
end
end
---@diagnostic disable-next-line: unused-local
local apply_settings_dev_token =
Token.register(
function(data)
local settings = data and data.value or nil
local current_time = 1700509719
if not current_time then
return
end
this.current_date = settings.current_date
this.buffs = settings.buffs
apply_startup_dev_settings(settings)
this.rounds_survived = settings.rounds_survived
Public.reset_stateful()
Public.increase_enemy_damage_and_health()
end
)
function Public.save_settings()
local granted_buff = get_random_buff()
this.buffs[#this.buffs + 1] = granted_buff
@@ -793,6 +955,7 @@ function Public.reset_stateful(refresh_gui, clear_buffs)
this.objectives_completed = {}
this.objectives_completed_count = 0
this.final_battle = false
this.extra_wagons = 0
if clear_buffs then
this.buffs_collected = {}
end
@@ -1085,4 +1248,86 @@ Public.sizeof_stateful_spawn_points = #stateful_spawn_points
Public.on_pre_player_died = on_pre_player_died
Public.on_market_item_purchased = on_market_item_purchased
if _DEBUG then
Event.on_init(
function()
local cbl = Token.get(apply_settings_dev_token)
local data = {
rounds_survived = 20,
test_mode = false,
buffs = {
{name = 'character_running_speed_modifier', modifier = 'force', state = 0.4},
{name = 'distance', modifier = 'rpg_distance', modifiers = {'character_resource_reach_distance_bonus', 'character_item_pickup_distance_bonus', 'character_loot_pickup_distance_bonus', 'character_reach_distance_bonus'}, state = 1},
{name = 'manual_crafting_speed_modifier', modifier = 'force', state = 0.04},
{name = 'distance', modifier = 'rpg_distance', modifiers = {'character_resource_reach_distance_bonus', 'character_item_pickup_distance_bonus', 'character_loot_pickup_distance_bonus', 'character_reach_distance_bonus'}, state = 1},
{name = 'worker_robots_speed_modifier', modifier = 'force', state = 0.05},
{name = 'laboratory_productivity_bonus', modifier = 'force', state = 0.05},
{
name = 'armor',
modifier = 'starting_items',
limit = 1,
items = {
{name = 'heavy-armor', count = 1}
}
},
{name = 'distance', modifier = 'rpg_distance', modifiers = {'character_resource_reach_distance_bonus', 'character_item_pickup_distance_bonus', 'character_loot_pickup_distance_bonus', 'character_reach_distance_bonus'}, state = 1},
{name = 'worker_robots_speed_modifier', modifier = 'force', state = 0.05},
{name = 'worker_robots_speed_modifier', modifier = 'force', state = 0.05},
{name = 'distance', modifier = 'rpg_distance', modifiers = {'character_resource_reach_distance_bonus', 'character_item_pickup_distance_bonus', 'character_loot_pickup_distance_bonus', 'character_reach_distance_bonus'}, state = 1},
{name = 'xp_level', modifier = 'rpg', state = 16},
{name = 'manual_mining_speed_modifier', modifier = 'force', state = 0.05},
{name = 'defense', modifier = 'starting_items', items = {{name = 'gun-turret', count = 2}, {name = 'firearm-magazine', count = 100}}},
{name = 'xp_level', modifier = 'rpg', state = 16},
{name = 'production', modifier = 'starting_items', items = {{name = 'stone-furnace', count = 4}, {name = 'coal', count = 100}}},
{
name = 'production_1',
modifier = 'starting_items',
limit = nil,
replaces = 'production',
items = {
{name = 'steel-furnace', count = 4},
{name = 'solid-fuel', count = 100}
}
},
{name = 'laboratory_productivity_bonus', modifier = 'force', state = 0.05},
{name = 'character_health_bonus', modifier = 'force', state = 50},
{name = 'manual_mining_speed_modifier', modifier = 'force', state = 0.05},
{name = 'mining_drill_productivity_bonus', modifier = 'force', state = 0.05},
{name = 'manual_crafting_speed_modifier', modifier = 'force', state = 0.04},
{name = 'laboratory_speed_modifier', modifier = 'force', state = 0.05},
{name = 'xp_bonus', modifier = 'rpg', state = 0.02},
{name = 'defense', modifier = 'starting_items', items = {{name = 'gun-turret', count = 2}, {name = 'firearm-magazine', count = 100}}},
{name = 'manual_mining_speed_modifier', modifier = 'force', state = 0.05},
{
name = 'armor',
modifier = 'starting_items',
limit = 1,
items = {
{name = 'heavy-armor', count = 1}
}
},
{
name = 'armor_2',
modifier = 'starting_items',
limit = 1,
replaces = 'armor',
items = {
{name = 'modular-armor', count = 1},
{name = 'solar-panel-equipment', count = 2}
}
},
{name = 'laboratory_productivity_bonus', modifier = 'force', state = 0.05},
{name = 'worker_robots_speed_modifier', modifier = 'force', state = 0.05},
{name = 'extra_wagons', modifier = 'locomotive', state = 1}
},
current_date = 1695168057
}
local settings = {
value = data
}
cbl(settings)
end
)
end
return Public

View File

@@ -115,6 +115,7 @@ function Public.reset_main_table()
this.death_mode = false
this.locomotive_health = 10000
this.locomotive_max_health = 10000
this.extra_wagons = 0
this.gap_between_zones = {
set = false,
gap = 900,
@@ -183,6 +184,7 @@ function Public.reset_main_table()
this.pickaxe_speed_per_purchase = 0.07
this.breached_wall = 1
this.final_battle = false
this.disable_link_chest_cheese_mode = true
this.left_top = {
x = 0,
y = 0
@@ -245,7 +247,7 @@ function Public.reset_main_table()
this.check_afk_players = true
this.winter_mode = false
this.sent_to_discord = false
this.random_seed = random(23849829, 1283989182)
this.random_seed = random(100000000, 1000000000)
this.difficulty = {
multiply = 0.25,
highest = 10,

View File

@@ -71,7 +71,7 @@ local function get_explosion_name(health)
return 'big-artillery-explosion'
end
local function cell_birth(surface_index, origin_position, origin_tick, position, health)
local function cell_birth(surface_index, origin_position, origin_tick, position, health, atomic)
local key = pos_to_key(position)
--Merge cells that are overlapping.
@@ -80,6 +80,10 @@ local function cell_birth(surface_index, origin_position, origin_tick, position,
return
end
if not atomic then
atomic = false
end
--Spawn new cell.
this.explosives.cells[key] = {
surface_index = surface_index,
@@ -87,7 +91,8 @@ local function cell_birth(surface_index, origin_position, origin_tick, position,
origin_tick = origin_tick,
position = {x = position.x, y = position.y},
spawn_tick = game.tick + speed,
health = health
health = health,
atomic = atomic
}
end
@@ -121,8 +126,12 @@ local function grow_cell(cell)
return
end
if not cell.atomic then
cell.atomic = false
end
for _, p in pairs(positions) do
cell_birth(cell.surface_index, cell.origin_position, cell.origin_tick, p, new_cell_health)
cell_birth(cell.surface_index, cell.origin_position, cell.origin_tick, p, new_cell_health, cell.atomic)
end
end
@@ -175,7 +184,11 @@ local function damage_area(cell)
end
if math_random(1, 4) == 1 then
surface.create_entity({name = get_explosion_name(cell.health), position = cell.position})
if cell.atomic then
surface.create_entity({name = 'nuke-explosion', position = cell.position})
else
surface.create_entity({name = get_explosion_name(cell.health), position = cell.position})
end
end
for _, entity in pairs(
@@ -304,6 +317,23 @@ function Public.detonate_chest(entity)
return true
end
function Public.detonate_entity(entity, amount, damage)
if not entity or not entity.valid then
return false
end
if not amount then
amount = 200
end
if not damage then
damage = 700
end
cell_birth(entity.surface.index, {x = entity.position.x, y = entity.position.y}, game.tick, {x = entity.position.x, y = entity.position.y}, amount * damage, true)
return true
end
function Public.reset()
this.explosives.cells = {}
this.explosives.tiles = {}

View File

@@ -9,6 +9,7 @@ local PriorityQueue = require 'utils.priority_queue'
local Event = require 'utils.event'
local Token = require 'utils.token'
local Global = require 'utils.global'
local Color = require 'utils.color_presets'
local floor = math.floor
local log10 = math.log10
@@ -49,6 +50,23 @@ Global.register(
end
)
local delay_print_token =
Token.register(
function(event)
local text = event.text
if not text then
return
end
local color = event.color
if not color then
color = Color.info
end
game.print(text, color)
end
)
local function handler_error(err)
log('\n\t' .. trace(err))
end
@@ -112,6 +130,19 @@ function Task.set_timeout_in_ticks(ticks, func_token, params)
PriorityQueue_push(callbacks, callback)
end
--- Allows you to set a timer (in ticks) after which the tokened function will be run with params given as an argument
-- Cannot be called before init
-- @param ticks <number>
-- @param params <any> the argument to send to the tokened function
function Task.set_timeout_in_ticks_text(ticks, params)
if not game then
error('cannot call when game is not available', 2)
end
local time = game.tick + ticks
local callback = {time = time, func_token = delay_print_token, params = params}
PriorityQueue_push(callbacks, callback)
end
--- Allows you to set a timer (in seconds) after which the tokened function will be run with params given as an argument
-- Cannot be called before init
-- @param sec <number>