From ddd845f01ab4c8bd988e39488b10a67c615e9b1d Mon Sep 17 00:00:00 2001 From: Mark van Alphen Date: Wed, 3 Apr 2019 22:50:34 +0200 Subject: [PATCH] Improve slot accessory handling --- code/__DEFINES/clothing.dm | 7 ++++++- code/game/turfs/simulated/floor/asteroid.dm | 1 - code/modules/clothing/clothing.dm | 8 +++++--- code/modules/clothing/under/accessories/accessory.dm | 7 ++++--- code/modules/clothing/under/accessories/armband.dm | 2 +- code/modules/clothing/under/accessories/holster.dm | 2 +- code/modules/clothing/under/accessories/storage.dm | 2 +- 7 files changed, 18 insertions(+), 11 deletions(-) diff --git a/code/__DEFINES/clothing.dm b/code/__DEFINES/clothing.dm index f7fe5b8b28e..c44c65397dd 100644 --- a/code/__DEFINES/clothing.dm +++ b/code/__DEFINES/clothing.dm @@ -9,7 +9,7 @@ #define HIDEEYES 4 //APPLIES ONLY TO HELMETS/MASKS!! (eyes means glasses) #define HIDEFACE 8 //APPLIES ONLY TO HELMETS/MASKS!! Dictates whether we appear as unknown. -//slots +// slots #define slot_back 1 #define slot_wear_mask 2 #define slot_handcuffed 3 @@ -35,6 +35,11 @@ #define slot_collar 23 #define slots_amt 23 +// accessory slots +#define ACCESSORY_SLOT_DECOR 1 +#define ACCESSORY_SLOT_UTILITY 2 +#define ACCESSORY_SLOT_ARMBAND 3 + //Cant seem to find a mob bitflags area other than the powers one // bitflags for clothing parts diff --git a/code/game/turfs/simulated/floor/asteroid.dm b/code/game/turfs/simulated/floor/asteroid.dm index 5f4b05bd009..65fc8fb9ba3 100644 --- a/code/game/turfs/simulated/floor/asteroid.dm +++ b/code/game/turfs/simulated/floor/asteroid.dm @@ -278,7 +278,6 @@ GLOBAL_LIST_INIT(megafauna_spawn_list, list(/mob/living/simple_animal/hostile/me return #undef SPAWN_MEGAFAUNA -#undef SPAWN_BUBBLEGUM /turf/simulated/floor/plating/asteroid/airless/cave/proc/SpawnFlora(turf/T) if(prob(12)) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 2d11612ecde..bd97d9184dc 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -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) diff --git a/code/modules/clothing/under/accessories/accessory.dm b/code/modules/clothing/under/accessories/accessory.dm index 4aaddea1dde..85f82964197 100644 --- a/code/modules/clothing/under/accessories/accessory.dm +++ b/code/modules/clothing/under/accessories/accessory.dm @@ -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" diff --git a/code/modules/clothing/under/accessories/armband.dm b/code/modules/clothing/under/accessories/armband.dm index 90bcf90ec62..23a22fd77e7 100644 --- a/code/modules/clothing/under/accessories/armband.dm +++ b/code/modules/clothing/under/accessories/armband.dm @@ -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" diff --git a/code/modules/clothing/under/accessories/holster.dm b/code/modules/clothing/under/accessories/holster.dm index 1a1d5d1a98b..29b89e8418d 100644 --- a/code/modules/clothing/under/accessories/holster.dm +++ b/code/modules/clothing/under/accessories/holster.dm @@ -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) diff --git a/code/modules/clothing/under/accessories/storage.dm b/code/modules/clothing/under/accessories/storage.dm index 3b2e9c75a20..ede853c8145 100644 --- a/code/modules/clothing/under/accessories/storage.dm +++ b/code/modules/clothing/under/accessories/storage.dm @@ -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)