isSpectator check for notifications (#8558)

This commit is contained in:
Gualdimar 2023-02-03 09:40:02 +02:00 committed by GitHub
parent 772615cffa
commit af2307782f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 20 deletions

View File

@ -274,6 +274,7 @@ class TechManager : IsPartOfGameInfoSerialization {
city.updateCitizens = true
}
if(!civInfo.isSpectator())
civInfo.addNotification("Research of [$techName] has completed!", TechAction(techName),
NotificationCategory.General,
NotificationIcon.Science, techName)
@ -374,6 +375,7 @@ class TechManager : IsPartOfGameInfoSerialization {
updateEra()
val currentEra = civInfo.getEra()
if (previousEra != currentEra) {
if(!civInfo.isSpectator())
civInfo.addNotification(
"You have entered the [$currentEra]!",
NotificationCategory.General,
@ -390,6 +392,7 @@ class TechManager : IsPartOfGameInfoSerialization {
for (policyBranch in getRuleset().policyBranches.values.filter {
it.era == currentEra.name && civInfo.policies.isAdoptable(it)
}) {
if(!civInfo.isSpectator())
civInfo.addNotification(
"[${policyBranch.name}] policy branch unlocked!",
NotificationCategory.General,

View File

@ -98,6 +98,7 @@ class CivInfoTransientCache(val civInfo: Civilization) {
val metCiv = entry.key
if (metCiv == civInfo || metCiv.isBarbarian() || civInfo.diplomacy.containsKey(metCiv.civName)) continue
civInfo.diplomacyFunctions.makeCivilizationsMeet(metCiv)
if(!civInfo.isSpectator())
civInfo.addNotification("We have encountered [${metCiv.civName}]!",
entry.value.position,
NotificationCategory.Diplomacy, metCiv.civName,
@ -189,6 +190,7 @@ class CivInfoTransientCache(val civInfo: Civilization) {
if (civInfo.naturalWonders.contains(tile.naturalWonder))
continue
civInfo.naturalWonders.add(tile.naturalWonder!!)
if(!civInfo.isSpectator())
civInfo.addNotification("We have discovered [${tile.naturalWonder}]!",
tile.position, NotificationCategory.General, "StatIcons/Happiness")