# HG changeset patch # User Alys Brooks # Date 2021-12-12 23:17:38 # Node ID ecc77c69cbf9a0823786d0d14d41a6b278985adb # Parent cc40afa81b25e9b03d26a01be22c02813856010f Make censoring more completem. diff --git a/isometric-park-fna/Engines/DialogEngine.cs b/isometric-park-fna/Engines/DialogEngine.cs --- a/isometric-park-fna/Engines/DialogEngine.cs +++ b/isometric-park-fna/Engines/DialogEngine.cs @@ -23,13 +23,23 @@ class DialogEngine : Engine { public static Dictionary replacements = new Dictionary {{"Damn", "Drat"}, + {"Fucking hell", "Flipping heck"}, {"Fuck", "Fork"}, //Ty michael shur {"Motherfucker", "Motherforker"}, - {"Shit", "Shitake mushrooms"}, + {"Shitheel", "Slimewheel"}, //idk + {"Shit!", "Shitake mushrooms!"}, //depends on context + {"Shit", "Shitake mushroom"}, {"Hell", "Heck"}, {"Oh my God", "Oh my Glob"}, //Ty Pendleton Ward - {"Bastard", "Bollocks"} + {"Goddammit", "Glob drat it"}, + {"Goddamm", "Goshdarn"}, + {"Megadick", "Megadunce"}, + {"Dickhead", "Dunce"}, + {"Bastard", "Bollocks"}, + {"Asshole", "Bumhead"} //i guess }; + + public static Dictionary replacements_lower; public Story Story; public Grammar Grammar; @@ -41,6 +51,9 @@ this.Grammar = grammar; this.Random = new Random(); + + DialogEngine.replacements_lower = DialogEngine.replacements.Select((i) => (i.Key.ToLower(), i.Value.ToLower())).ToDictionary(i => i.Item1, i => i.Item2); + } public string BleepString(string s, ProfanityLevel setting) @@ -50,17 +63,26 @@ case ProfanityLevel.Uncensored: return s; case ProfanityLevel.Minced: - foreach (var item in replacements) + foreach (var item in DialogEngine.replacements) + { + s = s.Replace(item.Key, item.Value); + } + foreach (var item in DialogEngine.replacements_lower) { s = s.Replace(item.Key, item.Value); } return s; case ProfanityLevel.Removed: - return Regex.Replace(s, "(?i)((?<=d)amn|(?<=f)uck|(?<=D)amn|(?<=F)uck)", "------"); + return Regex.Replace(s, "(?i)((?<=d)amn|(?<=f)uck|(?<=D)amn|(?<=F)uck|(?<=S)hit|(?<=Motherf)ucker|(?<=megad)ick)", "------"); } return s; } + public string BleepAndFlatten(string s, ProfanityLevel setting) + { + return this.BleepString(this.Grammar.Flatten(s), setting); + } + public override void Update(double dt) { @@ -103,17 +125,17 @@ //Update the dialog component with the new speaker, dialog, and options: - var continuation = this.Grammar.Flatten(this.Story.Continue()); + var continuation = BleepAndFlatten(this.Story.Continue(), profanity_setting); var parts = Regex.Split(continuation, ":", 0); - var speaker = (parts.Length == 2) ? this.Grammar.Flatten(parts[0]) : "Dialog"; - var dialog = (parts.Length == 2) ? this.Grammar.Flatten(parts[1]) : continuation; + var speaker = (parts.Length == 2) ? BleepAndFlatten(parts[0], profanity_setting) : "Dialog"; + var dialog = (parts.Length == 2) ? BleepAndFlatten(parts[1], profanity_setting) : continuation; SetComponent(choiceMessage.Entity, new DialogComponent { CurrentDialog = dialog, CurrentSpeaker = speaker.Trim(), Options = this.Story.currentChoices - .Select(option => BleepString(this.Grammar.Flatten(option.text), - profanity_setting )) + .Select(option => BleepAndFlatten(option.text, + profanity_setting)) .ToList() }); @@ -157,14 +179,14 @@ Story.ChoosePathString(Knot); var continuation = this.Story.Continue(); var parts = Regex.Split(continuation, ":", 0); - var speaker = (parts.Length == 2) ? this.Grammar.Flatten(parts[0]) : "Dialog"; - var dialog = (parts.Length == 2) ? this.Grammar.Flatten(parts[1]) : continuation; + var speaker = (parts.Length == 2) ? BleepAndFlatten(parts[0], profanity_setting) : "Dialog"; + var dialog = (parts.Length == 2) ? BleepAndFlatten(parts[1], profanity_setting) : continuation; SetComponent(lowestEntity, new DialogComponent { Knot = Knot, CurrentDialog = dialog, CurrentSpeaker = speaker.Trim(), Options = this.Story.currentChoices - .Select(option => BleepString(this.Grammar.Flatten(option.text), + .Select(option => BleepAndFlatten(option.text, profanity_setting )) .ToList() }); diff --git a/isometric-park-fna/UI/OptionsWindow.cs b/isometric-park-fna/UI/OptionsWindow.cs --- a/isometric-park-fna/UI/OptionsWindow.cs +++ b/isometric-park-fna/UI/OptionsWindow.cs @@ -153,6 +153,14 @@ ImGui.EndCombo(); } + ImGui.SameLine(); + ImGui.TextDisabled("(?)"); + if (ImGui.IsItemHovered()) + { + ImGui.BeginTooltip(); + ImGui.Text("Removes profanity from the game, if you must."); + ImGui.EndTooltip(); + } ImGui.Separator();