Skip to content

Remove some unneeded parts of vanilla on-actions #2125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,8 @@
33922 # Muhammad

# Characters referenced in on-actions:
7627
90107 # Ludwig the German
74025
33358
76273
251187
251180
251181
214
364
40905
Expand Down Expand Up @@ -51,4 +45,7 @@ additional_fatimids_1
107590

# Characters referenced in common/character_interactions/00_debug_interactions.txt:
159835 # King Arthur
159835 # King Arthur

# Characters referenced in achievements:
109607
91 changes: 90 additions & 1 deletion ImperatorToCK3/Outputter/OnActionOutputter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,99 @@ public static async Task OutputEverything(Configuration config, ModFilesystem ck
if (config.FallenEagleEnabled) {
await DisableUnneededFallenEagleOnActions(outputModPath);
await RemoveStruggleStartFromFallenEagleOnActions(ck3ModFS, outputModPath);
} else { // vanilla
await RemoveUnneededPartsOfVanillaOnActions(ck3ModFS, outputModPath);
}
Logger.IncrementProgress();
}


private static async Task RemoveUnneededPartsOfVanillaOnActions(ModFilesystem ck3ModFS, string outputModPath) {
Logger.Info("Removing unneeded parts of vanilla on-actions...");
var inputPath = ck3ModFS.GetActualFileLocation("common/on_action/game_start.txt");
if (!File.Exists(inputPath)) {
Logger.Debug("game_start.txt not found.");
return;
}
var fileContent = await File.ReadAllTextAsync(inputPath);

// List of blocks to remove as of 2024-09-01.
string[] partsToRemove = [
"""
### 867 - RADHANITES IN KHAZARIA ###
character:74025 = {
if = {
limit = {
is_alive = yes
is_landed = yes
}
}
trigger_event = bookmark.0200
}
""",
"""
### 867 - WRATH OF THE NORTHMEN ###
#Æthelred dying (probably)
character:33358 = {
if = {
limit = {
is_alive = yes
is_landed = yes
}
trigger_event = {
id = bookmark.0001
days = { 365 730 }
}
}
}
""",
"""
#Alfred the Great becoming the Great
character:7627 = {
if = {
limit = {
is_alive = yes
is_landed = yes
}
trigger_event = {
id = bookmark.0002
days = 1800 #~5 years
}
}
}
""",
"""
### 867 - THE GREAT ADVENTURERS ###
character:251187 = {
if = {
limit = {
is_alive = yes
is_landed = yes
AND = {
character:251180 = { is_ai = yes }
character:251181 = {
is_ai = yes
is_alive = yes
}
}
}
trigger_event = {
id = bookmark.0101
days = { 21 35 }
}
}
}
""",];

foreach (var block in partsToRemove) {
// The file uses LF line endings, so we need to make the search string use LF line endings as well.
fileContent = fileContent.Replace(block.Replace("\r\n", "\n"), "");
}

var outputPath = $"{outputModPath}/common/on_action/game_start.txt";
await using var output = FileHelper.OpenWriteWithRetries(outputPath);
await output.WriteAsync(fileContent);
}

public static async Task OutputCustomGameStartOnAction(Configuration config) {
Logger.Info("Writing game start on-action...");

Expand Down
Loading