1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2024-12-26 22:56:43 +02:00

Mtn v3 - show what season we're on

This commit is contained in:
Gerkiz 2023-11-21 01:03:41 +01:00
parent 3e13c07ca5
commit 922e5e43ff
4 changed files with 72 additions and 4 deletions

View File

@ -139,6 +139,7 @@ researched_complete=__1__ has been researched!
[stateful]
win_conditions=Win conditions
season=[font=default-bold]Season: [/font]
rounds_survived=[font=default-bold]Rounds survived: [/font]
buffs=[font=default-bold]Buffs: [/font]
zone=[font=default-bold]Breach zones: [/font]
@ -155,6 +156,7 @@ production_single=[font=default-bold]Produce the following item: [/font]
market_spent=[font=default-bold]Spend coins in market: [/font]
research=[font=default-bold]Research __1__: [/font]
season_tooltip=Whenever a new season starts, all buffs are reset.\nGerkiz tries to add new content for each season that starts.\nSeason resets in __1__ days.
rounds_survived_tooltip=Winning the game increases this number by 1.\nThis number resets as of now each month.
buff_tooltip=Each buff that is given to the players is listed here.\nHover over the icon to the right to view the buffs.
zone_tooltip=Complete this objective by breaching/moving forward until you've reached the given zone.
@ -169,7 +171,7 @@ tooltip_failed=You've failed to complete this objective. [img=utility/not_availa
tooltip_not_completed=This objective has not been completed. [img=utility/not_available]
tooltip_completed=This objective has been completed. [img=utility/check_mark_green]
tooltip_final=[entity=behemoth-biter] Final battle awaits.
tooltip_final_disabled=[entity=behemoth-biter] Final battle is currently disabled.
tooltip_final_disabled=[entity=behemoth-biter] Final battle is currently being reworked.
tooltip_completing=Complete all objectives and the game is won!
warp_tooltip=This is the time you have left before the train enters the boss zone.\nBe sure to pick up everything that you might need.

View File

@ -1002,6 +1002,17 @@ function Public.render_direction(surface)
text = 'Welcome to Wintery Mountain Fortress v3!'
end
rendering.draw_text {
text = 'Season: ' .. Public.stateful.get_stateful('season'),
surface = surface,
target = {-0, 12},
color = {r = 0.98, g = 0.77, b = 0.22},
scale = 3,
font = 'heading-1',
alignment = 'center',
scale_with_zoom = false
}
if counter then
rendering.draw_text {
text = text .. '\nRun: ' .. counter,

View File

@ -344,6 +344,23 @@ local function boss_frame(player, alert)
frame.style.maximal_height = 500
frame.style.minimal_width = 200
frame.style.maximal_width = 400
local season_tbl = frame.add {type = 'table', column_count = 2}
season_tbl.style.horizontally_stretchable = true
local season_left_flow = season_tbl.add({type = 'flow'})
season_left_flow.style.horizontal_align = 'left'
season_left_flow.style.horizontally_stretchable = true
season_left_flow.add({type = 'label', caption = {'stateful.season'}, tooltip = {'stateful.season_tooltip', stateful.time_to_reset}})
frame.add({type = 'line', direction = 'vertical'})
local season_right_flow = season_tbl.add({type = 'flow'})
season_right_flow.style.horizontal_align = 'right'
season_right_flow.style.horizontally_stretchable = true
data.season_label = season_right_flow.add({type = 'label', caption = stateful.season})
spacer(frame)
local rounds_survived_tbl = frame.add {type = 'table', column_count = 2}
rounds_survived_tbl.style.horizontally_stretchable = true
@ -464,6 +481,23 @@ main_frame = function(player)
frame.style.maximal_height = 700
frame.style.minimal_width = 200
frame.style.maximal_width = 400
local season_tbl = frame.add {type = 'table', column_count = 2}
season_tbl.style.horizontally_stretchable = true
local season_left_flow = season_tbl.add({type = 'flow'})
season_left_flow.style.horizontal_align = 'left'
season_left_flow.style.horizontally_stretchable = true
season_left_flow.add({type = 'label', caption = {'stateful.season'}, tooltip = {'stateful.season_tooltip', stateful.time_to_reset}})
frame.add({type = 'line', direction = 'vertical'})
local season_right_flow = season_tbl.add({type = 'flow'})
season_right_flow.style.horizontal_align = 'right'
season_right_flow.style.horizontally_stretchable = true
data.season_label = season_right_flow.add({type = 'label', caption = stateful.season})
spacer(frame)
local rounds_survived_tbl = frame.add {type = 'table', column_count = 2}
rounds_survived_tbl.style.horizontally_stretchable = true
@ -649,6 +683,9 @@ local function update_data()
local data_boss = Gui.get_data(b)
if data then
if data.season_label and data.season_label.valid then
data.season_label.caption = stateful.season
end
if data.rounds_survived_label and data.rounds_survived_label.valid then
data.rounds_survived_label.caption = stateful.rounds_survived
end
@ -757,6 +794,9 @@ local function update_data()
end
end
if data_boss then
if data_boss.season_label and data_boss.season_label.valid then
data_boss.season_label.caption = stateful.season
end
if data_boss.rounds_survived_label and data_boss.rounds_survived_label.valid then
data_boss.rounds_survived_label.caption = stateful.rounds_survived
end

View File

@ -21,8 +21,10 @@ local Beam = require 'modules.render_beam'
local this = {
enabled = false,
rounds_survived = 0,
season = 1,
buffs = {},
reset_after = 60
reset_after = 60,
time_to_reset = 60
}
local random = math.random
@ -796,6 +798,8 @@ local function apply_startup_settings(settings)
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)
this.time_to_reset = this.reset_after - time_to_reset
if time_to_reset and time_to_reset > this.reset_after then
settings.current_date = current_time
settings.test_mode = false
@ -804,7 +808,10 @@ local function apply_startup_settings(settings)
this.buffs = {}
this.buffs_collected = {}
this.rounds_survived = 0
this.season = this.season + 1
this.current_date = current_time
settings.season = this.season
this.time_to_reset = this.reset_after
local message = ({'stateful.reset'})
local message_discord = ({'stateful.reset_discord'})
game.print(message)
@ -831,7 +838,8 @@ local apply_settings_token =
if not settings then
settings = {
rounds_survived = 0,
current_date = tonumber(current_time)
current_date = tonumber(current_time),
season = 1
}
if server_name_matches then
Server.set_data(dataset, dataset_key, settings)
@ -851,6 +859,7 @@ local apply_settings_token =
apply_startup_settings(settings)
this.rounds_survived = settings.rounds_survived
this.season = settings.season
Public.reset_stateful()
Public.increase_enemy_damage_and_health()
@ -861,7 +870,7 @@ local function apply_startup_dev_settings(settings)
local current_date = {
year = 2023,
month = 10,
day = 20
day = 30
}
if not current_date then
return
@ -885,6 +894,7 @@ local function apply_startup_dev_settings(settings)
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)
this.time_to_reset = this.reset_after - time_to_reset
if time_to_reset and time_to_reset > this.reset_after then
settings.current_date = current_time
settings.test_mode = false
@ -893,7 +903,10 @@ local function apply_startup_dev_settings(settings)
this.buffs = {}
this.buffs_collected = {}
this.rounds_survived = 0
this.season = this.season + 1
this.current_date = current_time
settings.season = this.season
this.time_to_reset = this.reset_after
local message = ({'stateful.reset'})
local message_discord = ({'stateful.reset_discord'})
Task.set_timeout_in_ticks_text(60, {text = message})
@ -935,6 +948,7 @@ function Public.save_settings()
local settings = {
rounds_survived = this.rounds_survived,
season = this.season,
test_mode = this.test_mode,
buffs = this.buffs,
current_date = this.current_date
@ -1254,6 +1268,7 @@ if _DEBUG then
local cbl = Token.get(apply_settings_dev_token)
local data = {
rounds_survived = 20,
season = 1,
test_mode = false,
buffs = {
{name = 'character_running_speed_modifier', modifier = 'force', state = 0.4},