mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-24 17:22:23 +00:00
Support for the new rank colours system
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user