From 1859b9ca9b15466268df67961aaf6d9e3bb56277 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Mon, 11 Dec 2017 18:14:14 +0000 Subject: [PATCH] Few bug fixes --- locale/ExpCore/commands.lua | 2 +- locale/ExpCore/ranks.lua | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/locale/ExpCore/commands.lua b/locale/ExpCore/commands.lua index 1c9ef779..cf375bfb 100644 --- a/locale/ExpCore/commands.lua +++ b/locale/ExpCore/commands.lua @@ -81,7 +81,7 @@ local function run_custom_command(command) local command_data = command_data[command.name] local player_name = Game.get_player(command) and Game.get_player(command).name or 'server' -- is the player allowed to use this command - if is_type(Ranking,'table') and is_type(Ranking.get_rank,'function') and not Ranking.get_rank(player_name):allowed(command.name) then + if is_type(Ranking,'table') and Ranking._presets and Ranking._presets().meta.rank_count > 0 and not Ranking.get_rank(player_name):allowed(command.name) then player_return{'commands.unauthorized'} game.write_file('commands.log','\n'..game.tick ..' Player: '..player_name diff --git a/locale/ExpCore/ranks.lua b/locale/ExpCore/ranks.lua index 61691d42..94dbe2ac 100644 --- a/locale/ExpCore/ranks.lua +++ b/locale/ExpCore/ranks.lua @@ -29,7 +29,7 @@ short_hand is what can be used when short on space but the rank still need to be tag is the tag the player will gain when moved to the rank, it can be nil. time is used for auto-rank feature where you are moved to the rank after a certain play time in minutes. colour is the RGB value that can be used to emphasise GUI elements based on rank. -power is asigned by the script based on their index in ranks, you can insert new ranks between current ones. +power is asigned by the script based on their index in ranks, you can insert new ranks between current ones, lower is better group is asigned by the script to show the group this rank is in disallow is a list containing input actions that the user can not perform. allow is a list of custom commands and effects that that rank can use, all defined in the sctips. @@ -218,6 +218,7 @@ end function Ranking._meta() local meta = {time_ranks={}} for power,rank in pairs(ranks) do + meta.rank_count = power if rank.is_default then meta.default = rank.name end @@ -226,8 +227,8 @@ function Ranking._meta() end if rank.time then table.insert(meta.time_ranks,rank.name) - if not meta.time_highest or power > meta.time_highest then meta.time_highest = power end - if not meta.time_lowest or power < meta.time_lowest then meta.time_lowest = power end + if not meta.time_highest or power < meta.time_highest then meta.time_highest = power end + if not meta.time_lowest or rank.time < meta.time_lowest then meta.time_lowest = power.time end end meta.time_highest = meta.time_highest or 0 meta.time_lowest = meta.time_lowest or 0