1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-17 20:58:13 +02:00

Mtn v3 - changes

Will the tweaks ever stop?
This commit is contained in:
Gerkiz 2024-05-30 09:07:37 +02:00
parent 98bbc7cabb
commit d0a28334ff
16 changed files with 100 additions and 395 deletions

View File

@ -63,6 +63,8 @@ local function get_coin_count(entity)
return coin_count
end
---comment
---@param event EventData.on_entity_died
local function on_entity_died(event)
local entity = event.entity
if not entity.valid then

View File

@ -168,6 +168,8 @@ function Public.reset_map()
JailData.reset_vote_table()
Explosives.set_surface_whitelist({[surface.name] = true})
Explosives.disable(false)
Explosives.slow_explode(true)
Beam.reset_valid_targets()

View File

@ -123,7 +123,7 @@ local function ore_vein(player, entity)
}
end
StatData:get_data(player):increase('ore_veins')
StatData.get_data(player):increase('ore_veins')
local ore_positions = {[entity.position.x .. '_' .. entity.position.y] = true}
local count = random(size[2], size[3])

View File

@ -60,7 +60,7 @@ local function write_additional_stats(key)
return
end
this.seasons[#this.seasons] = {
this.seasons[#this.seasons + 1] = {
season_index = season,
rounds_survived = rounds_survived,
buffs_granted = total_buffs,

View File

@ -252,9 +252,9 @@ local function create_input_element(frame, type, value, items, index, tooltip, c
end
local function play_game_won()
Explosives.disable(false)
Core.iter_connected_players(
function(player)
Explosives.disable(false)
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'})
@ -1109,10 +1109,10 @@ local function update_raw()
elseif collection.time_until_attack and collection.time_until_attack < 0 then
collection.time_until_attack = 0
if not collection.nuke_blueprint then
collection.survive_for = game.tick + Stateful.scale(random(54000, 72000), 126000)
collection.survive_for = game.tick + Stateful.scale(10 * 3600, 35 * 3600)
collection.survive_for_timer = collection.survive_for
collection.nuke_blueprint = true
Public.stateful_blueprints.nuke_blueprint()
-- Public.stateful_blueprints.nuke_blueprint()
WD.disable_spawning_biters(false)
Server.to_discord_embed('Final battle starts now!')
refresh_boss_frame()
@ -1260,7 +1260,8 @@ local function update_raw()
Collapse.set_reverse_position({0, reverse_position})
Collapse.set_reverse_direction()
Collapse.reverse_start_now(true)
Public.stateful_blueprints.blueprint()
Alert.alert_all_players(200, 'Reverse collapse has been initiated!')
-- Public.stateful_blueprints.blueprint()
WD.nuke_wave_gui()
Public.set('pre_final_battle', true)

View File

@ -42,7 +42,7 @@ Global.register(
end
)
local damage_types = {'physical', 'electric', 'fire', 'poison', 'laser'}
local damage_types = {'physical', 'electric', 'poison', 'laser'}
local stateful_spawn_points = {
{{x = -205, y = -37}, {x = 195, y = 37}},
@ -288,17 +288,6 @@ local function get_random_buff(fetch_all, only_force)
{name = 'copper-plate', count = 400}
}
},
{
name = 'defense',
discord = 'Defense starting supplies - start with some turrets and ammo',
modifier = 'starting_items',
limit = 10,
add_per_buff = 1,
items = {
{name = 'gun-turret', count = 2},
{name = 'firearm-magazine', count = 25}
}
},
{
name = 'defense_3',
discord = 'Defense starting supplies - start with more turrets and ammo',
@ -1678,7 +1667,7 @@ function Public.reset_stateful(refresh_gui, clear_buffs)
if not this.objectives.cast_spell_any or (this.objectives_completed ~= nil and this.objectives_completed.cast_spell_any) then
this.objectives.cast_spell_any = {
actual = 0,
expected = scale(50000, 4000000, 1.035),
expected = scale(1000, 4000000, 1.035),
name = 'Any'
}
end
@ -2015,347 +2004,4 @@ 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 = Task.get(apply_settings_dev_token)
local data = {
rounds_survived = 11,
season = 4,
test_mode = false,
buffs = {
{
name = 'steel_axe_unlocked',
discord = 'Equipement tech - start with steel axe tech unlocked.',
modifier = 'tech',
limit = 1,
add_per_buff = 1,
techs = {
{name = 'steel-axe', count = 1}
}
},
{
name = 'military_2_unlocked',
discord = 'Equipement tech - start with military 2 tech unlocked.',
modifier = 'tech',
limit = 1,
add_per_buff = 1,
techs = {
{name = 'military-2', count = 1}
}
},
{
name = 'character_running_speed_modifier',
discord = 'Running speed modifier - run faster!',
modifier = 'force',
per_force = true,
state = 0.05
},
{
name = 'manual_mining_speed_modifier',
discord = 'Mining speed modifier - mine faster!',
modifier = 'force',
per_force = true,
state = 0.15
},
{
name = 'laboratory_speed_modifier',
discord = 'Laboratory speed modifier - labs work faster!',
modifier = 'force',
per_force = true,
state = 0.15
},
{
name = 'laboratory_productivity_bonus',
discord = 'Laboratory productivity bonus - labs dupe things!',
modifier = 'force',
per_force = true,
state = 0.15
},
{
name = 'worker_robots_storage_bonus',
discord = 'Robot storage bonus - robots carry more!',
modifier = 'force',
per_force = true,
state = 1
},
{
name = 'worker_robots_battery_modifier',
discord = 'Robot battery bonus - robots work longer!',
modifier = 'force',
per_force = true,
state = 1
},
{
name = 'worker_robots_speed_modifier',
discord = 'Robot speed modifier - robots move faster!',
modifier = 'force',
per_force = true,
state = 0.5
},
{
name = 'mining_drill_productivity_bonus',
discord = 'Drill productivity bonus - drills work faster!',
modifier = 'force',
per_force = true,
state = 0.5
},
{
name = 'character_health_bonus',
discord = 'Character health bonus - more health!',
modifier = 'force',
per_force = true,
state = 250
},
{
name = 'distance',
discord = 'RPG reach distance bonus - reach further!',
modifier = 'rpg_distance',
per_force = true,
modifiers = {'character_resource_reach_distance_bonus', 'character_item_pickup_distance_bonus', 'character_loot_pickup_distance_bonus', 'character_reach_distance_bonus'},
state = 0.05
},
{
name = 'manual_crafting_speed_modifier',
discord = 'Crafting speed modifier - craft faster!',
modifier = 'force',
per_force = true,
state = 0.12
},
{
name = 'xp_bonus',
discord = 'RPG XP point bonus - more XP points from kills etc.',
modifier = 'rpg',
per_force = true,
state = 0.12
},
{
name = 'xp_level',
discord = 'RPG XP level bonus - start with more XP levels',
modifier = 'rpg',
per_force = true,
state = 20
},
{
name = 'chemicals_s',
discord = 'Starting items supplies - start with some sulfur',
modifier = 'starting_items',
limit = 200,
add_per_buff = 50,
items = {
{name = 'sulfur', count = 50}
}
},
{
name = 'chemicals_p',
discord = 'Starting items supplies - start with some plastic bar',
modifier = 'starting_items',
limit = 200,
add_per_buff = 50,
items = {
{name = 'plastic-bar', count = 100}
}
},
{
name = 'supplies',
discord = 'Starting items supplies - start with some copper and iron plates',
modifier = 'starting_items',
limit = 1000,
add_per_buff = 100,
items = {
{name = 'iron-plate', count = 100},
{name = 'copper-plate', count = 100}
}
},
{
name = 'supplies_1',
discord = 'Starting items supplies - start with more copper and iron plates',
modifier = 'starting_items',
limit = 1000,
add_per_buff = 200,
items = {
{name = 'iron-plate', count = 200},
{name = 'copper-plate', count = 200}
}
},
{
name = 'supplies_2',
discord = 'Starting items supplies - start with even more copper and iron plates',
modifier = 'starting_items',
limit = 1000,
add_per_buff = 400,
items = {
{name = 'iron-plate', count = 400},
{name = 'copper-plate', count = 400}
}
},
{
name = 'defense',
discord = 'Defense starting supplies - start with some turrets and ammo',
modifier = 'starting_items',
limit = 10,
add_per_buff = 1,
items = {
{name = 'gun-turret', count = 2},
{name = 'firearm-magazine', count = 25}
}
},
{
name = 'defense_3',
discord = 'Defense starting supplies - start with more turrets and ammo',
modifier = 'starting_items',
limit = 1,
add_per_buff = 1,
items = {
{name = 'rocket-launcher', count = 1},
{name = 'rocket', count = 100}
}
},
{
name = 'armor',
discord = 'Armor starting supplies - start with some armor and solar panels',
modifier = 'starting_items',
limit = 1,
add_per_buff = 1,
items = {
{name = 'modular-armor', count = 1},
{name = 'solar-panel-equipment', count = 2}
}
},
{
name = 'production',
discord = 'Production starting supplies - start with some furnaces and coal',
modifier = 'starting_items',
limit = 2,
add_per_buff = 1,
items = {
{name = 'stone-furnace', count = 4},
{name = 'coal', count = 100}
}
},
{
name = 'production_1',
discord = 'Production starting supplies - start with some steel furnaces and solid fuel',
modifier = 'starting_items',
limit = 2,
add_per_buff = 1,
items = {
{name = 'steel-furnace', count = 4},
{name = 'solid-fuel', count = 100}
}
},
{
name = 'fast_startup',
discord = 'Assembling starting supplies - start with some assembling machines T1',
modifier = 'starting_items',
limit = 25,
add_per_buff = 2,
items = {
{name = 'assembling-machine-1', count = 2}
}
},
{
name = 'fast_startup_1',
discord = 'Assembling starting supplies - start with some assembling machines T2',
modifier = 'starting_items',
limit = 25,
add_per_buff = 2,
items = {
{name = 'assembling-machine-2', count = 2}
}
},
{
name = 'fast_startup_2',
discord = 'Assembling starting supplies - start with some assembling machines T3',
modifier = 'starting_items',
limit = 25,
add_per_buff = 2,
items = {
{name = 'assembling-machine-3', count = 2}
}
},
{
name = 'heal-thy-buildings',
discord = 'Repair starting supplies - start with some repair packs',
modifier = 'starting_items',
limit = 20,
add_per_buff = 2,
items = {
{name = 'repair-pack', count = 5}
}
},
{
name = 'extra_wagons',
discord = 'Extra wagon at start',
modifier = 'locomotive',
state = 1
},
{
name = 'american_oil',
discord = 'Oil tech - start with some crude oil barrels',
modifier = 'starting_items',
limit = 40,
add_per_buff = 20,
items = {
{name = 'crude-oil-barrel', count = 20}
}
},
{
name = 'steel_plates',
discord = 'Steel tech - start with some steel plates',
modifier = 'starting_items',
limit = 200,
add_per_buff = 100,
items = {
{name = 'steel-plate', count = 100}
}
},
{
name = 'red_science',
discord = 'Science tech - start with some red science packs',
modifier = 'starting_items',
limit = 200,
add_per_buff = 10,
items = {
{name = 'automation-science-pack', count = 10}
}
},
{
name = 'roboport_equipement',
discord = 'Equipement tech - start with a personal roboport',
modifier = 'starting_items',
limit = 4,
add_per_buff = 1,
items = {
{name = 'personal-roboport-equipment', count = 1}
}
},
{
name = 'mk1_tech_unlocked',
discord = 'Equipement tech - start with power armor tech unlocked.',
modifier = 'tech',
limit = 1,
add_per_buff = 1,
techs = {
{name = 'power-armor', count = 1}
}
},
{
name = 'all_the_fish',
discord = 'Wagon is full of fish!',
modifier = 'fish',
limit = 1,
add_per_buff = 1
}
},
current_date = 1711187954
}
local settings = {
value = data
}
cbl(settings)
end
)
end
return Public

View File

@ -16,7 +16,7 @@ local this = {
}
local stateful_settings = {
reversed = true
reversed = false
}
local Public = {}
local random = math.random
@ -138,6 +138,7 @@ function Public.reset_main_table()
this.locomotive_max_health = 10000
this.extra_wagons = 0
this.all_the_fish = false
this.reverse_collapse_warning = false
this.gap_between_zones = {
set = false,
gap = 900,
@ -266,7 +267,7 @@ function Public.reset_main_table()
redraw_mystical_chest_cost = 3000
}
this.collapse_grace = true
this.corpse_removal_disabled = false
this.corpse_removal_disabled = true
this.locomotive_biter = nil
this.disconnect_wagon = false
this.collapse_amount = false

View File

@ -6,6 +6,7 @@ local this = {
explosives = {},
settings = {
disabled = false,
slow_explode = false,
check_growth_below_void = false,
valid_items = {
['explosives'] = 500,
@ -26,7 +27,7 @@ local math_sqrt = math.sqrt
local math_round = math.round
local math_random = math.random
local shuffle_table = table.shuffle_table
local speed = 3
local speed = 6
local density = 1
local density_r = density * 0.5
local valid_container_types = {
@ -242,12 +243,28 @@ local function tick()
return
end
for key, cell in pairs(this.explosives.cells) do
if cell.spawn_tick < game.tick then
life_cycle(cell)
this.explosives.cells[key] = nil
if this.settings.slow_explode then
local count = 0
for key, cell in pairs(this.explosives.cells) do
if cell.spawn_tick < game.tick then
count = count + 1
if count < 50 then
life_cycle(cell)
this.explosives.cells[key] = nil
else
cell.spawn_tick = game.tick + speed
end
end
end
else
for key, cell in pairs(this.explosives.cells) do
if cell.spawn_tick < game.tick then
life_cycle(cell)
this.explosives.cells[key] = nil
end
end
end
if game.tick % 216000 == 0 then
this.explosives.tiles = {}
end
@ -293,7 +310,9 @@ local function on_entity_died(event)
return
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)
local final_damage = amount * damage
cell_birth(entity.surface.index, {x = entity.position.x, y = entity.position.y}, game.tick, {x = entity.position.x, y = entity.position.y}, final_damage)
end
function Public.detonate_chest(entity)
@ -395,6 +414,10 @@ function Public.check_growth_below_void(value)
this.settings.check_growth_below_void = value or false
end
function Public.slow_explode(value)
this.settings.slow_explode = value or false
end
local function on_init()
Public.reset()
end

View File

@ -54,6 +54,11 @@ function Public:new_render()
if not surface or not surface.valid then
return
end
if self.render_id then
rendering.destroy(self.render_id)
end
self.render_id = rendering.draw_sprite {target = self.position, sprite = self.sprite, surface = surface}
return self
end
@ -113,6 +118,22 @@ function Public:random_position()
return {x = self.position.x + (random() - 0.5) * 64, y = self.position.y + (random() - 0.5) * 64}
end
--- Sets a random sprite
---@return table
function Public:random_sprite()
if random(1, 2) == 1 then
self.sprite = Gui.beam
self:new_render()
elseif random(1, 2) == 2 then
self.sprite = Gui.beam_2
self:new_render()
else
self.sprite = Gui.beam_1
self:new_render()
end
return self
end
--- Changes the position of a render.
---@param max_abs number
---@param value boolean
@ -166,7 +187,7 @@ end
--- Renders a new chart
function Public:render_chart()
if self.chart then
if self.chart and self.chart.valid then
self.chart.destroy()
end
@ -278,7 +299,7 @@ end
--- Destroys a render.
function Public:destroy_chart()
if self.chart then
if self.chart and self.chart.valid then
self.chart.destroy()
end
return self

View File

@ -752,9 +752,9 @@ function Public.add_tidal_wave(cause, ent_position, shape, length, max_spread)
cause = cause,
start_position = cause.position,
direction = {ent_position.x - cause.position.x, ent_position.y - cause.position.y},
length = length or 24,
length = length or 18,
base_spread = 0.5,
max_spread = max_spread or 5,
max_spread = max_spread or 4,
shape = shape or false,
tick = 0
}
@ -1427,10 +1427,10 @@ function Public.rpg_reset_player(player, one_time_reset)
dropdown_select_name = Public.all_spells[1].name[1],
dropdown_select_index_1 = 1,
dropdown_select_name_1 = Public.all_spells[1].name[1],
dropdown_select_index_2 = 1,
dropdown_select_name_2 = Public.all_spells[1].name[1],
dropdown_select_index_3 = 1,
dropdown_select_name_3 = Public.all_spells[1].name[1],
dropdown_select_index_2 = 2,
dropdown_select_name_2 = Public.all_spells[2].name[1],
dropdown_select_index_3 = 3,
dropdown_select_name_3 = Public.all_spells[3].name[1],
allocate_index = 1,
amount = 0,
explosive_bullets = false,
@ -1477,10 +1477,10 @@ function Public.rpg_reset_player(player, one_time_reset)
dropdown_select_name = Public.all_spells[1].name[1],
dropdown_select_index_1 = 1,
dropdown_select_name_1 = Public.all_spells[1].name[1],
dropdown_select_index_2 = 1,
dropdown_select_name_2 = Public.all_spells[1].name[1],
dropdown_select_index_3 = 1,
dropdown_select_name_3 = Public.all_spells[1].name[1],
dropdown_select_index_2 = 2,
dropdown_select_name_2 = Public.all_spells[2].name[1],
dropdown_select_index_3 = 3,
dropdown_select_name_3 = Public.all_spells[3].name[1],
allocate_index = 1,
amount = 0,
explosive_bullets = false,

View File

@ -140,6 +140,7 @@ function Public.update_spell_gui(player, spell_index)
local spell_3_data = Public.get_spell_by_name(rpg_t, rpg_t.dropdown_select_name_3)
local shift_tooltip = 'Hold [color=yellow]SHIFT[/color] while clicking a spell to quickly change your spells.'
local shift_active_tooltip = 'Current activated spell.'
local t1 = {'', {spell_1_data and spell_1_data.name and spell_1_data.name[1] or '---'}, '\n', shift_tooltip}
spell_table[spell1_button_name].tooltip = t1
@ -154,24 +155,30 @@ function Public.update_spell_gui(player, spell_index)
spell_table[spell3_button_name].sprite = spell_3_data.sprite
if rpg_t.dropdown_select_index_1 == rpg_t.dropdown_select_index then
local te1 = {'', {spell_1_data and spell_1_data.name and spell_1_data.name[1] or '---'}, '\n', shift_active_tooltip}
spell_table[spell1_button_name].enabled = false
spell_table[spell1_button_name].number = 1
spell_table[spell1_button_name].tooltip = te1
rpg_t.dropdown_select_name = rpg_t.dropdown_select_name_1
else
spell_table[spell1_button_name].enabled = true
spell_table[spell1_button_name].number = nil
end
if rpg_t.dropdown_select_index_2 == rpg_t.dropdown_select_index then
local te2 = {'', {spell_2_data and spell_2_data.name and spell_2_data.name[1] or '---'}, '\n', shift_active_tooltip}
spell_table[spell2_button_name].enabled = false
spell_table[spell2_button_name].number = 1
spell_table[spell2_button_name].tooltip = te2
rpg_t.dropdown_select_name = rpg_t.dropdown_select_name_2
else
spell_table[spell2_button_name].enabled = true
spell_table[spell2_button_name].number = nil
end
if rpg_t.dropdown_select_index_3 == rpg_t.dropdown_select_index then
local te3 = {'', {spell_3_data and spell_3_data.name and spell_3_data.name[1] or '---'}, '\n', shift_active_tooltip}
spell_table[spell3_button_name].enabled = false
spell_table[spell3_button_name].number = 1
spell_table[spell3_button_name].tooltip = te3
rpg_t.dropdown_select_name = rpg_t.dropdown_select_name_3
else
spell_table[spell3_button_name].enabled = true

View File

@ -102,11 +102,11 @@ end
local levels = {
[150] = {length = 26, max_spread = 6},
[200] = {length = 27, max_spread = 6},
[250] = {length = 28, max_spread = 7},
[300] = {length = 29, max_spread = 7},
[350] = {length = 30, max_spread = 8},
[400] = {length = 31, max_spread = 8}
[250] = {length = 27, max_spread = 6},
[350] = {length = 28, max_spread = 7},
[450] = {length = 29, max_spread = 7},
[550] = {length = 30, max_spread = 8},
[650] = {length = 31, max_spread = 8}
}
local function get_level_data(player_level)
@ -123,7 +123,7 @@ local function get_level_data(player_level)
if closest_level then
return levels[closest_level]
else
return {length = 26, max_spread = 6}
return {length = 18, max_spread = 4}
end
end
@ -374,7 +374,7 @@ spells[#spells + 1] = {
spells[#spells + 1] = {
name = {'entity-name.iron-chest'},
entityName = 'iron-chest',
level = 10,
level = 1,
type = 'item',
mana_cost = 50,
cooldown = 70,
@ -687,7 +687,7 @@ if _DEBUG then
name = 'Kewl Nade',
entityName = 'cluster-grenade',
target = true,
amount = 20,
amount = 10,
damage = true,
aoe = true,
force = 'player',
@ -1163,7 +1163,7 @@ spells[#spells + 1] = {
level = 60,
type = 'special',
mana_cost = 340,
cooldown = 2000,
cooldown = 1500,
enforce_cooldown = true,
enabled = true,
log_spell = true,
@ -1199,8 +1199,8 @@ spells[#spells + 1] = {
force = 'player',
level = 100,
type = 'special',
mana_cost = 340,
cooldown = 100,
mana_cost = 300,
cooldown = 200,
enforce_cooldown = true,
enabled = true,
log_spell = false,

BIN
utils/files/beam_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

BIN
utils/files/beam_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

View File

@ -43,6 +43,8 @@ Public.token =
)
Public.beam = 'file/utils/files/beam.png'
Public.beam_1 = 'file/utils/files/beam_1.png'
Public.beam_2 = 'file/utils/files/beam_2.png'
Public.settings_white_icon = 'file/utils/files/settings-white.png'
Public.settings_black_icon = 'file/utils/files/settings-black.png'
Public.pin_white_icon = 'file/utils/files/pin-white.png'

View File

@ -1,7 +1,7 @@
-- created by Gerkiz for ComfyFactorio
local Gui = require 'utils.gui'
local Token = require 'utils.token'
local Task = require 'utils.task_token'
local StatData = require 'utils.datastore.statistics'
local format_number = require 'util'.format_number
local Server = require 'utils.server'
@ -89,7 +89,7 @@ local function show_score(data)
end
end
local show_stats_token = Token.register(show_score)
local show_stats_token = Task.register(show_score)
Gui.add_tab_to_gui({name = module_name, caption = 'Statistics', id = show_stats_token, admin = false})