Change to rank system

This commit is contained in:
Cooldude2606
2017-09-16 19:12:55 +01:00
parent 18b4de2a3e
commit e4218be007

View File

@@ -19,6 +19,13 @@ local credits = {{
local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits,cred) end end
--Please Only Edit Below This Line-----------------------------------------------------------
--[[
How to use groups:
name the name that you can use to refence it.
colour if present then all ranks in this group will have this colour.
disallow if present then all ranks in this group will have this added to their disallow.
allow if present then all ranks in this group will have this added to their allow.
highest_rank is asigned by the script to show the highest rank in this group.
lowest_rank is asigned by the script to show the lowest rank in this group.
How to add ranks:
Name is what will be used in the scripts and is often the best choice for display in text.
short_hand is what can be used when short on space but the rank still need to be displayed.
@@ -26,6 +33,7 @@ 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 not in the list below as it is auto-defined by index but allows comparison between ranks.
group is the groups that this rank is apart of can be nil, group allow and disallow are non-inheritable.
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.
For disallow, add to the list the end part of the input action
@@ -37,116 +45,24 @@ local ranks = {
highest_timed_rank=nil,
lowest_timed_rank=nil,
number_of_ranks=0,
ranks={
{name='Owner',
short_hand='Owner',
tag='[Owner]',
time=nil,
colour={r=170,g=0,b=0},
disallow={},
allow={}},
{name='Community Manager',
short_hand='Com Mngr',
tag='[Com Mngr]',
time=nil,
colour={r=150,g=68,b=161},
disallow={},
allow={}},
{name='Developer',
short_hand='Dev',
tag='[Dev]',
time=nil,
colour={r=179,g=125,b=46},
disallow={},
groups={
{name='Management',
allow={'cheat-mode'}
},
{name='Admin',
short_hand='Admin',
tag='[Admin]',
time=nil,
colour={r=233,g=63,b=233},
{name='Moderation',
disallow={
'set_allow_commands',
'edit_permission_group',
'delete_permission_group',
'add_permission_group'},
allow={
'server-interface',
'tp-all',
'announcement',
'admin',
'force_modifiers_tab',
'player_modifiers_tab'}
},
{name='Mod',
short_hand='Mod',
tag='[Mod]',
time=nil,
colour={r=0,g=170,b=0},
disallow={
'server_command'},
allow={
'temp-ban',
'rank_changer',
'remove-report'}
},
{name='Donator',
short_hand='P2W',
tag='[P2W]',
time=nil,
colour={r=233,g=63,b=233},
disallow={},
allow={
'tp',
'repair',
'tree_remover',
'report_protection'}
},
{name='Veteran',
short_hand='Vet',
tag='[Veteran]',
time=600,
colour={r=140,g=120,b=200},
disallow={},
allow={'edit_tasks'}},
{name='Member',
short_hand='Mem',
tag='[Member]',
time=nil,
colour={r=24,g=172,b=188},
disallow={},
allow={'trusted_reporter'}},
{name='Regular',
short_hand='Reg',
tag='[Regular]',
time=180,
colour={r=24,g=172,b=188},
disallow={
'set_auto_launch_rocket',
'change_programmable_speaker_alert_parameters',
'drop_item'},
allow={'decon'}
},
{name='Guest',
short_hand='',
tag='[Guest]',
time=nil,
colour={r=255,g=159,b=27},
disallow={
'build_terrain',
'remove_cables',
'launch_rocket',
'reset_assembling_machine',
'cancel_research'},
{name='User',
allow={
'kill',
'tag',
@@ -165,12 +81,130 @@ local ranks = {
'servers_tab',
'credit_tab'}
},
{name='Jail'}
},
ranks={
{name='Owner',
short_hand='Owner',
tag='[Owner]',
time=nil,
colour={r=170,g=0,b=0},
group='Management',
disallow={},
allow={}},
{name='Community Manager',
short_hand='Com Mngr',
tag='[Com Mngr]',
time=nil,
colour={r=150,g=68,b=161},
group='Management',
disallow={},
allow={}},
{name='Developer',
short_hand='Dev',
tag='[Dev]',
time=nil,
colour={r=179,g=125,b=46},
group='Management',
disallow={},
allow={'cheat-mode'}
},
{name='Admin',
short_hand='Admin',
tag='[Admin]',
time=nil,
colour={r=233,g=63,b=233},
group='Moderation',
disallow={},
allow={
'server-interface',
'tp-all',
'announcement',
'admin',
'force_modifiers_tab',
'player_modifiers_tab'}
},
{name='Mod',
short_hand='Mod',
tag='[Mod]',
time=nil,
colour={r=0,g=170,b=0},
group='Moderation',
disallow={'server_command'},
allow={}
},
{name='Donator',
short_hand='P2W',
tag='[P2W]',
time=nil,
colour={r=233,g=63,b=233},
group='User',
disallow={},
allow={
'tp',
'repair',
'tree_remover',
'report_protection'}
},
{name='Veteran',
short_hand='Vet',
tag='[Veteran]',
time=600,
colour={r=140,g=120,b=200},
group='User',
disallow={},
allow={'edit_tasks'}},
{name='Member',
short_hand='Mem',
tag='[Member]',
time=nil,
colour={r=24,g=172,b=188},
group='User',
disallow={},
allow={'trusted_reporter'}},
{name='Regular',
short_hand='Reg',
tag='[Regular]',
time=180,
colour={r=24,g=172,b=188},
group='User',
disallow={
'set_auto_launch_rocket',
'change_programmable_speaker_alert_parameters',
'drop_item'},
allow={'decon'}
},
{name='Guest',
short_hand='',
tag='[Guest]',
time=nil,
colour={r=255,g=159,b=27},
group='User',
disallow={
'build_terrain',
'remove_cables',
'launch_rocket',
'reset_assembling_machine',
'cancel_research'},
allow={}
},
{name='Jail',
short_hand='Jail',
tag='[Jail]',
time=nil,
colour={r=50,g=50,b=50},
group='Jail',
disallow={
'open_character_gui',
'begin_mining',
@@ -181,6 +215,23 @@ local ranks = {
}
}
-- rank table setup
-- group setup
for n,rank in pairs(ranks.ranks) do
local group = nil; for _,g in pairs(ranks.groups) do if g.name == rank.group then group = g break end end
if group and not group.highest_rank then group.highest_rank=rank end
if group then group.lowest_rank=rank end
if group and group.colour then rank.colour = group.colour end
end
-- group to rank setup
for n,group in pairs(ranks.groups) do
if group.allow and group.lowest_rank then
for _,allow in pairs(group.allow) do table.insert(group.lowest_rank.allow,allow) end
end
if group.disallow and group.highest_rank then
for _,disallow in pairs(group.disallow) do table.insert(group.highest_rank.disallow,disallow) end
end
end
-- rank setup
for n,rank in pairs(ranks.ranks) do
rank.power = n
if ranks.ranks[n-1] then