more procs and roundstart loading files

This commit is contained in:
kevinz000
2017-05-13 16:23:43 -07:00
parent 9e0866871e
commit 25024432fe
3 changed files with 22 additions and 15 deletions
+7 -2
View File
@@ -8,21 +8,26 @@
#define LOADING_TO_HUMAN 1
/proc/handle_roundstart_items(mob/living/M)
if(!M.ckey || !istype(M))
world << "handle_roundstart_items([M])"
if(!istype(M) || !M.ckey)
world << "handle_roundstart_items: [M] has no ckey."
return FALSE
var/list/items = parse_custom_items_by_key(M.ckey)
if(isnull(items))
world << "handle_roundstart_items: itemlist null."
return FALSE
load_itemlist_to_mob(M, items, TRUE, TRUE, FALSE)
return load_itemlist_to_mob(M, items, TRUE, TRUE, FALSE)
//Just incase there's extra mob selections in the future.....
/proc/load_itemlist_to_mob(mob/living/L, list/itemlist, drop_on_floor_if_full = TRUE, load_to_all_slots = TRUE, replace_slots = FALSE)
world << "load_itemlist_to_mob([L], [itemlist], [drop_on_floor_if_full], [load_to_all_slots], [replace_slots])"
if(!istype(L) || !islist(itemlist))
return FALSE
var/loading_mode = DROP_TO_FLOOR
var/turf/current_turf = get_turf(L)
if(ishuman(L))
loading_mode = LOADING_TO_HUMAN
world << "load_itemlist_to_mob:loading_mode [loading_mode] current_turf [current_turf]"
switch(loading_mode)
if(DROP_TO_FLOOR)
for(var/I in itemlist)
@@ -1,5 +1,4 @@
#define CUSTOM_ITEM_LIST_FILE 'config/custom_items.txt'
GLOBAL_LIST(custom_item_list) //Assoc list in form of ckey = delimited paramlist.
//File should be in the format of Ckey|things, where things is in the form of itempath1=amount;itempath2=amount;itempath3=amount
@@ -7,7 +6,7 @@ GLOBAL_LIST(custom_item_list) //Assoc list in form of ckey = delimited paramlist
/proc/reload_custom_item_list(custom_filelist)
if(!custom_filelist)
custom_filelist = CUSTOM_ITEM_LIST_FILE
custom_filelist = "config/custom_items.txt"
GLOB.custom_item_list = list()
var/list/file_lines = world.file2list(custom_filelist)
for(var/line in file_lines)
@@ -40,7 +39,9 @@ GLOBAL_LIST(custom_item_list) //Assoc list in form of ckey = delimited paramlist
return GLOB.custom_item_list
/proc/parse_custom_items_by_key(ckey)
world << "parse_custom_items_by_key([ckey])"
if(!ckey || !GLOB.custom_item_list[ckey])
world << "parse_custom_items_by_key: no ckey match"
return null
var/list/items = GLOB.custom_item_list[ckey]
for(var/I in items)
+12 -11
View File
@@ -66,9 +66,9 @@
var/respawn = 1
var/guest_jobban = 1
var/usewhitelist = 0
var/inactivity_period = 3000 //time in ds until a player is considered inactive
var/afk_period = 6000 //time in ds until a player is considered afk and kickable
var/kick_inactive = FALSE //force disconnect for inactive players
var/inactivity_period = 3000 //time in ds until a player is considered inactive
var/afk_period = 6000 //time in ds until a player is considered afk and kickable
var/kick_inactive = FALSE //force disconnect for inactive players
var/load_jobs_from_txt = 0
var/automute_on = 0 //enables automuting/spam prevention
var/minimal_access_threshold = 0 //If the number of players is larger than this threshold, minimal access will be turned on.
@@ -284,6 +284,7 @@
load("config/config.txt")
load("config/game_options.txt","game_options")
loadsql("config/dbconfig.txt")
reload_custom_item_list()
if (maprotation)
loadmaplist("config/maps.txt")
@@ -291,7 +292,7 @@
GLOB.abandon_allowed = respawn
/datum/configuration/proc/load(filename, type = "config") //the type can also be game_options, in which case it uses a different switch. not making it separate to not copypaste code - Urist
var/list/Lines = world.file2list(filename)
var/list/Lines = world.file2list(filename)
for(var/t in Lines)
if(!t)
@@ -410,12 +411,12 @@
usewhitelist = TRUE
if("allow_metadata")
allow_Metadata = 1
if("inactivity_period")
inactivity_period = text2num(value) * 10 //documented as seconds in config.txt
if("afk_period")
afk_period = text2num(value) * 10 // ^^^
if("inactivity_period")
inactivity_period = text2num(value) * 10 //documented as seconds in config.txt
if("afk_period")
afk_period = text2num(value) * 10 // ^^^
if("kick_inactive")
kick_inactive = TRUE
kick_inactive = TRUE
if("load_jobs_from_txt")
load_jobs_from_txt = 1
if("forbid_singulo_possession")
@@ -785,7 +786,7 @@
/datum/configuration/proc/loadmaplist(filename)
var/list/Lines = world.file2list(filename)
var/list/Lines = world.file2list(filename)
var/datum/map_config/currentmap = null
for(var/t in Lines)
@@ -835,7 +836,7 @@
/datum/configuration/proc/loadsql(filename)
var/list/Lines = world.file2list(filename)
var/list/Lines = world.file2list(filename)
for(var/t in Lines)
if(!t)
continue