This commit is contained in:
SandPoot
2025-02-10 03:31:49 -03:00
parent 28f358a13a
commit 6724b3f132
6 changed files with 176 additions and 214 deletions
@@ -1,8 +1,7 @@
/obj/item/clothing/gloves
var/dummy_thick = FALSE // is able to hold accessories on its item
var/max_accessories = 1
var/list/obj/item/clothing/accessory/ring/attached_accessories = list()
var/list/mutable_appearance/accessory_overlays = list()
var/list/obj/item/clothing/accessory/ring/attached_accessories
/obj/item/clothing/gloves/Destroy()
QDEL_LIST(attached_accessories)
@@ -10,9 +9,12 @@
/obj/item/clothing/gloves/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE)
. = ..()
if(!isinhands)
if(length(accessory_overlays))
. += accessory_overlays
if(CHECK_BITFIELD(flags_inv, HIDEACCESSORY))
return
for(var/obj/item/clothing/accessory/ring/attached_accessory as anything in attached_accessories)
if(CHECK_BITFIELD(attached_accessory.flags_inv, HIDEACCESSORY))
continue
. += attached_accessory.build_worn_icon()
/obj/item/clothing/gloves/attackby(obj/item/I, mob/user, params)
if(!attach_accessory(I, user))
@@ -28,66 +30,43 @@
/obj/item/clothing/gloves/equipped(mob/user, slot)
..()
// Sandstorm edit
for(var/obj/item/clothing/accessory/ring/attached_accessory in attached_accessories)
if(attached_accessory && slot != ITEM_SLOT_HANDS && ishuman(user))
var/mob/living/carbon/human/H = user
for(var/obj/item/clothing/accessory/ring/attached_accessory as anything in attached_accessories)
if(attached_accessory && slot == ITEM_SLOT_HANDS && ishuman(user))
attached_accessory.on_uniform_equip(src, user)
if(attached_accessory.above_suit)
H.update_inv_wear_suit()
// Sandstorm edit END
/obj/item/clothing/gloves/dropped(mob/user)
// Sandstorm edit
for(var/obj/item/clothing/accessory/ring/attached_accessory in attached_accessories)
for(var/obj/item/clothing/accessory/ring/attached_accessory as anything in attached_accessories)
attached_accessory.on_uniform_dropped(src, user)
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(attached_accessory.above_suit)
H.update_inv_wear_suit()
// Sandstorm edit END
..()
/obj/item/clothing/gloves/proc/attach_accessory(obj/item/I, mob/user, notifyAttach = 1)
/obj/item/clothing/gloves/proc/attach_accessory(obj/item/clothing/accessory/ring/accessory, mob/user, notifyAttach = 1)
. = FALSE
if(istype(I, /obj/item/clothing/accessory/ring))
var/obj/item/clothing/accessory/ring/A = I
if(length(attached_accessories) >= max_accessories)
if(user)
to_chat(user, span_warning("[src] already has [length(attached_accessories)] accessories."))
return
if(dummy_thick)
if(user)
to_chat(user, span_warning("[src] is too bulky and cannot have accessories attached to it!"))
return
else
if(user && !user.temporarilyRemoveItemFromInventory(I))
return
if(!A.attach(src, user))
return
if(!istype(accessory))
return
if(length(attached_accessories) >= max_accessories)
if(user)
to_chat(user, "<span class='warning'>[src] already has [length(attached_accessories)] accessories.</span>")
return
if(dummy_thick)
if(user)
to_chat(user, "<span class='warning'>[src] is too bulky and cannot have accessories attached to it!</span>")
return
if(user && !user.temporarilyRemoveItemFromInventory(accessory))
return
if(!accessory.attach(src, user))
return
if(user && notifyAttach)
to_chat(user, span_notice("You attach [I] to [src]."))
if(user && notifyAttach)
to_chat(user, "<span class='notice'>You attach [accessory] to [src].</span>")
if((flags_inv & HIDEACCESSORY) || (A.flags_inv & HIDEACCESSORY))
return TRUE
if((flags_inv & HIDEACCESSORY) || (accessory.flags_inv & HIDEACCESSORY))
return TRUE
accessory_overlays = list(mutable_appearance('icons/mob/clothing/accessories.dmi', "blank"))
for(var/obj/item/clothing/accessory/attached_accessory in attached_accessories)
var/datum/element/polychromic/polychromic = LAZYACCESS(attached_accessory.comp_lookup, "item_worn_overlays")
if(!polychromic)
var/mutable_appearance/accessory_overlay = mutable_appearance(attached_accessory.mob_overlay_icon, attached_accessory.item_state || attached_accessory.icon_state, ABOVE_HUD_LAYER)
accessory_overlay.alpha = attached_accessory.alpha
accessory_overlay.color = attached_accessory.color
accessory_overlays += accessory_overlay
else
polychromic.apply_worn_overlays(attached_accessory, FALSE, attached_accessory.mob_overlay_icon, attached_accessory.item_state || attached_accessory.icon_state, NONE, accessory_overlays)
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
H.update_inv_gloves()
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
H.update_inv_gloves()
return TRUE
return TRUE
/obj/item/clothing/gloves/proc/remove_accessory(mob/user)
if(!isliving(user))
@@ -95,20 +74,20 @@
if(!can_use(user))
return
if(length(attached_accessories))
var/obj/item/clothing/accessory/ring/A = attached_accessories[length(attached_accessories)]
A.detach(src, user)
if(user.put_in_hands(A))
to_chat(user, span_notice("You detach [A] from [src]."))
else
to_chat(user, span_notice("You detach [A] from [src] and it falls on the floor."))
if(!LAZYLEN(attached_accessories))
return
var/obj/item/clothing/accessory/ring/accessory = attached_accessories[length(attached_accessories)]
accessory.detach(src, user)
if(user.put_in_hands(accessory))
to_chat(user, span_notice("You detach [accessory] from [src]."))
else
to_chat(user, span_notice("You detach [accessory] from [src] and it falls on the floor."))
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
H.update_inv_gloves()
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
H.update_inv_gloves()
/obj/item/clothing/gloves/examine(mob/user)
. = ..()
if(length(attached_accessories))
for(var/obj/item/clothing/accessory/ring/attached_accessory in attached_accessories)
. += "\A [attached_accessory] is attached to one of it's fingers."
for(var/obj/item/clothing/accessory/ring/attached_accessory as anything in attached_accessories)
. += "\A [attached_accessory] is attached to one of its fingers."
@@ -10,6 +10,8 @@
icon_state = "ringgold"
item_state = "gring"
strip_delay = 40
/// Here as a reminder, do not add this, unsupported.
above_suit = FALSE
var/transfer_prints = FALSE
var/transfer_blood = 0
var/strip_mod = 1