mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-09-04 16:23:22 +00:00
ADD - add in-game phone administration and configuration (#21)
* ADD - build in-game admin command center * ADD - open admin panel by command * ENH - rebuild admin panel as standalone editor * ENH - compact admin workspace navigation * ENH - expand admin device controls * ENH - refine admin panel navigation style * ADD - add SQL phone configurator * FIX - expose complete phone configuration * FIX - make company jobs freely configurable * FIX - align configurator tables to left * ENH - organize configurator collection controls * ENH - organize nested configurator sections * ENH - add configurator field descriptions * FIX - hide fixed configurator add controls * ENH - refine configurator editing experience * ENH - refine admin configurator controls * FIX - apply configurator settings instantly * FIX - close live activity command registration
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
Bridge.Database.AfterMigration("sky_phone", function()
|
||||
|
||||
if not Config.TestData.Enabled then
|
||||
return
|
||||
end
|
||||
|
||||
local photo_urls = {
|
||||
city = "https://images.unsplash.com/photo-1519501025264-65ba15a82390?auto=format&fit=crop&w=1200&q=80",
|
||||
car = "https://images.unsplash.com/photo-1493238792000-8113da705763?auto=format&fit=crop&w=1200&q=80",
|
||||
@@ -1041,7 +1037,10 @@ local function seed_for_source(source)
|
||||
return account.email
|
||||
end
|
||||
|
||||
RegisterCommand(Config.TestData.Command, function(source)
|
||||
local function run_test_data_command(source)
|
||||
if not Config.TestData.Enabled then
|
||||
return
|
||||
end
|
||||
if source <= 0 then
|
||||
Bridge.Debug("warn", "[sky_phone] The test data command must be run by an in-game player.")
|
||||
return
|
||||
@@ -1066,7 +1065,34 @@ RegisterCommand(Config.TestData.Command, function(source)
|
||||
end
|
||||
Bridge.Debug("info", "[sky_phone] Test data seeded for source %s.", tostring(source), { always = true })
|
||||
TriggerClientEvent("sky_phone:testdata:feedback", source, true, result)
|
||||
end, false)
|
||||
end
|
||||
|
||||
local active_test_data_command = nil
|
||||
local registered_test_data_commands = {}
|
||||
|
||||
local function refresh_test_data_command()
|
||||
active_test_data_command = Config.TestData.Enabled and Config.TestData.Command or nil
|
||||
if not active_test_data_command then
|
||||
return
|
||||
end
|
||||
if type(active_test_data_command) ~= "string" or active_test_data_command == "" then
|
||||
error("[sky_phone] Config.TestData.Command must be a non-empty command name.")
|
||||
end
|
||||
if registered_test_data_commands[active_test_data_command] then
|
||||
return
|
||||
end
|
||||
local command_name = active_test_data_command
|
||||
registered_test_data_commands[command_name] = true
|
||||
RegisterCommand(command_name, function(source)
|
||||
if active_test_data_command == command_name then
|
||||
run_test_data_command(source)
|
||||
end
|
||||
end, false)
|
||||
end
|
||||
|
||||
refresh_test_data_command()
|
||||
|
||||
AddEventHandler("sky_phone:configurator:serverUpdated", refresh_test_data_command)
|
||||
|
||||
AddEventHandler("playerDropped", function()
|
||||
seed_attempts[source] = nil
|
||||
|
||||
Reference in New Issue
Block a user