Sex restriction for markings (#19894)
* Add sex restriction to markings * Apply to existing systems
This commit is contained in:
@@ -170,11 +170,11 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
|
||||
var facialHair = new Marking(profile.Appearance.FacialHairStyleId,
|
||||
new[] { facialHairColor });
|
||||
|
||||
if (_markingManager.CanBeApplied(profile.Species, hair, _prototypeManager))
|
||||
if (_markingManager.CanBeApplied(profile.Species, profile.Sex, hair, _prototypeManager))
|
||||
{
|
||||
markings.AddBack(MarkingCategories.Hair, hair);
|
||||
}
|
||||
if (_markingManager.CanBeApplied(profile.Species, facialHair, _prototypeManager))
|
||||
if (_markingManager.CanBeApplied(profile.Species, profile.Sex, facialHair, _prototypeManager))
|
||||
{
|
||||
markings.AddBack(MarkingCategories.FacialHair, facialHair);
|
||||
}
|
||||
@@ -192,6 +192,7 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
|
||||
}
|
||||
|
||||
markings.EnsureSpecies(profile.Species, profile.Appearance.SkinColor, _markingManager, _prototypeManager);
|
||||
markings.EnsureSexes(profile.Sex, _markingManager);
|
||||
markings.EnsureDefault(
|
||||
profile.Appearance.SkinColor,
|
||||
profile.Appearance.EyeColor,
|
||||
|
||||
@@ -42,7 +42,7 @@ public sealed class HumanoidMarkingModifierBoundUserInterface : BoundUserInterfa
|
||||
return;
|
||||
}
|
||||
|
||||
_window.SetState(cast.MarkingSet, cast.Species, cast.SkinColor, cast.CustomBaseLayers);
|
||||
_window.SetState(cast.MarkingSet, cast.Species, cast.Sex, cast.SkinColor, cast.CustomBaseLayers);
|
||||
}
|
||||
|
||||
private void SendMarkingSet(MarkingSet set)
|
||||
|
||||
@@ -63,6 +63,7 @@ public sealed partial class HumanoidMarkingModifierWindow : DefaultWindow
|
||||
public void SetState(
|
||||
MarkingSet markings,
|
||||
string species,
|
||||
Sex sex,
|
||||
Color skinColor,
|
||||
Dictionary<HumanoidVisualLayers, CustomBaseLayerInfo> info
|
||||
)
|
||||
@@ -84,7 +85,7 @@ public sealed partial class HumanoidMarkingModifierWindow : DefaultWindow
|
||||
eyesColor = eyes.Color.Value;
|
||||
}
|
||||
|
||||
MarkingPickerWidget.SetData(markings, species, skinColor, eyesColor);
|
||||
MarkingPickerWidget.SetData(markings, species, sex, skinColor, eyesColor);
|
||||
}
|
||||
|
||||
private sealed class HumanoidBaseLayerModifier : BoxContainer
|
||||
|
||||
@@ -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