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
+6 -1
View File
@@ -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
@@ -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))
+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)