From 039a0bea61832af3ee55121ff140388f5f05e8af Mon Sep 17 00:00:00 2001
From: Svornost <11434-svornost@users.noreply.gitgud.io>
Date: Wed, 18 Oct 2023 15:16:54 -0400
Subject: [PATCH] Make automatic generation of AI images optional

---
 js/003-data/gameVariableData.js | 1 +
 src/002-config/fc-version.js    | 2 +-
 src/art/artJS.js                | 2 +-
 src/gui/options/options.js      | 3 +++
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js
index 3a8ebea0290..635f2b522be 100644
--- a/js/003-data/gameVariableData.js
+++ b/js/003-data/gameVariableData.js
@@ -173,6 +173,7 @@ App.Data.defaultGameStateVariables = {
 
 	// Stable Diffusion settings
 	aiApiUrl: "http://localhost:7860",
+	aiAutoGen: true,
 	aiCfgScale: 5,
 	aiCustomImagePrompts: 0,
 	aiCustomStyleNeg: "",
diff --git a/src/002-config/fc-version.js b/src/002-config/fc-version.js
index 8a4955f6955..d6e66c900a0 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: "4.0.0-alpha.27",
 	commitHash: null,
-	release: 1213, // When getting close to 2000, please remove the check located within the onLoad() function defined at line five of src/js/eventHandlers.js.
+	release: 1214, // 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/art/artJS.js b/src/art/artJS.js
index 77ff50d4fd6..c381189a6ba 100644
--- a/src/art/artJS.js
+++ b/src/art/artJS.js
@@ -690,7 +690,7 @@ App.Art.aiArtElement = function(slave, imageSize) {
 		});
 	}
 
-	if (slave.custom.aiImageIds.length === 0) {
+	if (V.aiAutoGen && slave.custom.aiImageIds.length === 0) {
 		updateAndRefresh();
 	} else {
 		refresh();
diff --git a/src/gui/options/options.js b/src/gui/options/options.js
index 2d7b21e833c..5656e386cf3 100644
--- a/src/gui/options/options.js
+++ b/src/gui/options/options.js
@@ -1267,6 +1267,9 @@ App.UI.artOptions = function() {
 				options.addCustom(App.UI.DOM.stableDiffusionInstallationGuide("Stable Diffusion Installation Guide"));
 				options.addOption("API URL", "aiApiUrl").showTextBox().addComment("The URL of the Automatic 1111 Stable Diffusion API.");
 				App.UI.aiPromptingOptions(options);
+				options.addOption("Automatic generation", "aiAutoGen")
+					.addValue("Enabled", true).on().addValue("Disabled", false).off()
+					.addComment("Generate images for new slaves on the fly. If disabled, you will need to manually click to generate each slave's image.");
 				options.addOption("Sampling Method", "aiSamplingMethod").showTextBox()
 					.addComment(`The sampling method used by AI. You can query ${V.aiApiUrl}/sdapi/v1/samplers to see the list of available samplers.`);
 				options.addOption("CFG Scale", "aiCfgScale").showTextBox()
-- 
GitLab