Space Station 13 - Modules - Types


What is the purpose of Traits?

The main-purpose of traits is to make it easier to adhere to the Open-Closed Principle. When adding a new mob type or species, instead of having to go over all potential interactions and add additional checks for that particular mob or species, simply grant them appropriate traits to achieve the effects that you desire.

As a specific example: Previously water checked for either the mob type /mob/living/carbon/slime or a species with the IS_SLIME tag, now simply checks for the trait "Water Allergy". Should one wish to add an additional mob or species with similar reaction to water, one simply grant them said trait.

What is a Trait?
  • A trait is at this time simply a /decl with a name, description, and potency:
    • Simply has the trait, or:
    • Minor/Moderate/Major (or a subset thereof)
  • Traits are currently primarily checked for during various interactions between chemicals and mobs, but can potentially be used anywhere a mob type or species check is currently made.
  • Trait checks can either merely check if a mob has a given trait, or have the trait potency affect the effect of the interaction.
  • Can be used by both /mob/living and /datum/species subtypes. In the latter case traits are granted to all /mob/living/carbon instances of a given species.
What makes a good Trait?

If you plan to add your own trait, it's worthwhile to consider the following points:

  • A trait should potentially be applicable to multiple types of mobs or species.
  • However, a trait rarely being applicable to multiple mobs or species is fine, e.g. the "Serpentid Adapted" trait which is currently only relevant to the GAS.
  • A trait should generally not be too specific, though there are exceptions.
    • "Acetone Resistance" is too specific, due to acetone being a relatively basic chemical.
    • "Solvent Resistance" is more appropriate, due to covering a wider range of cases.
    • "Phoron Resistance" is acceptable, due to Phoron being such an exotic matter.
Future Potential

Traits do not necessarily have to be granted to entire /mob/living or /datum/species types, it is technically possible to grant them to individual mob instances as there are procs for doing so.

Some examples for those inclined to implement practical uses:

  • "Toughness": Increases a mob's max health and/or damage resistance.
  • "Precise": Increases a mob's ability to hit objects, or avoid traps.
  • "Clumsy": Decreases a mob's ability to handle objects with dexterity and finesse.

However, to reach the highest potential of utilizing individual traits in this manner further work should be done to deal with the situation of multiple sources wanting to add/remove the same trait.