From da615b14402a7bd172d8fa56cb2c72ce6b5c384f Mon Sep 17 00:00:00 2001 From: kevinz000 Date: Sun, 14 May 2017 20:19:26 -0700 Subject: [PATCH] h --- code/citadel/custom_loadout/load_to_mob.dm | 9 ++++++--- code/citadel/custom_loadout/read_from_file.dm | 7 ++++++- code/controllers/subsystem/server_maint.dm | 1 + config/custom_roundstart_items.txt | 2 ++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/code/citadel/custom_loadout/load_to_mob.dm b/code/citadel/custom_loadout/load_to_mob.dm index e0913cd383..9e8bddd677 100644 --- a/code/citadel/custom_loadout/load_to_mob.dm +++ b/code/citadel/custom_loadout/load_to_mob.dm @@ -10,7 +10,9 @@ /proc/handle_roundstart_items(mob/living/M) world << "handle_roundstart_items([M])" if(!istype(M) || !M.ckey || !M.mind) - world << "handle_roundstart_items: [M] has either no ckey or no mind!" + world << "handle_roundstart_items: [M] has either no ckey or no mind!" + if(!M.mind) + world << "[M] has no mind!" return FALSE var/list/items = parse_custom_items_by_key_and_job(M.ckey, M.mind.assigned_role) if(M.mind.special_role) @@ -52,8 +54,9 @@ return FALSE var/turf/T = get_turf(H) for(var/item in itemlist) - if(!ispath(item)) - item = text2path(item) + var/path = item + if(!ispath(path)) + path = text2path(path) if(!path) continue var/amount = itemlist[item] diff --git a/code/citadel/custom_loadout/read_from_file.dm b/code/citadel/custom_loadout/read_from_file.dm index dbca069cb7..642c56f8c0 100644 --- a/code/citadel/custom_loadout/read_from_file.dm +++ b/code/citadel/custom_loadout/read_from_file.dm @@ -24,6 +24,8 @@ GLOBAL_LIST(custom_item_list) var/ckey_str = ckey(copytext(line, 1, ckey_str_sep)) var/job_str = copytext(line, ckey_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)) + 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]." if(!islist(GLOB.custom_item_list[ckey_str])) @@ -40,10 +42,13 @@ GLOBAL_LIST(custom_item_list) var/path = copytext(item_string, 1, path_str_sep) //Path to spawn var/amount = copytext(item_string, path_str_sep+1) //Amount to spawn world << "DEBUG: Item string [item_string] processed" + amount = text2num(amount) path = text2path(path) + 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! + 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~ diff --git a/code/controllers/subsystem/server_maint.dm b/code/controllers/subsystem/server_maint.dm index 08f60d23e6..4d32ce719c 100644 --- a/code/controllers/subsystem/server_maint.dm +++ b/code/controllers/subsystem/server_maint.dm @@ -8,6 +8,7 @@ SUBSYSTEM_DEF(server_maint) var/list/currentrun /datum/controller/subsystem/server_maint/Initialize(timeofday) + reload_custom_roundstart_items_list() if (config.hub) world.visibility = 1 ..() diff --git a/config/custom_roundstart_items.txt b/config/custom_roundstart_items.txt index 227015e9e1..7d206d8d09 100644 --- a/config/custom_roundstart_items.txt +++ b/config/custom_roundstart_items.txt @@ -5,4 +5,6 @@ //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