mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-29 20:16:38 +09:00
All error message fixed
This commit is contained in:
@@ -9,7 +9,7 @@ Discord: https://discord.gg/XSsBV6b
|
||||
--Please Only Edit Below This Line-----------------------------------------------------------
|
||||
local server = {}
|
||||
--this command is just a way or using loadstring from in game while keeping achievements
|
||||
define_command('server-interface',{'server-interface.command-help'},{'command',true},function(player,event,args)
|
||||
define_command('server-interface',{'server.server-command-help'},{'command',true},function(player,event,args)
|
||||
if player == '<server>' then
|
||||
local returned,value = pcall(loadstring(event.parameter))
|
||||
if type(value) == 'table' then game.write_file('server-interface.log', '\n'..game.tick..' Ran by: <server> Code: '..event.parameter..'\n Returned: '..table.tostring(value), true, 0) print(table.tostring(value))
|
||||
@@ -21,15 +21,15 @@ define_command('server-interface',{'server-interface.command-help'},{'command',t
|
||||
end
|
||||
end)
|
||||
--runs a server interface command with debug on and does not return any values to the user
|
||||
define_command('debug',{'server-interface.debug-command-help'},{'command',true},function(player,event,args)
|
||||
define_command('debug',{'server.debug-command-help'},{'command',true},function(player,event,args)
|
||||
global.exp_core.debug.state = true
|
||||
debug_write({'START'},game.tick..' '..event.parameter)
|
||||
global.exp_core.debug.triggered = false
|
||||
local returned,value = pcall(loadstring(event.parameter))
|
||||
if global.exp_core.debug.triggered and #global.exp_core.server.callbacks_queue == 0 then debug_write({'END'},game.tick) global.exp_core.debug.state = false end
|
||||
if global.exp_core.debug.triggered and #global.exp_core.server.callback_queue == 0 then debug_write({'END'},game.tick) global.exp_core.debug.state = false end
|
||||
end)
|
||||
--runs the preset callback with the uuid
|
||||
define_command('socket',{'server-interface.socket-command-help'},{'uuid','args'},function(player,event,args)
|
||||
define_command('socket',{'server.socket-command-help'},{'uuid','args'},function(player,event,args)
|
||||
if global.exp_core.server.callbacks[args[1]] then
|
||||
server.queue_callback(global.exp_core.server.callbacks[args[1]],{unpack(args,2)},args[1])
|
||||
end
|
||||
@@ -62,7 +62,7 @@ function server.queue_callback(callback,args,uuid)
|
||||
local args = args or {}
|
||||
local uuid = uuid or server.get_uuid(callback)
|
||||
debug_write({'callback','QUEUE'},uuid)
|
||||
table.insert(global.exp_core.server.callbacks_queue,{fun=callback,args=args,uuid=uuid})
|
||||
table.insert(global.exp_core.server.callback_queue,{fun=callback,args=args,uuid=uuid})
|
||||
server.refresh_uuid(uuid)
|
||||
return uuid
|
||||
end
|
||||
@@ -73,8 +73,8 @@ function server.clear_callbacks()
|
||||
end
|
||||
-- converts any value into the uuid the script will use
|
||||
function server.get_uuid(var)
|
||||
if type(var) == 'string' then uuid = var..tostring(#global.exp_core.server.callbacks_queue)
|
||||
else uuid = tostring(var)..tostring(#global.exp_core.server.callbacks_queue) end
|
||||
if type(var) == 'string' then uuid = var..tostring(#global.exp_core.server.callback_queue)
|
||||
else uuid = tostring(var)..tostring(#global.exp_core.server.callback_queue) end
|
||||
server.refresh_uuid(uuid)
|
||||
return string.tohex('uuid'..uuid)
|
||||
end
|
||||
@@ -100,22 +100,22 @@ end
|
||||
function server.get_callback_queue_info(string)
|
||||
local lenth = 0
|
||||
for _,v in pairs(global.exp_core.server.temp_varibles) do lenth = lenth + 1 end
|
||||
if string then return {'server-interface.callback-info',game.tick,#global.exp_core.server.callbacks_queue,lenth}
|
||||
else return {tick=game.tick,commands=#global.exp_core.server.callbacks_queue,temp_varibles=#global.exp_core.server.temp_varibles} end
|
||||
if string then return {'server.callback-info',game.tick,#global.exp_core.server.callback_queue,lenth}
|
||||
else return {tick=game.tick,commands=#global.exp_core.server.callback_queue,temp_varibles=#global.exp_core.server.temp_varibles} end
|
||||
end
|
||||
--callback 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 callback
|
||||
if global.exp_core.debug.state and global.exp_core.debug.triggered and #global.exp_core.server.callbacks_queue == 0 then debug_write({'END'},game.tick) global.exp_core.debug.state = global.exp_core.debug.focre end
|
||||
if global.exp_core.debug.state and global.exp_core.debug.triggered and #global.exp_core.server.callback_queue == 0 then debug_write({'END'},game.tick) global.exp_core.debug.state = global.exp_core.debug.focre end
|
||||
-- runs the commands in callback
|
||||
debug_write({'callback'},server.get_callback_queue_info(true),true)
|
||||
if game.tick % ticks_per_iteration == 0 and global.exp_core.server.callbacks_queue and #global.exp_core.server.callbacks_queue > 0 then
|
||||
if game.tick % ticks_per_iteration == 0 and global.exp_core.server.callback_queue and #global.exp_core.server.callback_queue > 0 then
|
||||
-- gets the number of call backs to run
|
||||
local length = nil
|
||||
if #global.exp_core.server.callbacks_queue > commands_per_iteration then length = commands_per_iteration else length = #global.exp_core.server.callbacks_queue end
|
||||
if #global.exp_core.server.callback_queue > commands_per_iteration then length = commands_per_iteration else length = #global.exp_core.server.callback_queue end
|
||||
-- runs the right number of commands as set
|
||||
for i = 1,length do
|
||||
local callback=table.remove(global.exp_core.server.callbacks_queue,1)
|
||||
local callback=table.remove(global.exp_core.server.callback_queue,1)
|
||||
if callback and callback.fun and type(callback.fun) == 'function' then
|
||||
local args = {}
|
||||
-- retrives any temp varibles
|
||||
|
||||
Reference in New Issue
Block a user