This commit is contained in:
Fluffy
2024-02-29 17:37:43 +00:00
committed by GitHub
parent 4fe26b6f6d
commit 0df26f261d
2 changed files with 65 additions and 8 deletions
+23 -8
View File
@@ -23,8 +23,15 @@
var/icon_species_tag = ""//If set, this holds the 3-letter shortname of a species, used for species-specific worn icons
var/icon_auto_adapt = 0//If 1, this item will automatically change its species tag to match the wearer's species.
//requires that the wearer's species is listed in icon_supported_species_tags
var/list/icon_supported_species_tags //Used with icon_auto_adapt, a list of species which have differing appearances for this item
var/icon_species_in_hand = 0//If 1, we will use the species tag even for rendering this item in the left/right hand.
/**
* A list of strings used with icon_auto_adapt, a list of species which have differing appearances for this item,
* based on the specie short name
*/
var/list/icon_supported_species_tags
///If `TRUE`, will use the `icon_species_tag` var for rendering this item in the left/right hand
var/icon_species_in_hand = FALSE
var/equip_slot = 0
var/usesound
@@ -198,15 +205,23 @@
step(src, pick(NORTH,SOUTH,EAST,WEST))
sleep(rand(2,4))
/obj/proc/auto_adapt_species(var/mob/living/carbon/human/wearer)
/**
* Sets the `icon_species_tag` on the `/obj` based on the wearer specie, which is
* then used by the icon generator to select the correct overlay of the object
*
* * wearer - A `/mob/living/carbon/human` to adapt the object to the specie of
*
* Returns `TRUE` on successful adaptation, `FALSE` otherwise
*/
/obj/proc/auto_adapt_species(mob/living/carbon/human/wearer)
SHOULD_NOT_SLEEP(TRUE)
if(icon_auto_adapt)
icon_species_tag = ""
if (wearer && icon_supported_species_tags.len)
if (wearer.species.short_name in icon_supported_species_tags)
if(wearer && length(icon_supported_species_tags))
if(wearer.species.short_name in icon_supported_species_tags)
icon_species_tag = wearer.species.short_name
return 1
return 0
return TRUE
return FALSE
//This function should be called on an item when it is: