mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
All error message fixed
This commit is contained in:
@@ -12,7 +12,7 @@ require("mod-gui")
|
||||
Event = require("locale/StdLib/event")
|
||||
--this is the main code that starts the softmod
|
||||
Event.soft_init = script.generate_event_name()
|
||||
local function init() if not global.soft_init then script.raise_event(Event.soft_init,{tick=game.tick}) global.soft_init = true end end
|
||||
local function init() if not global.soft_init then global.exp_core = {} script.raise_event(Event.soft_init,{tick=game.tick}) global.soft_init = true end end
|
||||
Event.register(defines.events.on_player_joined_game,init)
|
||||
Event.register(defines.events.on_tick,init)
|
||||
--below 'game.tick/(3600*game.speed)) % 15 == 0' raises the gui_update event every 15 minutes - feel free to change the update time
|
||||
@@ -32,7 +32,7 @@ Event.register(defines.events.on_tick, function(event)
|
||||
end
|
||||
end)
|
||||
--loads core files
|
||||
ranking,ExpGui,server = require("locale/ExpGaming-Core/file-header")
|
||||
ranking,ExpGui,server = unpack(require("locale/ExpGaming-Core/file-header"))
|
||||
--loads all the other scripts
|
||||
require("locale/Stand-Alone/file-header")
|
||||
require("locale/ExpGaming-Addons/file-header")
|
||||
@@ -54,7 +54,8 @@ local function load_command(command)
|
||||
global.exp_core.commands[command.name] = command
|
||||
debug_write({'COMMAND','LOAD'},command.name)
|
||||
--add command to game
|
||||
commands.add_command(command.name,{command.help,command_inputs_to_string(command)},function(event)
|
||||
debug_write({'COMMAND','LOAD'},command)
|
||||
commands.add_command(command.name,{'commands.help-format',command_inputs_to_string(command),command.help},function(event)
|
||||
--gets the command data
|
||||
local command_data = global.exp_core.commands[event.name]
|
||||
debug_write({'COMMAND','RUN','START'},command.name)
|
||||
@@ -105,6 +106,6 @@ function get_commands(rank)
|
||||
end
|
||||
return to_return
|
||||
end
|
||||
Event.register(Event.soft_init,function() for command_name,command in pairs(Exp_commands) do load_command(command) end end)
|
||||
Event.register(Event.soft_init,function() global.exp_core.commands = {} for command_name,command in pairs(Exp_commands) do load_command(command) end end)
|
||||
--######TEST#####TEST#####TEST###### un comment below
|
||||
--Event.register(defines.events.on_player_joined_game,function() for command_name,command in pairs(Exp_commands) do load_command(command) end end)
|
||||
@@ -5,18 +5,7 @@ This file can be used with permission but this and the credit below must remain
|
||||
Contact a member of management on our discord to seek permission to use our code.
|
||||
Any changes that you may make to the code are yours but that does not make the script yours.
|
||||
Discord: https://discord.gg/XSsBV6b
|
||||
|
||||
The credit below may be used by another script do not remove.
|
||||
]]
|
||||
local credits = {{
|
||||
name='ExpGaming - Lib',
|
||||
owner='Explosive Gaming',
|
||||
dev='Cooldude2606',
|
||||
description='A few basic functions used by scripts',
|
||||
factorio_version='0.15.23',
|
||||
show=false
|
||||
}}
|
||||
local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits,cred) end end
|
||||
--Please Only Edit Below This Line-----------------------------------------------------------
|
||||
--Convert ticks to 12H 34M format or 8.97M when less than 10
|
||||
function tick_to_display_format(tick)
|
||||
@@ -88,6 +77,4 @@ function debug_write(idenitys,string,no_trigger)
|
||||
end
|
||||
end
|
||||
Event.register(defines.events.on_tick,function() debug_write({'NEW TICK'},game.tick,true) end)
|
||||
Event.register(Event.soft_init,function() global.exp_core.debug={state=false,triggered=false,force=false} end)
|
||||
--Please Only Edit Above This Line-----------------------------------------------------------
|
||||
return credits
|
||||
Event.register(Event.soft_init,function() global.exp_core.debug={state=false,triggered=false,force=false} end)
|
||||
@@ -7,8 +7,8 @@ Any changes that you may make to the code are yours but that does not make the s
|
||||
Discord: https://discord.gg/XSsBV6b
|
||||
]]
|
||||
--Please Only Edit Below This Line-----------------------------------------------------------
|
||||
ranking = {}
|
||||
local ranking.get_ranks, ranking.get_rank_groups = require("ExpGaming - Rank Table")
|
||||
local ranking = {}
|
||||
ranking.get_ranks,ranking.get_rank_groups = unpack(require("ExpGaming - Rank Table"))
|
||||
--Return the rank of a given player
|
||||
function ranking.get_player_rank(player)
|
||||
if player then
|
||||
@@ -17,7 +17,7 @@ function ranking.get_player_rank(player)
|
||||
if player.permission_group == game.permissions.get_group(rank.name) then return rank end
|
||||
end
|
||||
return ranking.string_to_rank_group('User').lowest_rank
|
||||
end
|
||||
end
|
||||
end
|
||||
--Convert the name of a rank into the rank object
|
||||
function ranking.string_to_rank(string)
|
||||
@@ -126,7 +126,7 @@ function ranking.find_new_rank(player,tick)
|
||||
-- to reduce lag if the player is already higher than any time rank then it does not cheak
|
||||
-- also there play time must be higher than the lowest required for a rank
|
||||
debug_write({'RANK','NEW-RANK','TIME-CHEAK'},tick_to_min(player.online_time))
|
||||
if current_rank.power > global.exp_core.exp_core.ranks.highest_timed_rank.power and tick_to_min(player.online_time) >= global.exp_core.exp_core.ranks.lowest_timed_rank.time then
|
||||
if current_rank.power > global.exp_core.ranks.highest_timed_rank.power and tick_to_min(player.online_time) >= global.exp_core.ranks.lowest_timed_rank.time then
|
||||
debug_write({'RANK','NEW-RANK','TIME-START'},player.name)
|
||||
--Loop through rank times
|
||||
for _,rank in pairs(ranking.get_ranks()) do
|
||||
|
||||
@@ -243,7 +243,7 @@ for n = #ranks.ranks, 1, -1 do
|
||||
end
|
||||
end
|
||||
-- returns a list off all the ranks, return only one part if given
|
||||
function get_ranks(part)
|
||||
local function get_ranks(part)
|
||||
local to_return = {}
|
||||
if part then
|
||||
for _,rank in pairs(global.exp_core.ranks.ranks) do table.insert(to_return,rank[part]) end
|
||||
@@ -251,7 +251,7 @@ function get_ranks(part)
|
||||
return to_return
|
||||
end
|
||||
-- returns a list off all the groups, return only one part if given
|
||||
function get_rank_groups(part)
|
||||
local function get_rank_groups(part)
|
||||
local to_return = {}
|
||||
if part then
|
||||
for _,group in pairs(global.exp_core.ranks.groups) do table.insert(to_return,group[part]) end
|
||||
@@ -261,4 +261,4 @@ end
|
||||
-- Move the ranks to the global array
|
||||
Event.register(Event.soft_init,function() global.exp_core.ranks = ranks end)
|
||||
--Please Only Edit Above This Line-----------------------------------------------------------
|
||||
return get_ranks, get_rank_groups
|
||||
return {get_ranks, get_rank_groups}
|
||||
@@ -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
|
||||
|
||||
@@ -7,6 +7,7 @@ Any changes that you may make to the code are yours but that does not make the s
|
||||
Discord: https://discord.gg/XSsBV6b
|
||||
]]
|
||||
--Please Only Edit Below This Line-----------------------------------------------------------
|
||||
local ExpGui = require("ExpGaming - Module Setup")
|
||||
local add_frame = ExpGui.add_frame
|
||||
local frames = ExpGui.frames
|
||||
local draw_frame = ExpGui.draw_frame
|
||||
@@ -76,4 +77,6 @@ function draw_frame.tab(player,element)
|
||||
frames.tabs[element.name].event(player,element.parent.parent.parent.tab)
|
||||
end
|
||||
|
||||
Event.register(Event.rank_change,function(event) event.player.gui.center.clear() end)
|
||||
Event.register(Event.rank_change,function(event) event.player.gui.center.clear() end)
|
||||
|
||||
return ExpGui
|
||||
@@ -7,17 +7,18 @@ Any changes that you may make to the code are yours but that does not make the s
|
||||
Discord: https://discord.gg/XSsBV6b
|
||||
]]
|
||||
--Please Only Edit Below This Line-----------------------------------------------------------
|
||||
local ExpGui = require("ExpGaming - Module Setup")
|
||||
local add_input = ExpGui.add_input
|
||||
local inputs = ExpGui.inputs
|
||||
--allows defining of new buttons;;name how to call button;;default_display what is shown on the button;;default_tooltip the tooltip display;;event function(player,element) that runs on click
|
||||
function add_input.button(name,default_display,default_tooltip,event)
|
||||
if not name then error('Button requires a name') end
|
||||
inputs.buttons[name] = {name=name,display=default_display,tooltip=default_tooltip,event=event})
|
||||
inputs.buttons[name] = {name=name,display=default_display,tooltip=default_tooltip,event=event}
|
||||
end
|
||||
--allows defining of text box inputs;;name how to call button;;default_display what is shown on the button;;event function(player,element) that runs on text change
|
||||
function add_input.text(name,default_display,event)
|
||||
if not name then error('Text Filed requires a name') end
|
||||
inputs.text[name] = {name=name,display=default_display,event=event})
|
||||
inputs.text[name] = {name=name,display=default_display,event=event}
|
||||
end
|
||||
--draws the button into a gui;;frame the frame to draw to;;name name of button to draw;;display(opptinal) overrides the default;;tooltip(opptinal) overrides the default
|
||||
function add_input.draw_button(frame,name,display,tooltip)
|
||||
@@ -68,4 +69,6 @@ Event.register(defines.events.on_gui_text_changed, function(event)
|
||||
local text = inputs.text[event.element.name]
|
||||
if text.event then text.event(player,event.element) end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
return ExpGui
|
||||
@@ -7,6 +7,7 @@ Any changes that you may make to the code are yours but that does not make the s
|
||||
Discord: https://discord.gg/XSsBV6b
|
||||
]]
|
||||
--Please Only Edit Below This Line-----------------------------------------------------------
|
||||
local ExpGui = require("ExpGaming - Module Setup")
|
||||
local add_frame = ExpGui.add_frame
|
||||
local frames = ExpGui.frames
|
||||
local draw_frame = ExpGui.draw_frame
|
||||
@@ -61,4 +62,6 @@ Event.register(Event.rank_change,function(event)
|
||||
local left = mod_gui.get_frame_flow(event.player)
|
||||
if left[frame_data.name] then left[frame_data.name].style.visible = frame_data.vis end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
return ExpGui
|
||||
@@ -7,6 +7,7 @@ Any changes that you may make to the code are yours but that does not make the s
|
||||
Discord: https://discord.gg/XSsBV6b
|
||||
]]
|
||||
--Please Only Edit Below This Line-----------------------------------------------------------
|
||||
local ExpGui = require("ExpGaming - Module Setup")
|
||||
local player_table_functions = ExpGui.player_table
|
||||
--filters that are used. Feel free to add more
|
||||
player_table_functions.filters = {
|
||||
@@ -108,4 +109,6 @@ function player_table_functions.draw(player,frame,filters,input_location)
|
||||
end
|
||||
end
|
||||
|
||||
Event.register(Event.soft_init,function() global.exp_core.current_filters = {} end)
|
||||
Event.register(Event.soft_init,function() global.exp_core.current_filters = {} end)
|
||||
|
||||
return ExpGui
|
||||
@@ -7,6 +7,7 @@ Any changes that you may make to the code are yours but that does not make the s
|
||||
Discord: https://discord.gg/XSsBV6b
|
||||
]]
|
||||
--Please Only Edit Below This Line-----------------------------------------------------------
|
||||
local ExpGui = require("ExpGaming - Module Setup")
|
||||
local add_frame = ExpGui.add_frame
|
||||
local frames = ExpGui.frames
|
||||
local draw_frame = ExpGui.draw_frame
|
||||
@@ -32,7 +33,7 @@ end
|
||||
function add_frame.popup(style,default_display,default_tooltip,on_click,event)
|
||||
if not style then error('Popup style requires a name') end
|
||||
if not event or type(event) ~= 'function' then error('Popup style requires a draw function') end
|
||||
frames.popup[style] = {style=style,display=default_display,on_click=on_click,event=event})
|
||||
frames.popup[style] = {style=style,display=default_display,on_click=on_click,event=event}
|
||||
if on_click and type(on_click) == 'function' then
|
||||
ExpGui.toolbar.add_button(style,default_display,default_tooltip,draw_frame.popup_button)
|
||||
end
|
||||
@@ -61,4 +62,10 @@ function draw_frame.popup(style,args)
|
||||
end
|
||||
end
|
||||
--used to make the popup area
|
||||
Event.register(defines.events.on_player_joined_game,function(event) if not mod_gui.get_frame_flow(game.players[event.player_index]).popups then mod_gui.get_frame_flow(game.players[event.player_index]).add{name='popups',type='flow',direction='vertical'} end end)
|
||||
Event.register(defines.events.on_player_joined_game,function(event)
|
||||
if not mod_gui.get_frame_flow(game.players[event.player_index]).popups then
|
||||
mod_gui.get_frame_flow(game.players[event.player_index]).add{name='popups',type='flow',direction='vertical'}
|
||||
end
|
||||
end)
|
||||
|
||||
return ExpGui
|
||||
@@ -7,6 +7,7 @@ Any changes that you may make to the code are yours but that does not make the s
|
||||
Discord: https://discord.gg/XSsBV6b
|
||||
]]
|
||||
--Please Only Edit Below This Line-----------------------------------------------------------
|
||||
local ExpGui = require("ExpGaming - Module Setup")
|
||||
local toolbar = ExpGui.toolbar
|
||||
--similar to ExpGui.add_input.button but it also accepts a restriction and button is drawn to the toolbar
|
||||
function toolbar.add_button(name,default_display,default_tooltip,event)
|
||||
@@ -29,4 +30,6 @@ function toolbar.draw(player)
|
||||
end
|
||||
end
|
||||
--auto-redraw toolbar after new rank is given
|
||||
Event.register(Event.rank_change,function(event) toolbar.draw(event.player) end)
|
||||
Event.register(Event.rank_change,function(event) toolbar.draw(event.player) end)
|
||||
|
||||
return ExpGui
|
||||
@@ -7,11 +7,12 @@ Any changes that you may make to the code are yours but that does not make the s
|
||||
Discord: https://discord.gg/XSsBV6b
|
||||
]]
|
||||
--Please Only Edit Below This Line-----------------------------------------------------------
|
||||
local function merge(first_table,second_table) for k,v in pairs(second_table) do first_table[k] = v end end
|
||||
local ExpGui = require("ExpGaming - Module Setup")
|
||||
require("ExpGaming - Inputs")
|
||||
require("ExpGaming - Toolbar")
|
||||
require("ExpGaming - Center Gui")
|
||||
require("ExpGaming - Left Gui")
|
||||
require("ExpGaming - Popup")
|
||||
require("ExpGaming - Player Table")
|
||||
merge(ExpGui,require("ExpGaming - Inputs"))
|
||||
merge(ExpGui,require("ExpGaming - Toolbar"))
|
||||
merge(ExpGui,require("ExpGaming - Center Gui"))
|
||||
merge(ExpGui,require("ExpGaming - Left Gui"))
|
||||
merge(ExpGui,require("ExpGaming - Popup"))
|
||||
merge(ExpGui,require("ExpGaming - Player Table"))
|
||||
return ExpGui
|
||||
@@ -14,4 +14,4 @@ local ExpGui = require("GUI/file-header")
|
||||
require("ExpGaming - Command Maker")
|
||||
local server = require("ExpGaming - Server Interface")
|
||||
--Please Only Edit Above This Line-----------------------------------------------------------
|
||||
return ranking,ExpGui,server
|
||||
return {ranking,ExpGui,server}
|
||||
@@ -6,12 +6,13 @@ rank-given=You have been given the __1__ Rank!
|
||||
tag-reset=Your Tag was reset due to a Rank change
|
||||
|
||||
[commands]
|
||||
no-help=__1__ No Help Given
|
||||
no-help=No Help Given
|
||||
help-format= __1__ __2__
|
||||
unauthorized=401 - Unauthorized: Access is denied due to invalid credentials
|
||||
invalid-inputs=Invalid Input, /__1__ __2__
|
||||
command-ran=Command Complete
|
||||
|
||||
[server-interface]
|
||||
[server]
|
||||
server-command-help=For use of the highest staff only
|
||||
debug-command-help=For use of the highest staff only, this will lag A LOT
|
||||
socket-command-help=For use out side of factorio to run predefinded functions
|
||||
|
||||
Reference in New Issue
Block a user