Merge pull request #8562 from Sypsoti/ponchofix_v2

Poncho Custom Item compatibility
This commit is contained in:
Atermonera
2022-04-19 22:07:23 -08:00
committed by GitHub
2 changed files with 41 additions and 5 deletions
+19
View File
@@ -59,6 +59,25 @@
..()
/// Ponchos specifically, but other accessories may eventually need this.
/// Consequence of snowflake-y teshari code.
/obj/item/kit/accessory
name = "accessory modification kit"
desc = "A kit for modifying accessories."
/obj/item/kit/accessory/can_customize(var/obj/item/I)
return istype(I, /obj/item/clothing/accessory/poncho)
/obj/item/kit/accessory/customize(var/obj/item/I, var/mob/user)
if(can_customize(I))
if(istype(I, /obj/item/clothing/accessory/poncho))
var/obj/item/clothing/accessory/poncho/P = I
P.icon_override_state = new_icon_override_file
P.sprite_sheets[SPECIES_TESHARI] = new_icon_override_file /// Will look the same on teshari and other species.
P.item_state = new_icon
to_chat(user, "You set about modifying the poncho into [new_name].")
return ..()
// Root hardsuit kit defines.
// Icons for modified hardsuits need to be in the proper .dmis because suit cyclers may cock them up.
/obj/item/kit/suit
@@ -49,6 +49,7 @@
icon_state = "classicponcho"
item_state = "classicponcho"
icon_override = 'icons/mob/ties.dmi'
var/icon_override_state /// Change this for mid-round and paintkit.
var/fire_resist = T0C+100
allowed = list(/obj/item/tank/emergency/oxygen)
armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0)
@@ -61,18 +62,34 @@
SPECIES_TESHARI = 'icons/mob/species/teshari/suit.dmi'
)
/obj/item/clothing/accessory/poncho/equipped() //Solution for race-specific sprites for an accessory which is also a suit. Suit icons break if you don't use icon override which then also overrides race-specific sprites.
/obj/item/clothing/accessory/poncho/equipped() /// Sets override, allows for mid-round changes && custom items. If you improve this code, please update paintkit.dm to accept it.
..()
var/mob/living/carbon/human/H = loc
if(istype(H) && H.wear_suit == src)
if(H.species.name == SPECIES_TESHARI)
icon_override = 'icons/mob/species/teshari/suit.dmi'
icon_override = sprite_sheets[SPECIES_TESHARI]
else if(icon_override_state)
icon_override = icon_override_state
else
icon_override = 'icons/mob/ties.dmi'
update_clothing_icon()
H.update_inv_wear_suit()
/obj/item/clothing/accessory/poncho/dropped() //Resets the override to prevent the wrong .dmi from being used because equipped only triggers when wearing ponchos as suits.
icon_override = null
/obj/item/clothing/accessory/poncho/dropped() // Reset override
if(icon_override_state)
icon_override = icon_override_state
else
icon_override = 'icons/mob/ties.dmi'
/obj/item/clothing/accessory/poncho/on_attached(obj/item/clothing/S, mob/user) /// Otherwise gives teshari normal icon.
. = ..()
if(icon_override_state)
icon_override = icon_override_state
else if(ishuman(user))
var/mob/living/carbon/human/H = user
if(H.species.name == SPECIES_TESHARI)
icon_override = sprite_sheets[SPECIES_TESHARI]
else
icon_override = 'icons/mob/ties.dmi'
/obj/item/clothing/accessory/poncho/green
name = "green poncho"