RimWorld

RimWorld

Post Office: The Letter Filter
47 Comments
Th3_Fr3d  [author] 29 Jul @ 8:07am 
pushed the 1.6 update without support for CAI 5000 since it seems to have been discontinued for now
Th3_Fr3d  [author] 28 Jul @ 7:28am 
The 1.6 version of this mod is now waiting for CAI 5000 - Advanced AI + Fog Of War to update, since it's a build dependency
Th3_Fr3d  [author] 27 Jul @ 8:45am 
@Aegis Yes, I'll push a 1.6 update, hopefully in the next few weeks, when I have a little more time
Aegis 27 Jul @ 8:23am 
This mod is exactly what I was looking for (including regular expressions <3), except it doesn't work in 1.6 =( (the mod options are blank, opening them throws an error in the debug log).

Any chance someone is motivated enough to update this for 1.6?
Th3_Fr3d  [author] 25 Nov, 2024 @ 6:32am 
@LeMestache I'd say one thing to be aware of is that Rimworld heavily uses the composite pattern and prefers delegation over inheritance, so you'll find rather generic concrete classes (like Pawn or Hediff) and the actual behavior is implemented by their components. Coming from more conventional OOP background it takes some getting used to, but it actually makes a lot of sense in terms of modding support. Anyways, I'm sure you'll figure it out. Good luck!
LeMestache 25 Nov, 2024 @ 5:31am 
I have a bachelors in CS so I won't have too many issues with C#, but I couldn't find a decent guide to quickly get into modding, guess I just need to invest more time in it. I'll see how it goes, thanks a lot!
Th3_Fr3d  [author] 25 Nov, 2024 @ 5:07am 
@LeMestache I work as a software engineer so the C# part wasn't an issue for me to get into Rimworld modding. Otherwise, a good way to get started is to look at the official rimworld wiki and whenever you're after something specific use tools like grep (or dnGrep on Windows) to search through Rimworld's XML data (in steamapps/common/RimWorld/Data) to get an idea for what you're after. Once you know a specific class or symbol name, you can use tools like dotPeek to disassemble Rimworld's binaries (Assembly-CSharp.dll) and search in there for the implementation details. This can also give you a good idea on where to apply Harmony patches and things like that.

For the project setup and deployment feel free to take a look at the source code of this mod, linked in the description.
LeMestache 24 Nov, 2024 @ 2:20pm 
That's certainly an interesting interaction, was wondering why it was trying to access CAI-5000 which I didn't have. Thanks for the quick fix, gonna try my hand at modding later for fun. Did you learn everything on your own or did you look up some guide to get a basic understanding of modding Rimworld? Not programming in general, just Rimworld :P
Th3_Fr3d  [author] 24 Nov, 2024 @ 5:41am 
@LeMestache should be fixed now :)
Th3_Fr3d  [author] 24 Nov, 2024 @ 4:53am 
@LeMestache Incredible. Apparently Vehicle Framework does some reflection in the background where it enumerates any and all types that are currently loaded, even if they are completely unrelated to their mod - something they absolutely should not do. Anyways, in doing so they somehow manage to access a Harmony patch in Post Office for Combat AI 5000, which is inactive and not initialized because that mod is not part of your mod pack (which is fine), and everything crashes because Vehicle Framework tries to access something that obviously isn't loaded.

Thanks for the report, I believe this could also be the reason why the debug action menu breaks for some people. Can someone confirm that of those who are having issues with the debug menu you have Vehicle Framework loaded but not Combat AI 5000?
LeMestache 23 Nov, 2024 @ 1:17pm 
Had a weird issue with Vehicle Framework where all the settings were blank. I was unable to reset them as I'd get a:

Exception filling window for Verse.Dialog_MessageBox: System.TypeLoadException: Could not load type of field

when attempting to do so. Removing this mod fixed the issue.
Logs:
https://gist.github.com/HugsLibRecordKeeper/ffd1eabffe075e0a338d837e4008e8e3

2918 - Vehicle settings not loaded and the entire page is blank
3088 - Attempted to reset all settings in VehicleFramework
Th3_Fr3d  [author] 2 Oct, 2024 @ 3:18pm 
I still wasn't able to reproduce the reported issues. I assume it must be an incompatibility with another mod? If something doesn't work for you, please give share your mod list, and include the steps to reproduce the problem, so that I can take a look at it.
if it doesn't work for you, it would also be great if you could use the Visual Exceptions mod and send me the exact stack traces :)
Pierre_M3 19 Aug, 2024 @ 2:02pm 
Deactivated this mod since errors exist. Maybe i just need a trigger mod: if a new letter comes out and contains certain words, it is auto closed. Left top messages as well.
Wolfe 18 Jul, 2024 @ 1:59am 
And unfortunately I can't use it. I figured out that it bugs the debug actions menu.

Pls fix.
Wolfe 17 Jul, 2024 @ 1:50pm 
Awesome. Thanks for this, doing a 'civil war' type of thing that involves my pawns fighting each other so I really don't need all the death buzzers and stuff popping up on my screen and screaming in my ear lol.
B flat 8 Jun, 2024 @ 11:33am 
Although adding an option to hide a few annoying letters like "masterwork/legendary" work would be appreciated by some. Added it from your discussions post for myself.
B flat 8 Jun, 2024 @ 11:26am 
Legend. Thanks a lot for this.
Bad Connection * 21 May, 2024 @ 4:22am 
hey, thanks for updating this, now its time for the complete anomaly experience
Ossanoda 20 May, 2024 @ 1:08am 
To find the cause of the error, I turned off some mods and then re-enabled all the mods exactly as they were. Now I can use the dev console again, it's really strange.
Ossanoda 20 May, 2024 @ 12:54am 
really good work but break my dev-console
Th3_Fr3d  [author] 19 May, 2024 @ 5:45am 
I created a discussion for questions regarding regular expressions
Th3_Fr3d  [author] 19 May, 2024 @ 5:26am 
Regex might not be the easiest thing to get started with, but once you get the hang of it you can basically customize the hide/show rules in any way you'd like, and depending on what you do for a living it may also benefit you at your job (you can search in microsoft excel or other editors by regex too, for example. So it's a universal notation, albeit an advanced one) ;)
Th3_Fr3d  [author] 19 May, 2024 @ 5:20am 
@Winterwolf
You can achieve inverse matching ("hiding everything except xyz") using regular expressions (regex).

To hide multiple specific letters like Meteorite, Toxic fallout, and Volcanic winter, you can use a regex like this:
^(Meteorite|Toxic fallout|Volcanic winter)$
Here, ^ marks the start of the text, | allows for match alternatives (either Meteorite, Toxic fallout, or Volcanic winter), and $ marks the end of the text.
To invert this behavior (match and hide everything except these messages), you use:
^(?!(Meteorite|Toxic fallout|Volcanic winter)).+$
Here, ^ and $ have the same meaning, while ?! is a negative lookahead that inverts the match inside its parentheses. The . means "any character" and * means "any number of times".
So the full regex hides any message that doesn't start with "Meteorite", "Toxic fallout", or "Volcanic winter".

You can use websites like regex101.com to help you extend this list of messages you want to see, and copy the regex into your mod settings.
Winter 17 May, 2024 @ 1:05am 
Thanks for the mod. Have you ever considered adding the option to un-mute specific letters & messages with expressions?
For context, i have all notifications muted but I'd like to un-mute things that pawns would see or hear (such as crashed shuttles)
Arylice 12 May, 2024 @ 8:26pm 
Ok... I have no idea how this mod worked, but it did, and it's weird... Like some dark magic stuff. I just wrote the word "deteriorated", and all the sudden, those messages were gone... I'll take a potato chip... and eat it! :cleandino:
Th3_Fr3d  [author] 10 May, 2024 @ 10:54am 
updated it to 1.5 ^^
- Added support for the new Anomaly letter types
- Added support for hiding messages (in the top left) by regex
- disabled log outputs by default (was this what you guys were complaining about in dev mode?) Anyways, as always you can toggle debug logging in the mod options.
- PostOffice now only interacts with DLC-based letter types if these DLCs are loaded (might have caused some issues in the past, I don't know)
- reduced overall log spam when verbose logging is enabled and CAI-5000 is loaded.

Did some basic testing and all seems good, but I haven't started a new 1.5 play-through yet, so please report if there are still things that need to be done.
Bad Connection * 26 Apr, 2024 @ 4:19pm 
this would be so good with anomaly and fog of war. fingers crossed you plan to update it
Th3_Fr3d  [author] 1 Mar, 2024 @ 5:30am 
Also, all letter types are now shown by default, there were some complaints about raid notifications being disabled before, so check your mod settings
Th3_Fr3d  [author] 1 Mar, 2024 @ 5:24am 
Okay, I pushed an update. I couldn't reproduce the issue, but I cleaned some things up. Can someone verify if the issue is fixed?

I also added support to hide letters by regular expressions that will be matched against the title of the letter, so if you don't want those "Legendary work" or "Masterwork" letters, add this regex in the mod settings:

([Ll]egendary |[Mm]aster)work

Note that the exact regex may depend on the in-game language
Th3_Fr3d  [author] 1 Mar, 2024 @ 2:49am 
@Raubwurst interesting, that patch shouldn't even be loaded. I'll look into it
Raubwurst 25 Feb, 2024 @ 11:05am 
Issue with breaking devmode still persists. It gives the following error message:


Exception filling window for Verse.ImmediateWindow: System.TypeLoadException: Could not load type of field 'PostOffice.Patching.HarmonyPatches.MusicManagerPlay_DangerMusicModePatch+<>c__DisplayClass0_0:fog' (0) due to: Could not resolve type with token 01000023 (from typeref, class/assembly CombatAI.MapComponent_FogGrid, CombatAI, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null) assembly:CombatAI, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null type:CombatAI.MapComponent_FogGrid member:(null) signature:<none>
at (wrapper managed-to-native) System.RuntimeType.GetMethodsByName_native(System.RuntimeType,intptr,System.Reflection.BindingFlags,bool)
at System.RuntimeType.GetMethodsByName (System.String name, ...
Vampyr 30 Dec, 2023 @ 9:24pm 
With just Post Office(this) alone, if you go into devmode and try to open any of the lists, it breaks. No error message from what I can see, it simply *breaks*.
Th3_Fr3d  [author] 30 Dec, 2023 @ 1:16pm 
Not sure in what way the dev console breaks (how exactly?), maybe there are some mod incompatibilities as I'm not experiencing any issues in my playthrough. Please create an issue on GitHub with the mod list, your settings, and preferably some logs or screenshots. I can't fix what I can't reproduce ;)
Delta1138 26 Dec, 2023 @ 5:44pm 
Yeah can confirm this breaks dev mode and stops all raid/mad animal notifications (lost 3 colonies due to raids attacks and me not seeing till my pawn went down, didn't realise this was the the default setting).
Reick 6 Dec, 2023 @ 12:54am 
Same here, broken dev console.
Vampyr 13 Nov, 2023 @ 11:59pm 
Yep, borked dev console. :(
Winter 10 Nov, 2023 @ 8:45pm 
Would enabling Raid alerts while pawns are on watch towers from Preemptive Strike be possible?
Draylynn 8 Nov, 2023 @ 12:14pm 
Also broken dev console here with this mod.
toetruckthetrain 29 Sep, 2023 @ 4:08pm 
well, i have harmony but this just breaks the dev console
toetruckthetrain 28 Sep, 2023 @ 4:11pm 
Masterwork shelves
Alex Nares 22 Sep, 2023 @ 8:47pm 
I was confused by the terminology used in the options. I thought "Drop" letters meant to allow them to appear (as in "dropping" loot or dropping a letter), but in this case, it means "Disallow". For clarification, a green checkmark means the mod will STOP those letters from appearing, and a red X means you will still receive them as normal.
Th3_Fr3d  [author] 19 Sep, 2023 @ 6:02am 
Would definitely be cool to be able to toggle each actual letter type individually tho
Th3_Fr3d  [author] 19 Sep, 2023 @ 6:00am 
@Sprinkles The mod (and RimWorld) uses something called "LetterDef"s to differentiate between different letter types, of which already all are supported. Some of these rather abstract type categories then are somehow divided into the actual letter types you see in the game (for example the "Underground scan" letter). rn I'm not sure how that second/more fine-grained division is implemented by the game. In short: atm I'm busy writing my thesis, but after that I may take a deeper look into how the game handles these things. Can't promise anything though :)
Sprinkles 15 Sep, 2023 @ 8:19am 
Would be great to add functionality for all letter types, I've been looking for the ability to disable the "Underground scan" letter. Also would it be possible to add a way to change any letter to a top left notification?
Johnson1893 13 Sep, 2023 @ 4:19am 
How to open letter filter? Can't find a mod options...
cptnoname 23 Jul, 2023 @ 1:58pm 
Noice!
Sir Luis 23 Jul, 2023 @ 1:18pm 
subbing and testing