Merge branch 'wip' into testing

This commit is contained in:
Cooldude2606
2018-01-04 14:10:35 +00:00
2 changed files with 18 additions and 3 deletions

View File

@@ -34,7 +34,7 @@ end
-- this returns a global list
function Ranking._presets()
if not global.exp_core then global.exp_core = {} end
if not global.exp_core.ranking then global.exp_core.ranking = {meta=Ranking._meta(),old={},current={}} end
if not global.exp_core.ranking then global.exp_core.ranking = {meta=Ranking._meta(),old={},current={},last_jail=nil} end
return global.exp_core.ranking
end
@@ -134,6 +134,16 @@ function Ranking.give_rank(player,rank,by_player,tick)
old_rank=old_rank
})
end
if rank.group.name == 'Jail' and Ranking._presets().last_jail ~= player.name then
discord_emit{
title='Player Jail',
color=Color.to_hex(defines.text_color.med),
description='There was a player jailed.',
['Player:']=player.name,
['By:']='<<inline>>'..by_player_name,
['Reason:']='No Reason'
}
end
end
--- Revert the last change to a players rank

View File

@@ -77,9 +77,14 @@ function ExpLib.discord_emit(args)
local color = is_type(args.color,'string') and args.color:find("0x") and args.color or '0x0'
local description = is_type(args.description,'string') and args.description or ''
local server_detail = is_type(args.server_detail,'string') and args.server_detail or ''
local _count = 0
for _,player in pairs(game.connected_players) do
if player.admin then _count=_count+1 end
end
local mods_online = 'Mods Online: '.._count
local done, fields = {title=true,color=true,description=true,server_detail=true}, {{
name='Server Details',
value='Server Name: {{ serverName }} Online Players: '..#game.connected_players..' Server Time: '..tick_to_display_format(game.tick)..' '..server_detail
name='Server Details',
value='Server Name: {{ serverName }} Online Players: '..#game.connected_players..' '..mods_online..' Server Time: '..tick_to_display_format(game.tick)..' '..server_detail
}}
for key, value in pairs(args) do
if not done[key] then