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,9 +274,10 @@ class TechManager : IsPartOfGameInfoSerialization {
city.updateCitizens = true
}
civInfo.addNotification("Research of [$techName] has completed!", TechAction(techName),
NotificationCategory.General,
NotificationIcon.Science, techName)
if(!civInfo.isSpectator())
civInfo.addNotification("Research of [$techName] has completed!", TechAction(techName),
NotificationCategory.General,
NotificationIcon.Science, techName)
if (isNewTech)
civInfo.popupAlerts.add(PopupAlert(AlertType.TechResearched, techName))
@ -374,11 +375,12 @@ class TechManager : IsPartOfGameInfoSerialization {
updateEra()
val currentEra = civInfo.getEra()
if (previousEra != currentEra) {
civInfo.addNotification(
"You have entered the [$currentEra]!",
NotificationCategory.General,
NotificationIcon.Science
)
if(!civInfo.isSpectator())
civInfo.addNotification(
"You have entered the [$currentEra]!",
NotificationCategory.General,
NotificationIcon.Science
)
if (civInfo.isMajorCiv()) {
for (knownCiv in civInfo.getKnownCivs()) {
knownCiv.addNotification(
@ -390,11 +392,12 @@ class TechManager : IsPartOfGameInfoSerialization {
for (policyBranch in getRuleset().policyBranches.values.filter {
it.era == currentEra.name && civInfo.policies.isAdoptable(it)
}) {
civInfo.addNotification(
"[${policyBranch.name}] policy branch unlocked!",
NotificationCategory.General,
NotificationIcon.Culture
)
if(!civInfo.isSpectator())
civInfo.addNotification(
"[${policyBranch.name}] policy branch unlocked!",
NotificationCategory.General,
NotificationIcon.Culture
)
}
val erasPassed = getRuleset().eras.values

View File

@ -98,11 +98,12 @@ class CivInfoTransientCache(val civInfo: Civilization) {
val metCiv = entry.key
if (metCiv == civInfo || metCiv.isBarbarian() || civInfo.diplomacy.containsKey(metCiv.civName)) continue
civInfo.diplomacyFunctions.makeCivilizationsMeet(metCiv)
civInfo.addNotification("We have encountered [${metCiv.civName}]!",
entry.value.position,
NotificationCategory.Diplomacy, metCiv.civName,
NotificationIcon.Diplomacy
)
if(!civInfo.isSpectator())
civInfo.addNotification("We have encountered [${metCiv.civName}]!",
entry.value.position,
NotificationCategory.Diplomacy, metCiv.civName,
NotificationIcon.Diplomacy
)
metCiv.addNotification("We have encountered [${civInfo.civName}]!",
entry.value.position,
NotificationCategory.Diplomacy, civInfo.civName,
@ -189,8 +190,9 @@ class CivInfoTransientCache(val civInfo: Civilization) {
if (civInfo.naturalWonders.contains(tile.naturalWonder))
continue
civInfo.naturalWonders.add(tile.naturalWonder!!)
civInfo.addNotification("We have discovered [${tile.naturalWonder}]!",
tile.position, NotificationCategory.General, "StatIcons/Happiness")
if(!civInfo.isSpectator())
civInfo.addNotification("We have discovered [${tile.naturalWonder}]!",
tile.position, NotificationCategory.General, "StatIcons/Happiness")
var goldGained = 0
val discoveredNaturalWonders = civInfo.gameInfo.civilizations.filter { it != civInfo && it.isMajorCiv() }