Feature: Toolbar Menu (#268)

* Fix left flow not using uids

* Mock Toolbar menu

* Fix task list after core gui change

* Allow show/hide override

* Fix autofill permissions

* Copy style from toolbar on change

* Open and close automatically

* Removed hacky prevent default

* Fixed more core issues

* Add reset button

* Allow for custom draw order on join

* Add methods to reorder ui flows

* Impliment move buttons

* Add locale

* Add toolbar to player data

* Better player data layout

* Picked a suitable datastore id

* Update locale for readme

* Fix swaping left flow order

* Fix datastore updates

* Code cleanup

* Fix incorrect top flow hashing on load

* Fix loading of malformed data

* Fixed loading state of left flows

* Dont save default data

* Dont open menu on join

* Lint

* Remove incorrect new index metamethod

* Revert method used for move_toolbar_button

* Fixed missing toolbar button

* Fixed desync between visibilty and toggle state

* Fix bad gui element path

* Fixed enable state of toggle button

* Change order of operations

* Fix reset not showing top flow
This commit is contained in:
Cooldude2606
2024-01-16 00:01:00 +00:00
committed by GitHub
parent 96813816b9
commit 1c8a97a339
19 changed files with 912 additions and 168 deletions

View File

@@ -522,7 +522,7 @@ function Datastore:increment(key, delta)
return self:set(key, value + (delta or 1))
end
local function update_error(err) log('An error occurred in datastore update: '..trace(err)) end
local function update_error(err) log('An error occurred in datastore update:\n\t'..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
@@ -536,13 +536,16 @@ end)
]]
function Datastore:update(key, callback)
key = self:serialize(key)
local value = self:raw_get(key)
local value = self:get(key)
local raw_value = self:raw_get(key)
local old_value = copy(self:raw_get(key))
local success, new_value = xpcall(callback, update_error, key, value)
if not success then
self:raw_set(key, old_value)
elseif new_value ~= nil then
self:set(key, new_value)
elseif raw_value == nil then
self:set(key, value)
else
self:raise_event('on_update', key, value, old_value)
if self.auto_save then self:save(key) end
@@ -566,7 +569,7 @@ function Datastore:remove(key)
if self.parent and self.parent.auto_save then return self.parent:save(key) end
end
local function filter_error(err) log('An error ocurred in a datastore filter:'..trace(err)) end
local function filter_error(err) log('An error ocurred in a datastore filter:\n\t'..trace(err)) end
--[[-- Internal, Used to filter elements from a table
@tparam table tbl The table that will have the filter applied to it
@tparam[opt] function callback The function that will be used as a filter, if none giving then the provided table is returned
@@ -744,7 +747,7 @@ end
----- Events
-- @section events
local function event_error(err) log('An error ocurred in a datastore event handler: '..trace(err)) end
local function event_error(err) log('An error ocurred in a datastore event handler:\n\t'..trace(err)) end
--[[-- Internal, Raise an event on this datastore
@tparam string event_name The name of the event to raise for this datastore
@tparam string key The key that this event is being raised for