This commit is contained in:
kevinz000
2017-09-01 03:36:18 -07:00
parent 41318e715c
commit b193d77c1c
4 changed files with 12 additions and 15 deletions
+4 -1
View File
@@ -9,6 +9,7 @@
/proc/handle_roundstart_items(mob/living/M)
if(!istype(M) || !M.ckey || !M.mind)
to_chat(world, "DEBUG: handle_roundstart_items: No ckey, mind, or not a mob.")
return FALSE
return load_itemlist_to_mob(M, parse_custom_roundstart_items(M.ckey, M.name, M.mind.assigned_role, M.mind.special_role), TRUE, TRUE, FALSE)
@@ -16,6 +17,7 @@
/proc/load_itemlist_to_mob(mob/living/L, list/itemlist, drop_on_floor_if_full = TRUE, load_to_all_slots = TRUE, replace_slots = FALSE)
to_chat(world, "load_itemlist_to_mob([L], [itemlist], [drop_on_floor_if_full], [load_to_all_slots], [replace_slots])")
if(!istype(L) || !islist(itemlist))
to_chat(world, "DEBUG: load_itemlist_to_mob: not a mob or not an itemlist")
return FALSE
var/loading_mode = DROP_TO_FLOOR
var/turf/current_turf = get_turf(L)
@@ -36,6 +38,7 @@
/proc/load_itemlist_to_human(mob/living/carbon/human/H, list/itemlist, drop_on_floor_if_full = TRUE, load_to_all_slots = TRUE, replace_slots = FALSE)
if(!istype(H) || !islist(itemlist))
to_chat(world, "DEBUG: load_itemlist_to_human: Not a human or not an itemlist")
return FALSE
var/turf/T = get_turf(H)
for(var/item in itemlist)
@@ -54,7 +57,7 @@
loaded_atom.forceMove(T)
continue
var/obj/item/loaded = loaded_atom
var/obj/item/weapon/storage/S = H.get_item_by_slot(slot_back)
var/obj/item/storage/S = H.get_item_by_slot(slot_back)
if(istype(S))
S.handle_item_insertion(loaded, TRUE, H) //Force it into their backpack
continue
@@ -27,8 +27,6 @@ GLOBAL_LIST(custom_item_list)
var/item_str = copytext(line, job_str_sep+1, item_str_sep)
if(!ckey_str || !char_str || !job_str || !item_str || !length(ckey_str) || !length(char_str) || !length(job_str) || !length(item_str))
log_admin("Errored custom_items_whitelist line: [line] - Component/separator missing!")
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, "/")
@@ -36,8 +34,6 @@ GLOBAL_LIST(custom_item_list)
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)
for(var/character in characters)
if(!islist(GLOB.custom_item_list[ckey_str][character][job]))
@@ -52,7 +48,6 @@ GLOBAL_LIST(custom_item_list)
path = text2path(path)
if(!ispath(path) || !isnum(amount))
log_admin("Errored custom_items_whitelist line: [line] - Path/number for item missing or invalid.")
world << "DEBUG: [path_str_sep], [path], [amount]"
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!
@@ -61,17 +56,16 @@ GLOBAL_LIST(custom_item_list)
GLOB.custom_item_list[ckey_str][character][job][path] += amount //Exists, we want more~
return GLOB.custom_item_list
/proc/parse_custom_roundstart_items(ckey, char_name = "ANY", job_name = "ANY", special_role)
/proc/parse_custom_roundstart_items(ckey, char_name = "ALL", job_name = "ALL", special_role)
var/list/ret = list()
if(GLOB.custom_item_list[ckey])
for(var/char in GLOB.custom_item_list[ckey])
if((char_name == char) || (char_name == "ANY") || (char == "ANY"))
if((char_name == char) || (char_name == "ALL") || (char == "ALL"))
for(var/job in GLOB.custom_item_list[ckey][char])
if((job_name == job) || (job == "ANY") || (job_name == "ANY") || (special_role && (job == special_role)))
if((job_name == job) || (job == "ALL") || (job_name == "ALL") || (special_role && (job == special_role)))
for(var/item_path in GLOB.custom_item_list[ckey][char][job])
if(ret[item_path])
ret[item_path] += GLOB.custom_item_list[ckey][char][job][item_path]
else
ret[item_path] = GLOB.custom_item_list[ckey][char][job][item_path]
to_chat(world, "debug: parsing returned [english_list(ret)]")
return ret
+1 -1
View File
@@ -407,7 +407,7 @@ SUBSYSTEM_DEF(job)
if(job && H)
job.after_spawn(H, M)
handle_roundstart_items(H)
return H