- Fixed issue where apparel settings were not being saved between sessions
- Using the 'set all true / false' buttons in the apparel settings now only applies to the apparel that are currently displayed in the configuration table
- Added default apparel settings for Biotech apparel
- Set up the strings used in the apparel configuration table menu to be translatable
This commit is contained in:
AbstractConcept 2023-02-11 15:05:49 -06:00
parent e139ff14fb
commit 91b3a80400
13 changed files with 193 additions and 199 deletions

View file

@ -1,3 +1,9 @@
Change log v 2.0.7
- Fixed issue where apparel settings were not being saved between sessions
- Using the 'set all true / false' buttons in the apparel settings now only applies to the apparel that are currently displayed in the configuration table
- Added default apparel settings for Biotech apparel
- Set up the strings used in the apparel configuration table menu to be translatable
Change log v 2.0.6 Change log v 2.0.6
- Fixed an issue where body addons with custom sizes were not scaling correctly - Fixed an issue where body addons with custom sizes were not scaling correctly
- Added additional debugging option which disables the patching of c0ffeeee's animation system - to be used to assist in determining if bugs or other issues are related to this patching - Added additional debugging option which disables the patching of c0ffeeee's animation system - to be used to assist in determining if bugs or other issues are related to this patching

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest> <Manifest>
<version>2.0.6</version> <version>2.0.7</version>
<downloadUri>https://gitgud.io/AbstractConcept/rimworld-animations-patch</downloadUri> <downloadUri>https://gitgud.io/AbstractConcept/rimworld-animations-patch</downloadUri>
</Manifest> </Manifest>

View file

@ -25,6 +25,7 @@
<show_hands> Add animated hands to animations</show_hands> <show_hands> Add animated hands to animations</show_hands>
<show_hands_desc>Requires RimNudeWorld. This feature can be performance intense. If you have large colonies (50+ colonist), you may wish to turn this off.</show_hands_desc> <show_hands_desc>Requires RimNudeWorld. This feature can be performance intense. If you have large colonies (50+ colonist), you may wish to turn this off.</show_hands_desc>
<!-- Apparel settings-->
<rimworld_animation_patch_clothing>Clothing options</rimworld_animation_patch_clothing> <rimworld_animation_patch_clothing>Clothing options</rimworld_animation_patch_clothing>
<crop_apparel> Crop the bottoms of worn shirts, tank tops, etc. when not wearing pants or a skirt</crop_apparel> <crop_apparel> Crop the bottoms of worn shirts, tank tops, etc. when not wearing pants or a skirt</crop_apparel>
<crop_apparel_desc>Only applies to torso covering apparel that lies directly on the skin and that does not cover the legs - best used alongside mods that draw pants on pawns, like the Visible Pants mod.\n\nThis setting will not be applied if you are using the Sized Apparel mod.\n\nRequires that the game to be reset if you wish to toggle it off.</crop_apparel_desc> <crop_apparel_desc>Only applies to torso covering apparel that lies directly on the skin and that does not cover the legs - best used alongside mods that draw pants on pawns, like the Visible Pants mod.\n\nThis setting will not be applied if you are using the Sized Apparel mod.\n\nRequires that the game to be reset if you wish to toggle it off.</crop_apparel_desc>
@ -35,4 +36,18 @@
<wearing_clothes_for_quickies> Preferred state of dress for people having a quickie</wearing_clothes_for_quickies> <wearing_clothes_for_quickies> Preferred state of dress for people having a quickie</wearing_clothes_for_quickies>
<wearing_clothes_for_quickies_desc></wearing_clothes_for_quickies_desc> <wearing_clothes_for_quickies_desc></wearing_clothes_for_quickies_desc>
<apparel_button_desc>List of apparel that covers the legs and/or torso. Use the provided drop down menu to load apparel settings for different mods.</apparel_button_desc>
<covers_groin>Hides\ngroin</covers_groin>
<covers_groin_desc>Toggles whether genitials should be hidden when wearing this apparel.</covers_groin_desc>
<covers_belly>Hides\nbelly</covers_belly>
<covers_belly_desc>Toggles whether an enlarged belly should be hidden when wearing this apparel.</covers_belly_desc>
<covers_chest>Hides\nbreasts</covers_chest>
<covers_chest_desc>Toggles whether breasts should be hidden when wearing this apparel.</covers_chest_desc>
<sex_wear>Sex-wear</sex_wear>
<sex_wear_desc>Toggles whether this piece of apparel should always be kept on during lovin'</sex_wear_desc>
<set_all_true>Set all 'true'</set_all_true>
<set_all_false>Set all 'false'</set_all_false>
<reset_to_defaults>Reset to\ndefaults</reset_to_defaults>
<reset_to_defaults_desc>Returns all values in this table to their default state.</reset_to_defaults_desc>
</LanguageData> </LanguageData>

View file

@ -192,7 +192,7 @@ namespace Rimworld_Animations_Patch
if (comp?.rimNudeDataStatus == RimNudeDataStatus.NotLoaded) if (comp?.rimNudeDataStatus == RimNudeDataStatus.NotLoaded)
{ {
RimNudeData rimNudeData = ApparelSettings.GetRimNudeData(comp?.apparel); RimNudeData rimNudeData = ApparelSettingsUtility.GetRimNudeData(comp?.apparel);
if (rimNudeData == null) if (rimNudeData == null)
{ {

View file

@ -86,7 +86,7 @@ namespace Rimworld_Animations_Patch
public static bool Prefix_DrawAddons(PawnRenderFlags renderFlags, Vector3 vector, Vector3 headOffset, Pawn pawn, Quaternion quat, Rot4 rotation) public static bool Prefix_DrawAddons(PawnRenderFlags renderFlags, Vector3 vector, Vector3 headOffset, Pawn pawn, Quaternion quat, Rot4 rotation)
{ {
if (!(pawn.def is ThingDef_AlienRace alienProps) || renderFlags.FlagSet(PawnRenderFlags.Invisible)) return true; if (!(pawn.def is ThingDef_AlienRace alienProps) || renderFlags.FlagSet(PawnRenderFlags.Invisible)) return true;
// Get actor components and body addons // Get actor components and body addons
List<AlienPartGenerator.BodyAddon> bodyAddons = alienProps.alienRace.generalSettings.alienPartGenerator.bodyAddons; List<AlienPartGenerator.BodyAddon> bodyAddons = alienProps.alienRace.generalSettings.alienPartGenerator.bodyAddons;
AlienPartGenerator.AlienComp alienComp = pawn.GetComp<AlienPartGenerator.AlienComp>(); AlienPartGenerator.AlienComp alienComp = pawn.GetComp<AlienPartGenerator.AlienComp>();
@ -116,9 +116,9 @@ namespace Rimworld_Animations_Patch
Graphic addonGraphic = alienComp.addonGraphics[i]; Graphic addonGraphic = alienComp.addonGraphics[i];
BodyAddonData bodyAddonDatum = sexDataComp.GetBodyAddonData(bodyAddon, renderFlags.FlagSet(PawnRenderFlags.Portrait)); BodyAddonData bodyAddonDatum = sexDataComp.GetBodyAddonData(bodyAddon, renderFlags.FlagSet(PawnRenderFlags.Portrait));
if (bodyAddonDatum == null) continue; if (bodyAddonDatum == null) continue;
// Can draw? // Can draw?
bool canDraw = addonGraphic.path.Contains("featureless", StringComparison.OrdinalIgnoreCase) == false && bodyAddonDatum.CanDraw(); bool canDraw = bodyAddonDatum.CanDraw();
bool drawHand = BasicSettings.showHands && handsAvailableCount > 0 && renderFlags.FlagSet(PawnRenderFlags.Portrait) == false; bool drawHand = BasicSettings.showHands && handsAvailableCount > 0 && renderFlags.FlagSet(PawnRenderFlags.Portrait) == false;
if (canDraw == false && drawHand == false) if (canDraw == false && drawHand == false)

View file

@ -23,20 +23,7 @@ namespace Rimworld_Animations_Patch
Scribe_Values.Look(ref cropApparel, "cropApparel", false); Scribe_Values.Look(ref cropApparel, "cropApparel", false);
Scribe_Values.Look(ref clothesThrownOnGround, "clothesThrownOnGround", true); Scribe_Values.Look(ref clothesThrownOnGround, "clothesThrownOnGround", true);
Scribe_Values.Look(ref apparelWornForQuickies, "apparelWornForQuickies", RJWPreferenceSettings.Clothing.Clothed); Scribe_Values.Look(ref apparelWornForQuickies, "apparelWornForQuickies", RJWPreferenceSettings.Clothing.Clothed);
} Scribe_Collections.Look(ref rimNudeData, "rimNudeData", LookMode.Deep);
public static RimNudeData GetRimNudeData(Apparel apparel)
{
if (rimNudeData.NullOrEmpty())
{ ApparelSettingsUtility.ResetRimNudeData(rimNudeData); }
foreach (RimNudeData apparelData in rimNudeData)
{
if (apparelData.EquivalentTo(new RimNudeData(apparel.def)))
{ return apparelData; }
}
return null;
} }
} }
@ -70,6 +57,7 @@ namespace Rimworld_Animations_Patch
public ApparelSettingsDisplay(ModContentPack content) : base(content) public ApparelSettingsDisplay(ModContentPack content) : base(content)
{ {
ApparelSettings.rimNudeData = new List<RimNudeData>();
GetSettings<ApparelSettings>(); GetSettings<ApparelSettings>();
} }
@ -183,8 +171,7 @@ namespace Rimworld_Animations_Patch
} }
// Ensure that all apparel has associated RimNudeData // Ensure that all apparel has associated RimNudeData
if (ApparelSettings.rimNudeData.NullOrEmpty()) if (ApparelSettings.rimNudeData.NullOrEmpty()) ApparelSettingsUtility.ResetRimNudeData();
{ ApparelSettingsUtility.ResetRimNudeData(ApparelSettings.rimNudeData); }
// Add buttons to the top of the main window // Add buttons to the top of the main window
innerX = halfColumnWidth; innerX = halfColumnWidth;
@ -194,9 +181,9 @@ namespace Rimworld_Animations_Patch
// Apparel // Apparel
tempRect = new Rect(innerX + SettingsUtility.Align(labelWidth, doubleColumnWidth), windowY - headerHeight - 5, labelWidth, headerHeight); tempRect = new Rect(innerX + SettingsUtility.Align(labelWidth, doubleColumnWidth), windowY - headerHeight - 5, labelWidth, headerHeight);
Widgets.DrawHighlightIfMouseover(tempRect); Widgets.DrawHighlightIfMouseover(tempRect);
TooltipHandler.TipRegion(tempRect, "List of apparel that covers the legs and/or torso. Use the provided drop down menu to load apparel settings for different mods."); TooltipHandler.TipRegion(tempRect, "apparel_button_desc".Translate());
if (Widgets.ButtonText(tempRect, "Apparel - " + currentModContentPack.ModMetaData.Name)) { if (Widgets.ButtonText(tempRect, currentModContentPack.ModMetaData.Name)) {
List<FloatMenuOption> options = new List<FloatMenuOption> { }; List<FloatMenuOption> options = new List<FloatMenuOption> { };
foreach (ModContentPack modContentPack in relevantModContentPacks) foreach (ModContentPack modContentPack in relevantModContentPacks)
@ -217,17 +204,17 @@ namespace Rimworld_Animations_Patch
// Covers groin // Covers groin
tempRect = new Rect(innerX + SettingsUtility.Align(buttonWidth, singleColumnWidth), windowY - headerHeight - 5, buttonWidth, headerHeight); tempRect = new Rect(innerX + SettingsUtility.Align(buttonWidth, singleColumnWidth), windowY - headerHeight - 5, buttonWidth, headerHeight);
Widgets.DrawHighlightIfMouseover(tempRect); Widgets.DrawHighlightIfMouseover(tempRect);
TooltipHandler.TipRegion(tempRect, "Toggles whether genitials should be hidden when wearing this apparel."); TooltipHandler.TipRegion(tempRect, "covers_groin_desc".Translate());
if (Widgets.ButtonText(tempRect, "Covers\ngroin")) if (Widgets.ButtonText(tempRect, "covers_groin".Translate()))
{ {
List<FloatMenuOption> options = new List<FloatMenuOption> List<FloatMenuOption> options = new List<FloatMenuOption>
{ {
new FloatMenuOption("Set all 'true'", delegate() new FloatMenuOption("set_all_true".Translate(), delegate()
{ ApparelSettingsUtility.SetAllCoversGroin(ApparelSettings.rimNudeData, true); { ApparelSettingsUtility.SetAllCoversGroin(shortListedApparelDefs, true);
}, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0), }, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0),
new FloatMenuOption("Set all 'false'", delegate() new FloatMenuOption("set_all_false".Translate(), delegate()
{ ApparelSettingsUtility.SetAllCoversGroin(ApparelSettings.rimNudeData, false); { ApparelSettingsUtility.SetAllCoversGroin(shortListedApparelDefs, false);
}, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0), }, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0),
}; Find.WindowStack.Add(new FloatMenu(options)); }; Find.WindowStack.Add(new FloatMenu(options));
}; innerX += singleColumnWidth; }; innerX += singleColumnWidth;
@ -235,17 +222,17 @@ namespace Rimworld_Animations_Patch
// Covers belly // Covers belly
tempRect = new Rect(innerX + SettingsUtility.Align(buttonWidth, singleColumnWidth), windowY - headerHeight - 5, buttonWidth, headerHeight); tempRect = new Rect(innerX + SettingsUtility.Align(buttonWidth, singleColumnWidth), windowY - headerHeight - 5, buttonWidth, headerHeight);
Widgets.DrawHighlightIfMouseover(tempRect); Widgets.DrawHighlightIfMouseover(tempRect);
TooltipHandler.TipRegion(tempRect, "Toggles whether an enlarged belly should be hidden when wearing this apparel."); TooltipHandler.TipRegion(tempRect, "covers_belly_desc".Translate());
if (Widgets.ButtonText(tempRect, "Covers\nbelly")) if (Widgets.ButtonText(tempRect, "covers_belly".Translate()))
{ {
List<FloatMenuOption> options = new List<FloatMenuOption> List<FloatMenuOption> options = new List<FloatMenuOption>
{ {
new FloatMenuOption("Set all 'true'", delegate() new FloatMenuOption("set_all_true".Translate(), delegate()
{ ApparelSettingsUtility.SetAllCoversBelly(ApparelSettings.rimNudeData, true); { ApparelSettingsUtility.SetAllCoversBelly(shortListedApparelDefs, true);
}, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0), }, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0),
new FloatMenuOption("Set all 'false'", delegate() new FloatMenuOption("set_all_false".Translate(), delegate()
{ ApparelSettingsUtility.SetAllCoversBelly(ApparelSettings.rimNudeData, false); { ApparelSettingsUtility.SetAllCoversBelly(shortListedApparelDefs, false);
}, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0), }, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0),
}; Find.WindowStack.Add(new FloatMenu(options)); }; Find.WindowStack.Add(new FloatMenu(options));
}; innerX += singleColumnWidth; }; innerX += singleColumnWidth;
@ -253,17 +240,17 @@ namespace Rimworld_Animations_Patch
// Covers belly // Covers belly
tempRect = new Rect(innerX + SettingsUtility.Align(buttonWidth, singleColumnWidth), windowY - headerHeight - 5, buttonWidth, headerHeight); tempRect = new Rect(innerX + SettingsUtility.Align(buttonWidth, singleColumnWidth), windowY - headerHeight - 5, buttonWidth, headerHeight);
Widgets.DrawHighlightIfMouseover(tempRect); Widgets.DrawHighlightIfMouseover(tempRect);
TooltipHandler.TipRegion(tempRect, "Toggles whether this apparel conceals breasts."); TooltipHandler.TipRegion(tempRect, "covers_chest_desc".Translate());
if (Widgets.ButtonText(tempRect, "Covers\nbreasts")) if (Widgets.ButtonText(tempRect, "covers_chest".Translate()))
{ {
List<FloatMenuOption> options = new List<FloatMenuOption> List<FloatMenuOption> options = new List<FloatMenuOption>
{ {
new FloatMenuOption("Set all 'true'", delegate() new FloatMenuOption("set_all_true".Translate(), delegate()
{ ApparelSettingsUtility.SetAllCoversChest(ApparelSettings.rimNudeData, true); { ApparelSettingsUtility.SetAllCoversChest(shortListedApparelDefs, true);
}, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0), }, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0),
new FloatMenuOption("Set all 'false'", delegate() new FloatMenuOption("set_all_false".Translate(), delegate()
{ ApparelSettingsUtility.SetAllCoversChest(ApparelSettings.rimNudeData, false); { ApparelSettingsUtility.SetAllCoversChest(shortListedApparelDefs, false);
}, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0), }, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0),
}; Find.WindowStack.Add(new FloatMenu(options)); }; Find.WindowStack.Add(new FloatMenu(options));
}; innerX += singleColumnWidth; }; innerX += singleColumnWidth;
@ -271,17 +258,17 @@ namespace Rimworld_Animations_Patch
// Sex wear // Sex wear
tempRect = new Rect(innerX + SettingsUtility.Align(buttonWidth, singleColumnWidth), windowY - headerHeight - 5, buttonWidth, headerHeight); tempRect = new Rect(innerX + SettingsUtility.Align(buttonWidth, singleColumnWidth), windowY - headerHeight - 5, buttonWidth, headerHeight);
Widgets.DrawHighlightIfMouseover(tempRect); Widgets.DrawHighlightIfMouseover(tempRect);
TooltipHandler.TipRegion(tempRect, "Toggles whether this piece of apparel should always be kept on during lovin'"); TooltipHandler.TipRegion(tempRect, "sex_wear_desc".Translate());
if (Widgets.ButtonText(tempRect, "Sex-wear")) if (Widgets.ButtonText(tempRect, "sex_wear".Translate()))
{ {
List<FloatMenuOption> options = new List<FloatMenuOption> List<FloatMenuOption> options = new List<FloatMenuOption>
{ {
new FloatMenuOption("Set all 'true'", delegate() new FloatMenuOption("set_all_true".Translate(), delegate()
{ ApparelSettingsUtility.SetAllSexWear(ApparelSettings.rimNudeData, true); { ApparelSettingsUtility.SetAllSexWear(shortListedApparelDefs, true);
}, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0), }, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0),
new FloatMenuOption("Set all 'false'", delegate() new FloatMenuOption("set_all_false".Translate(), delegate()
{ ApparelSettingsUtility.SetAllSexWear(ApparelSettings.rimNudeData, false); { ApparelSettingsUtility.SetAllSexWear(shortListedApparelDefs, false);
}, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0), }, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0),
}; Find.WindowStack.Add(new FloatMenu(options)); }; Find.WindowStack.Add(new FloatMenu(options));
}; innerX += singleColumnWidth; }; innerX += singleColumnWidth;
@ -289,10 +276,10 @@ namespace Rimworld_Animations_Patch
// Reset button // Reset button
tempRect = new Rect(innerX + SettingsUtility.Align(buttonWidth, singleColumnWidth), windowY - headerHeight - 5, buttonWidth, headerHeight); tempRect = new Rect(innerX + SettingsUtility.Align(buttonWidth, singleColumnWidth), windowY - headerHeight - 5, buttonWidth, headerHeight);
Widgets.DrawHighlightIfMouseover(tempRect); Widgets.DrawHighlightIfMouseover(tempRect);
TooltipHandler.TipRegion(tempRect, "Returns all values in this table to their default state."); TooltipHandler.TipRegion(tempRect, "reset_to_defaults_desc".Translate());
if (Widgets.ButtonText(tempRect, "Reset to\ndefaults")) if (Widgets.ButtonText(tempRect, "reset_to_defaults".Translate()))
{ ApparelSettingsUtility.ResetRimNudeData(ApparelSettings.rimNudeData); }; innerX += singleColumnWidth + scrollBarWidthMargin; { ApparelSettingsUtility.ResetRimNudeData(shortListedApparelDefs); }; innerX += singleColumnWidth + scrollBarWidthMargin;
// Determine the height of the scrollable area // Determine the height of the scrollable area
int apparelCount = shortListedApparelDefs.Count(); int apparelCount = shortListedApparelDefs.Count();
@ -319,7 +306,7 @@ namespace Rimworld_Animations_Patch
innerY = (float)num * (rowHeight); innerY = (float)num * (rowHeight);
num++; num++;
RimNudeData rimNudeApparel = ApparelSettings.rimNudeData.First(x => x.EquivalentTo(new RimNudeData(thingDef))); RimNudeData rimNudeApparel = ApparelSettingsUtility.GetRimNudeData(thingDef);
// Apparel symbol // Apparel symbol
Widgets.ThingIcon(new Rect(innerX + SettingsUtility.Align(widgetWidth, halfColumnWidth), innerY + SettingsUtility.Align(widgetHeight, rowHeight), widgetWidth, widgetHeight), thingDef, null, null, 1f, null); Widgets.ThingIcon(new Rect(innerX + SettingsUtility.Align(widgetWidth, halfColumnWidth), innerY + SettingsUtility.Align(widgetHeight, rowHeight), widgetWidth, widgetHeight), thingDef, null, null, 1f, null);

View file

@ -104,7 +104,7 @@ namespace Rimworld_Animations_Patch
if (comp == null) continue; if (comp == null) continue;
if (apparel.def is bondage_gear_def) continue; if (apparel.def is bondage_gear_def) continue;
if (ApparelSettings.GetRimNudeData(apparel) != null && ApparelSettings.GetRimNudeData(apparel).sexWear) continue; if (ApparelSettingsUtility.GetRimNudeData(apparel)?.sexWear == true) continue;
if (clothingPreference == RJWPreferenceSettings.Clothing.Nude || undressForRitual || undressForParty) if (clothingPreference == RJWPreferenceSettings.Clothing.Nude || undressForRitual || undressForParty)
{ {

View file

@ -32,189 +32,175 @@ namespace Rimworld_Animations_Patch
cachedApparelTextures.Clear(); cachedApparelTextures.Clear();
} }
public static bool IsApparelOfInterest(ThingDef thingDef)
{
if (thingDef.IsApparel == false) return false;
return thingDef.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) ||
thingDef.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs) ||
thingDef.apparel.bodyPartGroups.Contains(PatchBodyPartGroupDefOf.GenitalsBPG) ||
thingDef.apparel.bodyPartGroups.Contains(PatchBodyPartGroupDefOf.ChestBPG);
}
public static List<ThingDef> GetApparelOfInterest() public static List<ThingDef> GetApparelOfInterest()
{ {
List<ThingDef> thingDefs = new List<ThingDef>(); List<ThingDef> thingDefs = new List<ThingDef>();
foreach (ThingDef thingDef in DefDatabase<ThingDef>.AllDefs) foreach (ThingDef thingDef in DefDatabase<ThingDef>.AllDefs)
{ {
if (thingDef.IsApparel && if (IsApparelOfInterest(thingDef))
(thingDef.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) ||
thingDef.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs) ||
thingDef.apparel.bodyPartGroups.Contains(PatchBodyPartGroupDefOf.GenitalsBPG) ||
thingDef.apparel.bodyPartGroups.Contains(PatchBodyPartGroupDefOf.ChestBPG)))
{ thingDefs.Add(thingDef); } { thingDefs.Add(thingDef); }
} }
return thingDefs; return thingDefs;
} }
// Resets all data // Get data
public static void ResetRimNudeData(List<RimNudeData> rimNudeData) public static RimNudeData GetRimNudeData(ThingDef thingDef)
{ {
rimNudeData.Clear(); if (ApparelSettings.rimNudeData.NullOrEmpty()) ResetRimNudeData();
List<ThingDef> thingDefs = GetApparelOfInterest(); if (IsApparelOfInterest(thingDef) == false) return null;
foreach (RimNudeData rimNudeData in ApparelSettings.rimNudeData)
{
if (rimNudeData.EquivalentTo(new RimNudeData(thingDef)))
{ return rimNudeData; }
}
var newRimNudeData = GetApparelDefault(thingDef);
if (newRimNudeData == null) newRimNudeData = new RimNudeData(thingDef);
ApparelSettings.rimNudeData.Add(newRimNudeData);
return newRimNudeData;
}
public static RimNudeData GetRimNudeData(Apparel apparel)
{
return GetRimNudeData(apparel.def);
}
// Reset all data
public static void ResetRimNudeData()
{
ApparelSettings.rimNudeData = new List<RimNudeData>();
foreach (ThingDef thingDef in GetApparelOfInterest())
{
var newRimNudeData = GetApparelDefault(thingDef);
if (newRimNudeData == null) newRimNudeData = new RimNudeData(thingDef);
ApparelSettings.rimNudeData.Add(newRimNudeData);
}
}
// Reset some data
public static void ResetRimNudeData(List<ThingDef> thingDefs)
{
if (ApparelSettings.rimNudeData.NullOrEmpty()) ResetRimNudeData();
foreach (ThingDef thingDef in thingDefs) foreach (ThingDef thingDef in thingDefs)
{ {
for (int i = 0; i < 5; i++) var newRimNudeData = GetApparelDefault(thingDef);
{ rimNudeData.Add(new RimNudeData(thingDef)); } if (newRimNudeData == null) newRimNudeData = new RimNudeData(thingDef);
}
GetApparelDefaults(rimNudeData); RimNudeData rimNudeData = ApparelSettings.rimNudeData.FirstOrDefault(x => x.EquivalentTo(new RimNudeData(thingDef)));
rimNudeData.coversGroin = newRimNudeData.coversGroin;
rimNudeData.coversBelly = newRimNudeData.coversBelly;
rimNudeData.coversChest = newRimNudeData.coversChest;
rimNudeData.sexWear = newRimNudeData.sexWear;
}
} }
// Update apparel data public static void SetAllCoversGroin(List<ThingDef> thingDefs, bool value)
public static void UpdateRimNudeData(List<RimNudeData> rimNudeData, string thingDef, bool coversGroin, bool coversBelly, bool coversChest, bool sexWear)
{ {
for (int i = 0; i < rimNudeData.Count; i++) foreach (ThingDef thingDef in thingDefs)
{ {
RimNudeData apparelData = rimNudeData[i]; RimNudeData rimNudeApparel = ApparelSettings.rimNudeData.First(x => x.EquivalentTo(new RimNudeData(thingDef)));
rimNudeApparel.coversGroin = value;
if (apparelData.thingDef == thingDef)
{
rimNudeData[i] = new RimNudeData(thingDef, coversGroin, coversBelly, coversChest, sexWear);
return;
}
} }
} }
public static void SetAllCoversGroin(List<RimNudeData> rimNudeData, bool value) public static void SetAllCoversBelly(List<ThingDef> thingDefs, bool value)
{ {
foreach (RimNudeData rimNudeApparel in rimNudeData) foreach (ThingDef thingDef in thingDefs)
{ rimNudeApparel.coversGroin = value; } {
RimNudeData rimNudeApparel = ApparelSettings.rimNudeData.First(x => x.EquivalentTo(new RimNudeData(thingDef)));
rimNudeApparel.coversBelly = value;
}
} }
public static void SetAllCoversBelly(List<RimNudeData> rimNudeData, bool value) public static void SetAllCoversChest(List<ThingDef> thingDefs, bool value)
{ {
foreach (RimNudeData rimNudeApparel in rimNudeData) foreach (ThingDef thingDef in thingDefs)
{ rimNudeApparel.coversBelly = value; } {
RimNudeData rimNudeApparel = ApparelSettings.rimNudeData.First(x => x.EquivalentTo(new RimNudeData(thingDef)));
rimNudeApparel.coversChest = value;
}
} }
public static void SetAllCoversChest(List<RimNudeData> rimNudeData, bool value) public static void SetAllSexWear(List<ThingDef> thingDefs, bool value)
{ {
foreach (RimNudeData rimNudeApparel in rimNudeData) foreach (ThingDef thingDef in thingDefs)
{ rimNudeApparel.coversChest = value; } {
RimNudeData rimNudeApparel = ApparelSettings.rimNudeData.First(x => x.EquivalentTo(new RimNudeData(thingDef)));
rimNudeApparel.sexWear = value;
}
} }
public static void SetAllSexWear(List<RimNudeData> rimNudeData, bool value) public static RimNudeData GetApparelDefault(ThingDef thingDef)
{ {
foreach (RimNudeData rimNudeApparel in rimNudeData) foreach(RimNudeData rimNudeData in apparelDefaults)
{ rimNudeApparel.sexWear = value; } {
if (rimNudeData.thingDef == thingDef.defName)
{ return rimNudeData; }
}
return null;
} }
public static void GetApparelDefaults(List<RimNudeData> rimNudeData) public static List<RimNudeData> apparelDefaults = new List<RimNudeData>()
{ {
//Apparel_BasicShirt new RimNudeData("Apparel_BasicShirt", coversGroin: false, coversBelly: true, coversChest: true, sexWear: false),
UpdateRimNudeData(rimNudeData, "Apparel_BasicShirt", coversGroin: false, coversBelly: true, coversChest: true, sexWear: false); new RimNudeData("Apparel_CollarShirt", coversGroin: false, coversBelly: true, coversChest: true, sexWear: false),
new RimNudeData("Apparel_FlakVest", coversGroin: false, coversBelly: false, coversChest: false, sexWear: false),
//Apparel_CollarShirt new RimNudeData("Apparel_Duster", coversGroin: false, coversBelly: false, coversChest: true, sexWear: false),
UpdateRimNudeData(rimNudeData, "Apparel_CollarShirt", coversGroin: false, coversBelly: true, coversChest: true, sexWear: false); new RimNudeData("Apparel_Jacket", coversGroin: false, coversBelly: false, coversChest: true, sexWear: false),
new RimNudeData("Apparel_TribalA", coversGroin: true, coversBelly: true, coversChest: true, sexWear: false),
//Apparel_FlakVest new RimNudeData("Apparel_BodyStrap", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true),
UpdateRimNudeData(rimNudeData, "Apparel_FlakVest", coversGroin: false, coversBelly: false, coversChest: false, sexWear: false); new RimNudeData("Apparel_PsyfocusRobe", coversGroin: false, coversBelly: false, coversChest: true, sexWear: false),
new RimNudeData("Apparel_Cape", coversGroin: false, coversBelly: false, coversChest: false, sexWear: false),
//Apparel_Duster new RimNudeData("Apparel_RobeRoyal", coversGroin: false, coversBelly: false, coversChest: true, sexWear: false),
UpdateRimNudeData(rimNudeData, "Apparel_Duster", coversGroin: false, coversBelly: false, coversChest: true, sexWear: false); new RimNudeData("Apparel_Corset", coversGroin: false, coversBelly: true, coversChest: true, sexWear: false),
new RimNudeData("Apparel_Bandolier", coversGroin: false, coversBelly: false, coversChest: false, sexWear: false),
//Apparel_Jacket new RimNudeData("Apparel_Sash", coversGroin: false, coversBelly: false, coversChest: false, sexWear: false),
UpdateRimNudeData(rimNudeData, "Apparel_Jacket", coversGroin: false, coversBelly: false, coversChest: true, sexWear: false); new RimNudeData("Apparel_HeavyShield", coversGroin: false, coversBelly: false, coversChest: false, sexWear: false),
new RimNudeData("VAE_Apparel_Overalls", coversGroin: true, coversBelly: true, coversChest: false, sexWear: false),
//Apparel_TribalA new RimNudeData("VAE_Apparel_LabCoat", coversGroin: false, coversBelly: false, coversChest: true, sexWear: false),
UpdateRimNudeData(rimNudeData, "Apparel_TribalA", coversGroin: true, coversBelly: true, coversChest: true, sexWear: false); new RimNudeData("VAE_Apparel_BuildersJacket", coversGroin: false, coversBelly: false, coversChest: true, sexWear: false),
new RimNudeData("VAE_Apparel_Apron", coversGroin: true, coversBelly: true, coversChest: false, sexWear: false),
//Apparel_BodyStrap new RimNudeData("VAE_Apparel_Tunic", coversGroin: false, coversBelly: true, coversChest: true, sexWear: false),
UpdateRimNudeData(rimNudeData, "Apparel_BodyStrap", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true); new RimNudeData("VAE_Apparel_PeltCoat", coversGroin: false, coversBelly: false, coversChest: true, sexWear: false),
new RimNudeData("VAE_Apparel_WoodenArmor", coversGroin: false, coversBelly: true, coversChest: false, sexWear: false),
//Apparel_PsyfocusRobe new RimNudeData("VAE_Apparel_AdvancedVest", coversGroin: false, coversBelly: false, coversChest: false, sexWear: false),
UpdateRimNudeData(rimNudeData, "Apparel_PsyfocusRobe", coversGroin: false, coversBelly: false, coversChest: true, sexWear: false); new RimNudeData("VAE_Apparel_BulletproofVest", coversGroin: false, coversBelly: true, coversChest: false, sexWear: false),
new RimNudeData("VWE_Apparel_Exoframe", coversGroin: false, coversBelly: false, coversChest: false, sexWear: false),
//Apparel_Cape new RimNudeData("VFEM_Apparel_Tabard", coversGroin: true, coversBelly: true, coversChest: true, sexWear: false),
UpdateRimNudeData(rimNudeData, "Apparel_Cape", coversGroin: false, coversBelly: false, coversChest: false, sexWear: false); new RimNudeData("VFEV_Apparel_JarlCape", coversGroin: false, coversBelly: false, coversChest: true, sexWear: false),
new RimNudeData("VFEV_Apparel_RoyalFurCoat", coversGroin: false, coversBelly: false, coversChest: true, sexWear: false),
//Apparel_RobeRoyal new RimNudeData("PrisonerChains", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true),
UpdateRimNudeData(rimNudeData, "Apparel_RobeRoyal", coversGroin: false, coversBelly: false, coversChest: true, sexWear: false); new RimNudeData("S16_ChainHarnessA", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true),
new RimNudeData("S16_NippleWristCuffs", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true),
//Apparel_Corset new RimNudeData("S16_ServantGirlDress", coversGroin: true, coversBelly: true, coversChest: false, sexWear: true),
UpdateRimNudeData(rimNudeData, "Apparel_Corset", coversGroin: false, coversBelly: true, coversChest: true, sexWear: false); new RimNudeData("S16_ZDress", coversGroin: false, coversBelly: true, coversChest: true, sexWear: true),
new RimNudeData("S16_MaidA", coversGroin: false, coversBelly: true, coversChest: false, sexWear: true),
//VAE_Apparel_Overalls new RimNudeData("S16_DiscoTop", coversGroin: false, coversBelly: false, coversChest: true, sexWear: true),
UpdateRimNudeData(rimNudeData, "VAE_Apparel_Overalls", coversGroin: true, coversBelly: true, coversChest: false, sexWear: false); new RimNudeData("S16_TransparentSkirt", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true),
new RimNudeData("S16_Vibrator", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true),
//VAE_Apparel_LabCoat new RimNudeData("S16_VibratorDouble", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true),
UpdateRimNudeData(rimNudeData, "VAE_Apparel_LabCoat", coversGroin: false, coversBelly: false, coversChest: true, sexWear: false); new RimNudeData("S16_WiredVibrator", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true),
new RimNudeData("S16_DoubleWiredVibrator", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true),
//VAE_Apparel_BuildersJacket new RimNudeData("S16_WiredAnalVibrator", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true),
UpdateRimNudeData(rimNudeData, "VAE_Apparel_BuildersJacket", coversGroin: false, coversBelly: false, coversChest: true, sexWear: false); };
//VAE_Apparel_Apron
UpdateRimNudeData(rimNudeData, "VAE_Apparel_Apron", coversGroin: true, coversBelly: true, coversChest: false, sexWear: false);
//VAE_Apparel_Tunic
UpdateRimNudeData(rimNudeData, "VAE_Apparel_Tunic", coversGroin: false, coversBelly: true, coversChest: true, sexWear: false);
//VAE_Apparel_PeltCoat
UpdateRimNudeData(rimNudeData, "VAE_Apparel_PeltCoat", coversGroin: false, coversBelly: false, coversChest: true, sexWear: false);
//VAE_Apparel_WoodenArmor
UpdateRimNudeData(rimNudeData, "VAE_Apparel_WoodenArmor", coversGroin: false, coversBelly: true, coversChest: false, sexWear: false);
//VAE_Apparel_AdvancedVest
UpdateRimNudeData(rimNudeData, "VAE_Apparel_AdvancedVest", coversGroin: false, coversBelly: false, coversChest: false, sexWear: false);
//VAE_Apparel_BulletproofVest
UpdateRimNudeData(rimNudeData, "VAE_Apparel_BulletproofVest", coversGroin: false, coversBelly: true, coversChest: false, sexWear: false);
//VWE_Apparel_Exoframe
UpdateRimNudeData(rimNudeData, "VWE_Apparel_Exoframe", coversGroin: false, coversBelly: false, coversChest: false, sexWear: false);
//VFEM_Apparel_Tabard
UpdateRimNudeData(rimNudeData, "VFEM_Apparel_Tabard", coversGroin: true, coversBelly: true, coversChest: true, sexWear: false);
//VFEV_Apparel_JarlCape
UpdateRimNudeData(rimNudeData, "VFEV_Apparel_JarlCape", coversGroin: false, coversBelly: false, coversChest: true, sexWear: false);
//VFEV_Apparel_RoyalFurCoat
UpdateRimNudeData(rimNudeData, "VFEV_Apparel_RoyalFurCoat", coversGroin: false, coversBelly: false, coversChest: true, sexWear: false);
//PrisonerChains
UpdateRimNudeData(rimNudeData, "PrisonerChains", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true);
//S16_ChainHarnessA
UpdateRimNudeData(rimNudeData, "S16_ChainHarnessA", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true);
//S16_NippleWristCuffs
UpdateRimNudeData(rimNudeData, "S16_NippleWristCuffs", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true);
//S16_ServantGirlDress
UpdateRimNudeData(rimNudeData, "S16_ServantGirlDress", coversGroin: true, coversBelly: true, coversChest: false, sexWear: true);
//S16_ZDress
UpdateRimNudeData(rimNudeData, "S16_ZDress", coversGroin: false, coversBelly: true, coversChest: true, sexWear: true);
//S16_MaidA
UpdateRimNudeData(rimNudeData, "S16_MaidA", coversGroin: false, coversBelly: true, coversChest: false, sexWear: true);
//S16_DiscoTop
UpdateRimNudeData(rimNudeData, "S16_DiscoTop", coversGroin: false, coversBelly: false, coversChest: true, sexWear: true);
//S16_TransparentSkirt
UpdateRimNudeData(rimNudeData, "S16_TransparentSkirt", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true);
//S16_Vibrator
UpdateRimNudeData(rimNudeData, "S16_Vibrator", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true);
//S16_VibratorDouble
UpdateRimNudeData(rimNudeData, "S16_VibratorDouble", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true);
//S16_WiredVibrator
UpdateRimNudeData(rimNudeData, "S16_WiredVibrator", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true);
//S16_DoubleWiredVibrator
UpdateRimNudeData(rimNudeData, "S16_DoubleWiredVibrator", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true);
//S16_WiredAnalVibrator
UpdateRimNudeData(rimNudeData, "S16_WiredAnalVibrator", coversGroin: false, coversBelly: false, coversChest: false, sexWear: true);
}
} }
} }