From 808970a18415cfadf185e1686e5cce2815566e18 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Tue, 29 Dec 2020 15:41:04 -0500
Subject: [PATCH] remove bad acc settings re: chastity from RA

---
 src/002-config/fc-version.js                  |  2 +-
 .../backwardsCompatibility/datatypeCleanup.js | 24 +++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/002-config/fc-version.js b/src/002-config/fc-version.js
index 393d11da8a1..a32907891c9 100644
--- a/src/002-config/fc-version.js
+++ b/src/002-config/fc-version.js
@@ -2,5 +2,5 @@ App.Version = {
 	base: "0.10.7.1", // The vanilla version the mod is based off of, this should never be changed.
 	pmod: "3.8.4",
 	commitHash: null,
-	release: 1113 // When getting close to 2000,  please remove the check located within the onLoad() function defined at line five of src/js/eventHandlers.js.
+	release: 1114 // When getting close to 2000,  please remove the check located within the onLoad() function defined at line five of src/js/eventHandlers.js.
 };
diff --git a/src/data/backwardsCompatibility/datatypeCleanup.js b/src/data/backwardsCompatibility/datatypeCleanup.js
index 2efa58d88e4..8639ad10682 100644
--- a/src/data/backwardsCompatibility/datatypeCleanup.js
+++ b/src/data/backwardsCompatibility/datatypeCleanup.js
@@ -2097,6 +2097,30 @@ App.Entity.Utils.RARuleDatatypeCleanup = function() {
 				break;
 		}
 		delete set.eyeColor;
+
+		// Look for and remove pieces of a rule that would apply an accessory that is not in data.  A common example is the old "chastity" accessories, which have now been moved to a different system
+		const vaginalAccessories = new Set([
+			"virginAccessory",
+			"aVirginAccessory",
+			"vaginalAccessory",
+		]);
+
+		for (const acc of vaginalAccessories) {
+			if (set[acc] && !(App.Data.vaginalAccessories.get(set[acc]) || V.customItem.dildos.get(set[acc]))) {
+				set[acc] = null;
+			}
+		}
+
+		const dickAccessories = new Set([
+			"aVirginDickAccessory",
+			"dickAccessory"
+		]);
+
+		for (const acc of dickAccessories) {
+			if (set[acc] && !(App.Data.slaveWear.dickAccessories.get(set[acc]))) {
+				set[acc] = null;
+			}
+		}
 	}
 }();
 
-- 
GitLab