Implements item_state overrides for back slot, hands
Updates backpacks to use the item_state overrides where necessary, fixes #8577
@@ -3,7 +3,6 @@
|
||||
icon = 'icons/obj/items.dmi'
|
||||
var/image/blood_overlay = null //this saves our blood splatter overlay, which will be processed not to go over the edges of the sprite
|
||||
var/abstract = 0
|
||||
var/item_state = null
|
||||
var/r_speed = 1.0
|
||||
var/health = null
|
||||
var/burn_point = null
|
||||
@@ -39,6 +38,9 @@
|
||||
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.
|
||||
|
||||
var/item_state = null // Used to specify the item state for the on-mob overlays.
|
||||
var/item_state_slots = null //overrides the default item_state for particular slots.
|
||||
|
||||
// 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.
|
||||
|
||||
@@ -6,8 +6,17 @@
|
||||
/obj/item/weapon/storage/backpack
|
||||
name = "backpack"
|
||||
desc = "You wear this on your back and put items into it."
|
||||
item_icons = list(
|
||||
slot_l_hand_key = 'icons/mob/items/lefthand_backpacks.dmi',
|
||||
slot_r_hand_key = 'icons/mob/items/righthand_backpacks.dmi',
|
||||
)
|
||||
icon_state = "backpack"
|
||||
item_state = "backpack"
|
||||
item_state = null
|
||||
//most backpacks use the default backpack state for inhand overlays
|
||||
item_state_slots = list(
|
||||
slot_l_hand_key = "backpack",
|
||||
slot_r_hand_key = "backpack",
|
||||
)
|
||||
w_class = 4
|
||||
slot_flags = SLOT_BACK
|
||||
max_w_class = 3
|
||||
@@ -95,6 +104,7 @@
|
||||
storage_slots = 20
|
||||
max_w_class = 3
|
||||
max_storage_space = 400 // can store a ton of shit!
|
||||
item_state_slots = null
|
||||
|
||||
/obj/item/weapon/storage/backpack/cultpack
|
||||
name = "trophy rack"
|
||||
@@ -105,61 +115,56 @@
|
||||
name = "Giggles von Honkerton"
|
||||
desc = "It's a backpack made by Honk! Co."
|
||||
icon_state = "clownpack"
|
||||
item_state = "clownpack"
|
||||
item_state_slots = null
|
||||
|
||||
/obj/item/weapon/storage/backpack/medic
|
||||
name = "medical backpack"
|
||||
desc = "It's a backpack especially designed for use in a sterile environment."
|
||||
icon_state = "medicalpack"
|
||||
item_state = "medicalpack"
|
||||
item_state_slots = null
|
||||
|
||||
/obj/item/weapon/storage/backpack/security
|
||||
name = "security backpack"
|
||||
desc = "It's a very robust backpack."
|
||||
icon_state = "securitypack"
|
||||
item_state = "securitypack"
|
||||
item_state_slots = null
|
||||
|
||||
/obj/item/weapon/storage/backpack/captain
|
||||
name = "captain's backpack"
|
||||
desc = "It's a special backpack made exclusively for Nanotrasen officers."
|
||||
icon_state = "captainpack"
|
||||
item_state = "captainpack"
|
||||
item_state_slots = null
|
||||
|
||||
/obj/item/weapon/storage/backpack/industrial
|
||||
name = "industrial backpack"
|
||||
desc = "It's a tough backpack for the daily grind of station life."
|
||||
icon_state = "engiepack"
|
||||
item_state = "engiepack"
|
||||
item_state_slots = null
|
||||
|
||||
/obj/item/weapon/storage/backpack/toxins
|
||||
name = "laboratory backpack"
|
||||
desc = "It's a light backpack modeled for use in laboratories and other scientific institutions."
|
||||
icon_state = "toxpack"
|
||||
item_state = "toxpack"
|
||||
|
||||
/obj/item/weapon/storage/backpack/hydroponics
|
||||
name = "herbalist's backpack"
|
||||
desc = "It's a green backpack with many pockets to store plants and tools in."
|
||||
icon_state = "hydpack"
|
||||
item_state = "hydpack"
|
||||
|
||||
/obj/item/weapon/storage/backpack/genetics
|
||||
name = "geneticist backpack"
|
||||
desc = "It's a backpack fitted with slots for diskettes and other workplace tools."
|
||||
icon_state = "genpack"
|
||||
item_state = "genpack"
|
||||
|
||||
/obj/item/weapon/storage/backpack/virology
|
||||
name = "sterile backpack"
|
||||
desc = "It's a sterile backpack able to withstand different pathogens from entering its fabric."
|
||||
icon_state = "viropack"
|
||||
item_state = "viropack"
|
||||
|
||||
/obj/item/weapon/storage/backpack/chemistry
|
||||
name = "chemistry backpack"
|
||||
desc = "It's an orange backpack which was designed to hold beakers, pill bottles and bottles."
|
||||
icon_state = "chempack"
|
||||
item_state = "chempack"
|
||||
|
||||
/*
|
||||
* Satchel Types
|
||||
@@ -184,13 +189,19 @@
|
||||
name = "industrial satchel"
|
||||
desc = "A tough satchel with extra pockets."
|
||||
icon_state = "satchel-eng"
|
||||
item_state = "engiepack"
|
||||
item_state_slots = list(
|
||||
slot_l_hand_key = "engiepack",
|
||||
slot_r_hand_key = "engiepack",
|
||||
)
|
||||
|
||||
/obj/item/weapon/storage/backpack/satchel_med
|
||||
name = "medical satchel"
|
||||
desc = "A sterile satchel used in medical departments."
|
||||
icon_state = "satchel-med"
|
||||
item_state = "medicalpack"
|
||||
item_state_slots = list(
|
||||
slot_l_hand_key = "medicalpack",
|
||||
slot_r_hand_key = "medicalpack",
|
||||
)
|
||||
|
||||
/obj/item/weapon/storage/backpack/satchel_vir
|
||||
name = "virologist satchel"
|
||||
@@ -216,7 +227,10 @@
|
||||
name = "security satchel"
|
||||
desc = "A robust satchel for security related needs."
|
||||
icon_state = "satchel-sec"
|
||||
item_state = "securitypack"
|
||||
item_state_slots = list(
|
||||
slot_l_hand_key = "securitypack",
|
||||
slot_r_hand_key = "securitypack",
|
||||
)
|
||||
|
||||
/obj/item/weapon/storage/backpack/satchel_hyd
|
||||
name = "hydroponics satchel"
|
||||
@@ -228,13 +242,17 @@
|
||||
desc = "An exclusive satchel for Nanotrasen officers."
|
||||
icon_state = "satchel-cap"
|
||||
item_state = "captainpack"
|
||||
item_state_slots = null
|
||||
|
||||
//ERT backpacks.
|
||||
/obj/item/weapon/storage/backpack/ert
|
||||
name = "emergency response team backpack"
|
||||
desc = "A spacious backpack with lots of pockets, used by members of the Nanotrasen Emergency Response Team."
|
||||
icon_state = "ert_commander"
|
||||
item_state = "backpack"
|
||||
item_state_slots = list(
|
||||
slot_l_hand_key = "securitypack",
|
||||
slot_r_hand_key = "securitypack",
|
||||
)
|
||||
|
||||
//Commander
|
||||
/obj/item/weapon/storage/backpack/ert/commander
|
||||
|
||||
@@ -741,19 +741,36 @@ 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
|
||||
var/obj/item/weapon/rig/rig = back
|
||||
|
||||
//determine the icon to use
|
||||
var/icon/overlay_icon
|
||||
if(back.icon_override)
|
||||
overlays_standing[BACK_LAYER] = image("icon" = back.icon_override, "icon_state" = "[back.icon_state]")
|
||||
//If this is a rig and a mob_icon is set, it will take species into account in the rig update_icon() proc.
|
||||
else if(istype(rig) && rig.mob_icon)
|
||||
overlays_standing[BACK_LAYER] = rig.mob_icon
|
||||
overlay_icon = back.icon_override
|
||||
else if(istype(back, /obj/item/weapon/rig))
|
||||
//If this is a rig and a mob_icon is set, it will take species into account in the rig update_icon() proc.
|
||||
var/obj/item/weapon/rig/rig = back
|
||||
overlay_icon = rig.mob_icon
|
||||
else if(back.sprite_sheets && back.sprite_sheets[species.name])
|
||||
overlays_standing[BACK_LAYER] = image("icon" = back.sprite_sheets[species.name], "icon_state" = "[back.icon_state]")
|
||||
overlay_icon = back.sprite_sheets[species.name]
|
||||
else
|
||||
overlays_standing[BACK_LAYER] = image("icon" = 'icons/mob/back.dmi', "icon_state" = "[back.icon_state]")
|
||||
overlay_icon = INV_BACK_DEF_ICON
|
||||
|
||||
//determine state to use
|
||||
var/overlay_state
|
||||
if(back.item_state_slots && back.item_state_slots[slot_back_key])
|
||||
overlay_state = back.item_state_slots[slot_back_key]
|
||||
else if(back.item_state)
|
||||
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) update_icons()
|
||||
overlays_standing[BACK_LAYER] = null
|
||||
|
||||
if(update_icons)
|
||||
update_icons()
|
||||
|
||||
|
||||
/mob/living/carbon/human/update_hud() //TODO: do away with this if possible
|
||||
@@ -790,19 +807,27 @@ var/global/list/damage_icon_parts = list()
|
||||
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
|
||||
//determine icon to use
|
||||
var/icon/t_icon
|
||||
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]")
|
||||
t_icon = r_hand.icon_override
|
||||
else if(r_hand.item_icons && (slot_r_hand_key in r_hand.item_icons))
|
||||
t_icon = r_hand.item_icons[slot_r_hand_key]
|
||||
else
|
||||
overlays_standing[R_HAND_LAYER] = image("icon" = t_icon, "icon_state" = "[t_state]")
|
||||
t_icon = INV_R_HAND_DEF_ICON
|
||||
|
||||
if (handcuffed) drop_r_hand()
|
||||
//determine icon state to use
|
||||
var/t_state
|
||||
if(r_hand.item_state_slots && r_hand.item_state_slots[slot_r_hand_key])
|
||||
t_state = r_hand.item_state_slots[slot_r_hand_key]
|
||||
else if(r_hand.item_state)
|
||||
t_state = r_hand.item_state
|
||||
else
|
||||
t_state = r_hand.icon_state
|
||||
|
||||
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
|
||||
else
|
||||
overlays_standing[R_HAND_LAYER] = null
|
||||
|
||||
@@ -813,19 +838,27 @@ var/global/list/damage_icon_parts = list()
|
||||
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
|
||||
//determine icon to use
|
||||
var/icon/t_icon
|
||||
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]")
|
||||
t_icon = l_hand.icon_override
|
||||
else if(l_hand.item_icons && (slot_l_hand_key in l_hand.item_icons))
|
||||
t_icon = l_hand.item_icons[slot_l_hand_key]
|
||||
else
|
||||
overlays_standing[L_HAND_LAYER] = image("icon" = t_icon, "icon_state" = "[t_state]")
|
||||
t_icon = INV_L_HAND_DEF_ICON
|
||||
|
||||
if (handcuffed) drop_l_hand()
|
||||
//determine icon state to use
|
||||
var/t_state
|
||||
if(l_hand.item_state_slots && l_hand.item_state_slots[slot_l_hand_key])
|
||||
t_state = l_hand.item_state_slots[slot_l_hand_key]
|
||||
else if(l_hand.item_state)
|
||||
t_state = l_hand.item_state
|
||||
else
|
||||
t_state = l_hand.icon_state
|
||||
|
||||
overlays_standing[L_HAND_LAYER] = image(icon = t_icon, icon_state = t_state)
|
||||
|
||||
if (handcuffed) drop_l_hand() //This probably should not be here
|
||||
else
|
||||
overlays_standing[L_HAND_LAYER] = null
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
//Having them here also makes for a nice reference list of the various overlay-updating procs available
|
||||
|
||||
//default item on-mob icons
|
||||
#define INV_BACK_DEF_ICON 'icons/mob/back.dmi'
|
||||
#define INV_L_HAND_DEF_ICON 'icons/mob/items/lefthand.dmi'
|
||||
#define INV_R_HAND_DEF_ICON 'icons/mob/items/righthand.dmi'
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
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',
|
||||
slot_l_hand_key = 'icons/mob/items/lefthand_guns.dmi',
|
||||
slot_r_hand_key = 'icons/mob/items/righthand_guns.dmi',
|
||||
)
|
||||
icon_state = "detective"
|
||||
item_state = "gun"
|
||||
|
||||
@@ -255,10 +255,12 @@
|
||||
#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"
|
||||
// Inventory slot strings.
|
||||
// since numbers cannot be used as associative list keys.
|
||||
#define slot_l_hand_key "slot_l_hand"
|
||||
#define slot_r_hand_key "slot_r_hand"
|
||||
#define slot_w_uniform_key "w_uniform"
|
||||
#define slot_back_key "back"
|
||||
|
||||
// Bitflags for clothing parts.
|
||||
#define HEAD 1
|
||||
|
||||
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 138 KiB After Width: | Height: | Size: 135 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 137 KiB |
|
After Width: | Height: | Size: 3.7 KiB |