RimWorld

RimWorld

796 ratings
TD Find Lib
3
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.4, 1.5
File Size
Posted
Updated
1.318 MB
29 Nov, 2022 @ 2:11pm
8 Aug, 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://steamhost.cn/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 (7)
6
14 Jan @ 4:26pm
Share your Search Library
Uuugggg
7
6 Oct, 2024 @ 1:52am
Expansion filters?
Uuugggg
1
17 Apr, 2024 @ 12:19am
Not sure where to report an error
Genaeve
180 Comments
oscarmdsh69 23 hours ago 
1.6 update coming?
Asteroid 25399 10 Jul @ 12:00pm 
@noszbytouj completely agree. I miss Ctrl+F and Custom Alerts soooo much.
noszbytouj 6 Jul @ 4:47am 
@Nuker1110 Ctrl F is on a whole different level compared to vanilla; doesn't even come close to what the mod can offer
Nuker1110 5 Jul @ 6:38pm 
@nosz for "Ctrl F" searching the map, press Z. It's vanilla now.
noszbytouj 30 Jun @ 12:36pm 
I know that there's still time for 1.6, but damn, playing without this (and custom alerts, ctrl f, and everyone gets one) is like being thrown back to the dark ages. Take your time, but fingers crossed for release sometime soon :)
晓山alreShan 25 Jun @ 7:07am 
@CrazyBlot Why you need it? Isn't there a white letter to notice you have orbital trader available?
CrazyBlot 25 Jun @ 5:29am 
Hello. Looking for possibility to alert myself when orbital trader in range. Perhaps we have such possibility with this mod?
2498timmy 16 Jun @ 5:47pm 
Will this be updated to 1.6?
DondarfSnowbonk 22 Apr @ 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 11 Apr @ 4:34pm 
perfect, thanks to both of you!