mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 19:45:22 +09:00
Added Sync.add_update
This commit is contained in:
@@ -131,7 +131,7 @@ function Ranking.give_rank(player,rank,by_player,tick)
|
||||
if old_rank.name == rank.name then return end
|
||||
if rank.power < old_rank.power then message = 'ranking.rank-up' player.play_sound{path='utility/achievement_unlocked'}
|
||||
else player.play_sound{path='utility/game_lost'} end
|
||||
game.print({message,player.name,rank.name,by_player_name},print_colour)
|
||||
if player.online_time > 60 or by_player_name ~= 'server' then game.print({message,player.name,rank.name,by_player_name},print_colour) end
|
||||
if rank.group.name ~= 'User' then player_return({'ranking.rank-given',rank.name},print_colour,player) end
|
||||
if player.tag ~= old_rank.tag then player_return({'ranking.tag-reset'},print_colour,player) end
|
||||
-- rank change
|
||||
|
||||
@@ -10,6 +10,7 @@ Discord: https://discord.gg/r6dC2uK
|
||||
-- this file is used to allow easy syncing with out side programes
|
||||
local Sync = {}
|
||||
local Sync_gui_functions = {}
|
||||
local Sync_updates = {}
|
||||
|
||||
--- Used as a faster way to get to the ranking function, overrides previous
|
||||
-- @usage Sync.set_ranks{name=rank_name}
|
||||
@@ -222,9 +223,16 @@ function Sync.update()
|
||||
}
|
||||
info.ranks = Sync.count_ranks()
|
||||
info.rockets = game.forces['player'].get_item_launched('satellite')
|
||||
for key,callback in pairs(Sync_updates) do info[key] = callback() end
|
||||
return info
|
||||
end
|
||||
|
||||
function Sync.add_update(key,callback)
|
||||
if game then return end
|
||||
if not is_type(callback,'function') then return end
|
||||
Sync_updates[key] = callback
|
||||
end
|
||||
|
||||
--- outputs the curent server info into a file
|
||||
-- @usage Sync.emit_data()
|
||||
function Sync.emit_data()
|
||||
|
||||
Reference in New Issue
Block a user