mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 20:41:41 +09:00
Fixed Debug
This commit is contained in:
@@ -76,10 +76,11 @@ end
|
|||||||
function debug_write(idenitys,string)
|
function debug_write(idenitys,string)
|
||||||
if global.debug then
|
if global.debug then
|
||||||
if type(string) == 'table' then string = table.tostring(string)
|
if type(string) == 'table' then string = table.tostring(string)
|
||||||
elseif tpye(string) ~= 'string' then string = tostring(string) end
|
elseif type(string) ~= 'string' then string = tostring(string) end
|
||||||
game.write_file('debug.log', '\n'..game.tick..' ['..table.concat(idenitys, " " )..'] '..string, true, 0)
|
game.write_file('debug.log', '\n['..table.concat(idenitys, " " )..'] '..string, true, 0)
|
||||||
end
|
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(-1,function() global.debug = false end)
|
||||||
--Please Only Edit Above This Line-----------------------------------------------------------
|
--Please Only Edit Above This Line-----------------------------------------------------------
|
||||||
return credits
|
return credits
|
||||||
@@ -47,7 +47,7 @@ local ranks = {
|
|||||||
number_of_ranks=0,
|
number_of_ranks=0,
|
||||||
groups={
|
groups={
|
||||||
{name='Management',
|
{name='Management',
|
||||||
allow={'cheat-mode'}
|
allow={'cheat-mode','debug'}
|
||||||
},
|
},
|
||||||
|
|
||||||
{name='Moderation',
|
{name='Moderation',
|
||||||
|
|||||||
@@ -32,12 +32,10 @@ define_command('server-interface','For use of the highest staff only',{'command'
|
|||||||
end)
|
end)
|
||||||
--runs a server interface command with debug on and does not return any values to the user
|
--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)
|
define_command('debug','For use of the highest staff only, this will lag A LOT',{'command',true},function(player,event,args)
|
||||||
local before_debug = false; if global.debug then before_debug = true end
|
|
||||||
global.debug = true
|
global.debug = true
|
||||||
debug_write({'START'},game.tick..' '..event.parameter)
|
debug_write({'START'},game.tick..' '..event.parameter)
|
||||||
pcall(loadstring(event.parameter))
|
local returned,value = pcall(loadstring(event.parameter))
|
||||||
debug_write({'END'},game.tick)
|
if #global.sudo.commands == 0 then debug_write({'END'},game.tick) global.debug = false end
|
||||||
global.debug = before_debug
|
|
||||||
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
|
--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
|
local commands_per_iteration = 50 --number of sudo commands ran every sudo iteration
|
||||||
@@ -88,6 +86,7 @@ end
|
|||||||
--sudo main loop
|
--sudo main loop
|
||||||
Event.register(defines.events.on_tick, function(event)
|
Event.register(defines.events.on_tick, function(event)
|
||||||
-- runs the commands in sudo
|
-- runs the commands in sudo
|
||||||
|
if #global.sudo.commands == 0 then debug_write({'END'},game.tick) global.debug = false end
|
||||||
debug_write({'SUDO'},get_sudo_info(true))
|
debug_write({'SUDO'},get_sudo_info(true))
|
||||||
if game.tick % ticks_per_iteration == 0 and global.sudo.commands and #global.sudo.commands > 0 then
|
if game.tick % ticks_per_iteration == 0 and global.sudo.commands and #global.sudo.commands > 0 then
|
||||||
local length = nil
|
local length = nil
|
||||||
|
|||||||
Reference in New Issue
Block a user