diff --git a/control.lua b/control.lua index 7dce206f..60541e07 100644 --- a/control.lua +++ b/control.lua @@ -27,7 +27,7 @@ Event.register(defines.events.on_tick, function(event) elseif ((event.tick/(3600*game.speed))+(15/2))% 15 == 0 then -- this is the system to auto rank players for i,player in pairs(game.connected_players) do - sudo(ranking.find_new_rank,{player,event.tick}) + server.queue_callback(ranking.find_new_rank,{player,event.tick}) end end end) diff --git a/locale/ExpGaming-Core/Core Help File.md b/locale/ExpGaming-Core/Core Help File.md index 7931c473..3af0e487 100644 --- a/locale/ExpGaming-Core/Core Help File.md +++ b/locale/ExpGaming-Core/Core Help File.md @@ -1,5 +1,5 @@ # Functions added in core -See code for more details. +See code for more details. (may not be upto date as im lazy) ## GUI ### Defining * ExpGui.add_frame.center(name,default_display,default_tooltip,tabs,event) @@ -69,10 +69,10 @@ See code for more details. * We stole this but we don't know from where, just google it * output -> table as a string ## Get Commands -* get_temp_var_data(name) - * name = value retured by sudo - * returens a list if the data returend by thefunction if any -* get_sudo_info(string) +* server.get_uuid_data(uuid) + * uuid = value retured by callback + * returnd the data stored here +* server.get_callback_queue_info(string) * return either a list or string based on the string boliean * ranking.get_ranks(part) * returns a list of all the ranks @@ -86,25 +86,39 @@ See code for more details. * get_commands(rank) * returns all commands that are useable * rank (opt) = rank name to limt it to what that rank can use +## Server +* server.queue_callback(command,args,uuid) + * Ask server to run a script function at a diffrent time + * command = function to be ran + * args (as function needs) = {...} + * uuid (opt) = the uuid that it will return (use with get_uuid_data) + * returns the uuid +* server.add_callback(callback,uuid) + * Sets a function in memory + * used with /socket to run + * callbacl = function to save to memory + * uuid = sting for a custom uuid +* server.refresh_uuid(uuid,value,offset) + * uuid = location of the data to be refreshed + * value (opt) = new value if making a new temp varible + * offset (opt) = if the base time is too short, for very big commands +* server.get_uuid(string) + * returns the same value that queue_callback would when given a custom return name + * will return the same as callback but cant be used to get the value of a previous callback +* server.emit(code, callback) + * you dont see this i was just asked to add it ## Other +* server.clear_callbacks() + * resets the callback system * define_command(name,help,inputs,event) * Add game commands in a way it does not cause crashes * name = 'test' -> /test * help = 'help message' * inputs = {'input name',...,true/nil} last value being true means no cap on the length * event = on command -> function(player,event,args) -* sudo(command,args,custom_return_name) - * Ask server to run a script function at a diffrent time - * command = function or function name - * args (as function needs) = {...} - * custom_return_name (opt) = name of the value temp varible returned - * returns the name of its temp varible -* refresh_temp_var(name,value,offset) - * name = value retured by sudo - * value (opt) = new value if making a new temp varible - * offset (opt) = if the base time is too short, for very big commands -* format_as_temp_var(string) - * returns the same value that sudo would when given a custom return name - * note only works when there is a custom return name else temp var is nil * command: /server-interface - * Run loadstring on lua code given like /c but does not break achievements \ No newline at end of file + * Run loadstring on lua code given like /c but does not break achievements +* command: /debug + * same as server-interface but runs in debug mode +* command: /socket + * its just magic ok, its for server sync \ 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 99356e43..eb5a0c88 100644 --- a/locale/ExpGaming-Core/ExpGaming - Rank Control.lua +++ b/locale/ExpGaming-Core/ExpGaming - Rank Control.lua @@ -58,11 +58,11 @@ function ranking.rank_print(msg, rank, inv) --this part uses sudo to soread it other many ticks player_rank_power = ranking.get_player_rank(player).power if inv then - sudo(function(player_rank_power,rank) + server.queue_callback(function(player_rank_power,rank) if player_rank_power >= rank.power then player.print({'ranking.all-rank-print',msg}) end end,{player_rank_power,rank}) else - sudo(function(player_rank_power,rank) + server.queue_callback(function(player_rank_power,rank) if player_rank_power <= rank.power then if rank.short_hand ~= '' then player.print(('['..(rank.short_hand)..']: '..msg)) else player.print({'ranking.all-rank-print',msg}) end end