From 77c9c2f2efb3f873d846da41ade62e0f4204b99d Mon Sep 17 00:00:00 2001 From: user Date: Tue, 17 Dec 2024 05:04:19 +0300 Subject: [PATCH] For scanned ships and derelicts, source mod will be shown if they are not part of Save Our Ship 2 mod. --- 1.5/Languages/English/Keyed/Letters.xml | 1 + Source/1.5/Comp/CompShipScanner.cs | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/1.5/Languages/English/Keyed/Letters.xml b/1.5/Languages/English/Keyed/Letters.xml index b78337a1..3a92756a 100644 --- a/1.5/Languages/English/Keyed/Letters.xml +++ b/1.5/Languages/English/Keyed/Letters.xml @@ -30,6 +30,7 @@ Using your ship's sensors, {0} has detected a nearby ship. The ship appears to be {1}. It does not respond to hails, but makes no move to attack. You can use your bridge to order an attack, or wait for it to leave peaceably. Derelict detected Using your ship's sensors, {0} has detected a nearby derelict. The ship appears to be {1}. It does not respond to hails and appears to be powered down. You can use your bridge to order an investigation, or wait for it to burn up in the atmosphere. + \nThe ship was identified to be coming from: {0} Starship bow detected! its AI Using your ship's sensors, {0} has detected a large, relatively intact piece of debris. It appears to be part of the very same ship which brought your original colonists to this world!\n\nThis could be your best chance to acquire a working Johnson-Tanaka drive, or even rescue any of your fellow travelers who remain in cryptosleep, but do not underestimate the dangers you will face here. diff --git a/Source/1.5/Comp/CompShipScanner.cs b/Source/1.5/Comp/CompShipScanner.cs index 520c7aec..03935903 100644 --- a/Source/1.5/Comp/CompShipScanner.cs +++ b/Source/1.5/Comp/CompShipScanner.cs @@ -105,6 +105,15 @@ public void ScannedRoom() } } + private string GetContentPackDescription(ShipDef ship) + { + if (ship == null || ship.modContentPack.Name == "Save Our Ship 2") + { + return ""; + } + return "SoS.ContentPackDescription".Translate(ship.modContentPack.Name); + + } protected void FoundMinerals(Pawn worker) { this.daysWorkingSinceLastMinerals = 0f; @@ -213,9 +222,9 @@ protected void FoundMinerals(Pawn worker) Log.Message("SOS2: ".Colorize(Color.cyan) + "Found ship with def: " + ship.derelictShip + " fac: " + ship.shipFaction + " navy: " + ship.spaceNavyDef); parent.Map.passingShipManager.AddShip(ship); if (worker != null) - Find.LetterStack.ReceiveLetter("SoS.DerelictScan".Translate(), "SoS.DerelictScanDesc".Translate(worker, ship.derelictShip), LetterDefOf.PositiveEvent); + Find.LetterStack.ReceiveLetter("SoS.DerelictScan".Translate(), "SoS.DerelictScanDesc".Translate(worker, ship.derelictShip) + GetContentPackDescription(ship.derelictShip), LetterDefOf.PositiveEvent); else - Find.LetterStack.ReceiveLetter("SoS.DerelictScan".Translate(), "SoS.DerelictScanDesc".Translate("its AI", ship.derelictShip), LetterDefOf.PositiveEvent); + Find.LetterStack.ReceiveLetter("SoS.DerelictScan".Translate(), "SoS.DerelictScanDesc".Translate("its AI", ship.derelictShip) + GetContentPackDescription(ship.derelictShip), LetterDefOf.PositiveEvent); } else if (chance > 7 && chance < 12) //tradeship, already has faction, navy resolves in SpawnEnemyShip { @@ -253,10 +262,11 @@ protected void FoundMinerals(Pawn worker) Log.Message("SOS2: ".Colorize(Color.cyan) + "Found ship with def: " + ship.attackableShip + " fac: " + ship.shipFaction + " navy: " + ship.spaceNavyDef); parent.Map.passingShipManager.AddShip(ship); + if (worker != null) - Find.LetterStack.ReceiveLetter("SoS.EnemyScan".Translate(), "SoS.EnemyScanDesc".Translate(worker, ship.attackableShip), LetterDefOf.PositiveEvent); + Find.LetterStack.ReceiveLetter("SoS.EnemyScan".Translate(), "SoS.EnemyScanDesc".Translate(worker, ship.attackableShip) + GetContentPackDescription(ship.attackableShip), LetterDefOf.PositiveEvent); else - Find.LetterStack.ReceiveLetter("SoS.EnemyScan".Translate(), "SoS.EnemyScanDesc".Translate("its AI", ship.attackableShip), LetterDefOf.PositiveEvent); + Find.LetterStack.ReceiveLetter("SoS.EnemyScan".Translate(), "SoS.EnemyScanDesc".Translate("its AI", ship.attackableShip) + GetContentPackDescription(ship.attackableShip), LetterDefOf.PositiveEvent); } }