diff --git a/code/citadel/custom_loadout/read_from_file.dm b/code/citadel/custom_loadout/read_from_file.dm index a4d363bd06..e29fc74128 100644 --- a/code/citadel/custom_loadout/read_from_file.dm +++ b/code/citadel/custom_loadout/read_from_file.dm @@ -19,23 +19,30 @@ GLOBAL_LIST(custom_item_list) if(copytext(line,1,3) == "//") //Commented line, ignore. continue var/ckey_str_sep = findtext(line, "|") //Process our stuff.. - var/job_str_sep = findtext(line, "|", ckey_str_sep+1) + var/char_str_sep = findtext(line, "|", ckey_str_sep+1) + var/job_str_sep = findtext(line, "|", char_str_sep+1) var/item_str_sep = findtext(line, "|", job_str_sep+1) var/ckey_str = ckey(copytext(line, 1, ckey_str_sep)) - var/job_str = copytext(line, ckey_str_sep+1, job_str_sep) + var/char_str = copytext(line, ckey_str_sep+1, char_str_sep) + var/job_str = copytext(line, char_str_sep+1, job_str_sep) var/item_str = copytext(line, job_str_sep+1, item_str_sep) - if(!ckey_str || !job_str || !item_str || !length(ckey_str) || !length(job_str) || !length(item_str)) + if(!ckey_str || !!char_str || !job_str || !item_str || !length(ckey_str) || !length(char_str) || !length(job_str) || !length(item_str)) throw EXCEPTION("Errored Line") - world << "DEBUG: Line process: [line]" - world << "DEBUG: [ckey_str_sep], [job_str_sep], [item_str_sep], [ckey_str], [job_str], [item_str]." + to_chat(world, "DEBUG: Line process: [line]") + to_chat(world, "DEBUG: [ckey_str_sep], [char_str_sep], [job_str_sep], [item_str_sep], [ckey_str], [char_str], [job_str], [item_str].") if(!islist(GLOB.custom_item_list[ckey_str])) GLOB.custom_item_list[ckey_str] = list() //Initialize list for this ckey if it isn't initialized.. + var/list/characters = splittext(char_str, "/") + for(var/character in characters) + if(!islist(GLOB.custom_item_list[ckey_str][character])) + GLOB.custom_item_list[ckey_str][character] = list() var/list/jobs = splittext(job_str, "/") world << "DEBUG: Job string processed." world << "DEBUG: JOBS: [english_list(jobs)]" for(var/job in jobs) - if(!islist(GLOB.custom_item_list[ckey_str][job])) - GLOB.custom_item_list[ckey_str][job] = list() //Initialize item list for this job of this ckey if not already initialized. + for(var/character in characters) + if(!islist(GLOB.custom_item_list[ckey_str][character][job])) + GLOB.custom_item_list[ckey_str][character][job] = list() //Initialize item list for this job of this ckey if not already initialized. var/list/item_strings = splittext(item_str, ";") //Get item strings in format of /path/to/item=amount for(var/item_string in item_strings) var/path_str_sep = findtext(item_string, "=") @@ -47,11 +54,12 @@ GLOBAL_LIST(custom_item_list) if(!ispath(path) || !isnum(amount)) throw EXCEPTION("Errored line") world << "DEBUG: [path_str_sep], [path], [amount]" - for(var/job in jobs) - if(!GLOB.custom_item_list[ckey_str][job][path]) //Doesn't exist, make it exist! - GLOB.custom_item_list[ckey_str][job][path] = amount - else - GLOB.custom_item_list[ckey_str][job][path] += amount //Exists, we want more~ + for(var/character in characters) + for(var/job in jobs) + if(!GLOB.custom_item_list[ckey_str][character][job][path]) //Doesn't exist, make it exist! + GLOB.custom_item_list[ckey_str][character][job][path] = amount + else + GLOB.custom_item_list[ckey_str][character][job][path] += amount //Exists, we want more~ catch //Uh oh. var/msg = "Error processing line in [custom_filelist]. Line : [line]" message_admins(msg) @@ -60,26 +68,8 @@ GLOBAL_LIST(custom_item_list) continue return GLOB.custom_item_list -/proc/parse_custom_item_list_key_to_joblist(ckey) //First stage - if(!ckey || !GLOB.custom_item_list[ckey]) - return null - return GLOB.custom_item_list[ckey] +/proc/parse_custom_roundstart_items(ckey, char_name = "ANY", job_name = "ANY") -/proc/parse_custom_item_list_joblist_to_items(list, job) //Second stage - var/list/ret = list() - for(var/j in list) //for job in ckey-job-item list - if((j == job) || (j == "ALL") || (job == "ALL")) //job matches or is all jobs or we want everything. - for(var/i in list[j]) //for item in job-item list - if(!ret[i]) - world << "DEBUG: [i] initialized to return list" - ret[i] = list[j][i] //add to return with return value if not there - else - world << "DEBUG: [i] added to return list" - ret[i] += list[j][i] //else, add to that item in return value! - return ret //If done properly, you'll have a list of item typepaths with how many to spawn. - -/proc/parse_custom_items_by_key_and_job(ckey, job) - return parse_custom_item_list_joblist_to_items(parse_custom_item_list_key_to_joblist(ckey), job) /proc/debug_roundstart_items() reload_custom_roundstart_items_list() diff --git a/config/custom_roundstart_items.txt b/config/custom_roundstart_items.txt index 7d206d8d09..b71836fe53 100644 --- a/config/custom_roundstart_items.txt +++ b/config/custom_roundstart_items.txt @@ -1,10 +1,9 @@ -//File should be in the format of ckey|exact job name/exact job name/or put ALL instead of any job names|/path/to/item=amount;/path/to/item=amount +//File should be in the format of ckey|exact character name/exact second character name/ALL for all chars|exact job name/exact job name/or put ALL instead of any job names|/path/to/item=amount;/path/to/item=amount //Each ckey should be in a different line //if there's multiple entries of a single ckey the later ones will add to the earlier definitions. //is obviously a comment. //Recommend defining one job per line, but do what you want. -test1|testjob1/test job 2/ALL|/obj/item/weapon/gun/energy/laser=3;/obj/item/weapon/gun/energy/laser/retro=1;/obj/item/weapon/gun/energy=2 -test1|testjob1|/obj/item/device/aicard=3;/obj/item/device/flightpack=1;/obj/item/weapon/gun/energy=3 -kevinz000|ALL|/obj/item/weapon/bikehorn/airhorn=1 -kevinz000|Clown|/obj/item/weapon/bikehorn=1 - +test1|Secondary Memenamefortesting|testjob1/test job 2/ALL|/obj/item/weapon/gun/energy/laser=3;/obj/item/weapon/gun/energy/laser/retro=1;/obj/item/weapon/gun/energy=2 +test1|Memename Lastname|testjob1|/obj/item/device/aicard=3;/obj/item/device/flightpack=1;/obj/item/weapon/gun/energy=3 +kevinz000|Skylar Lineman|ALL|/obj/item/weapon/bikehorn/airhorn=1 +kevinz000|ALL|Clown|/obj/item/weapon/bikehorn=1 diff --git a/tgstation.dme b/tgstation.dme index 968f93d4d7..2b6762c36c 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -826,6 +826,7 @@ #include "code\game\objects\items\weapons\charter.dm" #include "code\game\objects\items\weapons\chrono_eraser.dm" #include "code\game\objects\items\weapons\cigs_lighters.dm" +#include "code\game\objects\items\weapons\clown.dm" #include "code\game\objects\items\weapons\clown_items.dm" #include "code\game\objects\items\weapons\cosmetics.dm" #include "code\game\objects\items\weapons\courtroom.dm"