Skip to content

Commit

Permalink
Merge pull request #4592 from MistakeNot4892/feature/jewellery
Browse files Browse the repository at this point in the history
Updating necklaces and rings to use new icons.
  • Loading branch information
out-of-phaze authored Dec 11, 2024
2 parents a48c4b9 + 02495f8 commit e2f91e9
Show file tree
Hide file tree
Showing 69 changed files with 941 additions and 331 deletions.
23 changes: 23 additions & 0 deletions code/_global_vars/lists/jewellery.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
var/global/list/random_jewellery_material_types = list(
/decl/material/solid/metal/gold,
/decl/material/solid/metal/silver,
/decl/material/solid/metal/copper,
/decl/material/solid/metal/platinum,
/decl/material/solid/metal/steel,
/decl/material/solid/organic/bone,
/decl/material/solid/organic/wood
)
var/global/list/random_jewellery_gem_types = list(
/obj/item/gemstone/baguette/topaz,
/obj/item/gemstone/baguette/sapphire,
/obj/item/gemstone/baguette/ruby,
/obj/item/gemstone/hexagon/topaz,
/obj/item/gemstone/hexagon/sapphire,
/obj/item/gemstone/hexagon/ruby,
/obj/item/gemstone/octagon/topaz,
/obj/item/gemstone/octagon/sapphire,
/obj/item/gemstone/octagon/ruby,
/obj/item/gemstone/round/topaz,
/obj/item/gemstone/round/sapphire,
/obj/item/gemstone/round/ruby
)
2 changes: 1 addition & 1 deletion code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ avoid code duplication. This includes items that may sometimes act as a standard

// Return TRUE if further actions (afterattack, etc) should be prevented, FALSE if they can proceed.
/atom/movable/proc/bash(obj/item/weapon, mob/user)
if(isliving(user) && user.check_intent(I_FLAG_HELP))
if(isliving(user) && !user.check_intent(I_FLAG_HARM))
return FALSE
if(!weapon.user_can_attack_with(user))
return FALSE
Expand Down
16 changes: 0 additions & 16 deletions code/game/objects/auras/blueforge_aura.dm

This file was deleted.

2 changes: 1 addition & 1 deletion code/game/objects/auras/radiant_aura.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
if(P.damage_flags() & DAM_LASER)
user.visible_message("<span class='warning'>\The [P] refracts, bending into \the [user]'s aura.</span>")
return AURA_FALSE
return 0
return 0
21 changes: 0 additions & 21 deletions code/game/objects/auras/shadowling_aura.dm

This file was deleted.

20 changes: 0 additions & 20 deletions code/game/objects/auras/starlight.dm

This file was deleted.

13 changes: 13 additions & 0 deletions code/game/objects/items/__item.dm
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,16 @@
set_material(material_key)
paint_verb ||= "painted" // fallback for the case of no material

// This is a bit gross, but it makes writing rings and necklaces much easier.
// If the decorations list is already populated at this point, we assume it's
// prebaked decorations. Only things handled appropriately at the moment are gems.
if(length(decorations))
for(var/decoration_type in decorations)
decorations -= decoration_type
if(ispath(decoration_type, /obj/item/gemstone))
decorations[GET_DECL(/decl/item_decoration/setting)] = list("object" = new decoration_type(src))
else
PRINT_STACK_TRACE("Item [type] tried to initialize with an unsupported initial decoration type ('[decoration_type]')")
. = ..()

setup_sprite_sheets()
Expand Down Expand Up @@ -200,6 +210,9 @@

/obj/item/Destroy()

// May contain object references.
LAZYCLEARLIST(decorations)

if(LAZYLEN(_item_effects))
_item_effects = null
SSitem_effects.queued_items -= src
Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/stacks/stack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
update_name()

/obj/item/stack/update_name()
. = ..()
if(amount == 1)
gender = NEUTER
SetName(singular_name)
Expand Down
5 changes: 1 addition & 4 deletions code/game/objects/items/weapons/storage/backpack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,6 @@

/obj/item/backpack/crafted/backpack
name = "backpack"
name_prefix = "handmade"
desc = "A rather rough handmade backpack."
icon = 'icons/obj/items/storage/backpack/backpack_crafted.dmi'

/obj/item/backpack/crafted/backpack/update_name()
. = ..()
SetName("handmade [name]")
32 changes: 16 additions & 16 deletions code/game/objects/random/subtypes/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -515,22 +515,22 @@

/obj/random/jewelry/spawn_choices()
var/static/list/spawnable_choices = list(
/obj/item/clothing/ears/stud/wood = 10,
/obj/item/clothing/ears/dangle/wood = 10,
/obj/item/clothing/gloves/bracelet = 10,
/obj/item/clothing/neck/necklace = 10,
/obj/item/clothing/gloves/ring/material/silver = 5,
/obj/item/clothing/gloves/ring/material/bronze = 5,
/obj/item/clothing/gloves/ring/material/gold = 3,
/obj/item/clothing/ears/stud/silver = 3,
/obj/item/clothing/ears/dangle/silver = 3,
/obj/item/clothing/ears/stud/gold = 3,
/obj/item/clothing/ears/dangle/gold = 3,
/obj/item/clothing/gloves/ring/material/platinum = 1,
/obj/item/clothing/ears/stud/platinum = 1,
/obj/item/clothing/ears/dangle/platinum = 1,
/obj/item/clothing/ears/stud/diamond = 1,
/obj/item/clothing/ears/dangle/diamond = 1
/obj/item/clothing/ears/stud/wood = 10,
/obj/item/clothing/ears/dangle/wood = 10,
/obj/item/clothing/gloves/bracelet = 10,
/obj/item/clothing/neck/necklace = 10,
/obj/item/clothing/gloves/ring/silver = 5,
/obj/item/clothing/gloves/ring/bronze = 5,
/obj/item/clothing/gloves/ring/gold = 3,
/obj/item/clothing/ears/stud/silver = 3,
/obj/item/clothing/ears/dangle/silver = 3,
/obj/item/clothing/ears/stud/gold = 3,
/obj/item/clothing/ears/dangle/gold = 3,
/obj/item/clothing/gloves/ring/platinum = 1,
/obj/item/clothing/ears/stud/platinum = 1,
/obj/item/clothing/ears/dangle/platinum = 1,
/obj/item/clothing/ears/stud/diamond = 1,
/obj/item/clothing/ears/dangle/diamond = 1

)
return spawnable_choices
26 changes: 26 additions & 0 deletions code/modules/client/preference_setup/loadout/lists/accessories.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,32 @@
path = /obj/item/clothing/neck/necklace
loadout_flags = GEAR_HAS_COLOR_SELECTION
uid = "gear_accessory_necklace"
var/list/available_materials = list(
/decl/material/solid/metal/steel,
/decl/material/solid/metal/bronze,
/decl/material/solid/metal/silver,
/decl/material/solid/metal/gold,
/decl/material/solid/metal/platinum
)

/decl/loadout_option/accessory/necklace/get_gear_tweak_options()
. = ..()
LAZYINITLIST(.[/datum/gear_tweak/path])
.[/datum/gear_tweak/path] |= list(
"necklace" = /obj/item/clothing/neck/necklace,
"necklace, square pendant" = /obj/item/clothing/neck/necklace/square,
"necklace, frill" = /obj/item/clothing/neck/necklace/frill,
"necklace, cross pendant" = /obj/item/clothing/neck/necklace/cross,
"necklace, diamond pendant" = /obj/item/clothing/neck/necklace/diamond,
"necklace, ornate" = /obj/item/clothing/neck/necklace/ornate
)
if(length(available_materials))
for(var/mat in available_materials)
var/decl/material/mat_decl = GET_DECL(mat)
available_materials -= mat
available_materials[mat_decl.name] = mat
LAZYINITLIST(.[/datum/gear_tweak/material])
.[/datum/gear_tweak/material] = available_materials

/decl/loadout_option/accessory/bow
name = "bowtie, horrible"
Expand Down
41 changes: 30 additions & 11 deletions code/modules/client/preference_setup/loadout/lists/gloves.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,39 @@
path = /obj/item/clothing/gloves/ring
cost = 2
uid = "gear_gloves_ring"
var/list/available_materials = list(
/decl/material/solid/metal/steel,
/decl/material/solid/metal/bronze,
/decl/material/solid/metal/silver,
/decl/material/solid/metal/gold,
/decl/material/solid/metal/platinum,
/decl/material/solid/glass,
/decl/material/solid/organic/plastic,
/decl/material/solid/organic/wood/oak,
/decl/material/solid/organic/wood/bamboo,
/decl/material/solid/organic/wood/ebony,
/decl/material/solid/organic/wood/mahogany,
/decl/material/solid/organic/wood/maple,
/decl/material/solid/organic/wood/walnut,
/decl/material/solid/organic/wood/yew
)

/decl/loadout_option/ring/get_gear_tweak_options()
. = ..()
LAZYINITLIST(.[/datum/gear_tweak/path])
.[/datum/gear_tweak/path] |= list(
"engagement ring" = /obj/item/clothing/gloves/ring/engagement,
"signet ring" = /obj/item/clothing/gloves/ring/seal/signet,
"masonic ring" = /obj/item/clothing/gloves/ring/seal/mason,
"ring, steel" = /obj/item/clothing/gloves/ring/material/steel,
"ring, bronze" = /obj/item/clothing/gloves/ring/material/bronze,
"ring, silver" = /obj/item/clothing/gloves/ring/material/silver,
"ring, gold" = /obj/item/clothing/gloves/ring/material/gold,
"ring, platinum" = /obj/item/clothing/gloves/ring/material/platinum,
"ring, glass" = /obj/item/clothing/gloves/ring/material/glass,
"ring, wood" = /obj/item/clothing/gloves/ring/material/wood,
"ring, plastic" = /obj/item/clothing/gloves/ring/material/plastic
"ring" = /obj/item/clothing/gloves/ring/gold,
"ring, thin" = /obj/item/clothing/gloves/ring/thin,
"ring, thick" = /obj/item/clothing/gloves/ring/thick,
"ring, split" = /obj/item/clothing/gloves/ring/split,
"engagement ring" = /obj/item/clothing/gloves/ring/engagement,
"signet ring" = /obj/item/clothing/gloves/ring/seal/signet,
"masonic ring" = /obj/item/clothing/gloves/ring/seal/mason
)
if(length(available_materials))
for(var/mat in available_materials)
var/decl/material/mat_decl = GET_DECL(mat)
available_materials -= mat
available_materials[mat_decl.name] = mat
LAZYINITLIST(.[/datum/gear_tweak/material])
.[/datum/gear_tweak/material] = available_materials
81 changes: 73 additions & 8 deletions code/modules/clothing/gloves/jewelry/rings/_ring.dm
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
/obj/item/clothing/gloves/ring
name = "ring"
icon = 'icons/clothing/accessories/jewelry/rings/ring.dmi'
w_class = ITEM_SIZE_TINY
gender = NEUTER
material = /decl/material/solid/metal/silver
name = "ring"
icon = 'icons/clothing/accessories/jewelry/rings/ring_band.dmi'
desc = null
w_class = ITEM_SIZE_TINY
gender = NEUTER
material = /decl/material/solid/metal/silver
material_alteration = MAT_FLAG_ALTERATION_COLOR | MAT_FLAG_ALTERATION_DESC // We handle name manually
sprite_sheets = null
var/use_material_name = TRUE
var/can_fit_under_gloves = TRUE
var/can_inscribe = FALSE
var/can_inscribe = TRUE
var/inscription
var/base_desc

Expand All @@ -14,6 +18,24 @@
base_desc = desc
. = ..()

/obj/item/clothing/gloves/ring/get_decoration_icon(default_icon, obj/item/thing, on_mob = FALSE)
if(!on_mob && istype(thing, /obj/item/gemstone))
return thing.icon
return ..()

/obj/item/clothing/gloves/ring/update_name()
var/list/name_comp = list()
if(name_prefix)
name_comp += name_prefix
if(use_material_name)
var/obj/item/gemstone/gem = locate() in contents
if(gem)
name_comp += gem.name
if(material)
name_comp += material.adjective_name
name_comp += base_name || initial(name)
SetName(jointext(name_comp, " "))

/obj/item/clothing/gloves/ring/set_material(var/new_material)
. = ..()
update_desc()
Expand All @@ -32,7 +54,7 @@
desc = "[base_desc] [desc]"

/obj/item/clothing/gloves/ring/attackby(var/obj/item/tool, var/mob/user)
if(can_inscribe && tool.sharp)
if(can_inscribe && tool.sharp && user.check_intent(I_FLAG_HELP))
var/new_inscription = sanitize(input("Enter an inscription to engrave.", "Inscription") as null|text)
if(user.stat || !user.incapacitated() || !user.Adjacent(src) || tool.loc != user)
return TRUE
Expand All @@ -55,4 +77,47 @@

/obj/item/clothing/gloves/ring/get_examine_line()
. = ..()
. += " <a href='byond://?src=\ref[src];examine=1'>\[View\]</a>"
. += " <a href='byond://?src=\ref[src];examine=1'>\[View\]</a>"

// Craftable subtypes.
/obj/item/clothing/gloves/ring/thin
name_prefix = "thin"
icon = 'icons/clothing/accessories/jewelry/rings/ring_band_thin.dmi'

/obj/item/clothing/gloves/ring/thick
name_prefix = "thick"
icon = 'icons/clothing/accessories/jewelry/rings/ring_band_thick.dmi'

/obj/item/clothing/gloves/ring/split
name_prefix = "split"
icon = 'icons/clothing/accessories/jewelry/rings/ring_band_split.dmi'

// Material subtypes for mapping etc.
/obj/item/clothing/gloves/ring/wood
material = /decl/material/solid/organic/wood/walnut

/obj/item/clothing/gloves/ring/plastic
material = /decl/material/solid/organic/plastic

/obj/item/clothing/gloves/ring/steel
material = /decl/material/solid/metal/steel

/obj/item/clothing/gloves/ring/silver
material = /decl/material/solid/metal/silver

/obj/item/clothing/gloves/ring/gold
material = /decl/material/solid/metal/gold

/obj/item/clothing/gloves/ring/platinum
material = /decl/material/solid/metal/platinum

/obj/item/clothing/gloves/ring/bronze
material = /decl/material/solid/metal/bronze

/obj/item/clothing/gloves/ring/glass
material = /decl/material/solid/glass

/obj/item/clothing/gloves/ring/random/Initialize(ml, material_key)
material_key = pick(global.random_jewellery_material_types)
decorations = list(pick(global.random_jewellery_gem_types))
. = ..()
Loading

0 comments on commit e2f91e9

Please sign in to comment.