From eed71de00556453978a6cfce42f71b414768fc3a Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 23 Jul 2017 22:20:11 +0100 Subject: [PATCH] Sudo Speed increase again --- locale/ExpGaming-Core/ExpGaming - Server Interface.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/locale/ExpGaming-Core/ExpGaming - Server Interface.lua b/locale/ExpGaming-Core/ExpGaming - Server Interface.lua index c3372363..d321891c 100644 --- a/locale/ExpGaming-Core/ExpGaming - Server Interface.lua +++ b/locale/ExpGaming-Core/ExpGaming - Server Interface.lua @@ -31,12 +31,14 @@ define_command('server-interface','For use of the highest staff only',{'command' end end) --this is used when changing permsion groups when the person does not have permsion to, can also be used to split a large event accross mutilple ticks +local commands_per_itteration = 10 --number of sudo commands ran every sudo itteration +local ticks_per_itteration = 1 --the number of ticks break before the next sudo itteration function sudo(command,args) table.insert(global.sudo,{fun=command,var=args}) end --runs at most five sudo commandd every five ticks if one is present Event.register(defines.events.on_tick, function(event) - if game.tick % 5 == 0 and global.sudo and #global.sudo > 0 then + if game.tick % ticks_per_itteration == 0 and global.sudo and #global.sudo > 0 then local lenth = nil - if #global.sudo > 5 then lenth = 5 else lenth = #global.sudo end + if #global.sudo > commands_per_itteration then lenth = commands_per_itteration else lenth = #global.sudo end for i = 1,lenth do command=table.remove(global.sudo) if command and command.fun and type(command.fun) == 'function' then