mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Debugging!
This commit is contained in:
@@ -1,8 +1,19 @@
|
||||
//switch this out to use a database at some point
|
||||
//list of ckey/ real_name and item paths
|
||||
//gives item to specific people when they join if it can
|
||||
//see config/custom_items.txt how to to add things to it (yes crazy idea i know)
|
||||
//yes, it has to be an item, you can't pick up nonitems
|
||||
// Switch this out to use a database at some point. Each ckey is
|
||||
// associated with a list of custom item datums. When the character
|
||||
// spawns, the list is checked and all appropriate datums are spawned.
|
||||
// See config/example/custom_items.txt for a more detailed overview
|
||||
// of how the config system works.
|
||||
|
||||
// CUSTOM ITEM ICONS:
|
||||
// Inventory icons must be in CUSTOM_ITEM_OBJ with state name [item_icon].
|
||||
// On-mob icons must be in CUSTOM_ITEM_MOB with state name [item_icon].
|
||||
// Inhands must be in CUSTOM_ITEM_MOB as [icon_state]_l and [icon_state]_r.
|
||||
|
||||
// Kits must have mech icons in CUSTOM_ITEM_OBJ under [kit_icon].
|
||||
// Broken must be [kit_icon]-broken and open must be [kit_icon]-open.
|
||||
|
||||
// Kits must also have hardsuit icons in CUSTOM_ITEM_MOB as [kit_icon]_suit
|
||||
// and [kit_icon]_helmet, and in CUSTOM_ITEM_OBJ as [kit_icon].
|
||||
|
||||
/var/list/custom_items = list()
|
||||
|
||||
@@ -33,9 +44,10 @@
|
||||
if(item_desc)
|
||||
item.desc = item_desc
|
||||
if(item_icon)
|
||||
item.icon = 'icons/obj/custom_items.dmi'
|
||||
item.icon_override = 'icons/mob/custom_items.dmi'
|
||||
item.icon = CUSTOM_ITEM_OBJ
|
||||
item.icon_state = item_icon
|
||||
if(istype(item, /obj/item))
|
||||
item.icon_override = CUSTOM_ITEM_MOB
|
||||
|
||||
// Kits are dumb so this is going to have to be hardcoded/snowflake.
|
||||
if(istype(item, /obj/item/device/kit))
|
||||
@@ -43,23 +55,26 @@
|
||||
K.new_name = kit_name
|
||||
K.new_desc = kit_desc
|
||||
K.new_icon = kit_icon
|
||||
K.new_icon_file = CUSTOM_ITEM_OBJ
|
||||
if(istype(item, /obj/item/device/kit/paint))
|
||||
var/obj/item/device/kit/paint/kit = item
|
||||
kit.allowed_types = text2list(additional_data, ", ")
|
||||
else if(istype(item, /obj/item/device/kit/suit))
|
||||
var/obj/item/device/kit/suit/kit = item
|
||||
kit.new_light_overlay = additional_data
|
||||
kit.new_mob_icon_file = CUSTOM_ITEM_MOB
|
||||
|
||||
return item
|
||||
|
||||
//parses the config file into the above listlist
|
||||
/hook/startup/proc/loadCustomItems()
|
||||
|
||||
// Parses the config file into the custom_items list.
|
||||
/hook/startup/proc/load_custom_items()
|
||||
|
||||
var/datum/custom_item/current_data
|
||||
for(var/line in text2list(file2text("config/custom_items.txt"), "\n"))
|
||||
|
||||
line = trim(line)
|
||||
if(line == "" || !line || findtext(line, "#", 1, 2) || findtext(line, "}", 1, 2))
|
||||
if(line == "" || !line || findtext(line, "#", 1, 2))
|
||||
continue
|
||||
|
||||
if(findtext(line, "{", 1, 2) || findtext(line, "}", 1, 2)) // New block!
|
||||
@@ -91,12 +106,12 @@
|
||||
if("item_name")
|
||||
current_data.name = field_data
|
||||
if("item_icon")
|
||||
if(field_data in icon_states('icons/obj/custom_items.dmi'))
|
||||
if(field_data in icon_states(CUSTOM_ITEM_OBJ))
|
||||
current_data.item_icon = field_data
|
||||
if("item_desc")
|
||||
current_data.item_desc = field_data
|
||||
if("req_access")
|
||||
current_data.req_access = field_data
|
||||
current_data.req_access = text2num(field_data)
|
||||
if("req_titles")
|
||||
current_data.req_titles = text2list(field_data,", ")
|
||||
if("kit_name")
|
||||
@@ -110,9 +125,7 @@
|
||||
return 1
|
||||
|
||||
//gets the relevant list for the key from the listlist if it exists, check to make sure they are meant to have it and then calls the giving function
|
||||
/proc/EquipCustomItems(mob/living/carbon/human/M)
|
||||
return
|
||||
|
||||
/proc/equip_custom_items(mob/living/carbon/human/M)
|
||||
var/list/key_list = custom_items[M.ckey]
|
||||
if(!key_list || key_list.len < 1)
|
||||
return
|
||||
@@ -120,23 +133,25 @@
|
||||
for(var/datum/custom_item/citem in key_list)
|
||||
|
||||
// Check for requisite ckey and character name.
|
||||
if(citem.assoc_key != M.ckey || citem.character_name != M.real_name)
|
||||
if((lowertext(citem.assoc_key) != lowertext(M.ckey)) || (lowertext(citem.character_name) != lowertext(M.real_name)))
|
||||
continue
|
||||
|
||||
// Check for required access.
|
||||
var/obj/item/weapon/card/id/current_id = M.wear_id
|
||||
if(citem.req_access && !(istype(current_id) && (citem.req_access in current_id.access)))
|
||||
continue
|
||||
if(citem.req_access && citem.req_access > 0)
|
||||
if(!(istype(current_id) && (citem.req_access in current_id.access)))
|
||||
continue
|
||||
|
||||
// Check for required job title.
|
||||
var/has_title
|
||||
var/current_title = M.mind.role_alt_title ? M.mind.role_alt_title : M.mind.assigned_role
|
||||
for(var/title in citem.req_titles)
|
||||
if(title == current_title)
|
||||
has_title = 1
|
||||
break
|
||||
if(!has_title)
|
||||
continue
|
||||
if(citem.req_titles && citem.req_titles.len > 0)
|
||||
var/has_title
|
||||
var/current_title = M.mind.role_alt_title ? M.mind.role_alt_title : M.mind.assigned_role
|
||||
for(var/title in citem.req_titles)
|
||||
if(title == current_title)
|
||||
has_title = 1
|
||||
break
|
||||
if(!has_title)
|
||||
continue
|
||||
|
||||
// ID cards and PDAs are applied directly to the existing object rather than spawned fresh.
|
||||
var/obj/item/existing_item
|
||||
@@ -150,7 +165,6 @@
|
||||
citem.apply_to_item(existing_item)
|
||||
else
|
||||
place_custom_item(M,citem)
|
||||
return
|
||||
|
||||
// Places the item on the target mob.
|
||||
/proc/place_custom_item(mob/living/carbon/human/M, var/datum/custom_item/citem)
|
||||
@@ -173,4 +187,4 @@
|
||||
newitem.loc = S
|
||||
return newitem
|
||||
newitem.loc = get_turf(M.loc)
|
||||
return newitem
|
||||
return newitem
|
||||
|
||||
Reference in New Issue
Block a user