mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2024-12-30 23:17:53 +02:00
Gui: fix progressbar style change for 2.0
This commit is contained in:
parent
07eb4847d0
commit
39ed308f37
@ -8,11 +8,11 @@ local this = {
|
||||
fish_in_space = 0,
|
||||
fish_autolaunch = true,
|
||||
catplanet_goals = {
|
||||
{goal = 0, rank = false, achieved = true},
|
||||
{ goal = 0, rank = false, achieved = true },
|
||||
{
|
||||
goal = 100,
|
||||
rank = 'Copper',
|
||||
color = {r = 201, g = 133, b = 6},
|
||||
color = { r = 201, g = 133, b = 6 },
|
||||
msg = 'You have saved the first container of fish!',
|
||||
msg2 = 'However, this is only the beginning.',
|
||||
achieved = false
|
||||
@ -20,7 +20,7 @@ local this = {
|
||||
{
|
||||
goal = 1000,
|
||||
rank = 'Bronze',
|
||||
color = {r = 186, g = 115, b = 39},
|
||||
color = { r = 186, g = 115, b = 39 },
|
||||
msg = 'Thankful for the fish, they sent back a toy mouse made of solid bronze!',
|
||||
msg2 = 'They are demanding more.',
|
||||
achieved = false
|
||||
@ -28,7 +28,7 @@ local this = {
|
||||
{
|
||||
goal = 10000,
|
||||
rank = 'Silver',
|
||||
color = {r = 186, g = 178, b = 171},
|
||||
color = { r = 186, g = 178, b = 171 },
|
||||
msg = 'In gratitude for the fish, they left you a silver furball!',
|
||||
msg2 = 'They are still longing for more.',
|
||||
achieved = false
|
||||
@ -36,7 +36,7 @@ local this = {
|
||||
{
|
||||
goal = 25000,
|
||||
rank = 'Gold',
|
||||
color = {r = 255, g = 214, b = 33},
|
||||
color = { r = 255, g = 214, b = 33 },
|
||||
msg = 'Pleased about the delivery, they sent back a golden audiotape with cat purrs.',
|
||||
msg2 = 'They still demand more.',
|
||||
achieved = false
|
||||
@ -44,7 +44,7 @@ local this = {
|
||||
{
|
||||
goal = 50000,
|
||||
rank = 'Platinum',
|
||||
color = {r = 224, g = 223, b = 215},
|
||||
color = { r = 224, g = 223, b = 215 },
|
||||
msg = 'To express their infinite love, they sent back a yarnball made of shiny material.',
|
||||
msg2 = 'Defying all logic, they still demand more fish.',
|
||||
achieved = false
|
||||
@ -52,7 +52,7 @@ local this = {
|
||||
{
|
||||
goal = 100000,
|
||||
rank = 'Diamond',
|
||||
color = {r = 237, g = 236, b = 232},
|
||||
color = { r = 237, g = 236, b = 232 },
|
||||
msg = 'A box arrives with a mewing kitten, it a has a diamond collar.',
|
||||
msg2 = 'More fish? Why? What..',
|
||||
achieved = false
|
||||
@ -60,7 +60,7 @@ local this = {
|
||||
{
|
||||
goal = 250000,
|
||||
rank = 'Anti-matter',
|
||||
color = {r = 100, g = 100, b = 245},
|
||||
color = { r = 100, g = 100, b = 245 },
|
||||
msg = 'The obese cat colapses and forms a black hole!',
|
||||
msg2 = ':obese:',
|
||||
achieved = false
|
||||
@ -68,7 +68,7 @@ local this = {
|
||||
{
|
||||
goal = 500000,
|
||||
rank = 'Black Hole',
|
||||
color = {r = 100, g = 100, b = 245},
|
||||
color = { r = 100, g = 100, b = 245 },
|
||||
msg = 'A letter arrives, it reads: Go to bed hooman!',
|
||||
msg2 = 'Not yet...',
|
||||
achieved = false
|
||||
@ -76,7 +76,7 @@ local this = {
|
||||
{
|
||||
goal = 1000000,
|
||||
rank = 'Blue Screen',
|
||||
color = {r = 100, g = 100, b = 245},
|
||||
color = { r = 100, g = 100, b = 245 },
|
||||
msg = 'Cat error #4721',
|
||||
msg2 = '....',
|
||||
achieved = false
|
||||
@ -84,7 +84,7 @@ local this = {
|
||||
{
|
||||
goal = 10000000,
|
||||
rank = 'Blue Screen',
|
||||
color = {r = 100, g = 100, b = 245},
|
||||
color = { r = 100, g = 100, b = 245 },
|
||||
msg = '....',
|
||||
msg2 = '....',
|
||||
achieved = false
|
||||
@ -94,7 +94,7 @@ local this = {
|
||||
|
||||
Global.register(
|
||||
this,
|
||||
function(t)
|
||||
function (t)
|
||||
this = t
|
||||
end
|
||||
)
|
||||
@ -113,11 +113,11 @@ local function fish_in_space_toggle_button(player)
|
||||
end
|
||||
local button =
|
||||
player.gui.top.add {
|
||||
name = 'fish_in_space_toggle',
|
||||
type = 'sprite-button',
|
||||
sprite = 'item/raw-fish',
|
||||
tooltip = 'Fish in Space'
|
||||
}
|
||||
name = 'fish_in_space_toggle',
|
||||
type = 'sprite-button',
|
||||
sprite = 'item/raw-fish',
|
||||
tooltip = 'Fish in Space'
|
||||
}
|
||||
button.style.font = 'default-bold'
|
||||
button.style.minimal_height = 38
|
||||
button.style.minimal_width = 38
|
||||
@ -132,14 +132,14 @@ local function level_up_popup(player)
|
||||
if player.gui.center['level_up_popup'] then
|
||||
player.gui.center['level_up_popup'].destroy()
|
||||
end
|
||||
local frame = player.gui.center.add({type = 'frame', name = 'level_up_popup', direction = 'vertical'})
|
||||
local label = frame.add({type = 'label', caption = reward.msg})
|
||||
local frame = player.gui.center.add({ type = 'frame', name = 'level_up_popup', direction = 'vertical' })
|
||||
local label = frame.add({ type = 'label', caption = reward.msg })
|
||||
label.style.font = 'default-listbox'
|
||||
label.style.font_color = reward.color
|
||||
local button = frame.add({type = 'button', caption = reward.msg2, name = 'level_up_popup_close'})
|
||||
local button = frame.add({ type = 'button', caption = reward.msg2, name = 'level_up_popup_close' })
|
||||
button.style.minimal_width = string.len(reward.msg) * 7
|
||||
button.style.font = 'default-listbox'
|
||||
button.style.font_color = {r = 0.77, g = 0.77, b = 0.77}
|
||||
button.style.font_color = { r = 0.77, g = 0.77, b = 0.77 }
|
||||
end
|
||||
|
||||
local function fish_in_space_gui(player)
|
||||
@ -154,28 +154,29 @@ local function fish_in_space_gui(player)
|
||||
player.gui.left['fish_in_space'].destroy()
|
||||
end
|
||||
|
||||
local frame = player.gui.left.add({type = 'frame', name = 'fish_in_space'})
|
||||
local label = frame.add({type = 'label', caption = 'Fish rescued: '})
|
||||
label.style.font_color = {r = 0.11, g = 0.8, b = 0.44}
|
||||
local frame = player.gui.left.add({ type = 'frame', name = 'fish_in_space' })
|
||||
local label = frame.add({ type = 'label', caption = 'Fish rescued: ' })
|
||||
label.style.font_color = { r = 0.11, g = 0.8, b = 0.44 }
|
||||
|
||||
local progress = this.fish_in_space / this.catplanet_goals[i + 1].goal
|
||||
if progress > 1 then
|
||||
progress = 1
|
||||
end
|
||||
local progressbar = frame.add({type = 'progressbar', value = progress})
|
||||
local progressbar = frame.add({ type = 'progressbar', value = progress })
|
||||
progressbar.style = 'achievement_progressbar'
|
||||
progressbar.style.minimal_width = 96
|
||||
progressbar.style.maximal_width = 96
|
||||
progressbar.style.padding = -1
|
||||
progressbar.style.top_padding = 1
|
||||
progressbar.style.height = 20
|
||||
|
||||
label = frame.add({type = 'label', caption = this.fish_in_space .. '/' .. tostring(this.catplanet_goals[i + 1].goal)})
|
||||
label.style.font_color = {r = 0.33, g = 0.66, b = 0.9}
|
||||
label = frame.add({ type = 'label', caption = this.fish_in_space .. '/' .. tostring(this.catplanet_goals[i + 1].goal) })
|
||||
label.style.font_color = { r = 0.33, g = 0.66, b = 0.9 }
|
||||
|
||||
if this.catplanet_goals[i].rank then
|
||||
label = frame.add({type = 'label', caption = ' ~Rank~'})
|
||||
label.style.font_color = {r = 0.75, g = 0.75, b = 0.75}
|
||||
label = frame.add({type = 'label', caption = this.catplanet_goals[i].rank})
|
||||
label = frame.add({ type = 'label', caption = ' ~Rank~' })
|
||||
label.style.font_color = { r = 0.75, g = 0.75, b = 0.75 }
|
||||
label = frame.add({ type = 'label', caption = this.catplanet_goals[i].rank })
|
||||
label.style.font = 'default-bold'
|
||||
label.style.font_color = this.catplanet_goals[i].color
|
||||
end
|
||||
@ -185,16 +186,16 @@ local function fireworks(entity)
|
||||
for x = entity.position.x - 32, entity.position.x + 32, 1 do
|
||||
for y = entity.position.y - 32, entity.position.y + 32, 1 do
|
||||
if math.random(1, 150) == 1 then
|
||||
entity.surface.create_entity({name = 'big-explosion', position = {x = x, y = y}})
|
||||
entity.surface.create_entity({ name = 'big-explosion', position = { x = x, y = y } })
|
||||
end
|
||||
if math.random(1, 150) == 1 then
|
||||
entity.surface.create_entity({name = 'uranium-cannon-shell-explosion', position = {x = x, y = y}})
|
||||
entity.surface.create_entity({ name = 'uranium-cannon-shell-explosion', position = { x = x, y = y } })
|
||||
end
|
||||
if math.random(1, 150) == 1 then
|
||||
entity.surface.create_entity({name = 'blood-explosion-huge', position = {x = x, y = y}})
|
||||
entity.surface.create_entity({ name = 'blood-explosion-huge', position = { x = x, y = y } })
|
||||
end
|
||||
if math.random(1, 150) == 1 then
|
||||
entity.surface.create_entity({name = 'big-artillery-explosion', position = {x = x, y = y}})
|
||||
entity.surface.create_entity({ name = 'big-artillery-explosion', position = { x = x, y = y } })
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -216,7 +217,7 @@ local function on_rocket_launched(event)
|
||||
|
||||
if not this.catplanet_goals[i].achieved then
|
||||
for _, player in pairs(game.connected_players) do
|
||||
player.play_sound {path = 'utility/game_won', volume_modifier = 0.9}
|
||||
player.play_sound { path = 'utility/game_won', volume_modifier = 0.9 }
|
||||
level_up_popup(player)
|
||||
end
|
||||
this.catplanet_goals[i].achieved = true
|
||||
@ -263,7 +264,7 @@ local function tick()
|
||||
if game.tick % 6000 == 0 then
|
||||
local found_silos = {}
|
||||
for _, surface in pairs(game.surfaces) do
|
||||
local objects = surface.find_entities_filtered {name = 'rocket-silo'}
|
||||
local objects = surface.find_entities_filtered { name = 'rocket-silo' }
|
||||
for _, object in pairs(objects) do
|
||||
table.insert(found_silos, object)
|
||||
end
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -96,6 +96,7 @@ local function create_wave_gui(player)
|
||||
progressbar.style.minimal_width = 120
|
||||
progressbar.style.maximal_width = 120
|
||||
progressbar.style.top_padding = 10
|
||||
progressbar.style.height = 20
|
||||
else
|
||||
local time_remaining = math.floor(((this.wave_grace_period - (game.tick % this.wave_grace_period)) / 60) / 60)
|
||||
if time_remaining <= 0 then
|
||||
|
@ -89,6 +89,7 @@ local function create_wave_gui(player)
|
||||
progressbar.style.minimal_width = 120
|
||||
progressbar.style.maximal_width = 120
|
||||
progressbar.style.top_padding = 10
|
||||
progressbar.style.height = 20
|
||||
else
|
||||
local time_remaining = math.floor(((storage.wave_grace_period - (game.tick % storage.wave_grace_period)) / 60) / 60)
|
||||
if time_remaining <= 0 then
|
||||
|
@ -142,6 +142,7 @@ local function create_wave_gui(player)
|
||||
progressbar.style.maximal_width = 96
|
||||
progressbar.style.padding = -1
|
||||
progressbar.style.top_padding = 1
|
||||
progressbar.style.height = 20
|
||||
else
|
||||
local time_remaining = math.floor(((wave_grace_period - (game.tick % wave_grace_period)) / 60) / 60)
|
||||
if time_remaining <= 0 then
|
||||
|
@ -330,6 +330,7 @@ local function cargo_gui(name, itemname, tooltip, value, hidden)
|
||||
progressbar.style.maximal_width = 100
|
||||
progressbar.style.top_margin = 2
|
||||
progressbar.style.right_margin = 6
|
||||
progressbar.style.height = 20
|
||||
end
|
||||
local frame = player.gui.top[name]
|
||||
frame.tooltip = tooltip
|
||||
|
@ -433,6 +433,8 @@ function draw_gui_status(player)
|
||||
|
||||
element_progressbar.style.color = table_of_colors.team
|
||||
|
||||
element_progressbar.style.height = 20
|
||||
|
||||
local element_label = element_frame.add({ type = 'label', caption = math.floor(storage.table_of_properties[player.force.name].available_tickets) })
|
||||
|
||||
element_label.style.font_color = table_of_colors.white
|
||||
@ -471,6 +473,8 @@ function draw_gui_status(player)
|
||||
|
||||
element_progressbar.style.color = table_of_colors.enemy
|
||||
|
||||
element_progressbar.style.height = 20
|
||||
|
||||
for _, element_item in pairs(element_frame.children) do
|
||||
element_item.style.font = 'heading-1'
|
||||
end
|
||||
|
@ -146,6 +146,7 @@ local function fish_in_space_gui(player)
|
||||
progressbar.style.maximal_width = 96
|
||||
progressbar.style.padding = -1
|
||||
progressbar.style.top_padding = 1
|
||||
progressbar.style.height = 20
|
||||
|
||||
label = frame.add({ type = 'label', caption = storage.fish_in_space .. '/' .. tostring(storage.catplanet_goals[i + 1].goal) })
|
||||
label.style.font_color = { r = 0.33, g = 0.66, b = 0.9 }
|
||||
|
@ -127,6 +127,7 @@ local function show_rewards(player)
|
||||
l.style.font = 'default-bold'
|
||||
l.style.font_color = { r = 0.9, g = 0.9, b = 0.9 }
|
||||
l.style.minimal_width = 123
|
||||
l.style.height = 20
|
||||
|
||||
t = frame.add { type = 'table', column_count = 1 }
|
||||
|
||||
|
@ -66,6 +66,7 @@ local function satellites_in_space_gui(player)
|
||||
progressbar.style = 'achievement_progressbar'
|
||||
progressbar.style.minimal_width = 100
|
||||
progressbar.style.maximal_width = 100
|
||||
progressbar.style.height = 20
|
||||
|
||||
label = frame.add({ type = 'label', caption = this.satellites_in_space .. '/' .. tostring(this.satellite_score[i + 1].goal) })
|
||||
label.style.font_color = { r = 0.33, g = 0.66, b = 0.9 }
|
||||
@ -111,24 +112,24 @@ local function init()
|
||||
this.satellites_in_space = 0
|
||||
this.satellite_score = {
|
||||
{ goal = 0, rank = false, achieved = true },
|
||||
{ goal = 1, rank = 'Copper', color = { r = 201, g = 133, b = 6 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 1, rank = 'Copper', color = { r = 201, g = 133, b = 6 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 10, rank = 'Iron', color = { r = 219, g = 216, b = 206 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 100, rank = 'Bronze', color = { r = 186, g = 115, b = 39 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 100, rank = 'Bronze', color = { r = 186, g = 115, b = 39 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 500, rank = 'Silver', color = { r = 186, g = 178, b = 171 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 1000, rank = 'Gold', color = { r = 255, g = 214, b = 33 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 1000, rank = 'Gold', color = { r = 255, g = 214, b = 33 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 2500, rank = 'Platinum', color = { r = 224, g = 223, b = 215 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 5000, rank = 'Diamond', color = { r = 237, g = 236, b = 232 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 10000, rank = 'Iridium', color = { r = 255, g = 220, b = 220 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 20000, rank = 'Anti-Matter', color = { r = 190, g = 255, b = 190 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 30000, rank = 'Orange Dwarf', color = { r = 255, g = 150, b = 50 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 30000, rank = 'Orange Dwarf', color = { r = 255, g = 150, b = 50 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 40000, rank = 'Blue Supergiant', color = { r = 130, g = 130, b = 255 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 50000, rank = 'Red Hypergiant', color = { r = 255, g = 90, b = 90 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 50000, rank = 'Red Hypergiant', color = { r = 255, g = 90, b = 90 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 75000, rank = 'Neutron Star', color = { r = 200, g = 200, b = 255 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 100000, rank = 'Supernova', color = { r = 200, g = 255, b = 200 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 150000, rank = 'Black Hole', color = { r = 0, g = 0, b = 0 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 150000, rank = 'Black Hole', color = { r = 0, g = 0, b = 0 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 1000000, rank = 'Blue Screen', color = { r = 100, g = 100, b = 245 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 10000000, rank = '?????', color = { r = 0, g = 0, b = 0 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 1000000000, rank = '?!??!?', color = { r = 0, g = 0, b = 0 }, msg = '', msg2 = '', achieved = false }
|
||||
{ goal = 10000000, rank = '?????', color = { r = 0, g = 0, b = 0 }, msg = '', msg2 = '', achieved = false },
|
||||
{ goal = 1000000000, rank = '?!??!?', color = { r = 0, g = 0, b = 0 }, msg = '', msg2 = '', achieved = false }
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -52,6 +52,7 @@ local function create_gui(player)
|
||||
progressbar.style.maximal_width = 96
|
||||
progressbar.style.padding = -1
|
||||
progressbar.style.top_padding = 1
|
||||
progressbar.style.height = 20
|
||||
|
||||
local line = frame.add({ type = 'line', direction = 'vertical' })
|
||||
line.style.left_padding = 4
|
||||
|
Loading…
Reference in New Issue
Block a user