Skip to content

Commit

Permalink
Merge pull request #3611 from out-of-phaze/feature/required-bodytypes
Browse files Browse the repository at this point in the history
Replace sprite accessory required_gender with bodytypes_allowed/bodytypes_denied
  • Loading branch information
MistakeNot4892 authored Jan 23, 2024
2 parents ce00d2b + 2d1f70e commit f096d40
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
12 changes: 8 additions & 4 deletions code/modules/sprite_accessories/_accessory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
var/icon
/// the icon_state of the accessory
var/icon_state
/// Restricted to specific genders. null matches any
var/required_gender
/// Restricted to specific bodytypes. null matches any
var/list/decl/bodytype/bodytypes_allowed
/// Restricted from specific bodytypes. null matches none
var/list/decl/bodytype/bodytypes_denied
/// Restrict some styles to specific root species names
var/list/species_allowed = list(SPECIES_HUMAN)
/// Restrict some styles to specific species names, irrespective of root species name
Expand Down Expand Up @@ -65,8 +67,6 @@
var/list/disallows_accessories

/decl/sprite_accessory/proc/accessory_is_available(var/mob/owner, var/decl/species/species, var/decl/bodytype/bodytype)
if(!isnull(required_gender) && bodytype.associated_gender != required_gender)
return FALSE
if(species)
var/species_is_permitted = TRUE
if(species_allowed)
Expand All @@ -76,6 +76,10 @@
if(!species_is_permitted)
return FALSE
if(bodytype)
if(LAZYLEN(bodytypes_allowed) && !(bodytype.type in bodytypes_allowed))
return FALSE
if(LAZYISIN(bodytypes_denied, bodytype.type))
return FALSE
if(!isnull(bodytype_categories_allowed) && !(bodytype.bodytype_category in bodytype_categories_allowed))
return FALSE
if(!isnull(bodytype_categories_denied) && (bodytype.bodytype_category in bodytype_categories_denied))
Expand Down
3 changes: 2 additions & 1 deletion code/modules/sprite_accessories/_accessory_facial.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
/decl/sprite_accessory/facial_hair/shaved
name = "Shaved"
icon_state = "bald"
required_gender = null
bodytypes_allowed = null
bodytypes_denied = null
species_allowed = null
subspecies_allowed = null
bodytype_categories_allowed = null
Expand Down
3 changes: 2 additions & 1 deletion code/modules/sprite_accessories/_accessory_hair.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
name = "Bald"
icon_state = "bald"
flags = VERY_SHORT | HAIR_BALD
required_gender = null
bodytypes_allowed = null
bodytypes_denied = null
species_allowed = null
subspecies_allowed = null
bodytype_categories_allowed = null
Expand Down

0 comments on commit f096d40

Please sign in to comment.