From e38f302b79f7802d72dfed6f56f8a43aec16b57c Mon Sep 17 00:00:00 2001
From: SandPoot <43283559+SandPoot@users.noreply.github.com>
Date: Mon, 1 Mar 2021 19:20:40 -0300
Subject: [PATCH] Rings can now be placed on gloves. (#144)
* upload files
* stupid maps
---
.../LavaRuins/lavaland_surface_pride.dmm | 8 +-
code/game/objects/items/storage/fancy.dm | 9 +-
code/modules/clothing/gloves/ring.dm | 4 +-
code/modules/clothing/under/_under.dm | 2 +-
code/modules/clothing/under/accessories.dm | 2 +-
.../code/modules/client/loadout/gloves.dm | 21 +---
.../modules/client/loadout/accessories.dm | 22 ++++
.../code/modules/clothing/gloves/_gloves.dm | 112 ++++++++++++++++++
.../modules/clothing/gloves/accessories.dm | 37 ++++++
tgstation.dme | 3 +
10 files changed, 188 insertions(+), 32 deletions(-)
create mode 100644 modular_sand/code/modules/client/loadout/accessories.dm
create mode 100644 modular_sand/code/modules/clothing/gloves/_gloves.dm
create mode 100644 modular_sand/code/modules/clothing/gloves/accessories.dm
diff --git a/_maps/RandomRuins/LavaRuins/lavaland_surface_pride.dmm b/_maps/RandomRuins/LavaRuins/lavaland_surface_pride.dmm
index f42aef243a..40403a67ae 100644
--- a/_maps/RandomRuins/LavaRuins/lavaland_surface_pride.dmm
+++ b/_maps/RandomRuins/LavaRuins/lavaland_surface_pride.dmm
@@ -24,7 +24,7 @@
/turf/open/floor/mineral/silver,
/area/ruin/powered/pride)
"i" = (
-/obj/item/clothing/gloves/ring,
+/obj/item/clothing/accessory/ring,
/turf/open/floor/mineral/silver,
/area/ruin/powered/pride)
"j" = (
@@ -70,7 +70,7 @@
/obj/structure/mirror{
pixel_x = -32
},
-/obj/item/clothing/gloves/ring/silver,
+/obj/item/clothing/accessory/ring/silver,
/turf/open/floor/mineral/silver,
/area/ruin/powered/pride)
"r" = (
@@ -92,7 +92,7 @@
/turf/closed/mineral/volcanic/lava_land_surface,
/area/lavaland/surface/outdoors)
"I" = (
-/obj/item/clothing/gloves/ring/silver,
+/obj/item/clothing/accessory/ring/silver,
/turf/open/floor/mineral/silver,
/area/ruin/powered/pride)
"J" = (
@@ -109,7 +109,7 @@
/turf/open/floor/mineral/silver,
/area/ruin/powered/pride)
"O" = (
-/obj/item/clothing/gloves/ring/diamond,
+/obj/item/clothing/accessory/ring/diamond,
/turf/open/floor/mineral/silver,
/area/ruin/powered/pride)
"V" = (
diff --git a/code/game/objects/items/storage/fancy.dm b/code/game/objects/items/storage/fancy.dm
index 4080a45af0..b8cd2a1389 100644
--- a/code/game/objects/items/storage/fancy.dm
+++ b/code/game/objects/items/storage/fancy.dm
@@ -460,21 +460,20 @@
icon_state = "gold ringbox"
icon_type = "gold ring"
w_class = WEIGHT_CLASS_TINY
- spawn_type = /obj/item/clothing/gloves/ring
+ spawn_type = /obj/item/clothing/accessory/ring
/obj/item/storage/fancy/ringbox/ComponentInitialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_items = 1
- STR.can_hold = typecacheof(list(/obj/item/clothing/gloves/ring))
+ STR.can_hold = typecacheof(list(/obj/item/clothing/accessory/ring))
/obj/item/storage/fancy/ringbox/diamond
icon_state = "diamond ringbox"
icon_type = "diamond ring"
- spawn_type = /obj/item/clothing/gloves/ring/diamond
+ spawn_type = /obj/item/clothing/accessory/ring/diamond
/obj/item/storage/fancy/ringbox/silver
icon_state = "silver ringbox"
icon_type = "silver ring"
- spawn_type = /obj/item/clothing/gloves/ring/silver
-
+ spawn_type = /obj/item/clothing/accessory/ring/silver
diff --git a/code/modules/clothing/gloves/ring.dm b/code/modules/clothing/gloves/ring.dm
index daca843c45..d58610bb9a 100644
--- a/code/modules/clothing/gloves/ring.dm
+++ b/code/modules/clothing/gloves/ring.dm
@@ -1,4 +1,4 @@
-/obj/item/clothing/gloves/ring
+/* /obj/item/clothing/gloves/ring
name = "gold ring"
desc = "A tiny gold ring, sized to wrap around a finger."
gender = NEUTER
@@ -39,3 +39,5 @@
obj_flags = UNIQUE_RENAME
icon_state = "ringsilver"
item_state = "sring"
+
+*/
diff --git a/code/modules/clothing/under/_under.dm b/code/modules/clothing/under/_under.dm
index 5f5624f3e7..ffadc0b565 100644
--- a/code/modules/clothing/under/_under.dm
+++ b/code/modules/clothing/under/_under.dm
@@ -90,7 +90,7 @@
/obj/item/clothing/under/proc/attach_accessory(obj/item/I, mob/user, notifyAttach = 1)
. = FALSE
- if(istype(I, /obj/item/clothing/accessory))
+ if(istype(I, /obj/item/clothing/accessory) && !istype(I, /obj/item/clothing/accessory/ring))
var/obj/item/clothing/accessory/A = I
if(length(attached_accessories) >= max_accessories)
if(user)
diff --git a/code/modules/clothing/under/accessories.dm b/code/modules/clothing/under/accessories.dm
index 6cd00a7b83..15d87a261e 100644
--- a/code/modules/clothing/under/accessories.dm
+++ b/code/modules/clothing/under/accessories.dm
@@ -116,7 +116,7 @@
/obj/item/clothing/accessory/examine(mob/user)
. = ..()
- . += "\The [src] can be attached to a uniform. Alt-click to remove it once attached."
+ . += "\The [src] can be attached to [istype(src, /obj/item/clothing/accessory/ring) ? "gloves" : "a uniform"]. Alt-click to remove it once attached."
if(initial(above_suit))
. += "\The [src] can be worn above or below your suit. Alt-click to toggle."
diff --git a/modular_citadel/code/modules/client/loadout/gloves.dm b/modular_citadel/code/modules/client/loadout/gloves.dm
index 09694ddec7..529d733e05 100644
--- a/modular_citadel/code/modules/client/loadout/gloves.dm
+++ b/modular_citadel/code/modules/client/loadout/gloves.dm
@@ -9,26 +9,7 @@
/datum/gear/gloves/evening
name = "Evening gloves"
path = /obj/item/clothing/gloves/evening
-
+
/datum/gear/gloves/midnight
name = "Midnight gloves"
path = /obj/item/clothing/gloves/evening/black
-
-/datum/gear/gloves/goldring
- name = "A gold ring"
- path = /obj/item/clothing/gloves/ring
- cost = 2
-
-/datum/gear/gloves/silverring
- name = "A silver ring"
- path = /obj/item/clothing/gloves/ring/silver
- cost = 2
-
-/datum/gear/gloves/diamondring
- name = "A diamond ring"
- path = /obj/item/clothing/gloves/ring/diamond
- cost = 4
-
-/datum/gear/gloves/customring
- name = "A ring, renameable"
- path = /obj/item/clothing/gloves/ring/custom
diff --git a/modular_sand/code/modules/client/loadout/accessories.dm b/modular_sand/code/modules/client/loadout/accessories.dm
new file mode 100644
index 0000000000..ca35c063ad
--- /dev/null
+++ b/modular_sand/code/modules/client/loadout/accessories.dm
@@ -0,0 +1,22 @@
+/datum/gear/accessories/ring
+ category = LOADOUT_CATEGORY_GLOVES
+ slot = SLOT_GLOVES
+
+/datum/gear/accessories/ring/goldring
+ name = "A gold ring"
+ path = /obj/item/clothing/accessory/ring
+ cost = 2
+
+/datum/gear/accessories/ring/silverring
+ name = "A silver ring"
+ path = /obj/item/clothing/accessory/ring/silver
+ cost = 2
+
+/datum/gear/accessories/ring/diamondring
+ name = "A diamond ring"
+ path = /obj/item/clothing/accessory/ring/diamond
+ cost = 4
+
+/datum/gear/accessories/ring/customring
+ name = "A ring, renameable"
+ path = /obj/item/clothing/accessory/ring/custom
diff --git a/modular_sand/code/modules/clothing/gloves/_gloves.dm b/modular_sand/code/modules/clothing/gloves/_gloves.dm
new file mode 100644
index 0000000000..51044d77fb
--- /dev/null
+++ b/modular_sand/code/modules/clothing/gloves/_gloves.dm
@@ -0,0 +1,112 @@
+/obj/item/clothing/gloves
+ var/dummy_thick = FALSE // is able to hold accessories on its item
+ //SKYRAT EDIT - Removed the old attached accessory system. We use a list of accessories instead.
+ var/list/obj/item/clothing/accessory/ring/attached_accessories = list()
+ var/max_accessories = 1
+ //SKYRAT EDIT END
+ var/mutable_appearance/accessory_overlay
+
+/obj/item/clothing/gloves/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE)
+ . = ..()
+ if(!isinhands)
+ if(accessory_overlay)
+ . += accessory_overlay
+
+/obj/item/clothing/gloves/attackby(obj/item/I, mob/user, params)
+ if(!attach_accessory(I, user))
+ return ..()
+
+/obj/item/clothing/gloves/AltClick(mob/user)
+ . = ..()
+ if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user)))
+ return
+ if(length(attached_accessories)) //SKYRAT EDIT
+ remove_accessory(user)
+
+/obj/item/clothing/gloves/equipped(mob/user, slot)
+ ..()
+
+ //SKYRAT EDIT
+ for(var/obj/item/clothing/accessory/ring/attached_accessory in attached_accessories)
+ if(attached_accessory && slot != SLOT_HANDS && ishuman(user))
+ var/mob/living/carbon/human/H = user
+ attached_accessory.on_uniform_equip(src, user)
+ if(attached_accessory.above_suit)
+ H.update_inv_wear_suit()
+ //SKYRAT EDIT END
+
+/obj/item/clothing/gloves/dropped(mob/user)
+ //SKYRAT EDIT
+ for(var/obj/item/clothing/accessory/ring/attached_accessory 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()
+ //SKYRAT EDIT END
+ ..()
+
+/obj/item/clothing/gloves/proc/attach_accessory(obj/item/I, 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, "[src] already has [length(attached_accessories)] accessories.")
+ return
+ if(dummy_thick)
+ if(user)
+ to_chat(user, "[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(user && notifyAttach)
+ to_chat(user, "You attach [I] to [src].")
+
+ if((flags_inv & HIDEACCESSORY) || (A.flags_inv & HIDEACCESSORY))
+ return TRUE
+
+ //SKYRAT EDIT
+ accessory_overlay = mutable_appearance(I.mob_overlay_icon, I.item_state)
+ for(var/obj/item/clothing/accessory/ring/attached_accessory in attached_accessories)
+ var/mutable_appearance/Y = mutable_appearance(attached_accessory.mob_overlay_icon, attached_accessory.icon_state, ABOVE_HUD_LAYER)
+ Y.alpha = attached_accessory.alpha
+ Y.color = attached_accessory.color
+ accessory_overlay.add_overlay(Y)
+ //SKYRAT EDIT END
+
+ if(ishuman(loc))
+ var/mob/living/carbon/human/H = loc
+ H.update_inv_gloves()
+
+ return TRUE
+
+/obj/item/clothing/gloves/proc/remove_accessory(mob/user)
+ if(!isliving(user))
+ return
+ if(!can_use(user))
+ return
+
+ //SKYRAT EDIT
+ if(length(attached_accessories))
+ var/obj/item/clothing/accessory/ring/A = attached_accessories[length(attached_accessories)]
+ //SKYRAT EDIT END
+ A.detach(src, user)
+ if(user.put_in_hands(A))
+ to_chat(user, "You detach [A] from [src].")
+ else
+ to_chat(user, "You detach [A] from [src] and it falls on the floor.")
+
+ 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."
diff --git a/modular_sand/code/modules/clothing/gloves/accessories.dm b/modular_sand/code/modules/clothing/gloves/accessories.dm
new file mode 100644
index 0000000000..c763357b99
--- /dev/null
+++ b/modular_sand/code/modules/clothing/gloves/accessories.dm
@@ -0,0 +1,37 @@
+/obj/item/clothing/accessory/ring
+ name = "gold ring"
+ desc = "A tiny gold ring, sized to wrap around a finger."
+ gender = NEUTER
+ w_class = WEIGHT_CLASS_TINY
+ slot_flags = ITEM_SLOT_GLOVES
+ icon = 'icons/obj/ring.dmi'
+ mob_overlay_icon = 'icons/mob/clothing/hands.dmi'
+ icon_state = "ringgold"
+ item_state = "gring"
+ strip_delay = 40
+
+/obj/item/clothing/accessory/ring/suicide_act(mob/living/carbon/user)
+ user.visible_message("\[user] is putting the [src] in [user.p_their()] mouth! It looks like [user] is trying to choke on the [src]!")
+ return OXYLOSS
+
+/obj/item/clothing/accessory/ring/attack_self(mob/user)
+ user.visible_message("\The [user] gets down on one knee, presenting \the [src].","You get down on one knee, presenting \the [src].")
+
+/obj/item/clothing/accessory/ring/diamond
+ name = "diamond ring"
+ desc = "An expensive ring, studded with a diamond. Cultures have used these rings in courtship for a millenia."
+ icon_state = "ringdiamond"
+ item_state = "dring"
+
+/obj/item/clothing/accessory/ring/silver
+ name = "silver ring"
+ desc = "A tiny silver ring, sized to wrap around a finger."
+ icon_state = "ringsilver"
+ item_state = "sring"
+
+/obj/item/clothing/accessory/ring/custom
+ name = "ring"
+ desc = "A ring."
+ icon_state = "ringsilver"
+ item_state = "sring"
+ obj_flags = UNIQUE_RENAME
diff --git a/tgstation.dme b/tgstation.dme
index a8114cd1ba..1d0b404c1f 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -3786,11 +3786,14 @@
#include "modular_sand\code\modules\client\asset_cache.dm"
#include "modular_sand\code\modules\client\preferences.dm"
#include "modular_sand\code\modules\client\preferences_savefile.dm"
+#include "modular_sand\code\modules\client\loadout\accessories.dm"
#include "modular_sand\code\modules\client\loadout\boxers.dm"
#include "modular_sand\code\modules\client\loadout\shirts.dm"
#include "modular_sand\code\modules\client\loadout\socks.dm"
#include "modular_sand\code\modules\client\loadout\wrists.dm"
#include "modular_sand\code\modules\clothing\refactor.dm"
+#include "modular_sand\code\modules\clothing\gloves\_gloves.dm"
+#include "modular_sand\code\modules\clothing\gloves\accessories.dm"
#include "modular_sand\code\modules\clothing\head\misc.dm"
#include "modular_sand\code\modules\clothing\masks\miscellaneous.dm"
#include "modular_sand\code\modules\clothing\outfits\standard.dm"