diff --git a/baystation12.dme b/baystation12.dme index ae6a940471..95aab9ea58 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -936,7 +936,6 @@ #include "code\modules\clothing\under\jobs\engineering.dm" #include "code\modules\clothing\under\jobs\medsci.dm" #include "code\modules\clothing\under\jobs\security.dm" -#include "code\modules\customitems\item_defines.dm" #include "code\modules\customitems\item_spawning.dm" #include "code\modules\detectivework\evidence.dm" #include "code\modules\detectivework\footprints_and_rag.dm" diff --git a/code/game/gamemodes/gameticker.dm b/code/game/gamemodes/gameticker.dm index 41183aeffa..08ad7e7253 100644 --- a/code/game/gamemodes/gameticker.dm +++ b/code/game/gamemodes/gameticker.dm @@ -292,7 +292,7 @@ var/global/datum/controller/gameticker/ticker if(player.mind.assigned_role != "MODE") job_master.EquipRank(player, player.mind.assigned_role, 0) UpdateFactionList(player) - EquipCustomItems(player) + equip_custom_items(player) if(captainless) for(var/mob/M in player_list) if(!istype(M,/mob/new_player)) diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index d45cade6c5..d1e728e676 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -736,6 +736,10 @@ user << "The cycler already contains a helmet." return + if(I.icon_override == CUSTOM_ITEM_MOB) + user << "You cannot refit a customised voidsuit." + return + user << "You fit \the [I] into the suit cycler." user.drop_item() I.loc = src @@ -755,6 +759,10 @@ user << "The cycler already contains a voidsuit." return + if(I.icon_override == CUSTOM_ITEM_MOB) + user << "You cannot refit a customised voidsuit." + return + user << "You fit \the [I] into the suit cycler." user.drop_item() I.loc = src diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 0f908c5130..d27670c1d4 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -814,32 +814,6 @@ user.visible_message("[user] attaches [W] to [src].", "You attach [W] to [src]") return - else if(istype(W, /obj/item/device/kit/paint)) - - if(occupant) - user << "You can't customize a mech while someone is piloting it - that would be unsafe!" - return - - var/obj/item/device/kit/paint/P = W - var/found = null - - for(var/type in P.allowed_types) - if(type==src.initial_icon) - found = 1 - break - - if(!found) - user << "That kit isn't meant for use on this class of exosuit." - return - - user.visible_message("[user] opens [P] and spends some quality time customising [src].") - - src.name = P.new_name - src.desc = P.new_desc - src.initial_icon = P.new_icon - src.reset_icon() - P.use(1, user) - else call((proc_res["dynattackby"]||src), "dynattackby")(W,user) /* diff --git a/code/game/objects/items/paintkit.dm b/code/game/objects/items/paintkit.dm index 34059c1359..a562528fa5 100644 --- a/code/game/objects/items/paintkit.dm +++ b/code/game/objects/items/paintkit.dm @@ -1,8 +1,11 @@ /obj/item/device/kit + icon_state = "modkit" + icon = 'icons/obj/device.dmi' var/new_name = "mech" //What is the variant called? var/new_desc = "A mech." //How is the new mech described? var/new_icon = "ripley" //What base icon will the new mech use? - var/uses = 2 // Uses before the kit deletes itself. + var/new_icon_file + var/uses = 1 // Uses before the kit deletes itself. /obj/item/device/kit/proc/use(var/amt, var/mob/user) uses -= amt @@ -16,33 +19,46 @@ /obj/item/device/kit/suit name = "voidsuit modification kit" desc = "A kit for modifying a voidsuit." - icon = 'icons/obj/custom_items.dmi' - icon_state = "salvage_kit" + uses = 2 var/new_light_overlay + var/new_mob_icon_file -/obj/item/clothing/head/helmet/space/void/attackby(var/obj/item/O as obj, mob/user as mob) +/obj/item/clothing/head/helmet/space/void/attackby(var/obj/item/O, var/mob/user) if(istype(O,/obj/item/device/kit/suit)) - var/obj/item/device/kit/suit/kit = O name = "[kit.new_name] suit helmet" desc = kit.new_desc - icon_state = kit.new_icon - item_state = kit.new_icon + icon_state = "[kit.new_icon]_helmet" + item_state = "[kit.new_icon]_helmet" + if(kit.new_icon_file) + icon = kit.new_icon_file + if(kit.new_mob_icon_file) + icon_override = kit.new_mob_icon_file if(kit.new_light_overlay) light_overlay = kit.new_light_overlay user << "You set about modifying the helmet into [src]." + var/mob/living/carbon/human/H = user + if(istype(H)) + species_restricted = list(H.species.name) kit.use(1,user) return 1 return ..() -/obj/item/clothing/suit/space/void/attackby(var/obj/item/O as obj, mob/user as mob) +/obj/item/clothing/suit/space/void/attackby(var/obj/item/O, var/mob/user) if(istype(O,/obj/item/device/kit/suit)) var/obj/item/device/kit/suit/kit = O name = "[kit.new_name] voidsuit" desc = kit.new_desc - icon_state = kit.new_icon - item_state = kit.new_icon + icon_state = "[kit.new_icon]_suit" + item_state = "[kit.new_icon]_suit" + if(kit.new_icon_file) + icon = kit.new_icon_file + if(kit.new_mob_icon_file) + icon_override = kit.new_mob_icon_file user << "You set about modifying the suit into [src]." + var/mob/living/carbon/human/H = user + if(istype(H)) + species_restricted = list(H.species.name) kit.use(1,user) return 1 return ..() @@ -51,8 +67,35 @@ /obj/item/device/kit/paint name = "mecha customisation kit" desc = "A generic kit containing all the needed tools and parts to turn a mech into another mech." - icon = 'icons/obj/custom_items.dmi' - icon_state = "royce_kit" - var/removable = null - var/list/allowed_types = list() \ No newline at end of file + var/list/allowed_types = list() + +/obj/mecha/attackby(var/obj/item/weapon/W, var/mob/user) + if(istype(W, /obj/item/device/kit/paint)) + if(occupant) + user << "You can't customize a mech while someone is piloting it - that would be unsafe!" + return + + var/obj/item/device/kit/paint/P = W + var/found = null + + for(var/type in P.allowed_types) + if(type==src.initial_icon) + found = 1 + break + + if(!found) + user << "That kit isn't meant for use on this class of exosuit." + return + + user.visible_message("[user] opens [P] and spends some quality time customising [src].") + src.name = P.new_name + src.desc = P.new_desc + src.initial_icon = P.new_icon + if(P.new_icon_file) + src.icon = P.new_icon_file + src.reset_icon() + P.use(1, user) + return 1 + else + return ..() \ No newline at end of file diff --git a/code/game/objects/items/weapons/storage/belt.dm b/code/game/objects/items/weapons/storage/belt.dm index 47821d6a24..79b1852e7b 100644 --- a/code/game/objects/items/weapons/storage/belt.dm +++ b/code/game/objects/items/weapons/storage/belt.dm @@ -92,12 +92,9 @@ /obj/item/weapon/storage/belt/medical/emt name = "EMT utility belt" desc = "A sturdy black webbing belt with attached pouches." - icon = 'icons/obj/custom_items.dmi' icon_state = "emsbelt" item_state = "emsbelt" - - /obj/item/weapon/storage/belt/security name = "security belt" desc = "Can hold security gear like handcuffs and flashes." diff --git a/code/game/objects/structures/coathanger.dm b/code/game/objects/structures/coathanger.dm index a54c40b755..decba4bfd3 100644 --- a/code/game/objects/structures/coathanger.dm +++ b/code/game/objects/structures/coathanger.dm @@ -4,7 +4,7 @@ icon = 'icons/obj/coatrack.dmi' icon_state = "coatrack0" var/obj/item/clothing/suit/coat - var/list/allowed = list(/obj/item/clothing/suit/storage/labcoat, /obj/item/clothing/suit/storage/toggle/labcoat, /obj/item/clothing/suit/storage/det_suit) + var/list/allowed = list(/obj/item/clothing/suit/storage/toggle/labcoat, /obj/item/clothing/suit/storage/det_suit) /obj/structure/coatrack/attack_hand(mob/user as mob) user.visible_message("[user] takes [coat] off \the [src].", "You take [coat] off the \the [src]") diff --git a/code/modules/client/preferences_gear.dm b/code/modules/client/preferences_gear.dm index eff194f545..b63869bccb 100644 --- a/code/modules/client/preferences_gear.dm +++ b/code/modules/client/preferences_gear.dm @@ -893,7 +893,7 @@ var/global/list/gear_datums = list() /datum/gear/toeless_jackboots display_name = "toe-less jackboots" - path = /obj/item/clothing/shoes/jackboots/fluff/kecer_eldraran + path = /obj/item/clothing/shoes/jackboots/unathi cost = 1 slot = slot_shoes diff --git a/code/modules/clothing/shoes/miscellaneous.dm b/code/modules/clothing/shoes/miscellaneous.dm index 616d13e858..9fd713fc74 100644 --- a/code/modules/clothing/shoes/miscellaneous.dm +++ b/code/modules/clothing/shoes/miscellaneous.dm @@ -89,6 +89,13 @@ force = 3 siemens_coefficient = 0.7 +/obj/item/clothing/shoes/jackboots/unathi + name = "toe-less jackboots" + desc = "Modified pair of jackboots, particularly friendly to those species whose toes hold claws." + item_state = "digiboots" + icon_state = "digiboots" + species_restricted = null + /obj/item/clothing/shoes/cult name = "boots" desc = "A pair of boots worn by the followers of Nar-Sie." diff --git a/code/modules/customitems/item_spawning.dm b/code/modules/customitems/item_spawning.dm index a5024aee34..d8e7d5b07b 100644 --- a/code/modules/customitems/item_spawning.dm +++ b/code/modules/customitems/item_spawning.dm @@ -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 \ No newline at end of file + return newitem diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index d7776fa18d..e17c0f49f8 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -468,7 +468,7 @@ var/global/list/damage_icon_parts = list() under_icon = w_uniform.item_icons[slot_w_uniform_str] else under_icon = INV_W_UNIFORM_DEF_ICON - + //determine state to use var/under_state if(w_uniform.item_state_slots && w_uniform.item_state_slots[slot_w_uniform_str]) @@ -480,7 +480,7 @@ var/global/list/damage_icon_parts = list() //need to append _s to the icon state for legacy compatibility var/image/standing = image(icon = under_icon, icon_state = "[under_state]_s") - + //apply blood overlay if(w_uniform.blood_DNA) var/image/bloodsies = image(icon = species.blood_mask, icon_state = "uniformblood") @@ -499,7 +499,7 @@ var/global/list/damage_icon_parts = list() overlays_standing[UNIFORM_LAYER] = null if(update_icons) - update_icons() + update_icons() /mob/living/carbon/human/update_inv_wear_id(var/update_icons=1) if(wear_id) @@ -754,7 +754,7 @@ var/global/list/damage_icon_parts = list() /mob/living/carbon/human/update_inv_back(var/update_icons=1) if(back) back.screen_loc = ui_back //TODO - + //determine the icon to use var/icon/overlay_icon if(back.icon_override) @@ -769,7 +769,7 @@ var/global/list/damage_icon_parts = list() overlay_icon = back.item_icons[slot_back_str] else overlay_icon = INV_BACK_DEF_ICON - + //determine state to use var/overlay_state if(back.item_state_slots && back.item_state_slots[slot_back_str]) @@ -778,13 +778,13 @@ var/global/list/damage_icon_parts = list() overlay_state = back.item_state else overlay_state = back.icon_state - + //create the image overlays_standing[BACK_LAYER] = image(icon = overlay_icon, icon_state = overlay_state) else overlays_standing[BACK_LAYER] = null - if(update_icons) + if(update_icons) update_icons() @@ -822,15 +822,6 @@ var/global/list/damage_icon_parts = list() if(r_hand) r_hand.screen_loc = ui_rhand //TODO - //determine icon to use - var/icon/t_icon - if(r_hand.icon_override) - t_icon = r_hand.icon_override - else if(r_hand.item_icons && (slot_r_hand_str in r_hand.item_icons)) - t_icon = r_hand.item_icons[slot_r_hand_str] - else - t_icon = INV_R_HAND_DEF_ICON - //determine icon state to use var/t_state if(r_hand.item_state_slots && r_hand.item_state_slots[slot_r_hand_str]) @@ -839,7 +830,17 @@ var/global/list/damage_icon_parts = list() t_state = r_hand.item_state else t_state = r_hand.icon_state - + + //determine icon to use + var/icon/t_icon + if(r_hand.icon_override) + t_state += "_r" + t_icon = r_hand.icon_override + else if(r_hand.item_icons && (slot_r_hand_str in r_hand.item_icons)) + t_icon = r_hand.item_icons[slot_r_hand_str] + else + t_icon = INV_R_HAND_DEF_ICON + overlays_standing[R_HAND_LAYER] = image(icon = t_icon, icon_state = t_state) if (handcuffed) drop_r_hand() //this should be moved out of icon code @@ -853,15 +854,6 @@ var/global/list/damage_icon_parts = list() if(l_hand) l_hand.screen_loc = ui_lhand //TODO - //determine icon to use - var/icon/t_icon - if(l_hand.icon_override) - t_icon = l_hand.icon_override - else if(l_hand.item_icons && (slot_l_hand_str in l_hand.item_icons)) - t_icon = l_hand.item_icons[slot_l_hand_str] - else - t_icon = INV_L_HAND_DEF_ICON - //determine icon state to use var/t_state if(l_hand.item_state_slots && l_hand.item_state_slots[slot_l_hand_str]) @@ -870,7 +862,17 @@ var/global/list/damage_icon_parts = list() t_state = l_hand.item_state else t_state = l_hand.icon_state - + + //determine icon to use + var/icon/t_icon + if(l_hand.icon_override) + t_state += "_l" + t_icon = l_hand.icon_override + else if(l_hand.item_icons && (slot_l_hand_str in l_hand.item_icons)) + t_icon = l_hand.item_icons[slot_l_hand_str] + else + t_icon = INV_L_HAND_DEF_ICON + overlays_standing[L_HAND_LAYER] = image(icon = t_icon, icon_state = t_state) if (handcuffed) drop_l_hand() //This probably should not be here diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index d233ecea40..6ca5caf174 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -311,7 +311,7 @@ var/mob/living/character = create_character() //creates the human and transfers vars and mind character = job_master.EquipRank(character, rank, 1) //equips the human UpdateFactionList(character) - EquipCustomItems(character) + equip_custom_items(character) // AIs don't need a spawnpoint, they must spawn at an empty core if(character.mind.assigned_role == "AI") diff --git a/code/modules/research/xenoarchaeology/misc.dm b/code/modules/research/xenoarchaeology/misc.dm index c66e57f3de..b2d8cef42c 100644 --- a/code/modules/research/xenoarchaeology/misc.dm +++ b/code/modules/research/xenoarchaeology/misc.dm @@ -73,7 +73,7 @@ ..() sleep(2) new /obj/item/clothing/under/rank/scientist(src) - new /obj/item/clothing/suit/storage/labcoat(src) + new /obj/item/clothing/suit/storage/toggle/labcoat(src) new /obj/item/clothing/shoes/white(src) new /obj/item/clothing/glasses/science(src) new /obj/item/device/radio/headset/headset_sci(src) diff --git a/code/setup.dm b/code/setup.dm index 654d9c8b70..82d89e277b 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -261,7 +261,7 @@ #define slot_legs 21 #define slot_tie 22 -// Inventory slot strings. +// Inventory slot strings. // since numbers cannot be used as associative list keys. #define slot_back_str "back" #define slot_l_hand_str "slot_l_hand" @@ -956,3 +956,12 @@ var/list/be_special_flags = list( #define LANGUAGE_GUTTER "Gutter" #define CLAMP01(x) max(0, min(1, x)) + +// Convoluted setup so defines can be supplied by Bay12 main server compile script. +// Should still work fine for people jamming the icons into their repo. +#ifndef CUSTOM_ITEM_OBJ +#define CUSTOM_ITEM_OBJ 'icons/obj/custom_items.dmi' +#endif +#ifndef CUSTOM_ITEM_MOB +#define CUSTOM_ITEM_MOB 'icons/mob/custom_items.dmi' +#endif \ No newline at end of file diff --git a/icons/mecha/mecha.dmi b/icons/mecha/mecha.dmi index a81afab57b..b1f35226f8 100644 Binary files a/icons/mecha/mecha.dmi and b/icons/mecha/mecha.dmi differ diff --git a/icons/mob/custom_items.dmi b/icons/mob/custom_items.dmi index e69de29bb2..4e07b49bd7 100644 Binary files a/icons/mob/custom_items.dmi and b/icons/mob/custom_items.dmi differ diff --git a/icons/obj/clothing/shoes.dmi b/icons/obj/clothing/shoes.dmi index 5098143271..f6512b0d44 100644 Binary files a/icons/obj/clothing/shoes.dmi and b/icons/obj/clothing/shoes.dmi differ diff --git a/icons/obj/custom_items.dmi b/icons/obj/custom_items.dmi index f69c02c71d..ab385ae164 100644 Binary files a/icons/obj/custom_items.dmi and b/icons/obj/custom_items.dmi differ