RimWorld

RimWorld

749 ratings
TD Find Lib
3
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.4, 1.5
File Size
Posted
Updated
1.318 MB
Nov 29, 2022 @ 2:11pm
Aug 8, 2024 @ 1:35pm
44 Change Notes ( view )

Subscribe to download
TD Find Lib

In 1 collection by Uuugggg
Uuugggg's RimWorld mods
29 items
Description
A framework for user-customizable, highly-detailed filters for things.

Library mod
This is a Library mod which does nothing by itself! It does have some UI to hold the library of searches, which you can set up, peek at and save. But other mods are needed for real use:

Get yourself Ctrl-F and Custom Alerts to use it! Also, Everybody Gets One makes use of it. Also YOUR MOD should use this! It's a library mod! USE IT IN YOUR MOD!

Share your Custom Filters
The possibilities are endless! New ideas come up all the time! So share your custom search with everyone in this thread:
https://steamcommunity.com/workshop/filedetails/discussion/2895299310/4342103279871646531/

Features
A very deep filtering framework. A long list of details to filter things on.

A library of saved searches. (Accessible through settings, but also mods that use TDFindLib should have an easier button to open the library) Whatever mod uses TD Find Lib has access to the library so it's easy to share across games.

An editor window to create and edit searches, openable from the library. Ctrl-C, Ctrl-V copy/paste. Ctrl-drag a filter to copy it (with the caveat it can't be placed next it itself because underlying code didn't handle that)

A viewer window to perform a search on a map, openable from the editor. (Rudimentary use here, use other mods for better UI) Click/drags items in the list to select them. Double-click to select all of the same type. Ctrl-click to add or remove from selection. Right-click them to go to them.

Easily import and export searches from mod to mod, or to the library, or even the clipboard!

For use in other mods
This mod is made for other modders to use. If your mod can make use of user-customizable searches, this mod makes it easy.

So what could you use it for? Well, I very quickly updated my mod Everybody Gets One to use it! That mod lets work bills set a limit based on the number of colonists instead of a set number. But ever since 1.1->1.4 added slaves, children, etc, you don't just want the number of colonists to set the limit - there's room for customization! But that's too many options and combinations for that mod to think about. But with the power of TDFindLib, it was easy! So instead of making "One Hat for each colonist", it can be "One Hat per prisoner/colonist" or "tribalwear for slaves and prisoners" or "pants for children only" or any of those, EXCEPT for people with the nudist trait! Whatever you can imagine, the user can set their own filters using TDFindLib. For example when making it, I remembered, hey, I can make swords for only people with melee skill! THANK YOU TDFINDLIB!

Search Details
A search has a few components:

Listing. What basic type of thing to list. Ctrl-click the listing to set multiple types.

Match any/all. Simply whether or not to match any or all filters.

Map. By default, searches are performed on the current map. But it can be set to use all maps, or specific maps in your game.

Filters. The bulk of this mod is a huge list of filters for nearly anything about an item. If you want a new one, ask - they're not hard to code up. (If you're making a mod yourself - it's also easy to add new ThingQuery subclasses in C#)

Each filter can be set to Include or Exclude items that match the filter. A filter can be temporarily turned off. The filters can be locked, I guess, to show a cleaner presentation... I dunno, it felt like a good idea.

When selecting a filter setting, it will often narrow down the options to things that are available on the map. Shift-click the setting to get a list of all possible things (which can be a very long list!)

Advanced filters: if you dare, the C# fields of Thing are accessible with the Advanced Filter. Type in a field name and get a dropdown list for C# fields, among a few other options like is null. This is not technically running that C#, but is painstakingly handled so it is not slow either. There's some safety measures so you don't, for example, thing.Kill() every item on the map. But still, you should know what you're doing in C# to use this. If you *really* know what you're doing, you can enable godmode to access private fields (enable godmode before creating the filter)

Performance
When a mod performs a lot of of searches, you might worry about performance.

Well, don't set up a search that goes through 10,000 things and searches them by name! The 'all' filter literally searches all bushes, grass, dirt, etc.

First, if your search only concerns one type, be sure to set the Listing appropriately so the search is faster, like Listing: Items. Ctrl-click listing to select multiple types.

Second, order your filters to narrow down things quickly. The lower filters are only checked if the item passes the previous filters. For example, in the the Wild Plants filter: Don't put the "Not in a zone" filter first, since most things are not in a zone. First, narrow down quickly by filtering for the few plants that are "Harvestable Now".

Some filters are slower than others. Some are simply one-item checks whereas others like the name filter have a lot more work to do. Consider that.

Tedious detailed Notes

Corpses/"Minified Buildings" are weird. They are technically two items: containers, and the the Person/Building in the container. Since you probably want to match on the "contents", TDFindLib applies the filter to the "contents". But the location is from the "container", so filters pass if either the "container" or the "contents" pass. So that poses few conundrums. Some filters like 'Health %' are weird since a 0% Colonist is stored in a 100% corpse. So don't expect corpse searching to work perfect.

If you just want any minified thing : Specific thing => Shift-click (Other) => Minified thing. You can also add to that search Specific Thing => Furniture => Bedroll and it will find minified bedrolls.

Each corpse has a separate listing under Specific Thing => ___ Corpses.

Selected items highlight what filters they match - but this doesn't work for Inventory items, since you're not selecting the things in the inventory.

Filters like area/zone are filtered by a single position, not accounting size of the thing.

Compatibility?

* RimThemes; all you have to do is enable dialog stacking in RimThemes dialog options.

---

This is an evolution of my old mod List Everything. This mod takes the searching functionality and makes it simple for other mods to use: So List Everything is now Ctrl-F and Custom Alerts, and hopefully more to come.

---

This mod has pushed vanilla UI to the limits, and a few bugfixes are needed for full UI functionality. The fixes are generally useful, so they went in another mod : TDS Bug Fixes, which will include other fixes at some point. Of course the game should auto-download that for you.

---

Github source and releases : https://github.com/alextd/RimWorld-TDFindLib/releases/latest

[tdsgames.com] More from me at https://tdsgames.com. I have a clue-giving party game, Word Limit[tdsgames.com], on the app store!

Hey, people seem to like donating, so: https://ko-fi.com/alextd
Popular Discussions View All (6)
6
Jan 14 @ 4:26pm
Share your Search Library
Uuugggg
7
Oct 6, 2024 @ 1:52am
Expansion filters?
Uuugggg
1
Apr 17, 2024 @ 12:19am
Not sure where to report an error
Nana to Many Monsters
172 Comments
DondarfSnowbonk Apr 22 @ 10:22pm 
Should TDS Bug Fixes be placed above or below this in the mod list? Being a dependency makes me think before, but the fact that it's a bugfix makes me think it should be placed lower (and low in the order).
twystd Apr 11 @ 4:34pm 
perfect, thanks to both of you!
Uuugggg  [author] Apr 9 @ 8:34pm 
Yea, ctrl-drag a filter to copy it (with the caveat it can't be placed next it itself because underlying code didn't handle that)
晓山alreShan Apr 9 @ 6:01pm 
@twystd
filter place[1], filter place[2], filter place[3],
hold "ctrl" and drag to one filter interval ( filter place[+-2] )
twystd Apr 9 @ 5:32pm 
when i add a filter to a search, the list of filters closes after i add one

would it be possible to have a hotkey such as shift or alt that keeps the list of filters open after i add it?

for example if i want to quickly add 5 gene filters to a single search, instead of needing to click add new filter > expansion/mod > biotech > gene and then repeating five times, ideally i'd be able to navigate to the gene filter and then hold a button and left click five times to add five gene filters to the search
CurtimusPrime92 Feb 11 @ 2:18pm 
can you add a Health Condition -> Sickness search option for "developed immunity"

like i want to make a filter with

Health Condition [Sickness(Any)]

on one line, then the next line have

NOT Health Condition [Sickness(Developed Immunity)]

to filter out pawns who are sick but achieved immunity before sickness overtook them
Davai Feb 3 @ 11:02pm 
Oh, thank you for your help, will try it soon!
Uuugggg  [author] Feb 3 @ 1:35pm 
Aye, its doable:
1. Create a Custom filter
2. Click the "thing as Thing" button, select Pawn
3. Paste this in: GetComp LoadoutComponent.Loadout.elements.Tag.name
4. Click "Contains" to change to "is"
5. Write in your Tag name.

Slightly better would be to change that 'name' to 'uniqueId' but the mod doesn't tell you Tag's IDs easily. That can be found in the savefile though.
Uuugggg  [author] Feb 3 @ 1:14pm 
That sort of thing might be handled with the custom filter
Davai Feb 3 @ 9:02am 
Hello there! Love this mod. Is there any chance you will add support for Compositable Loadouts mod? Wanna configure bills to search who uses specific loadout tags and make clothing for them. Compositable Loadouts has their own "X per tag" bill configuration, but it only allows to select one tag and I want to select multiple and maybe add additionl filters from your lib.