diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 8879eeb2b7..6c520ae189 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -40,6 +40,11 @@ var/zoomdevicename = null //name used for message when binoculars/scope is used var/zoom = 0 //1 if item is actively being used to zoom. For scoped guns and binoculars. + // Used to specify the icon file to be used when the item is worn. If not set the default icon for that slot will be used. + // If icon_override or sprite_sheets are set they will take precendence over this, assuming they apply to the slot in question. + // Only slot_l_hand/slot_r_hand are implemented at the moment. Others to be implemented as needed. + var/list/item_icons = null + /* Species-specific sprites, concept stolen from Paradise//vg/. ex: sprite_sheets = list( diff --git a/code/modules/admin/verbs/BrokenInhands.dm b/code/modules/admin/verbs/BrokenInhands.dm index 43f6d0b793..914ba1b5df 100644 --- a/code/modules/admin/verbs/BrokenInhands.dm +++ b/code/modules/admin/verbs/BrokenInhands.dm @@ -1,7 +1,7 @@ /proc/getbrokeninhands() - var/icon/IL = new('icons/mob/items_lefthand.dmi') + var/icon/IL = new('icons/mob/items/lefthand.dmi') var/list/Lstates = IL.IconStates() - var/icon/IR = new('icons/mob/items_righthand.dmi') + var/icon/IR = new('icons/mob/items/righthand.dmi') var/list/Rstates = IR.IconStates() diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 15ad0b6bfd..cc9814b7fd 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -856,37 +856,47 @@ proc/get_damage_icon_part(damage_state, body_part) /mob/living/carbon/human/update_inv_r_hand(var/update_icons=1) if(r_hand) r_hand.screen_loc = ui_rhand //TODO + + var/t_icon = INV_R_HAND_DEF_ICON + if(r_hand.item_icons && (icon_r_hand in r_hand.item_icons)) + t_icon = r_hand.item_icons[icon_r_hand] + var/t_state = r_hand.item_state //useful for clothing that changes icon_state but retains the same sprite on the mob when held in hand if(!t_state) t_state = r_hand.icon_state - if(r_hand.icon_override) t_state = "[t_state]_r" overlays_standing[R_HAND_LAYER] = image("icon" = r_hand.icon_override, "icon_state" = "[t_state]") else - overlays_standing[R_HAND_LAYER] = image("icon" = 'icons/mob/items_righthand.dmi', "icon_state" = "[t_state]") + overlays_standing[R_HAND_LAYER] = image("icon" = t_icon, "icon_state" = "[t_state]") if (handcuffed) drop_r_hand() else overlays_standing[R_HAND_LAYER] = null - if(update_icons) update_icons() + + if(update_icons) update_icons() /mob/living/carbon/human/update_inv_l_hand(var/update_icons=1) if(l_hand) l_hand.screen_loc = ui_lhand //TODO + + var/t_icon = INV_L_HAND_DEF_ICON + if(l_hand.item_icons && (icon_l_hand in l_hand.item_icons)) + t_icon = l_hand.item_icons[icon_l_hand] + var/t_state = l_hand.item_state //useful for clothing that changes icon_state but retains the same sprite on the mob when held in hand if(!t_state) t_state = l_hand.icon_state - if(l_hand.icon_override) t_state = "[t_state]_l" overlays_standing[L_HAND_LAYER] = image("icon" = l_hand.icon_override, "icon_state" = "[t_state]") else - overlays_standing[L_HAND_LAYER] = image("icon" = 'icons/mob/items_lefthand.dmi', "icon_state" = "[t_state]") + overlays_standing[L_HAND_LAYER] = image("icon" = t_icon, "icon_state" = "[t_state]") if (handcuffed) drop_l_hand() else overlays_standing[L_HAND_LAYER] = null - if(update_icons) update_icons() + + if(update_icons) update_icons() /mob/living/carbon/human/proc/update_tail_showing(var/update_icons=1) overlays_standing[TAIL_LAYER] = null diff --git a/code/modules/mob/living/carbon/monkey/update_icons.dm b/code/modules/mob/living/carbon/monkey/update_icons.dm index ec69d454f6..1b3da8f49a 100644 --- a/code/modules/mob/living/carbon/monkey/update_icons.dm +++ b/code/modules/mob/living/carbon/monkey/update_icons.dm @@ -55,26 +55,38 @@ /mob/living/carbon/monkey/update_inv_r_hand(var/update_icons=1) if(r_hand) + var/t_icon = INV_R_HAND_DEF_ICON + if(r_hand.item_icons && (icon_r_hand in r_hand.item_icons)) + t_icon = r_hand.item_icons[icon_r_hand] + var/t_state = r_hand.item_state if(!t_state) t_state = r_hand.icon_state - overlays_standing[M_R_HAND_LAYER] = image("icon" = 'icons/mob/items_righthand.dmi', "icon_state" = t_state) + + overlays_standing[M_R_HAND_LAYER] = image("icon" = t_icon, "icon_state" = t_state) r_hand.screen_loc = ui_rhand if (handcuffed) drop_r_hand() else overlays_standing[M_R_HAND_LAYER] = null - if(update_icons) update_icons() + + if(update_icons) update_icons() /mob/living/carbon/monkey/update_inv_l_hand(var/update_icons=1) if(l_hand) + var/t_icon = INV_L_HAND_DEF_ICON + if(l_hand.item_icons && (icon_l_hand in l_hand.item_icons)) + t_icon = l_hand.item_icons[icon_l_hand] + var/t_state = l_hand.item_state if(!t_state) t_state = l_hand.icon_state - overlays_standing[M_L_HAND_LAYER] = image("icon" = 'icons/mob/items_lefthand.dmi', "icon_state" = t_state) + + overlays_standing[M_L_HAND_LAYER] = image("icon" = t_icon, "icon_state" = t_state) l_hand.screen_loc = ui_lhand if (handcuffed) drop_l_hand() else overlays_standing[M_L_HAND_LAYER] = null - if(update_icons) update_icons() + + if(update_icons) update_icons() /mob/living/carbon/monkey/update_inv_back(var/update_icons=1) diff --git a/code/modules/mob/new_player/preferences_setup.dm b/code/modules/mob/new_player/preferences_setup.dm index d25b66210e..bc17680e0c 100644 --- a/code/modules/mob/new_player/preferences_setup.dm +++ b/code/modules/mob/new_player/preferences_setup.dm @@ -375,7 +375,7 @@ datum/preferences if(LAWYER) clothes_s = new /icon('icons/mob/uniform.dmi', "internalaffairs_s") clothes_s.Blend(new /icon('icons/mob/feet.dmi', "brown"), ICON_UNDERLAY) - clothes_s.Blend(new /icon('icons/mob/items_righthand.dmi', "briefcase"), ICON_UNDERLAY) + clothes_s.Blend(new /icon(INV_R_HAND_DEF_ICON, "briefcase"), ICON_UNDERLAY) if(prob(1)) clothes_s.Blend(new /icon('icons/mob/suit.dmi', "suitjacket_blue"), ICON_OVERLAY) switch(backbag) @@ -534,7 +534,7 @@ datum/preferences clothes_s.Blend(new /icon('icons/mob/hands.dmi', "bgloves"), ICON_UNDERLAY) clothes_s.Blend(new /icon('icons/mob/suit.dmi', "labcoat_open"), ICON_OVERLAY) if(prob(1)) - clothes_s.Blend(new /icon('icons/mob/items_righthand.dmi', "toolbox_blue"), ICON_OVERLAY) + clothes_s.Blend(new /icon(INV_R_HAND_DEF_ICON, "toolbox_blue"), ICON_OVERLAY) switch(backbag) if(2) clothes_s.Blend(new /icon('icons/mob/back.dmi', "backpack"), ICON_OVERLAY) @@ -620,7 +620,7 @@ datum/preferences clothes_s.Blend(new /icon('icons/mob/belt.dmi', "utility"), ICON_OVERLAY) clothes_s.Blend(new /icon('icons/mob/head.dmi', "hardhat0_white"), ICON_OVERLAY) if(prob(1)) - clothes_s.Blend(new /icon('icons/mob/items_righthand.dmi', "blueprints"), ICON_OVERLAY) + clothes_s.Blend(new /icon(INV_R_HAND_DEF_ICON, "blueprints"), ICON_OVERLAY) switch(backbag) if(2) clothes_s.Blend(new /icon('icons/mob/back.dmi', "engiepack"), ICON_OVERLAY) diff --git a/code/modules/mob/update_icons.dm b/code/modules/mob/update_icons.dm index a6ae6dc4a0..480c4be322 100644 --- a/code/modules/mob/update_icons.dm +++ b/code/modules/mob/update_icons.dm @@ -1,6 +1,11 @@ //Most of these are defined at this level to reduce on checks elsewhere in the code. //Having them here also makes for a nice reference list of the various overlay-updating procs available +//default item on-mob icons +#define INV_L_HAND_DEF_ICON 'icons/mob/items/lefthand.dmi' +#define INV_R_HAND_DEF_ICON 'icons/mob/items/righthand.dmi' + + /mob/proc/regenerate_icons() //TODO: phase this out completely if possible return diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 05b877f87e..653d7c6b16 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -3,6 +3,10 @@ name = "gun" desc = "Its a gun. It's pretty terrible, though." icon = 'icons/obj/gun.dmi' + item_icons = list( + icon_l_hand = 'icons/mob/items/lefthand_guns.dmi', + icon_r_hand = 'icons/mob/items/righthand_guns.dmi', + ) icon_state = "detective" item_state = "gun" flags = CONDUCT diff --git a/code/modules/projectiles/guns/energy/special.dm b/code/modules/projectiles/guns/energy/special.dm index 508770bb4b..56c5867010 100644 --- a/code/modules/projectiles/guns/energy/special.dm +++ b/code/modules/projectiles/guns/energy/special.dm @@ -121,6 +121,7 @@ name = "staff of change" desc = "An artefact that spits bolts of coruscating energy which cause the target's very form to reshape itself" icon = 'icons/obj/gun.dmi' + item_icons = null icon_state = "staffofchange" item_state = "staffofchange" fire_sound = 'sound/weapons/emitter.ogg' @@ -174,6 +175,7 @@ obj/item/weapon/gun/energy/staff/focus desc = "It's a cute rubber duck. With an evil gleam in it's eye." projectile_type = /obj/item/projectile/icarus/pointdefense icon = 'icons/obj/watercloset.dmi' + item_icons = null icon_state = "rubberducky" item_state = "rubberducky" charge_cost = 0 diff --git a/code/setup.dm b/code/setup.dm index 0a09af0cd4..e127925632 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -243,6 +243,11 @@ #define slot_legs 21 #define slot_tie 22 +// Mob sprite sheets. These need to be strings as numbers +// cannot be used as associative list keys. +#define icon_l_hand "slot_l_hand" +#define icon_r_hand "slot_r_hand" + // Bitflags for clothing parts. #define HEAD 1 #define FACE 2 diff --git a/icons/mob/items/lefthand.dmi b/icons/mob/items/lefthand.dmi new file mode 100644 index 0000000000..fca687513a Binary files /dev/null and b/icons/mob/items/lefthand.dmi differ diff --git a/icons/mob/items/lefthand_guns.dmi b/icons/mob/items/lefthand_guns.dmi new file mode 100644 index 0000000000..e7024519a0 Binary files /dev/null and b/icons/mob/items/lefthand_guns.dmi differ diff --git a/icons/mob/items/righthand.dmi b/icons/mob/items/righthand.dmi new file mode 100644 index 0000000000..87b3eea46b Binary files /dev/null and b/icons/mob/items/righthand.dmi differ diff --git a/icons/mob/items/righthand_guns.dmi b/icons/mob/items/righthand_guns.dmi new file mode 100644 index 0000000000..be844f4711 Binary files /dev/null and b/icons/mob/items/righthand_guns.dmi differ diff --git a/icons/mob/items_lefthand.dmi b/icons/mob/items_lefthand.dmi deleted file mode 100644 index ad19b43cd2..0000000000 Binary files a/icons/mob/items_lefthand.dmi and /dev/null differ diff --git a/icons/mob/items_righthand.dmi b/icons/mob/items_righthand.dmi deleted file mode 100644 index e0dedf1d40..0000000000 Binary files a/icons/mob/items_righthand.dmi and /dev/null differ