mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-03-03 14:53:01 +02:00
Merge pull request #922 from grilledham/gui_settings
Settings sync for notify: pokes, polls, tasks, tag_groups
This commit is contained in:
commit
320fbe0874
@ -8,6 +8,7 @@ local Utils = require 'utils.core'
|
||||
local Report = require 'features.report'
|
||||
local table = require 'utils.table'
|
||||
local Color = require 'resources.color_presets'
|
||||
local Settings = require 'utils.redmew_settings'
|
||||
|
||||
local poke_messages = require 'resources.poke_messages'
|
||||
local player_sprites = require 'resources.player_sprites'
|
||||
@ -25,6 +26,9 @@ local symbol_desc = ' ▼'
|
||||
local focus_color = Color.dark_orange
|
||||
local donator_color = Color.donator
|
||||
|
||||
local notify_name = 'notify_poke'
|
||||
Settings.register(notify_name, Settings.types.boolean, true, 'player_list.poke_notify_caption_short')
|
||||
|
||||
local rank_column_width = 100
|
||||
|
||||
local inv_sprite_time_step = 1 / sprite_time_step
|
||||
@ -103,7 +107,7 @@ end
|
||||
local function apply_heading_style(style)
|
||||
style.font_color = focus_color
|
||||
style.font = 'default-bold'
|
||||
style.horizontal_align = 'center'
|
||||
style.horizontal_align = 'center'
|
||||
end
|
||||
|
||||
local column_builders = {
|
||||
@ -134,7 +138,7 @@ local column_builders = {
|
||||
sprite = player_sprites[cell_data]
|
||||
}
|
||||
local label_style = label.style
|
||||
label_style.horizontal_align = 'center'
|
||||
label_style.horizontal_align = 'center'
|
||||
label_style.width = 32
|
||||
|
||||
return label
|
||||
@ -169,7 +173,7 @@ local column_builders = {
|
||||
}
|
||||
local label_style = label.style
|
||||
label_style.font_color = color
|
||||
label_style.horizontal_align = 'left'
|
||||
label_style.horizontal_align = 'left'
|
||||
label_style.width = 150
|
||||
|
||||
return label
|
||||
@ -196,7 +200,7 @@ local column_builders = {
|
||||
|
||||
local label = parent.add {type = 'label', name = time_cell_name, caption = text}
|
||||
local label_style = label.style
|
||||
label_style.horizontal_align = 'left'
|
||||
label_style.horizontal_align = 'left'
|
||||
label_style.width = 125
|
||||
|
||||
return label
|
||||
@ -232,7 +236,7 @@ local column_builders = {
|
||||
if is_donator then
|
||||
local flow = parent.add {type = 'flow', name = rank_cell_name, direction = 'horizontal'}
|
||||
local flow_style = flow.style
|
||||
flow_style.horizontal_align = 'left'
|
||||
flow_style.horizontal_align = 'left'
|
||||
flow_style.width = rank_column_width
|
||||
|
||||
local label_rank = flow.add {type = 'label', caption = get_rank_name(rank)}
|
||||
@ -245,7 +249,7 @@ local column_builders = {
|
||||
else
|
||||
local label = parent.add {type = 'label', name = rank_cell_name, caption = get_rank_name(rank)}
|
||||
local label_style = label.style
|
||||
label_style.horizontal_align = 'left'
|
||||
label_style.horizontal_align = 'left'
|
||||
label_style.font_color = get_rank_color(rank)
|
||||
label_style.width = rank_column_width
|
||||
|
||||
@ -274,7 +278,7 @@ local column_builders = {
|
||||
|
||||
local label = parent.add {type = 'label', name = distance_cell_name, caption = text}
|
||||
local label_style = label.style
|
||||
label_style.horizontal_align = 'center'
|
||||
label_style.horizontal_align = 'center'
|
||||
label_style.width = 70
|
||||
|
||||
return label
|
||||
@ -316,7 +320,7 @@ local column_builders = {
|
||||
|
||||
local label = parent.add {type = 'label', name = coin_cell_name, caption = text}
|
||||
local label_style = label.style
|
||||
label_style.horizontal_align = 'center'
|
||||
label_style.horizontal_align = 'center'
|
||||
label_style.width = 80
|
||||
|
||||
return label
|
||||
@ -356,7 +360,7 @@ local column_builders = {
|
||||
local label =
|
||||
parent.add {type = 'label', name = deaths_cell_name, caption = cell_data.count, tooltip = tooltip}
|
||||
local label_style = label.style
|
||||
label_style.horizontal_align = 'center'
|
||||
label_style.horizontal_align = 'center'
|
||||
label_style.width = 60
|
||||
|
||||
return label
|
||||
@ -385,11 +389,11 @@ local column_builders = {
|
||||
|
||||
local parent_style = parent.style
|
||||
parent_style.width = 64
|
||||
parent_style.horizontal_align = 'center'
|
||||
parent_style.horizontal_align = 'center'
|
||||
|
||||
local label = parent.add {type = 'button', name = poke_cell_name, caption = cell_data.poke_count}
|
||||
local label_style = label.style
|
||||
label_style.horizontal_align = 'center'
|
||||
label_style.horizontal_align = 'center'
|
||||
label_style.minimal_width = 32
|
||||
label_style.height = 24
|
||||
label_style.font = 'default-bold'
|
||||
@ -430,7 +434,7 @@ local column_builders = {
|
||||
draw_cell = function(parent, cell_data)
|
||||
local parent_style = parent.style
|
||||
parent_style.width = 58
|
||||
parent_style.horizontal_align = 'center'
|
||||
parent_style.horizontal_align = 'center'
|
||||
|
||||
local label =
|
||||
parent.add {
|
||||
@ -440,7 +444,7 @@ local column_builders = {
|
||||
tooltip = {'player_list.report_button_tooltip', cell_data.name}
|
||||
}
|
||||
local label_style = label.style
|
||||
label_style.horizontal_align = 'center'
|
||||
label_style.horizontal_align = 'center'
|
||||
label_style.minimal_width = 32
|
||||
label_style.height = 24
|
||||
label_style.font = 'default-bold'
|
||||
@ -566,10 +570,12 @@ local function draw_main_frame(left, player)
|
||||
local cell_table_scroll_pane = frame.add {type = 'scroll-pane'}
|
||||
cell_table_scroll_pane.style.maximal_height = 400
|
||||
|
||||
frame.add {
|
||||
local state = Settings.get(player.index, notify_name)
|
||||
local notify_checkbox =
|
||||
frame.add {
|
||||
type = 'checkbox',
|
||||
name = notify_checkbox_name,
|
||||
state = not no_notify_players[player_index],
|
||||
state = state,
|
||||
caption = {'player_list.poke_notify_caption'},
|
||||
tooltip = {'player_list.poke_notify_tooltip'}
|
||||
}
|
||||
@ -581,7 +587,8 @@ local function draw_main_frame(left, player)
|
||||
frame = frame,
|
||||
heading_table_flow = heading_table_flow,
|
||||
cell_table_scroll_pane = cell_table_scroll_pane,
|
||||
settings = settings
|
||||
settings = settings,
|
||||
notify_checkbox = notify_checkbox
|
||||
}
|
||||
|
||||
redraw_title(data)
|
||||
@ -631,12 +638,14 @@ local function player_joined(event)
|
||||
local top = gui.top
|
||||
|
||||
if not top[main_button_name] then
|
||||
top.add({
|
||||
type = 'sprite-button',
|
||||
name = main_button_name,
|
||||
sprite = 'entity/character',
|
||||
tooltip = {'player_list.tooltip'}
|
||||
})
|
||||
top.add(
|
||||
{
|
||||
type = 'sprite-button',
|
||||
name = main_button_name,
|
||||
sprite = 'entity/character',
|
||||
tooltip = {'player_list.tooltip'}
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
for _, p in ipairs(game.connected_players) do
|
||||
@ -673,15 +682,17 @@ Gui.on_checked_state_changed(
|
||||
function(event)
|
||||
local player_index = event.player_index
|
||||
local checkbox = event.element
|
||||
local state = checkbox.state
|
||||
|
||||
local new_state
|
||||
if checkbox.state then
|
||||
new_state = nil
|
||||
local no_notify
|
||||
if state then
|
||||
no_notify = nil
|
||||
else
|
||||
new_state = true
|
||||
no_notify = true
|
||||
end
|
||||
|
||||
no_notify_players[player_index] = new_state
|
||||
no_notify_players[player_index] = no_notify
|
||||
Settings.set(player_index, notify_name, state)
|
||||
end
|
||||
)
|
||||
|
||||
@ -776,3 +787,38 @@ Gui.on_click(
|
||||
)
|
||||
|
||||
Gui.allow_player_to_toggle_top_element_visibility(main_button_name)
|
||||
|
||||
Event.add(
|
||||
Settings.events.on_setting_set,
|
||||
function(event)
|
||||
if event.setting_name ~= notify_name then
|
||||
return
|
||||
end
|
||||
|
||||
local player_index = event.player_index
|
||||
local player = game.get_player(player_index)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
|
||||
local state = event.new_value
|
||||
local no_notify
|
||||
if state then
|
||||
no_notify = nil
|
||||
else
|
||||
no_notify = true
|
||||
end
|
||||
|
||||
no_notify_players[player_index] = no_notify
|
||||
|
||||
local frame = player.gui.left[main_frame_name]
|
||||
if not frame then
|
||||
return
|
||||
end
|
||||
|
||||
local data = Gui.get_data(frame)
|
||||
local checkbox = data.notify_checkbox
|
||||
|
||||
checkbox.state = state
|
||||
end
|
||||
)
|
||||
|
@ -8,6 +8,7 @@ local Server = require 'features.server'
|
||||
local Command = require 'utils.command'
|
||||
local Color = require 'resources.color_presets'
|
||||
local Ranks = require 'resources.ranks'
|
||||
local Settings = require 'utils.redmew_settings'
|
||||
|
||||
local insert = table.insert
|
||||
|
||||
@ -22,6 +23,9 @@ local inv_tick_duration_step = 1 / tick_duration_step
|
||||
local normal_color = Color.white
|
||||
local focus_color = Color.dark_orange
|
||||
|
||||
local notify_name = 'notify_poll'
|
||||
Settings.register(notify_name, Settings.types.boolean, true, 'poll.notify_caption_short')
|
||||
|
||||
local polls = {}
|
||||
local polls_counter = {0}
|
||||
local no_notify_players = {}
|
||||
@ -351,7 +355,8 @@ local function draw_main_frame(left, player)
|
||||
poll_index_label = poll_index_label,
|
||||
poll_viewer_content = poll_viewer_content,
|
||||
remaining_time_label = remaining_time_label,
|
||||
poll_index = poll_index
|
||||
poll_index = poll_index,
|
||||
notify_checkbox = nil
|
||||
}
|
||||
|
||||
Gui.set_data(frame, data)
|
||||
@ -360,13 +365,16 @@ local function draw_main_frame(left, player)
|
||||
|
||||
update_poll_viewer(data)
|
||||
|
||||
frame.add {
|
||||
local state = Settings.get(player.index, notify_name)
|
||||
local notify_checkbox =
|
||||
frame.add {
|
||||
type = 'checkbox',
|
||||
name = notify_checkbox_name,
|
||||
caption = 'Notify me about polls.',
|
||||
state = not no_notify_players[player.index],
|
||||
tooltip = 'Receive a message when new polls are created and popup the poll.'
|
||||
state = state,
|
||||
caption = {'poll.notify_caption'},
|
||||
tooltip = {'poll.notify_tooltip'}
|
||||
}
|
||||
data.notify_checkbox = notify_checkbox
|
||||
|
||||
local bottom_flow = frame.add {type = 'flow', direction = 'horizontal'}
|
||||
|
||||
@ -809,12 +817,14 @@ local function player_joined(event)
|
||||
update_poll_viewer(data)
|
||||
end
|
||||
else
|
||||
gui.top.add({
|
||||
type = 'sprite-button',
|
||||
name = main_button_name,
|
||||
sprite = 'item/programmable-speaker',
|
||||
tooltip = {'poll.tooltip'}
|
||||
})
|
||||
gui.top.add(
|
||||
{
|
||||
type = 'sprite-button',
|
||||
name = main_button_name,
|
||||
sprite = 'item/programmable-speaker',
|
||||
tooltip = {'poll.tooltip'}
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@ -1126,15 +1136,17 @@ Gui.on_checked_state_changed(
|
||||
function(event)
|
||||
local player_index = event.player_index
|
||||
local checkbox = event.element
|
||||
local state = checkbox.state
|
||||
|
||||
local new_state
|
||||
if checkbox.state then
|
||||
new_state = nil
|
||||
local no_notify
|
||||
if state then
|
||||
no_notify = nil
|
||||
else
|
||||
new_state = true
|
||||
no_notify = true
|
||||
end
|
||||
|
||||
no_notify_players[player_index] = new_state
|
||||
no_notify_players[player_index] = no_notify
|
||||
Settings.set(player_index, notify_name, state)
|
||||
end
|
||||
)
|
||||
|
||||
@ -1176,6 +1188,41 @@ Gui.on_click(poll_view_vote_name, vote)
|
||||
|
||||
Gui.allow_player_to_toggle_top_element_visibility(main_button_name)
|
||||
|
||||
Event.add(
|
||||
Settings.events.on_setting_set,
|
||||
function(event)
|
||||
if event.setting_name ~= notify_name then
|
||||
return
|
||||
end
|
||||
|
||||
local player_index = event.player_index
|
||||
local player = game.get_player(player_index)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
|
||||
local state = event.new_value
|
||||
local no_notify
|
||||
if state then
|
||||
no_notify = nil
|
||||
else
|
||||
no_notify = true
|
||||
end
|
||||
|
||||
no_notify_players[player_index] = no_notify
|
||||
|
||||
local frame = player.gui.left[main_frame_name]
|
||||
if not frame then
|
||||
return
|
||||
end
|
||||
|
||||
local data = Gui.get_data(frame)
|
||||
local checkbox = data.notify_checkbox
|
||||
|
||||
checkbox.state = state
|
||||
end
|
||||
)
|
||||
|
||||
local Class = {}
|
||||
|
||||
function Class.validate(data)
|
||||
|
@ -6,6 +6,10 @@ local Game = require 'utils.game'
|
||||
local Command = require 'utils.command'
|
||||
local Ranks = require 'resources.ranks'
|
||||
local tag_groups = require 'resources.tag_groups'
|
||||
local Settings = require 'utils.redmew_settings'
|
||||
|
||||
local notify_name = 'notify_tag_group'
|
||||
Settings.register(notify_name, Settings.types.boolean, true, 'tag_group.notify_caption_short')
|
||||
|
||||
local default_verb = 'expanded'
|
||||
local player_tags = {}
|
||||
@ -22,7 +26,7 @@ Global.register(
|
||||
|
||||
local function notify_players(message)
|
||||
local players = game.connected_players
|
||||
for i=1, #players do
|
||||
for i = 1, #players do
|
||||
local p = players[i]
|
||||
if p.valid and not no_notify_players[p.index] then
|
||||
p.print(message)
|
||||
@ -131,12 +135,14 @@ local function player_joined(event)
|
||||
return
|
||||
end
|
||||
|
||||
player.gui.top.add({
|
||||
name = main_button_name,
|
||||
type = 'sprite-button',
|
||||
caption = 'tag',
|
||||
tooltip = {'tag_group.tooltip'}
|
||||
})
|
||||
player.gui.top.add(
|
||||
{
|
||||
name = main_button_name,
|
||||
type = 'sprite-button',
|
||||
caption = 'tag',
|
||||
tooltip = {'tag_group.tooltip'}
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
local function draw_main_frame_content(parent)
|
||||
@ -224,30 +230,34 @@ local function draw_main_frame(player)
|
||||
|
||||
draw_main_frame_content(scroll_pane)
|
||||
|
||||
main_frame.add {
|
||||
local state = Settings.get(player.index, notify_name)
|
||||
local notify_checkbox =
|
||||
main_frame.add {
|
||||
type = 'checkbox',
|
||||
name = notify_checkbox_name,
|
||||
caption = 'Notify me when tag groups change.',
|
||||
state = not no_notify_players[player.index],
|
||||
tooltip = 'Receive a message when a player enters or leaves a tag group or when a tag group is created, edited or deleted.'
|
||||
state = state,
|
||||
caption = {'tag_group.notify_caption'},
|
||||
tooltip = {'tag_group.notify_tooltip'}
|
||||
}
|
||||
|
||||
local bottom_flow = main_frame.add {type = 'flow', direction = 'horizontal'}
|
||||
|
||||
local left_flow = bottom_flow.add {type = 'flow', direction = 'horizontal'}
|
||||
left_flow.style.horizontal_align = 'left'
|
||||
left_flow.style.horizontal_align = 'left'
|
||||
left_flow.style.horizontally_stretchable = true
|
||||
|
||||
left_flow.add {type = 'button', name = main_button_name, caption = 'Close'}
|
||||
|
||||
local right_flow = bottom_flow.add {type = 'flow', direction = 'horizontal'}
|
||||
right_flow.style.horizontal_align = 'right'
|
||||
right_flow.style.horizontal_align = 'right'
|
||||
|
||||
right_flow.add {type = 'button', name = clear_button_name, caption = 'Clear Tag'}
|
||||
|
||||
if Rank.equal_or_greater_than(player.name, Ranks.regular) then
|
||||
right_flow.add {type = 'button', name = create_tag_button_name, caption = 'Create Tag'}
|
||||
end
|
||||
|
||||
Gui.set_data(main_frame, notify_checkbox)
|
||||
end
|
||||
|
||||
local function redraw_main_frame()
|
||||
@ -390,14 +400,14 @@ local function draw_create_tag_frame(event, tag_data)
|
||||
local bottom_flow = frame.add {type = 'flow', direction = 'horizontal'}
|
||||
|
||||
local left_flow = bottom_flow.add {type = 'flow', direction = 'horizontal'}
|
||||
left_flow.style.horizontal_align = 'left'
|
||||
left_flow.style.horizontal_align = 'left'
|
||||
left_flow.style.horizontally_stretchable = true
|
||||
|
||||
local close_button = left_flow.add {type = 'button', name = close_create_tag_name, caption = 'Close'}
|
||||
Gui.set_data(close_button, frame)
|
||||
|
||||
local right_flow = bottom_flow.add {type = 'flow', direction = 'horizontal'}
|
||||
right_flow.style.horizontal_align = 'right'
|
||||
right_flow.style.horizontal_align = 'right'
|
||||
|
||||
if tag_data then
|
||||
local delete_button = right_flow.add {type = 'button', name = delete_tag_name, caption = 'Delete'}
|
||||
@ -507,15 +517,17 @@ Gui.on_checked_state_changed(
|
||||
function(event)
|
||||
local player_index = event.player_index
|
||||
local checkbox = event.element
|
||||
local state = checkbox.state
|
||||
|
||||
local new_state
|
||||
if checkbox.state then
|
||||
new_state = nil
|
||||
local no_notify
|
||||
if state then
|
||||
no_notify = nil
|
||||
else
|
||||
new_state = true
|
||||
no_notify = true
|
||||
end
|
||||
|
||||
no_notify_players[player_index] = new_state
|
||||
no_notify_players[player_index] = no_notify
|
||||
Settings.set(player_index, notify_name, state)
|
||||
end
|
||||
)
|
||||
|
||||
@ -665,6 +677,39 @@ Gui.on_custom_close(
|
||||
|
||||
Gui.allow_player_to_toggle_top_element_visibility(main_button_name)
|
||||
|
||||
Event.add(
|
||||
Settings.events.on_setting_set,
|
||||
function(event)
|
||||
if event.setting_name ~= notify_name then
|
||||
return
|
||||
end
|
||||
|
||||
local player_index = event.player_index
|
||||
local player = game.get_player(player_index)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
|
||||
local state = event.new_value
|
||||
local no_notify
|
||||
if state then
|
||||
no_notify = nil
|
||||
else
|
||||
no_notify = true
|
||||
end
|
||||
|
||||
no_notify_players[player_index] = no_notify
|
||||
|
||||
local frame = player.gui.left[main_frame_name]
|
||||
if not frame then
|
||||
return
|
||||
end
|
||||
|
||||
local checkbox = Gui.get_data(frame)
|
||||
checkbox.state = state
|
||||
end
|
||||
)
|
||||
|
||||
Event.add(defines.events.on_player_joined_game, player_joined)
|
||||
|
||||
local function tag_command(args)
|
||||
@ -679,7 +724,9 @@ local function tag_command(args)
|
||||
local tag = tag_groups[tag_name]
|
||||
|
||||
if tag == nil then
|
||||
Game.player_print("Tag '" .. tag_name .. "' does not exist. Create the tag first by clicking Tag -> Create Tag.")
|
||||
Game.player_print(
|
||||
"Tag '" .. tag_name .. "' does not exist. Create the tag first by clicking Tag -> Create Tag."
|
||||
)
|
||||
return
|
||||
end
|
||||
|
||||
@ -693,7 +740,7 @@ end
|
||||
Command.add(
|
||||
'tag',
|
||||
{
|
||||
description = {"command_description.tag"},
|
||||
description = {'command_description.tag'},
|
||||
arguments = {'player', 'tag'},
|
||||
required_rank = Ranks.admin,
|
||||
capture_excess_arguments = true,
|
||||
|
@ -7,10 +7,14 @@ local math = require 'utils.math'
|
||||
local Command = require 'utils.command'
|
||||
local Color = require 'resources.color_presets'
|
||||
local Ranks = require 'resources.ranks'
|
||||
local Settings = require 'utils.redmew_settings'
|
||||
|
||||
local normal_color = Color.white
|
||||
local focus_color = Color.dark_orange
|
||||
|
||||
local notify_name = 'notify_task'
|
||||
Settings.register(notify_name, Settings.types.boolean, true, 'tasklist.notify_caption_short')
|
||||
|
||||
local server_player = {
|
||||
valid = true,
|
||||
index = 0,
|
||||
@ -229,7 +233,8 @@ local function redraw_tasks(data, enabled)
|
||||
delete_button_tooltip = 'Delete task.'
|
||||
edit_button_tooltip = 'Edit task.'
|
||||
up_button_tooltip = 'Move the task up, right click moves 5 spaces, shift click moves the task to the top.'
|
||||
down_button_tooltip = 'Move the task down, right click moves 5 spaces, shift click moves the task to the bottom.'
|
||||
down_button_tooltip =
|
||||
'Move the task down, right click moves 5 spaces, shift click moves the task to the bottom.'
|
||||
else
|
||||
delete_button_tooltip = 'Sorry, you have to be a regular to delete tasks.'
|
||||
edit_button_tooltip = 'Sorry, you have to be a regular to edit tasks.'
|
||||
@ -398,12 +403,16 @@ local function draw_main_frame(left, player)
|
||||
|
||||
redraw_tasks(data, enabled)
|
||||
|
||||
frame.add {
|
||||
local state = Settings.get(player.index, notify_name)
|
||||
local notify_checkbox =
|
||||
frame.add {
|
||||
type = 'checkbox',
|
||||
name = notify_checkbox_name,
|
||||
caption = 'Notify me about new announcements or tasks',
|
||||
state = not no_notify_players[left.player_index]
|
||||
state = state,
|
||||
caption = {'tasklist.notify_caption'},
|
||||
tooltip = {'tasklist.notify_tooltip'}
|
||||
}
|
||||
data.notify_checkbox = notify_checkbox
|
||||
|
||||
frame.add {type = 'button', name = main_button_name, caption = 'Close'}
|
||||
end
|
||||
@ -566,7 +575,8 @@ local function draw_create_task_frame(left, previous_task)
|
||||
confirm_button_caption = 'Create Task'
|
||||
end
|
||||
|
||||
local frame = left.add {type = 'frame', name = create_task_frame_name, caption = frame_caption, direction = 'vertical'}
|
||||
local frame =
|
||||
left.add {type = 'frame', name = create_task_frame_name, caption = frame_caption, direction = 'vertical'}
|
||||
frame.style.width = 470
|
||||
|
||||
local textbox = frame.add {type = 'textfield', text = text}
|
||||
@ -580,7 +590,8 @@ local function draw_create_task_frame(left, previous_task)
|
||||
local clear_button = bottom_flow.add {type = 'button', name = create_task_clear_button_name, caption = 'Clear'}
|
||||
Gui.set_data(clear_button, textbox)
|
||||
bottom_flow.add({type = 'flow'}).style.horizontally_stretchable = true
|
||||
local confirm_button = bottom_flow.add {type = 'button', name = confirm_button_name, caption = confirm_button_caption}
|
||||
local confirm_button =
|
||||
bottom_flow.add {type = 'button', name = confirm_button_name, caption = confirm_button_caption}
|
||||
Gui.set_data(confirm_button, {frame = frame, textbox = textbox, previous_task = previous_task})
|
||||
end
|
||||
|
||||
@ -626,12 +637,14 @@ local function player_joined(event)
|
||||
|
||||
local top = gui.top
|
||||
if not top[main_button_name] then
|
||||
top.add({
|
||||
type = 'sprite-button',
|
||||
name = main_button_name,
|
||||
sprite = 'item/repair-pack',
|
||||
tooltip = {'tasklist.tooltip'}
|
||||
})
|
||||
top.add(
|
||||
{
|
||||
type = 'sprite-button',
|
||||
name = main_button_name,
|
||||
sprite = 'item/repair-pack',
|
||||
tooltip = {'tasklist.tooltip'}
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@ -697,7 +710,8 @@ Gui.on_click(
|
||||
local last_edit_player_label = top_flow.add {type = 'label'}
|
||||
local editing_players_label = top_flow.add {type = 'label'}
|
||||
|
||||
local textbox = frame.add {type = 'text-box', name = edit_announcements_textbox_name, text = announcements.edit_text}
|
||||
local textbox =
|
||||
frame.add {type = 'text-box', name = edit_announcements_textbox_name, text = announcements.edit_text}
|
||||
--textbox.word_wrap = true
|
||||
local textbox_style = textbox.style
|
||||
textbox_style.width = 450
|
||||
@ -737,13 +751,19 @@ Gui.on_click(
|
||||
Gui.on_checked_state_changed(
|
||||
notify_checkbox_name,
|
||||
function(event)
|
||||
local checkbox = event.element
|
||||
local player_index = event.player_index
|
||||
if checkbox.state then
|
||||
no_notify_players[player_index] = nil
|
||||
local checkbox = event.element
|
||||
local state = checkbox.state
|
||||
|
||||
local no_notify
|
||||
if state then
|
||||
no_notify = nil
|
||||
else
|
||||
no_notify_players[player_index] = true
|
||||
no_notify = true
|
||||
end
|
||||
|
||||
no_notify_players[player_index] = no_notify
|
||||
Settings.set(player_index, notify_name, state)
|
||||
end
|
||||
)
|
||||
|
||||
@ -1076,6 +1096,41 @@ Gui.on_click(
|
||||
|
||||
Gui.allow_player_to_toggle_top_element_visibility(main_button_name)
|
||||
|
||||
Event.add(
|
||||
Settings.events.on_setting_set,
|
||||
function(event)
|
||||
if event.setting_name ~= notify_name then
|
||||
return
|
||||
end
|
||||
|
||||
local player_index = event.player_index
|
||||
local player = game.get_player(player_index)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
|
||||
local state = event.new_value
|
||||
local no_notify
|
||||
if state then
|
||||
no_notify = nil
|
||||
else
|
||||
no_notify = true
|
||||
end
|
||||
|
||||
no_notify_players[player_index] = no_notify
|
||||
|
||||
local frame = player.gui.left[main_frame_name]
|
||||
if not frame then
|
||||
return
|
||||
end
|
||||
|
||||
local data = Gui.get_data(frame)
|
||||
local checkbox = data.notify_checkbox
|
||||
|
||||
checkbox.state = state
|
||||
end
|
||||
)
|
||||
|
||||
Command.add(
|
||||
'task',
|
||||
{
|
||||
@ -1084,7 +1139,7 @@ Command.add(
|
||||
required_rank = Ranks.regular,
|
||||
allowed_by_server = true,
|
||||
log_command = true,
|
||||
capture_excess_arguments = true,
|
||||
capture_excess_arguments = true
|
||||
},
|
||||
function(args, player)
|
||||
create_new_tasks(args.task, player or server_player)
|
||||
|
@ -65,6 +65,7 @@ report_tooltip=Report player to the admin team for griefing or breaking the rule
|
||||
report_button_tooltip=Report __1__
|
||||
close_caption=Close
|
||||
poke_notify_caption=Notify me when pokes happen.
|
||||
poke_notify_caption_short=Notify pokes.
|
||||
poke_notify_tooltip=Receive a message when a player pokes another player.
|
||||
|
||||
[toast]
|
||||
@ -83,12 +84,21 @@ tooltip=Landscape painting tool
|
||||
|
||||
[tag_group]
|
||||
tooltip=Player tag group management
|
||||
notify_caption=Notify me when tag groups change.
|
||||
notify_caption_short=Notify tag groups.
|
||||
notify_tooltip=Receive a message when a player enters or leaves a tag group or when a tag group is created, edited or deleted.
|
||||
|
||||
[poll]
|
||||
tooltip=View and manage polls
|
||||
notify_caption=Notify me about polls.
|
||||
notify_caption_short=Notify polls.
|
||||
notify_tooltip=Receive a message when new polls are created and popup the poll.
|
||||
|
||||
[score]
|
||||
tooltip=Score
|
||||
|
||||
[tasklist]
|
||||
tooltip=View and manage Tasks
|
||||
notify_caption=Notify me about new announcements or tasks.
|
||||
notify_caption_short=Notify announcements / tasks.
|
||||
notify_tooltip=Receive a message when tasks or announcements are created or edited.
|
||||
|
Loading…
x
Reference in New Issue
Block a user