From ef33fcb5fe57f88677a21230d0ad87608d485aa6 Mon Sep 17 00:00:00 2001
From: Svornost <11434-svornost@users.noreply.gitgud.io>
Date: Wed, 12 Aug 2020 16:47:21 -0700
Subject: [PATCH] Arcologies won't choose names that are already in use within
 the Free City.

---
 src/neighbor/arcologyDiplomacy.js         |   9 ++
 src/uncategorized/neighborsDevelopment.tw | 106 +++++++++++-----------
 2 files changed, 62 insertions(+), 53 deletions(-)

diff --git a/src/neighbor/arcologyDiplomacy.js b/src/neighbor/arcologyDiplomacy.js
index 0f0a1c19621..402a19f0d48 100644
--- a/src/neighbor/arcologyDiplomacy.js
+++ b/src/neighbor/arcologyDiplomacy.js
@@ -158,3 +158,12 @@ App.Neighbor.PassiveFSInfluence = class {
 		return t.join(" ");
 	}
 };
+
+/** Get an arcology name from a given set, preferring unused ones.
+ * @param {string[]} nameSet
+ * @returns {string}
+ */
+App.Neighbor.getUnusedName = function(nameSet) {
+	const filteredSet = nameSet.filter(n => !V.arcologies.some(a => a.name === n));
+	return filteredSet.length > 0 ? filteredSet.random() : nameSet.random();
+};
diff --git a/src/uncategorized/neighborsDevelopment.tw b/src/uncategorized/neighborsDevelopment.tw
index f7ac60d4fc5..d8ff46b2b6f 100644
--- a/src/uncategorized/neighborsDevelopment.tw
+++ b/src/uncategorized/neighborsDevelopment.tw
@@ -426,29 +426,29 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 				Racial Supremacy for $arcologies[$i].FSSupremacistRace people has reached stability and acceptance there. The arcology has been renamed
 				<<switch $arcologies[$i].FSSupremacistRace>>
 				<<case "white">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSupremacistWhite.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistWhite)>>
 				<<case "asian">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSupremacistAsian.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistAsian)>>
 				<<case "latina">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSupremacistLatina.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistLatina)>>
 				<<case "middle eastern">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSupremacistMiddleEastern.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistMiddleEastern)>>
 				<<case "black">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSupremacistBlack.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistBlack)>>
 				<<case "indo-aryan">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSupremacistIndoAryan.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistIndoAryan)>>
 				<<case "pacific islander">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSupremacistPacificIslander.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistPacificIslander)>>
 				<<case "malay">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSupremacistMalay.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistMalay)>>
 				<<case "amerindian">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSupremacistAmerindian.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistAmerindian)>>
 				<<case "southern european">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSupremacistSouthernEuropean.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistSouthernEuropean)>>
 				<<case "semitic">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSupremacistSemitic.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistSemitic)>>
 				<<default>>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSupremacistMixedRace.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistMixedRace)>>
 				<</switch>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
@@ -476,29 +476,29 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 				Racial Subjugationism of $arcologies[$i].FSSubjugationistRace people has reached stability and acceptance there. The arcology has been renamed
 				<<switch $arcologies[$i].FSSubjugationistRace>>
 				<<case "white">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSubjugationistWhite.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistWhite)>>
 				<<case "asian">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSubjugationistAsian.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistAsian)>>
 				<<case "latina">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSubjugationistLatina.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistLatina)>>
 				<<case "middle eastern">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSubjugationistMiddleEastern.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistMiddleEastern)>>
 				<<case "black">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSubjugationistBlack.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistBlack)>>
 				<<case "indo-aryan">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSubjugationistIndoAryan.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistIndoAryan)>>
 				<<case "pacific islander">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSubjugationistPacificIslander.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistPacificIslander)>>
 				<<case "malay">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSubjugationistMalay.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistMalay)>>
 				<<case "amerindian">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSubjugationistAmerindian.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistAmerindian)>>
 				<<case "southern european">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSubjugationistSouthernEuropean.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistSouthernEuropean)>>
 				<<case "semitic">>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSubjugationistSemitic.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistSemitic)>>
 				<<default>>
-					<<set $arcologies[$i].name = setup.ArcologyNamesSubjugationistMixedRace.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistMixedRace)>>
 				<</switch>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
@@ -524,7 +524,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSRepopulationFocus >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Repopulationism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name to setup.ArcologyNamesRepopulationist.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesRepopulationist)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSRepopulationFocus < 0>>
@@ -556,7 +556,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				<<set $arcologies[$i].FSRestartResearch = 1>>
 				Eugenics has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesEugenics.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesEugenics)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSRestart < 0>>
@@ -590,7 +590,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				<<set $arcologies[$i].FSGenderRadicalistResearch = 1>>
 				Gender Radicalism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesGenderRadicalist.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesGenderRadicalist)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSGenderRadicalist < 0>>
@@ -627,7 +627,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSGenderFundamentalist >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Gender Fundamentalism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesGenderFundamentalist.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesGenderFundamentalist)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSGenderFundamentalist < 0>>
@@ -652,7 +652,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSPaternalist >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Paternalism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesPaternalist.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesPaternalist)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSPaternalist < 0>>
@@ -684,7 +684,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSDegradationist >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Degradationism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesDegradationist.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesDegradationist)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSDegradationist < 0>>
@@ -718,7 +718,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSIntellectualDependency >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Intellectual Dependency has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesIntellectualDependency.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesIntellectualDependency)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSIntellectualDependency < 0>>
@@ -746,7 +746,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				<<set $arcologies[$i].FSSlaveProfessionalismResearch = 1>>
 				Slave Professionalism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesSlaveProfessionalism.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSlaveProfessionalism)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSSlaveProfessionalism < 0>>
@@ -789,7 +789,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSBodyPurist >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Body Purism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesBodyPurist.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesBodyPurist)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSBodyPurist < 0>>
@@ -815,7 +815,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				<<set $arcologies[$i].FSTransformationFetishistResearch = 1>>
 				Transformation Fetishism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesTransformationFetishist.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesTransformationFetishist)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSTransformationFetishist < 0>>
@@ -845,11 +845,11 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Youth Preferentialism has reached stability and acceptance there. The arcology has been renamed
 				<<if $pedo_mode == 1 || $minimumSlaveAge < 6>>
-					<<set $arcologies[$i].name = setup.ArcologyNamesYouthPreferentialistLow.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesYouthPreferentialistLow)>>
 				<<elseif $minimumSlaveAge < 14>>
 					<<set $arcologies[$i].name = either(setup.ArcologyNamesYouthPreferentialist, setup.ArcologyNamesYouthPreferentialistLow)>>
 				<<else>>
-					<<set $arcologies[$i].name = setup.ArcologyNamesYouthPreferentialist.random()>>
+					<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesYouthPreferentialist)>>
 				<</if>>
 				'' $arcologies[$i].name'' to mark the occasion.
 				<<set $arcologies[$i].FSYouthPreferentialistResearch = 1>>
@@ -874,7 +874,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSMaturityPreferentialist >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Maturity Preferentialism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesMaturityPreferentialist.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesMaturityPreferentialist)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSMaturityPreferentialist < 0>>
@@ -899,7 +899,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSPetiteAdmiration >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Petite Admiration has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesPetiteAdmiration.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesPetiteAdmiration)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSPetiteAdmiration < 0>>
@@ -926,7 +926,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSStatuesqueGlorification >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Statuesque Glorification has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesStatuesqueGlorification.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesStatuesqueGlorification)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSStatuesqueGlorification < 0>>
@@ -955,7 +955,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSSlimnessEnthusiast >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Slimness Enthusiasm has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesSlimnessEnthusiast.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSlimnessEnthusiast)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 				<<set $arcologies[$i].FSSlimnessEnthusiastResearch = 1>>
 			<</if>>
@@ -982,7 +982,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				<<set $arcologies[$i].FSAssetExpansionistResearch = 1>>
 				Asset Expansionism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesAssetExpansionist.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesAssetExpansionist)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSAssetExpansionist < 0>>
@@ -1015,7 +1015,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSPastoralist >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Pastoralism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesPastoralist.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesPastoralist)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSPastoralist < 0>>
@@ -1042,7 +1042,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSCummunism >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Cummunism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesCummunism.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesCummunism)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSCummunism < 0>>
@@ -1075,7 +1075,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSPhysicalIdealist >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Physical Idealism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesPhysicalIdealist.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesPhysicalIdealist)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSPhysicalIdealist < 0>>
@@ -1107,7 +1107,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				<<set $arcologies[$i].FSHedonisticDecadenceResearch = 1>>
 				Decadent Hedonism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesHedonisticDecadence.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesHedonisticDecadence)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSHedonisticDecadence < 0>>
@@ -1136,7 +1136,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSIncestFetishist >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Incest Fetishism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesIncestFetishist.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesIncestFetishist)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSIncestFetishist < 0>>
@@ -1161,7 +1161,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSChattelReligionist >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Chattel Religionism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesChattelReligionist.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesChattelReligionist)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSChattelReligionist < 0>>
@@ -1190,7 +1190,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSRomanRevivalist >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Roman Revivalism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesRomanRevivalist.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesRomanRevivalist)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSRomanRevivalist < 0>>
@@ -1213,7 +1213,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSAztecRevivalist >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Aztec Revivalism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesAztecRevivalist.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesAztecRevivalist)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSAztecRevivalist < 0>>
@@ -1236,7 +1236,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSEgyptianRevivalist >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Egyptian Revivalism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesEgyptianRevivalist.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesEgyptianRevivalist)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSEgyptianRevivalist < 0>>
@@ -1259,7 +1259,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSEdoRevivalist >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Edo Revivalism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesEdoRevivalist.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesEdoRevivalist)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSEdoRevivalist < 0>>
@@ -1282,7 +1282,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSArabianRevivalist >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Arabian Revivalism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesArabianRevivalist.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesArabianRevivalist)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSArabianRevivalist < 0>>
@@ -1309,7 +1309,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $sh
 		<<if $arcologies[$i].FSChineseRevivalist >= $FSLockinLevel>>
 			<<if ($arcologies[$i].name.indexOf("Arcology") != -1) && (random(0,2) == 0)>>
 				Chinese Revivalism has reached stability and acceptance there. The arcology has been renamed
-				<<set $arcologies[$i].name = setup.ArcologyNamesChineseRevivalist.random()>>
+				<<set $arcologies[$i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesChineseRevivalist)>>
 				'' $arcologies[$i].name'' to mark the occasion.
 			<</if>>
 		<<elseif $arcologies[$i].FSChineseRevivalist < 0>>
-- 
GitLab