- 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

@ -23,20 +23,7 @@ namespace Rimworld_Animations_Patch
Scribe_Values.Look(ref cropApparel, "cropApparel", false);
Scribe_Values.Look(ref clothesThrownOnGround, "clothesThrownOnGround", true);
Scribe_Values.Look(ref apparelWornForQuickies, "apparelWornForQuickies", RJWPreferenceSettings.Clothing.Clothed);
}
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;
Scribe_Collections.Look(ref rimNudeData, "rimNudeData", LookMode.Deep);
}
}
@ -70,6 +57,7 @@ namespace Rimworld_Animations_Patch
public ApparelSettingsDisplay(ModContentPack content) : base(content)
{
ApparelSettings.rimNudeData = new List<RimNudeData>();
GetSettings<ApparelSettings>();
}
@ -183,8 +171,7 @@ namespace Rimworld_Animations_Patch
}
// Ensure that all apparel has associated RimNudeData
if (ApparelSettings.rimNudeData.NullOrEmpty())
{ ApparelSettingsUtility.ResetRimNudeData(ApparelSettings.rimNudeData); }
if (ApparelSettings.rimNudeData.NullOrEmpty()) ApparelSettingsUtility.ResetRimNudeData();
// Add buttons to the top of the main window
innerX = halfColumnWidth;
@ -194,9 +181,9 @@ namespace Rimworld_Animations_Patch
// Apparel
tempRect = new Rect(innerX + SettingsUtility.Align(labelWidth, doubleColumnWidth), windowY - headerHeight - 5, labelWidth, headerHeight);
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> { };
foreach (ModContentPack modContentPack in relevantModContentPacks)
@ -217,17 +204,17 @@ namespace Rimworld_Animations_Patch
// Covers groin
tempRect = new Rect(innerX + SettingsUtility.Align(buttonWidth, singleColumnWidth), windowY - headerHeight - 5, buttonWidth, headerHeight);
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>
{
new FloatMenuOption("Set all 'true'", delegate()
{ ApparelSettingsUtility.SetAllCoversGroin(ApparelSettings.rimNudeData, true);
new FloatMenuOption("set_all_true".Translate(), delegate()
{ ApparelSettingsUtility.SetAllCoversGroin(shortListedApparelDefs, true);
}, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0),
new FloatMenuOption("Set all 'false'", delegate()
{ ApparelSettingsUtility.SetAllCoversGroin(ApparelSettings.rimNudeData, false);
new FloatMenuOption("set_all_false".Translate(), delegate()
{ ApparelSettingsUtility.SetAllCoversGroin(shortListedApparelDefs, false);
}, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0),
}; Find.WindowStack.Add(new FloatMenu(options));
}; innerX += singleColumnWidth;
@ -235,17 +222,17 @@ namespace Rimworld_Animations_Patch
// Covers belly
tempRect = new Rect(innerX + SettingsUtility.Align(buttonWidth, singleColumnWidth), windowY - headerHeight - 5, buttonWidth, headerHeight);
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>
{
new FloatMenuOption("Set all 'true'", delegate()
{ ApparelSettingsUtility.SetAllCoversBelly(ApparelSettings.rimNudeData, true);
new FloatMenuOption("set_all_true".Translate(), delegate()
{ ApparelSettingsUtility.SetAllCoversBelly(shortListedApparelDefs, true);
}, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0),
new FloatMenuOption("Set all 'false'", delegate()
{ ApparelSettingsUtility.SetAllCoversBelly(ApparelSettings.rimNudeData, false);
new FloatMenuOption("set_all_false".Translate(), delegate()
{ ApparelSettingsUtility.SetAllCoversBelly(shortListedApparelDefs, false);
}, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0),
}; Find.WindowStack.Add(new FloatMenu(options));
}; innerX += singleColumnWidth;
@ -253,17 +240,17 @@ namespace Rimworld_Animations_Patch
// Covers belly
tempRect = new Rect(innerX + SettingsUtility.Align(buttonWidth, singleColumnWidth), windowY - headerHeight - 5, buttonWidth, headerHeight);
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>
{
new FloatMenuOption("Set all 'true'", delegate()
{ ApparelSettingsUtility.SetAllCoversChest(ApparelSettings.rimNudeData, true);
new FloatMenuOption("set_all_true".Translate(), delegate()
{ ApparelSettingsUtility.SetAllCoversChest(shortListedApparelDefs, true);
}, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0),
new FloatMenuOption("Set all 'false'", delegate()
{ ApparelSettingsUtility.SetAllCoversChest(ApparelSettings.rimNudeData, false);
new FloatMenuOption("set_all_false".Translate(), delegate()
{ ApparelSettingsUtility.SetAllCoversChest(shortListedApparelDefs, false);
}, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0),
}; Find.WindowStack.Add(new FloatMenu(options));
}; innerX += singleColumnWidth;
@ -271,17 +258,17 @@ namespace Rimworld_Animations_Patch
// Sex wear
tempRect = new Rect(innerX + SettingsUtility.Align(buttonWidth, singleColumnWidth), windowY - headerHeight - 5, buttonWidth, headerHeight);
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>
{
new FloatMenuOption("Set all 'true'", delegate()
{ ApparelSettingsUtility.SetAllSexWear(ApparelSettings.rimNudeData, true);
new FloatMenuOption("set_all_true".Translate(), delegate()
{ ApparelSettingsUtility.SetAllSexWear(shortListedApparelDefs, true);
}, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0),
new FloatMenuOption("Set all 'false'", delegate()
{ ApparelSettingsUtility.SetAllSexWear(ApparelSettings.rimNudeData, false);
new FloatMenuOption("set_all_false".Translate(), delegate()
{ ApparelSettingsUtility.SetAllSexWear(shortListedApparelDefs, false);
}, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0),
}; Find.WindowStack.Add(new FloatMenu(options));
}; innerX += singleColumnWidth;
@ -289,10 +276,10 @@ namespace Rimworld_Animations_Patch
// Reset button
tempRect = new Rect(innerX + SettingsUtility.Align(buttonWidth, singleColumnWidth), windowY - headerHeight - 5, buttonWidth, headerHeight);
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"))
{ ApparelSettingsUtility.ResetRimNudeData(ApparelSettings.rimNudeData); }; innerX += singleColumnWidth + scrollBarWidthMargin;
if (Widgets.ButtonText(tempRect, "reset_to_defaults".Translate()))
{ ApparelSettingsUtility.ResetRimNudeData(shortListedApparelDefs); }; innerX += singleColumnWidth + scrollBarWidthMargin;
// Determine the height of the scrollable area
int apparelCount = shortListedApparelDefs.Count();
@ -319,7 +306,7 @@ namespace Rimworld_Animations_Patch
innerY = (float)num * (rowHeight);
num++;
RimNudeData rimNudeApparel = ApparelSettings.rimNudeData.First(x => x.EquivalentTo(new RimNudeData(thingDef)));
RimNudeData rimNudeApparel = ApparelSettingsUtility.GetRimNudeData(thingDef);
// Apparel symbol
Widgets.ThingIcon(new Rect(innerX + SettingsUtility.Align(widgetWidth, halfColumnWidth), innerY + SettingsUtility.Align(widgetHeight, rowHeight), widgetWidth, widgetHeight), thingDef, null, null, 1f, null);