mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-24 12:37:50 +01:00
Merge pull request #9287 from Zuhayr/customitemsfix
Allowed accessories to function as custom items using icon_override
This commit is contained in:
@@ -9,11 +9,30 @@
|
||||
var/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/image/inv_overlay_mob = null
|
||||
var/overlay_state = null
|
||||
|
||||
/obj/item/clothing/accessory/New()
|
||||
..()
|
||||
inv_overlay = image("icon" = 'icons/obj/clothing/ties_overlay.dmi', "icon_state" = "[overlay_state? "[overlay_state]" : "[icon_state]"]")
|
||||
/obj/item/clothing/accessory/proc/get_inv_overlay()
|
||||
if(!inv_overlay)
|
||||
var/tmp_icon_state = "[overlay_state? "[overlay_state]" : "[icon_state]"]"
|
||||
if(icon_override)
|
||||
if("[tmp_icon_state]_tie" in icon_states(icon_override))
|
||||
tmp_icon_state = "[tmp_icon_state]_tie"
|
||||
inv_overlay = image("icon" = icon_override, "icon_state" = "[tmp_icon_state]")
|
||||
else
|
||||
inv_overlay = image("icon" = 'icons/obj/clothing/ties_overlay.dmi', "icon_state" = "[tmp_icon_state]")
|
||||
return inv_overlay
|
||||
|
||||
/obj/item/clothing/accessory/proc/get_inv_mob_overlay()
|
||||
if(!inv_overlay_mob)
|
||||
var/tmp_icon_state = "[overlay_state? "[overlay_state]" : "[icon_state]"]"
|
||||
if(icon_override)
|
||||
if("[tmp_icon_state]_mob" in icon_states(icon_override))
|
||||
tmp_icon_state = "[tmp_icon_state]_mob"
|
||||
inv_overlay_mob = image("icon" = icon_override, "icon_state" = "[tmp_icon_state]")
|
||||
else
|
||||
inv_overlay_mob = image("icon" = 'icons/obj/clothing/ties_overlay.dmi', "icon_state" = "[tmp_icon_state]")
|
||||
return inv_overlay_mob
|
||||
|
||||
//when user attached an accessory to S
|
||||
/obj/item/clothing/accessory/proc/on_attached(obj/item/clothing/under/S, mob/user as mob)
|
||||
@@ -21,7 +40,7 @@
|
||||
return
|
||||
has_suit = S
|
||||
loc = has_suit
|
||||
has_suit.overlays += inv_overlay
|
||||
has_suit.overlays += get_inv_overlay()
|
||||
|
||||
user << "<span class='notice'>You attach [src] to [has_suit].</span>"
|
||||
src.add_fingerprint(user)
|
||||
@@ -29,7 +48,7 @@
|
||||
/obj/item/clothing/accessory/proc/on_removed(mob/user as mob)
|
||||
if(!has_suit)
|
||||
return
|
||||
has_suit.overlays -= inv_overlay
|
||||
has_suit.overlays -= get_inv_overlay()
|
||||
has_suit = null
|
||||
usr.put_in_hands(src)
|
||||
src.add_fingerprint(user)
|
||||
|
||||
@@ -106,8 +106,7 @@
|
||||
if("item_name")
|
||||
current_data.name = field_data
|
||||
if("item_icon")
|
||||
if(field_data in icon_states(CUSTOM_ITEM_OBJ))
|
||||
current_data.item_icon = field_data
|
||||
current_data.item_icon = field_data
|
||||
if("item_desc")
|
||||
current_data.item_desc = field_data
|
||||
if("req_access")
|
||||
|
||||
@@ -491,8 +491,7 @@ var/global/list/damage_icon_parts = list()
|
||||
var/obj/item/clothing/under/under = w_uniform
|
||||
if(under.accessories.len)
|
||||
for(var/obj/item/clothing/accessory/A in under.accessories)
|
||||
var/accessory_state = A.overlay_state? A.overlay_state : A.icon_state
|
||||
standing.overlays += image(icon = INV_ACCESSORIES_DEF_ICON, icon_state = accessory_state)
|
||||
standing.overlays |= A.get_inv_mob_overlay()
|
||||
|
||||
overlays_standing[UNIFORM_LAYER] = standing
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user