Improve slot accessory handling

This commit is contained in:
Mark van Alphen
2019-04-03 22:50:34 +02:00
parent 731bc60958
commit ddd845f01a
7 changed files with 18 additions and 11 deletions
+5 -3
View File
@@ -596,12 +596,14 @@ BLIND // can't see anything
/obj/item/clothing/under/proc/can_attach_accessory(obj/item/clothing/accessory/A)
if(istype(A))
.=1
. = 1
else
return 0
if(accessories.len && (A.slot in list("utility","armband","skullcodpiece","talisman")))
if(accessories.len)
for(var/obj/item/clothing/accessory/AC in accessories)
if(AC.slot == A.slot)
if((A.slot in list(ACCESSORY_SLOT_UTILITY, ACCESSORY_SLOT_ARMBAND)) && AC.slot == A.slot)
return 0
if(!A.allow_duplicates && AC.type == A.type)
return 0
/obj/item/clothing/under/attackby(obj/item/I, mob/user, params)
@@ -7,9 +7,10 @@
item_color = "bluetie"
slot_flags = SLOT_TIE
w_class = WEIGHT_CLASS_SMALL
var/slot = "decor"
var/slot = ACCESSORY_SLOT_DECOR
var/obj/item/clothing/under/has_suit = null //the suit the tie may be attached to
var/image/inv_overlay = null //overlay used when attached to clothing.
var/allow_duplicates = TRUE // Allow accessories of the same type.
/obj/item/clothing/accessory/New()
..()
@@ -391,8 +392,8 @@
icon_state = "skull"
item_state = "skull"
item_color = "skull"
slot = "skullcodpiece"
armor = list("melee" = 5, "bullet" = 5, "laser" = 5, "energy" = 5, "bomb" = 20, "bio" = 20, "rad" = 5)
allow_duplicates = FALSE
/obj/item/clothing/accessory/necklace/talisman
name = "bone talisman"
@@ -400,8 +401,8 @@
icon_state = "talisman"
item_state = "talisman"
item_color = "talisman"
slot = "talisman"
armor = list("melee" = 5, "bullet" = 5, "laser" = 5, "energy" = 5, "bomb" = 20, "bio" = 20, "rad" = 5)
allow_duplicates = FALSE
/obj/item/clothing/accessory/necklace/locket
name = "gold locket"
@@ -3,7 +3,7 @@
desc = "A fancy red armband!"
icon_state = "red"
item_color = "red"
slot = "armband"
slot = ACCESSORY_SLOT_ARMBAND
/obj/item/clothing/accessory/armband/sec
name = "security armband"
@@ -3,7 +3,7 @@
desc = "A handgun holster."
icon_state = "holster"
item_color = "holster"
slot = "utility"
slot = ACCESSORY_SLOT_UTILITY
var/holster_allow = /obj/item/gun
var/obj/item/gun/holstered = null
actions_types = list(/datum/action/item_action/accessory/holster)
@@ -3,7 +3,7 @@
desc = "Used to hold things when you don't have enough hands."
icon_state = "webbing"
item_color = "webbing"
slot = "utility"
slot = ACCESSORY_SLOT_UTILITY
var/slots = 3
var/obj/item/storage/internal/hold
actions_types = list(/datum/action/item_action/accessory/storage)