mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 12:07:27 +01:00
Support for the new rank colours system
This commit is contained in:
@@ -663,9 +663,9 @@
|
||||
/proc/client2rankcolour(client/C)
|
||||
// First check if end user is an admin
|
||||
if(C.holder)
|
||||
if(C.holder.rank in GLOB.rank_colour_map)
|
||||
if(C.holder.rank in GLOB.configuration.admin.rank_colour_map)
|
||||
// Return their rank colour if they are in here
|
||||
return GLOB.rank_colour_map[C.holder.rank]
|
||||
return GLOB.configuration.admin.rank_colour_map[C.holder.rank]
|
||||
|
||||
// If they arent an admin, see if they are a patreon. Just accept any level
|
||||
if(C.donator_level)
|
||||
|
||||
@@ -54,7 +54,4 @@ GLOBAL_LIST_INIT(cooking_recipes, list(RECIPE_MICROWAVE = list(), RECIPE_OVEN =
|
||||
GLOBAL_LIST_INIT(cooking_ingredients, list(RECIPE_MICROWAVE = list(), RECIPE_OVEN = list(), RECIPE_GRILL = list(), RECIPE_CANDY = list()))
|
||||
GLOBAL_LIST_INIT(cooking_reagents, list(RECIPE_MICROWAVE = list(), RECIPE_OVEN = list(), RECIPE_GRILL = list(), RECIPE_CANDY = list()))
|
||||
|
||||
/// Associative list of admin rank to colour. Set in config/rank_colours.txt
|
||||
GLOBAL_LIST_EMPTY(rank_colour_map)
|
||||
|
||||
#define EGG_LAYING_MESSAGES list("lays an egg.", "squats down and croons.", "begins making a huge racket.", "begins clucking raucously.")
|
||||
|
||||
@@ -622,34 +622,3 @@
|
||||
runnable_modes[M] = probabilities[M.config_tag]
|
||||
// to_chat(world, "DEBUG: runnable_mode\[[runnable_modes.len]\] = [M.config_tag]")
|
||||
return runnable_modes
|
||||
|
||||
/datum/configuration/proc/load_rank_colour_map()
|
||||
var/list/lines = file2list("config/rank_colours.txt")
|
||||
|
||||
for(var/line in lines)
|
||||
// Skip newlines
|
||||
if(!length(line))
|
||||
continue
|
||||
// Skip comments
|
||||
if(line[1] == "#")
|
||||
continue
|
||||
|
||||
//Split the line at every " - "
|
||||
var/list/split_holder = splittext(line, " - ")
|
||||
if(!length(split_holder))
|
||||
continue
|
||||
|
||||
// Rank is before the " - "
|
||||
var/rank = split_holder[1]
|
||||
if(!rank)
|
||||
continue
|
||||
|
||||
// Color is after the " - "
|
||||
var/colour = ""
|
||||
if(length(split_holder) >= 2)
|
||||
colour = split_holder[2]
|
||||
|
||||
if(rank && colour)
|
||||
GLOB.rank_colour_map[rank] = colour
|
||||
else
|
||||
stack_trace("Invalid colour for rank '[rank]' in config/rank_colours.txt")
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
var/list/rank_rights_map = list()
|
||||
/// Assoc list of admin ckeys and their ranks. key: ckey | value: rank name
|
||||
var/list/ckey_rank_map = list()
|
||||
/// Assoc list of admin ranks and their colours. key: rank | value: rank colour
|
||||
var/list/rank_colour_map = list()
|
||||
|
||||
/datum/configuration_section/admin_configuration/load_data(list/data)
|
||||
// Use the load wrappers here. That way the default isnt made 'null' if you comment out the config line
|
||||
@@ -27,6 +29,12 @@
|
||||
for(var/list/kvset in data["admin_assignments"])
|
||||
ckey_rank_map[kvset["ckey"]] = kvset["rank"]
|
||||
|
||||
// Load admin colours
|
||||
if(islist(data["admin_rank_colour_map"]))
|
||||
rank_colour_map.Cut()
|
||||
for(var/list/kvset in data["admin_rank_colour_map"])
|
||||
rank_colour_map[kvset["name"]] = kvset["colour"]
|
||||
|
||||
// For the person who asks "Why not put admin datum generation in this step?", well I will tell you why
|
||||
// Admins can be reloaded at runtime when DB edits are made and such, and I dont want an entire config reload to be part of this
|
||||
// Separation makes sense. That and in prod we use the DB anyways.
|
||||
|
||||
@@ -196,7 +196,6 @@ GLOBAL_LIST_EMPTY(world_topic_handlers)
|
||||
config = new /datum/configuration()
|
||||
config.load("config/config.txt")
|
||||
config.load("config/game_options.txt","game_options")
|
||||
config.load_rank_colour_map()
|
||||
// apply some settings from config..
|
||||
|
||||
/world/proc/update_status()
|
||||
|
||||
@@ -79,6 +79,17 @@ admin_assignments = [
|
||||
]
|
||||
# Allow admins to set their own OOC colour
|
||||
allow_admin_ooc_colour = true
|
||||
# Map of admin rank colours to their respective rank. Note you can use hex or colour name here.
|
||||
admin_rank_colour_map = [
|
||||
{name = "Head of Staff", colour = "#e74c3c"},
|
||||
{name = "Maintainer", colour = "#992d22"},
|
||||
{name = "Server Dev", colour = "#1abc9c"},
|
||||
{name = "Community Manager", colour = "#e91e63"},
|
||||
{name = "Game Admin", colour = "#238afa"},
|
||||
{name = "Trial Admin", colour = "#7fb6fc"},
|
||||
{name = "PR Reviewer", colour = "#c27c0e"},
|
||||
{name = "Mentor", colour = "#f1c40f"},
|
||||
]
|
||||
|
||||
|
||||
################################################################
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
# Use this file to denote colours for ingame admin ranks, using the following format
|
||||
# Rankname - #12A5F4
|
||||
# Colours dont have to be in hex, since this colour string is thrown into the style -aa
|
||||
Head of Staff - #e74c3c
|
||||
Maintainer - #992d22
|
||||
Server Dev - #1abc9c
|
||||
Community Manager - #e91e63
|
||||
Game Admin - #238afa
|
||||
Trial Admin - #7fb6fc
|
||||
PR Reviewer - #c27c0e
|
||||
Mentor - #f1c40f
|
||||
Reference in New Issue
Block a user