1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-12 10:04:40 +02:00

added donator rank

This commit is contained in:
grilledham 2018-08-13 12:39:27 +01:00
parent e0832abef3
commit 7469b6304e
3 changed files with 21 additions and 5 deletions

View File

@ -16,6 +16,7 @@ local focus_color = {r = 1, g = 0.55, b = 0.1}
local rank_colors = { local rank_colors = {
{r = 1, g = 1, b = 1}, -- Guest {r = 1, g = 1, b = 1}, -- Guest
{r = 0.155, g = 0.540, b = 0.898}, -- Regular {r = 0.155, g = 0.540, b = 0.898}, -- Regular
{r = 172.6, g = 70.2, b = 215.8}, -- Donator {r = 152, g = 24, b = 206}
{r = 0.093, g = 0.768, b = 0.172} -- Admin {r = 0.093, g = 0.768, b = 0.172} -- Admin
} }
@ -23,6 +24,7 @@ local inv_sprite_time_step = 1 / sprite_time_step
local rank_names = { local rank_names = {
'Guest', 'Guest',
'Regular', 'Regular',
'Donator',
'Admin' 'Admin'
} }
@ -111,12 +113,17 @@ end
local function get_rank_level(player) local function get_rank_level(player)
if player.admin then if player.admin then
return 3 return 4
elseif UserGroups.is_regular(player.name) then
return 2
else
return 1
end end
local name = player.name
if UserGroups.is_donator(name) then
return 3
elseif UserGroups.is_regular(name) then
return 2
end
return 1
end end
local function do_poke_spam_protection(player) local function do_poke_spam_protection(player)

4
resources/donators.lua Normal file
View File

@ -0,0 +1,4 @@
return {
['robertkruijt'] = true,
['aldldl'] = true
}

View File

@ -1,4 +1,5 @@
global.regulars = require 'resources.regulars' global.regulars = require 'resources.regulars'
global.donators = require 'resources.donators'
local Event = require 'utils.event' local Event = require 'utils.event'
local Utils = require 'utils.utils' local Utils = require 'utils.utils'
@ -66,6 +67,10 @@ function Module.get_rank(player)
end end
end end
function Module.is_donator(player_name)
return global.donators[player_name]
end
Event.add( Event.add(
defines.events.on_player_joined_game, defines.events.on_player_joined_game,
function(event) function(event)