Merge pull request #215 from Cooldude2606/fix/6.1.1-bugs
fix/6.1.1-bugs
This commit is contained in:
@@ -522,7 +522,7 @@ function Datastore:increment(key, delta)
|
||||
return self:set(key, value + (delta or 1))
|
||||
end
|
||||
|
||||
local function update_error(err) error('An error ocurred in datastore update: '..trace(err), 2) end
|
||||
local function update_error(err) log('An error occurred in datastore update: '..trace(err)) end
|
||||
--[[-- Use a function to update the value locally, will trigger on_update then on_save, save_to_disk and auto_save is required for on_save
|
||||
@tparam any key The key that you want to apply the update to, must be a string unless a serializer is set
|
||||
@tparam function callback The function that will be used to update the value at this key
|
||||
@@ -539,7 +539,9 @@ function Datastore:update(key, callback)
|
||||
local value = self:raw_get(key)
|
||||
local old_value = copy(self:raw_get(key))
|
||||
local success, new_value = xpcall(callback, update_error, key, value)
|
||||
if success and new_value ~= nil then
|
||||
if not success then
|
||||
self:raw_set(key, old_value)
|
||||
elseif new_value ~= nil then
|
||||
self:set(key, new_value)
|
||||
else
|
||||
self:raise_event('on_update', key, value, old_value)
|
||||
|
||||
@@ -91,13 +91,15 @@ Gui.toggle_top_flow(game.player, true)
|
||||
|
||||
]]
|
||||
function Gui.toggle_top_flow(player, state)
|
||||
-- Get the top flow and hide button
|
||||
local top_flow = Gui.get_top_flow(player)
|
||||
-- Get the top flow, we need the parent as we want to toggle the outer frame
|
||||
local top_flow = Gui.get_top_flow(player).parent
|
||||
if state == nil then state = not top_flow.visible end
|
||||
|
||||
-- Change the visiblty of the flow
|
||||
-- Get the show button for the top flow
|
||||
local left_flow = Gui.get_left_flow(player)
|
||||
local show_button = left_flow.gui_core_buttons[show_top_flow]
|
||||
|
||||
-- Change the visibility of the top flow and show top flow button
|
||||
show_button.visible = not state
|
||||
top_flow.visible = state
|
||||
|
||||
|
||||
@@ -1012,9 +1012,14 @@ local function auto_assign(event)
|
||||
local roles = Roles.config.players[player.name] or {}
|
||||
|
||||
local lookup = {}
|
||||
for _, role in ipairs(roles) do lookup[role] = true end
|
||||
-- Create a lookup table for existing roles, and check for block auto assign
|
||||
for _, role in ipairs(roles) do
|
||||
if role.block_auto_assign then return end
|
||||
lookup[role] = true
|
||||
end
|
||||
|
||||
local assigns, ctn = {}, 0
|
||||
-- Check roles with auto assign conditions and run the handler
|
||||
for role, condition in pairs(Roles.config.auto_assign) do
|
||||
if not lookup[role] then
|
||||
local success, rtn = pcall(condition, player)
|
||||
@@ -1027,6 +1032,7 @@ local function auto_assign(event)
|
||||
end
|
||||
end
|
||||
|
||||
-- Assign new roles if any were passed
|
||||
if ctn > 0 then Roles.assign_player(player, assigns) end
|
||||
end
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ end)
|
||||
:add_to_left_flow(true)
|
||||
|
||||
--- Button on the top flow used to toggle the player list container
|
||||
-- @element toggle_left_element
|
||||
-- @element toggle_player_list
|
||||
Gui.left_toolbar_button('entity/character', {'player-list.main-tooltip'}, player_list_container, function(player)
|
||||
return Roles.player_allowed(player, 'gui/player-list')
|
||||
end)
|
||||
|
||||
@@ -521,7 +521,7 @@ end)
|
||||
end)
|
||||
|
||||
--- Button on the top flow used to toggle the container
|
||||
-- @element toggle_left_element
|
||||
-- @element toggle_rocket_info
|
||||
Gui.left_toolbar_button('item/satellite', {'rocket-info.main-tooltip'}, rocket_list_container, function(player)
|
||||
return Roles.player_allowed(player, 'gui/rocket-info')
|
||||
end)
|
||||
|
||||
@@ -318,7 +318,7 @@ end)
|
||||
:add_to_left_flow()
|
||||
|
||||
--- Button on the top flow used to toggle the task list container
|
||||
-- @element toggle_left_element
|
||||
-- @element toggle_science_info
|
||||
Gui.left_toolbar_button('entity/lab', {'science-info.main-tooltip'}, science_info_container, function(player)
|
||||
return Roles.player_allowed(player, 'gui/science-info')
|
||||
end)
|
||||
|
||||
@@ -572,6 +572,12 @@ local update_task = function(player, task_list_element, task_id)
|
||||
element[task_list_item.name].tooltip = {"task-list.last-edit", last_edit_name, format_time(last_edit_time)}
|
||||
end
|
||||
|
||||
--- Button on the top flow used to toggle the task list container
|
||||
-- @element toggle_task_list
|
||||
Gui.left_toolbar_button('utility/not_enough_repair_packs_icon', {'task-list.main-tooltip'}, task_list_container, function(player)
|
||||
return Roles.player_allowed(player, 'gui/task-list')
|
||||
end)
|
||||
|
||||
-- Update the footer task edit view
|
||||
local update_task_edit_footer = function(player, task_id)
|
||||
local task = Tasks.get_task(task_id)
|
||||
|
||||
@@ -687,7 +687,7 @@ end)
|
||||
:add_to_left_flow()
|
||||
|
||||
--- Button on the top flow used to toggle the warp list container
|
||||
-- @element warp_list_toggle
|
||||
-- @element toggle_warp_list
|
||||
Gui.left_toolbar_button(config.default_icon.type ..'/'..config.default_icon.name, {'warp-list.main-tooltip', config.standard_proximity_radius}, warp_list_container, function(player)
|
||||
return Roles.player_allowed(player, 'gui/warp-list')
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user