mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-11 10:22:13 +00:00
Config dir again except this time it works
This commit is contained in:
committed by
CitadelStationBot
parent
f692ffaa0c
commit
8dead1da6a
@@ -2,7 +2,7 @@
|
|||||||
#define CREDIT_SPAWN_SPEED 10
|
#define CREDIT_SPAWN_SPEED 10
|
||||||
#define CREDIT_ANIMATE_HEIGHT (14 * world.icon_size)
|
#define CREDIT_ANIMATE_HEIGHT (14 * world.icon_size)
|
||||||
#define CREDIT_EASE_DURATION 22
|
#define CREDIT_EASE_DURATION 22
|
||||||
#define CREDITS_PATH "[GLOB.config_dir]contributors.dmi"
|
#define CREDITS_PATH "[global.config.directory]/contributors.dmi"
|
||||||
|
|
||||||
/client/proc/RollCredits()
|
/client/proc/RollCredits()
|
||||||
set waitfor = FALSE
|
set waitfor = FALSE
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
GLOBAL_VAR_INIT(config_dir, "config/")
|
|
||||||
GLOBAL_PROTECT(config_dir)
|
|
||||||
|
|
||||||
/datum/controller/configuration
|
/datum/controller/configuration
|
||||||
name = "Configuration"
|
name = "Configuration"
|
||||||
|
|
||||||
|
var/directory = "config"
|
||||||
|
|
||||||
var/hiding_entries_by_type = TRUE //Set for readability, admins can set this to FALSE if they want to debug it
|
var/hiding_entries_by_type = TRUE //Set for readability, admins can set this to FALSE if they want to debug it
|
||||||
var/list/entries
|
var/list/entries
|
||||||
var/list/entries_by_type
|
var/list/entries_by_type
|
||||||
@@ -20,11 +19,12 @@ GLOBAL_PROTECT(config_dir)
|
|||||||
|
|
||||||
var/motd
|
var/motd
|
||||||
|
|
||||||
/datum/controller/configuration/New()
|
/datum/controller/configuration/proc/Load()
|
||||||
config = src
|
if(entries)
|
||||||
|
CRASH("[THIS_PROC_TYPE_WEIRD] called more than once!")
|
||||||
InitEntries()
|
InitEntries()
|
||||||
LoadModes()
|
LoadModes()
|
||||||
if(fexists("config/config.txt") && LoadEntries("config.txt") <= 1)
|
if(fexists("[directory]/config.txt") && LoadEntries("config.txt") <= 1)
|
||||||
log_config("No $include directives found in config.txt! Loading legacy game_options/dbconfig/comms files...")
|
log_config("No $include directives found in config.txt! Loading legacy game_options/dbconfig/comms files...")
|
||||||
LoadEntries("game_options.txt")
|
LoadEntries("game_options.txt")
|
||||||
LoadEntries("dbconfig.txt")
|
LoadEntries("dbconfig.txt")
|
||||||
@@ -74,7 +74,7 @@ GLOBAL_PROTECT(config_dir)
|
|||||||
stack = stack + filename_to_test
|
stack = stack + filename_to_test
|
||||||
|
|
||||||
log_config("Loading config file [filename]...")
|
log_config("Loading config file [filename]...")
|
||||||
var/list/lines = world.file2list("[GLOB.config_dir][filename]")
|
var/list/lines = world.file2list("[directory]/[filename]")
|
||||||
var/list/_entries = entries
|
var/list/_entries = entries
|
||||||
for(var/L in lines)
|
for(var/L in lines)
|
||||||
if(!L)
|
if(!L)
|
||||||
@@ -131,10 +131,11 @@ GLOBAL_PROTECT(config_dir)
|
|||||||
++.
|
++.
|
||||||
|
|
||||||
/datum/controller/configuration/can_vv_get(var_name)
|
/datum/controller/configuration/can_vv_get(var_name)
|
||||||
return (var_name != "entries_by_type" || !hiding_entries_by_type) && ..()
|
return (var_name != NAMEOF(src, entries_by_type) || !hiding_entries_by_type) && ..()
|
||||||
|
|
||||||
/datum/controller/configuration/vv_edit_var(var_name, var_value)
|
/datum/controller/configuration/vv_edit_var(var_name, var_value)
|
||||||
return !(var_name in list("entries_by_type", "entries")) && ..()
|
var/list/banned_edits = list(NAMEOF(src, entries_by_type), NAMEOF(src, entries), NAMEOF(src, directory))
|
||||||
|
return !(var_name in banned_edits) && ..()
|
||||||
|
|
||||||
/datum/controller/configuration/stat_entry()
|
/datum/controller/configuration/stat_entry()
|
||||||
if(!statclick)
|
if(!statclick)
|
||||||
@@ -196,14 +197,14 @@ GLOBAL_PROTECT(config_dir)
|
|||||||
votable_modes += "secret"
|
votable_modes += "secret"
|
||||||
|
|
||||||
/datum/controller/configuration/proc/LoadMOTD()
|
/datum/controller/configuration/proc/LoadMOTD()
|
||||||
motd = file2text("[GLOB.config_dir]/motd.txt")
|
motd = file2text("[directory]/motd.txt")
|
||||||
var/tm_info = GLOB.revdata.GetTestMergeInfo()
|
var/tm_info = GLOB.revdata.GetTestMergeInfo()
|
||||||
if(motd || tm_info)
|
if(motd || tm_info)
|
||||||
motd = motd ? "[motd]<br>[tm_info]" : tm_info
|
motd = motd ? "[motd]<br>[tm_info]" : tm_info
|
||||||
|
|
||||||
/datum/controller/configuration/proc/loadmaplist(filename)
|
/datum/controller/configuration/proc/loadmaplist(filename)
|
||||||
log_config("Loading config file [filename]...")
|
log_config("Loading config file [filename]...")
|
||||||
filename = "[GLOB.config_dir][filename]"
|
filename = "[directory]/[filename]"
|
||||||
var/list/Lines = world.file2list(filename)
|
var/list/Lines = world.file2list(filename)
|
||||||
|
|
||||||
var/datum/map_config/currentmap = null
|
var/datum/map_config/currentmap = null
|
||||||
|
|||||||
@@ -61,8 +61,9 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
|
|||||||
var/static/current_ticklimit = TICK_LIMIT_RUNNING
|
var/static/current_ticklimit = TICK_LIMIT_RUNNING
|
||||||
|
|
||||||
/datum/controller/master/New()
|
/datum/controller/master/New()
|
||||||
|
config = new
|
||||||
// Highlander-style: there can only be one! Kill off the old and replace it with the new.
|
// Highlander-style: there can only be one! Kill off the old and replace it with the new.
|
||||||
|
|
||||||
if(!random_seed)
|
if(!random_seed)
|
||||||
random_seed = rand(1, 1e9)
|
random_seed = rand(1, 1e9)
|
||||||
rand_seed(random_seed)
|
rand_seed(random_seed)
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ SUBSYSTEM_DEF(job)
|
|||||||
|
|
||||||
|
|
||||||
/datum/controller/subsystem/job/proc/LoadJobs()
|
/datum/controller/subsystem/job/proc/LoadJobs()
|
||||||
var/jobstext = file2text("config/jobs.txt")
|
var/jobstext = file2text("[global.config.directory]/jobs.txt")
|
||||||
for(var/datum/job/J in occupations)
|
for(var/datum/job/J in occupations)
|
||||||
var/regex/jobs = new("[J.title]=(-1|\\d+),(-1|\\d+)")
|
var/regex/jobs = new("[J.title]=(-1|\\d+),(-1|\\d+)")
|
||||||
jobs.Find(jobstext)
|
jobs.Find(jobstext)
|
||||||
|
|||||||
@@ -229,8 +229,8 @@ GLOBAL_LIST_EMPTY(the_station_areas)
|
|||||||
|
|
||||||
/datum/controller/subsystem/mapping/proc/preloadRuinTemplates()
|
/datum/controller/subsystem/mapping/proc/preloadRuinTemplates()
|
||||||
// Still supporting bans by filename
|
// Still supporting bans by filename
|
||||||
var/list/banned = generateMapList("config/lavaruinblacklist.txt")
|
var/list/banned = generateMapList("[global.config.directory]/lavaruinblacklist.txt")
|
||||||
banned += generateMapList("config/spaceruinblacklist.txt")
|
banned += generateMapList("[global.config.directory]/spaceruinblacklist.txt")
|
||||||
|
|
||||||
for(var/item in sortList(subtypesof(/datum/map_template/ruin), /proc/cmp_ruincost_priority))
|
for(var/item in sortList(subtypesof(/datum/map_template/ruin), /proc/cmp_ruincost_priority))
|
||||||
var/datum/map_template/ruin/ruin_type = item
|
var/datum/map_template/ruin/ruin_type = item
|
||||||
@@ -251,7 +251,7 @@ GLOBAL_LIST_EMPTY(the_station_areas)
|
|||||||
space_ruins_templates[R.name] = R
|
space_ruins_templates[R.name] = R
|
||||||
|
|
||||||
/datum/controller/subsystem/mapping/proc/preloadShuttleTemplates()
|
/datum/controller/subsystem/mapping/proc/preloadShuttleTemplates()
|
||||||
var/list/unbuyable = generateMapList("config/unbuyableshuttles.txt")
|
var/list/unbuyable = generateMapList("[global.config.directory]/unbuyableshuttles.txt")
|
||||||
|
|
||||||
for(var/item in subtypesof(/datum/map_template/shuttle))
|
for(var/item in subtypesof(/datum/map_template/shuttle))
|
||||||
var/datum/map_template/shuttle/shuttle_type = item
|
var/datum/map_template/shuttle/shuttle_type = item
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ SUBSYSTEM_DEF(ticker)
|
|||||||
"aiff" = TRUE
|
"aiff" = TRUE
|
||||||
)
|
)
|
||||||
|
|
||||||
var/list/provisional_title_music = flist("config/title_music/sounds/")
|
var/list/provisional_title_music = flist("[global.config.directory]/title_music/sounds/")
|
||||||
var/list/music = list()
|
var/list/music = list()
|
||||||
var/use_rare_music = prob(1)
|
var/use_rare_music = prob(1)
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ SUBSYSTEM_DEF(ticker)
|
|||||||
music = world.file2list(ROUND_START_MUSIC_LIST, "\n")
|
music = world.file2list(ROUND_START_MUSIC_LIST, "\n")
|
||||||
login_music = pick(music)
|
login_music = pick(music)
|
||||||
else
|
else
|
||||||
login_music = "config/title_music/sounds/[pick(music)]"
|
login_music = "[global.config.directory]/title_music/sounds/[pick(music)]"
|
||||||
|
|
||||||
crewobjlist = typesof(/datum/objective/crew)
|
crewobjlist = typesof(/datum/objective/crew)
|
||||||
miscreantobjlist = (typesof(/datum/objective/miscreant) - /datum/objective/miscreant)
|
miscreantobjlist = (typesof(/datum/objective/miscreant) - /datum/objective/miscreant)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ SUBSYSTEM_DEF(title)
|
|||||||
previous_icon = new(previous_icon)
|
previous_icon = new(previous_icon)
|
||||||
fdel("data/previous_title.dat")
|
fdel("data/previous_title.dat")
|
||||||
|
|
||||||
var/list/provisional_title_screens = flist("config/title_screens/images/")
|
var/list/provisional_title_screens = flist("[global.config.directory]/title_screens/images/")
|
||||||
var/list/title_screens = list()
|
var/list/title_screens = list()
|
||||||
var/use_rare_screens = prob(1)
|
var/use_rare_screens = prob(1)
|
||||||
|
|
||||||
@@ -34,7 +34,11 @@ SUBSYSTEM_DEF(title)
|
|||||||
break
|
break
|
||||||
|
|
||||||
if(length(title_screens))
|
if(length(title_screens))
|
||||||
|
<<<<<<< HEAD
|
||||||
file_path = "config/title_screens/images/[pick(title_screens)]"
|
file_path = "config/title_screens/images/[pick(title_screens)]"
|
||||||
|
=======
|
||||||
|
file_path = "[global.config.directory]/title_screens/images/[pick(title_screens)]"
|
||||||
|
>>>>>>> 015258d... Config dir again except this time it works (#34606)
|
||||||
|
|
||||||
if(!file_path)
|
if(!file_path)
|
||||||
file_path = "icons/default_title.dmi"
|
file_path = "icons/default_title.dmi"
|
||||||
|
|||||||
@@ -190,7 +190,7 @@
|
|||||||
|
|
||||||
/datum/ai_laws/custom/New() //This reads silicon_laws.txt and allows server hosts to set custom AI starting laws.
|
/datum/ai_laws/custom/New() //This reads silicon_laws.txt and allows server hosts to set custom AI starting laws.
|
||||||
..()
|
..()
|
||||||
for(var/line in world.file2list("config/silicon_laws.txt"))
|
for(var/line in world.file2list("[global.config.directory]/silicon_laws.txt"))
|
||||||
if(!line)
|
if(!line)
|
||||||
continue
|
continue
|
||||||
if(findtextEx(line,"#",1,2))
|
if(findtextEx(line,"#",1,2))
|
||||||
|
|||||||
@@ -400,7 +400,7 @@ AI MODULES
|
|||||||
|
|
||||||
/obj/item/aiModule/core/full/custom/Initialize()
|
/obj/item/aiModule/core/full/custom/Initialize()
|
||||||
. = ..()
|
. = ..()
|
||||||
for(var/line in world.file2list("config/silicon_laws.txt"))
|
for(var/line in world.file2list("[global.config.directory]/silicon_laws.txt"))
|
||||||
if(!line)
|
if(!line)
|
||||||
continue
|
continue
|
||||||
if(findtextEx(line,"#",1,2))
|
if(findtextEx(line,"#",1,2))
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ GLOBAL_PROTECT(security_mode)
|
|||||||
|
|
||||||
make_datum_references_lists() //initialises global lists for referencing frequently used datums (so that we only ever do it once)
|
make_datum_references_lists() //initialises global lists for referencing frequently used datums (so that we only ever do it once)
|
||||||
|
|
||||||
new /datum/controller/configuration
|
config.Load()
|
||||||
|
|
||||||
//SetupLogs depends on the RoundID, so lets check
|
//SetupLogs depends on the RoundID, so lets check
|
||||||
//DB schema and set RoundID if we can
|
//DB schema and set RoundID if we can
|
||||||
@@ -49,7 +49,7 @@ GLOBAL_PROTECT(security_mode)
|
|||||||
|
|
||||||
/world/proc/SetupExternalRSC()
|
/world/proc/SetupExternalRSC()
|
||||||
#if (PRELOAD_RSC == 0)
|
#if (PRELOAD_RSC == 0)
|
||||||
GLOB.external_rsc_urls = world.file2list("config/external_rsc_urls.txt","\n")
|
GLOB.external_rsc_urls = world.file2list("[global.config.directory]/external_rsc_urls.txt","\n")
|
||||||
var/i=1
|
var/i=1
|
||||||
while(i<=GLOB.external_rsc_urls.len)
|
while(i<=GLOB.external_rsc_urls.len)
|
||||||
if(GLOB.external_rsc_urls[i])
|
if(GLOB.external_rsc_urls[i])
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ GLOBAL_PROTECT(admin_ranks)
|
|||||||
if(CONFIG_GET(flag/admin_legacy_system))
|
if(CONFIG_GET(flag/admin_legacy_system))
|
||||||
var/previous_rights = 0
|
var/previous_rights = 0
|
||||||
//load text from file and process each line separately
|
//load text from file and process each line separately
|
||||||
for(var/line in world.file2list("config/admin_ranks.txt"))
|
for(var/line in world.file2list("[global.config.directory]/admin_ranks.txt"))
|
||||||
if(!line)
|
if(!line)
|
||||||
continue
|
continue
|
||||||
if(findtextEx(line,"#",1,2))
|
if(findtextEx(line,"#",1,2))
|
||||||
@@ -195,7 +195,7 @@ GLOBAL_PROTECT(admin_ranks)
|
|||||||
|
|
||||||
if(CONFIG_GET(flag/admin_legacy_system))
|
if(CONFIG_GET(flag/admin_legacy_system))
|
||||||
//load text from file
|
//load text from file
|
||||||
var/list/lines = world.file2list("config/admins.txt")
|
var/list/lines = world.file2list("[global.config.directory]/admins.txt")
|
||||||
|
|
||||||
//process each line separately
|
//process each line separately
|
||||||
for(var/line in lines)
|
for(var/line in lines)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
if (!msg)
|
if (!msg)
|
||||||
return
|
return
|
||||||
var/static/nicknames = world.file2list("config/admin_nicknames.txt")
|
var/static/nicknames = world.file2list("[global.config.directory]/admin_nicknames.txt")
|
||||||
|
|
||||||
var/rendered = "<span class='game deadsay'><span class='prefix'>DEAD:</span> <span class='name'>ADMIN([src.holder.fakekey ? pick(nicknames) : src.key])</span> says, <span class='message'>\"[msg]\"</span></span>"
|
var/rendered = "<span class='game deadsay'><span class='prefix'>DEAD:</span> <span class='name'>ADMIN([src.holder.fakekey ? pick(nicknames) : src.key])</span> says, <span class='message'>\"[msg]\"</span></span>"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#define WHITELISTFILE "config/whitelist.txt"
|
#define WHITELISTFILE "[global.config.directory]/whitelist.txt"
|
||||||
|
|
||||||
GLOBAL_LIST(whitelist)
|
GLOBAL_LIST(whitelist)
|
||||||
GLOBAL_PROTECT(whitelist)
|
GLOBAL_PROTECT(whitelist)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// How much "space" we give the edge of the map
|
// How much "space" we give the edge of the map
|
||||||
GLOBAL_LIST_INIT(potentialRandomZlevels, generateMapList(filename = "config/awaymissionconfig.txt"))
|
GLOBAL_LIST_INIT(potentialRandomZlevels, generateMapList(filename = "[global.config.directory]/awaymissionconfig.txt"))
|
||||||
|
|
||||||
/proc/createRandomZlevel()
|
/proc/createRandomZlevel()
|
||||||
if(GLOB.awaydestinations.len) //crude, but it saves another var!
|
if(GLOB.awaydestinations.len) //crude, but it saves another var!
|
||||||
|
|||||||
Reference in New Issue
Block a user