diff --git a/locale/ExpGaming-Core/ExpGaming - Command Maker.lua b/locale/ExpGaming-Core/ExpGaming - Command Maker.lua index 1e274a19..0f55c63e 100644 --- a/locale/ExpGaming-Core/ExpGaming - Command Maker.lua +++ b/locale/ExpGaming-Core/ExpGaming - Command Maker.lua @@ -95,7 +95,7 @@ function load_command(command) print('Command Complete') game.write_file('commands.log','\n'..game.tick..' Player: Used command: '..command.name..' With args of: '..table.tostring(args), true, 0) end - debug_write({'COMMAND','RUN','END'},command.name) + debug_write({'COMMAND','RUN','END'},command.name,true) end) end -- returns all the commands in a certain rank restriction diff --git a/locale/ExpGaming-Core/ExpGaming - Lib.lua b/locale/ExpGaming-Core/ExpGaming - Lib.lua index 7d929a7d..3a190c8f 100644 --- a/locale/ExpGaming-Core/ExpGaming - Lib.lua +++ b/locale/ExpGaming-Core/ExpGaming - Lib.lua @@ -72,15 +72,16 @@ function table.tostring( tbl ) end return "{" .. table.concat( result, "," ) .. "}" end --- allows a simple way to debug code -function debug_write(idenitys,string) - if global.debug then +-- allows a simple way to debug code; idenitys = {'string1','string2'}; string will be writen to file; no_trigger dissables the trigger useful for on_tick events +function debug_write(idenitys,string,no_trigger) + if global.debug.state then if type(string) == 'table' then string = table.tostring(string) elseif type(string) ~= 'string' then string = tostring(string) end - game.write_file('debug.log', '\n['..table.concat(idenitys, " " )..'] '..string, true, 0) + if not no_trigger or global.debug.triggered then game.write_file('debug.log', '\n['..table.concat(idenitys, " " )..'] '..string, true, 0) end + if not no_trigger then global.debug.triggered = true end end end -Event.register(defines.events.on_tick,function() debug_write({'NEW TICK'},game.tick) end) -Event.register(-1,function() global.debug = false end) +Event.register(defines.events.on_tick,function() debug_write({'NEW TICK'},game.tick,true) end) +Event.register(-1,function() global.debug={state=false,triggered=false,force=false} end) --Please Only Edit Above This Line----------------------------------------------------------- return credits \ No newline at end of file diff --git a/locale/ExpGaming-Core/ExpGaming - Rank Control.lua b/locale/ExpGaming-Core/ExpGaming - Rank Control.lua index c265227c..130e12a6 100644 --- a/locale/ExpGaming-Core/ExpGaming - Rank Control.lua +++ b/locale/ExpGaming-Core/ExpGaming - Rank Control.lua @@ -96,7 +96,7 @@ function give_rank(player,rank,by_player) debug_write({'RANK','GIVE'},'player: '..player.name..' by player: new rank: '..rank.name..' old rank: '..old_rank.name) rank_print(player.name..' was '..message..' to '..rank.name..' by ','Guest') end - if rank.name ~= 'Guest' then player.print('You have been given the '..rank.name..' Rank!') end + if rank.name ~= string_to_rank_group('User').lowest_rank.name then player.print('You have been given the '..rank.name..' Rank!') end if player.tag ~= old_rank.tag and player.tag ~= '' then player.print('Your Tag was reset due to a Rank change') end --rank change player.permission_group = game.permissions.get_group(rank.name) @@ -152,7 +152,7 @@ function find_new_rank(player) end debug_write({'RANK','NEW-RANK','GIVE','HIGHEST'},highest_rank.name) --Give player new rank if availble - if highest_rank.name == 'Guest' then + if highest_rank.name == string_to_rank_group('User').lowest_rank.name then -- to avoid spam in chat debug_write({'RANK','NEW-RANK','GIVE','VIA-SERVER'},player.name..' '..highest_rank.name) player.permission_group=game.permissions.get_group('Guest') diff --git a/locale/ExpGaming-Core/ExpGaming - Rank Presets.lua b/locale/ExpGaming-Core/ExpGaming - Rank Presets.lua index a24cd22e..50fb44db 100644 --- a/locale/ExpGaming-Core/ExpGaming - Rank Presets.lua +++ b/locale/ExpGaming-Core/ExpGaming - Rank Presets.lua @@ -18,6 +18,7 @@ local credits = {{ }} local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits,cred) end end --Please Only Edit Below This Line----------------------------------------------------------- +-- we run an exturnle script which syncs this table with discord, only top ranks are filled in case of error local preset_ranks = { Owner={'badgamernl'}, @@ -31,48 +32,9 @@ local preset_ranks = { 'mark9064', 'Smou'}, - Mod={ - 'AcThPaU', - 'Alanore', - 'Aquaday', - 'ayahuasca23', - 'cafeslacker', - 'CrashKonijn', - 'Drahc_pro', - 'everLord', - 'FlipHalfling90', - 'facere', - 'freek18', - 'Hobbitkicker', - 'hud', - 'Koroto', - 'matthias60', - 'MeDDish', - 'Mindxt20', - 'MottledPetrel', - 'Mr_Happy_212', - 'NextIdea', - 'Phoenix27833', - 'rezz', - 'samy115', - 'Sand3r205', - 'scarbvis', - 'steentje77', - 'SuperWinner50', - 'tophatgaming123', - 'VR29', - 'xenocyber', - 'Ruuyji', - 'mightycax', - 'Gizan', - 'mafisch3', - 'cydes', - 'Windbomb'}, + Mod={}, - Donator={ - 'M74132', - 'Splicer', - 'Nucklesamich'}, + Donator={}, Veteran={}, diff --git a/locale/ExpGaming-Core/ExpGaming - Rank Table.lua b/locale/ExpGaming-Core/ExpGaming - Rank Table.lua index c6487343..b454085a 100644 --- a/locale/ExpGaming-Core/ExpGaming - Rank Table.lua +++ b/locale/ExpGaming-Core/ExpGaming - Rank Table.lua @@ -46,6 +46,8 @@ local ranks = { lowest_timed_rank=nil, number_of_ranks=0, groups={ + --note dont remove these groups but you may add more + --all but the management group is used to indentiy ranks by the script {name='Management', allow={'cheat-mode','debug'} }, diff --git a/locale/ExpGaming-Core/ExpGaming - Server Interface.lua b/locale/ExpGaming-Core/ExpGaming - Server Interface.lua index 052c2d5f..56561c44 100644 --- a/locale/ExpGaming-Core/ExpGaming - Server Interface.lua +++ b/locale/ExpGaming-Core/ExpGaming - Server Interface.lua @@ -32,10 +32,11 @@ define_command('server-interface','For use of the highest staff only',{'command' end) --runs a server interface command with debug on and does not return any values to the user define_command('debug','For use of the highest staff only, this will lag A LOT',{'command',true},function(player,event,args) - global.debug = true + global.debug.state = true debug_write({'START'},game.tick..' '..event.parameter) + global.debug.triggered = false local returned,value = pcall(loadstring(event.parameter)) - if #global.sudo.commands == 0 then debug_write({'END'},game.tick) global.debug = false end + if global.debug.triggered and #global.sudo.commands == 0 then debug_write({'END'},game.tick) global.debug.state = false end end) --this is used when changing permission groups when the person does not have permsion to, can also be used to split a large event accross multiple ticks local commands_per_iteration = 50 --number of sudo commands ran every sudo iteration @@ -85,9 +86,10 @@ function clear_sudo() end --sudo main loop Event.register(defines.events.on_tick, function(event) + --used with debug command will stop debuging once atleast one message is send to file and there are no commands in sudo + if global.debug.state and global.debug.triggered and #global.sudo.commands == 0 then debug_write({'END'},game.tick) global.debug.state = global.debug.focre end -- runs the commands in sudo - if global.debug and #global.sudo.commands == 0 then debug_write({'END'},game.tick) global.debug = global.force_debug end - debug_write({'SUDO'},get_sudo_info(true)) + debug_write({'SUDO'},get_sudo_info(true),true) if game.tick % ticks_per_iteration == 0 and global.sudo.commands and #global.sudo.commands > 0 then local length = nil if #global.sudo.commands > commands_per_iteration then length = commands_per_iteration else length = #global.sudo.commands end @@ -112,6 +114,6 @@ Event.register(defines.events.on_tick, function(event) if data.remove_time <= game.tick then global.sudo.temp_varibles[name] = nil end end end) -Event.register(-1,function() global.sudo = {commands={},temp_varibles={}} global.force_debug = false end) +Event.register(-1,function() global.sudo = {commands={},temp_varibles={}} end) --Please Only Edit Above This Line----------------------------------------------------------- return credits \ No newline at end of file