Class MarkingSet
Marking set. For humanoid markings.
Inheritance
Namespace: Content.Shared.Humanoid.Markings
Assembly: Content.Shared.dll
Syntax
public sealed class MarkingSet : object
Remarks
This is serializable for the admin panel that sets markings on demand for a player. Most APIs that accept a set of markings usually use a List of type Marking instead.
Constructors
| Improve this Doc View SourceMarkingSet()
Declaration
public MarkingSet()
MarkingSet(MarkingSet)
Construct a MarkingSet by deep cloning another set.
Declaration
public MarkingSet(MarkingSet other)
Parameters
Type | Name | Description |
---|---|---|
MarkingSet | other | The other marking set. |
MarkingSet(List<Marking>, MarkingManager)
Construct a MarkingSet using a dictionary of markings, without point validation. This will still validate every marking, to ensure that it can be placed into the set.
Declaration
public MarkingSet(List<Marking> markings, MarkingManager markingManager = null)
Parameters
Type | Name | Description |
---|---|---|
List<Marking> | markings | The list of markings to use. |
MarkingManager | markingManager |
MarkingSet(List<Marking>, String, MarkingManager, IPrototypeManager)
Construct a MarkingSet using a list of markings, and a points dictionary. This will set up the points dictionary, and process the list, truncating if necessary. Markings that do not exist as a prototype will be removed.
Declaration
public MarkingSet(List<Marking> markings, string pointsPrototype, MarkingManager markingManager = null, IPrototypeManager prototypeManager = null)
Parameters
Type | Name | Description |
---|---|---|
List<Marking> | markings | The lists of markings to use. |
System.String | pointsPrototype | The ID of the points dictionary prototype. |
MarkingManager | markingManager | |
Robust.Shared.Prototypes.IPrototypeManager | prototypeManager |
MarkingSet(String, MarkingManager, IPrototypeManager)
Construct a MarkingSet only with a points dictionary.
Declaration
public MarkingSet(string pointsPrototype, MarkingManager markingManager = null, IPrototypeManager prototypeManager = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | pointsPrototype | The ID of the points dictionary prototype. |
MarkingManager | markingManager | |
Robust.Shared.Prototypes.IPrototypeManager | prototypeManager |
Fields
| Improve this Doc View SourceMarkings
Every single marking in this set.
Declaration
public Dictionary<MarkingCategories, List<Marking>> Markings
Field Value
Type | Description |
---|---|
Dictionary<MarkingCategories, List<Marking>> |
Remarks
The original version of MarkingSet preserved ordering across all markings - this one should instead preserve ordering across all categories, but not marking categories themselves. This is because the layers that markings appear in are guaranteed to be in the correct order. This is here to make lookups slightly faster, even if the n of a marking set is relatively small, and to encapsulate another important feature of markings, which is the limit of markings you can put on a humanoid.
Points
Marking points for each category.
Declaration
public Dictionary<MarkingCategories, MarkingPoints> Points
Field Value
Type | Description |
---|---|
Dictionary<MarkingCategories, MarkingPoints> |
Methods
| Improve this Doc View SourceAddBack(MarkingCategories, Marking)
Add a marking to the back of the category's list of markings.
Declaration
public void AddBack(MarkingCategories category, Marking marking)
Parameters
Type | Name | Description |
---|---|---|
MarkingCategories | category | |
Marking | marking |
AddCategory(MarkingCategories)
Adds a category to this marking set.
Declaration
public List<Marking> AddCategory(MarkingCategories category)
Parameters
Type | Name | Description |
---|---|---|
MarkingCategories | category |
Returns
Type | Description |
---|---|
List<Marking> |
AddFront(MarkingCategories, Marking)
Add a marking to the front of the category's list of markings.
Declaration
public void AddFront(MarkingCategories category, Marking marking)
Parameters
Type | Name | Description |
---|---|---|
MarkingCategories | category | Category to add the marking to. |
Marking | marking | The marking instance in question. |
CategoryDifference(MarkingSet)
Gets a difference of marking categories between two marking sets
Declaration
public IEnumerable<MarkingCategories> CategoryDifference(MarkingSet other)
Parameters
Type | Name | Description |
---|---|---|
MarkingSet | other | The other marking set. |
Returns
Type | Description |
---|---|
IEnumerable<MarkingCategories> | Enumerator of marking categories that were different between the two. |
CategoryEquals(MarkingCategories, MarkingSet)
Declaration
public bool CategoryEquals(MarkingCategories category, MarkingSet other)
Parameters
Type | Name | Description |
---|---|---|
MarkingCategories | category | |
MarkingSet | other |
Returns
Type | Description |
---|---|
System.Boolean |
Clear()
Clears all markings from this marking set.
Declaration
public void Clear()
EnsureDefault(Nullable<Color>, Nullable<Color>, MarkingManager)
Ensures that the default markings as defined by the marking point set in this marking set are applied.
Declaration
public void EnsureDefault(Color? skinColor = null, Color? eyeColor = null, MarkingManager markingManager = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<Color> | skinColor | Skin color for marking coloring. |
System.Nullable<Color> | eyeColor | Eye color for marking coloring. |
MarkingManager | markingManager | Marking manager. |
EnsureSexes(Sex, MarkingManager)
Filters markings based on sex and it's restrictions in the marking's prototype from this marking set.
Declaration
public void EnsureSexes(Sex sex, MarkingManager markingManager = null)
Parameters
Type | Name | Description |
---|---|---|
Sex | sex | The species to filter. |
MarkingManager | markingManager | Marking manager. |
EnsureSpecies(String, Nullable<Color>, MarkingManager, IPrototypeManager)
Filters and colors markings based on species and it's restrictions in the marking's prototype from this marking set.
Declaration
public void EnsureSpecies(string species, Color? skinColor, MarkingManager markingManager = null, IPrototypeManager prototypeManager = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | species | The species to filter. |
System.Nullable<Color> | skinColor | The skin color for recoloring (i.e. slimes). Use null if you want only filter markings |
MarkingManager | markingManager | Marking manager. |
Robust.Shared.Prototypes.IPrototypeManager | prototypeManager | Prototype manager. |
EnsureValid(MarkingManager)
Ensures that all markings in this set are valid.
Declaration
public void EnsureValid(MarkingManager markingManager = null)
Parameters
Type | Name | Description |
---|---|---|
MarkingManager | markingManager | Marking manager. |
Equals(MarkingSet)
Declaration
public bool Equals(MarkingSet other)
Parameters
Type | Name | Description |
---|---|---|
MarkingSet | other |
Returns
Type | Description |
---|---|
System.Boolean |
FindIndexOf(MarkingCategories, String)
Attempt to find the index of a marking in a category by ID.
Declaration
public int FindIndexOf(MarkingCategories category, string id)
Parameters
Type | Name | Description |
---|---|---|
MarkingCategories | category | The category to search in. |
System.String | id | The ID to search for. |
Returns
Type | Description |
---|---|
System.Int32 | The index of the marking, otherwise a negative number. |
GetForwardEnumerator()
Gets all markings in this set as an enumerator. Lists will be organized, but categories may be in any order.
Declaration
public ForwardMarkingEnumerator GetForwardEnumerator()
Returns
Type | Description |
---|---|
ForwardMarkingEnumerator | An enumerator of Markings. |
GetForwardEnumerator(MarkingCategories)
Gets an enumerator of markings in this set, but only for one category.
Declaration
public ForwardMarkingEnumerator GetForwardEnumerator(MarkingCategories category)
Parameters
Type | Name | Description |
---|---|---|
MarkingCategories | category | The category to fetch. |
Returns
Type | Description |
---|---|
ForwardMarkingEnumerator | An enumerator of Markings in that category. |
GetReverseEnumerator()
Gets all markings in this set as an enumerator, but in reverse order. Lists will be in reverse order, but categories may be in any order.
Declaration
public ReverseMarkingEnumerator GetReverseEnumerator()
Returns
Type | Description |
---|---|
ReverseMarkingEnumerator | An enumerator of Markings in reverse. |
GetReverseEnumerator(MarkingCategories)
Gets an enumerator of markings in this set in reverse order, but only for one category.
Declaration
public ReverseMarkingEnumerator GetReverseEnumerator(MarkingCategories category)
Parameters
Type | Name | Description |
---|---|---|
MarkingCategories | category | The category to fetch. |
Returns
Type | Description |
---|---|
ReverseMarkingEnumerator | An enumerator of Markings in that category, in reverse order. |
PointsLeft(MarkingCategories)
How many points are left in this marking set's category
Declaration
public int PointsLeft(MarkingCategories category)
Parameters
Type | Name | Description |
---|---|---|
MarkingCategories | category | The category to check |
Returns
Type | Description |
---|---|
System.Int32 | A number equal or greater than zero if the category exists, -1 otherwise. |
Remove(MarkingCategories, Int32)
Remove a marking by category and index.
Declaration
public void Remove(MarkingCategories category, int idx)
Parameters
Type | Name | Description |
---|---|---|
MarkingCategories | category | The category that contains the marking. |
System.Int32 | idx | The marking's index. |
Remove(MarkingCategories, String)
Remove a marking by category and ID.
Declaration
public bool Remove(MarkingCategories category, string id)
Parameters
Type | Name | Description |
---|---|---|
MarkingCategories | category | The category that contains the marking. |
System.String | id | The marking's ID. |
Returns
Type | Description |
---|---|
System.Boolean | True if removed, false otherwise. |
RemoveCategory(MarkingCategories)
Remove an entire category from this marking set.
Declaration
public bool RemoveCategory(MarkingCategories category)
Parameters
Type | Name | Description |
---|---|---|
MarkingCategories | category | The category to remove. |
Returns
Type | Description |
---|---|
System.Boolean | True if removed, false otherwise. |
Replace(MarkingCategories, Int32, Marking)
Replace a marking at a given index in a marking category with another marking.
Declaration
public void Replace(MarkingCategories category, int index, Marking marking)
Parameters
Type | Name | Description |
---|---|---|
MarkingCategories | category | The category to replace the marking in. |
System.Int32 | index | The index of the marking. |
Marking | marking | The marking to insert. |
ShiftRankDown(MarkingCategories, Int32)
Shifts a marking's rank towards the end of the list
Declaration
public void ShiftRankDown(MarkingCategories category, int idx)
Parameters
Type | Name | Description |
---|---|---|
MarkingCategories | category | The category to shift in. |
System.Int32 | idx | Index of the marking. |
ShiftRankDownFromEnd(MarkingCategories, Int32)
Shifts a marking's rank downwards from the end of the list
Declaration
public void ShiftRankDownFromEnd(MarkingCategories category, int idx)
Parameters
Type | Name | Description |
---|---|---|
MarkingCategories | category | The category to shift in. |
System.Int32 | idx | Index of the marking from the end |
ShiftRankUp(MarkingCategories, Int32)
Shifts a marking's rank towards the front of the list
Declaration
public void ShiftRankUp(MarkingCategories category, int idx)
Parameters
Type | Name | Description |
---|---|---|
MarkingCategories | category | The category to shift in. |
System.Int32 | idx | Index of the marking. |
ShiftRankUpFromEnd(MarkingCategories, Int32)
Shifts a marking's rank upwards from the end of the list
Declaration
public void ShiftRankUpFromEnd(MarkingCategories category, int idx)
Parameters
Type | Name | Description |
---|---|---|
MarkingCategories | category | The category to shift in. |
System.Int32 | idx | Index of the marking from the end |
TryGetCategory(MarkingCategories, out Nullable<IReadOnlyList<Marking>>)
Tries to get an entire category from this marking set.
Declaration
public bool TryGetCategory(MarkingCategories category, out IReadOnlyList<Marking>? markings)
Parameters
Type | Name | Description |
---|---|---|
MarkingCategories | category | The category to fetch. |
System.Nullable<IReadOnlyList<Marking>> | markings | A read only list of the all markings in that category. |
Returns
Type | Description |
---|---|
System.Boolean | True if successful, false otherwise. |
TryGetMarking(MarkingCategories, String, out Marking)
Tries to get a marking from this marking set, by category.
Declaration
public bool TryGetMarking(MarkingCategories category, string id, out Marking marking)
Parameters
Type | Name | Description |
---|---|---|
MarkingCategories | category | The category to search in. |
System.String | id | The ID to search for. |
Marking | marking | The marking, if it was retrieved. |
Returns
Type | Description |
---|---|
System.Boolean | True if successful, false otherwise. |