Sex restriction for markings (#19894)
* Add sex restriction to markings * Apply to existing systems
This commit is contained in:
@@ -35,6 +35,7 @@ public sealed partial class MarkingPicker : Control
|
||||
private List<MarkingCategories> _markingCategories = Enum.GetValues<MarkingCategories>().ToList();
|
||||
|
||||
private string _currentSpecies = SharedHumanoidAppearanceSystem.DefaultSpecies;
|
||||
private Sex _currentSex = Sex.Unsexed;
|
||||
public Color CurrentSkinColor = Color.White;
|
||||
public Color CurrentEyeColor = Color.Black;
|
||||
public Marking? HairMarking;
|
||||
@@ -77,7 +78,7 @@ public sealed partial class MarkingPicker : Control
|
||||
}
|
||||
}
|
||||
|
||||
public void SetData(List<Marking> newMarkings, string species, Color skinColor, Color eyeColor)
|
||||
public void SetData(List<Marking> newMarkings, string species, Sex sex, Color skinColor, Color eyeColor)
|
||||
{
|
||||
var pointsProto = _prototypeManager
|
||||
.Index<SpeciesPrototype>(species).MarkingPoints;
|
||||
@@ -89,6 +90,7 @@ public sealed partial class MarkingPicker : Control
|
||||
}
|
||||
|
||||
_currentSpecies = species;
|
||||
_currentSex = sex;
|
||||
CurrentSkinColor = skinColor;
|
||||
CurrentEyeColor = eyeColor;
|
||||
|
||||
@@ -96,7 +98,7 @@ public sealed partial class MarkingPicker : Control
|
||||
PopulateUsed();
|
||||
}
|
||||
|
||||
public void SetData(MarkingSet set, string species, Color skinColor, Color eyeColor)
|
||||
public void SetData(MarkingSet set, string species, Sex sex, Color skinColor, Color eyeColor)
|
||||
{
|
||||
_currentMarkings = set;
|
||||
|
||||
@@ -106,6 +108,7 @@ public sealed partial class MarkingPicker : Control
|
||||
}
|
||||
|
||||
_currentSpecies = species;
|
||||
_currentSex = sex;
|
||||
CurrentSkinColor = skinColor;
|
||||
CurrentEyeColor = eyeColor;
|
||||
|
||||
@@ -182,8 +185,8 @@ public sealed partial class MarkingPicker : Control
|
||||
_selectedUnusedMarking = null;
|
||||
|
||||
var markings = IgnoreSpecies
|
||||
? _markingManager.MarkingsByCategory(_selectedMarkingCategory)
|
||||
: _markingManager.MarkingsByCategoryAndSpecies(_selectedMarkingCategory, _currentSpecies);
|
||||
? _markingManager.MarkingsByCategoryAndSex(_selectedMarkingCategory, _currentSex)
|
||||
: _markingManager.MarkingsByCategoryAndSpeciesAndSex(_selectedMarkingCategory, _currentSpecies, _currentSex);
|
||||
|
||||
var sortedMarkings = markings.Values.Where(m =>
|
||||
m.ID.ToLower().Contains(filter.ToLower()) ||
|
||||
@@ -319,6 +322,22 @@ public sealed partial class MarkingPicker : Control
|
||||
|
||||
_currentMarkings = new(markingList, speciesPrototype.MarkingPoints, _markingManager, _prototypeManager);
|
||||
_currentMarkings.EnsureSpecies(species, null, _markingManager);
|
||||
_currentMarkings.EnsureSexes(_currentSex, _markingManager);
|
||||
|
||||
Populate(CMarkingSearch.Text);
|
||||
PopulateUsed();
|
||||
}
|
||||
|
||||
public void SetSex(Sex sex)
|
||||
{
|
||||
_currentSex = sex;
|
||||
var markingList = _currentMarkings.GetForwardEnumerator().ToList();
|
||||
|
||||
var speciesPrototype = _prototypeManager.Index<SpeciesPrototype>(_currentSpecies);
|
||||
|
||||
_currentMarkings = new(markingList, speciesPrototype.MarkingPoints, _markingManager, _prototypeManager);
|
||||
_currentMarkings.EnsureSpecies(_currentSpecies, null, _markingManager);
|
||||
_currentMarkings.EnsureSexes(_currentSex, _markingManager);
|
||||
|
||||
Populate(CMarkingSearch.Text);
|
||||
PopulateUsed();
|
||||
|
||||
Reference in New Issue
Block a user