RimWorld

RimWorld

368 ratings
Float Sub-Menus
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.3, 1.4, 1.5
File Size
Posted
Updated
949.574 KB
17 Sep, 2022 @ 2:37am
3 May @ 5:23pm
13 Change Notes ( view )

Subscribe to download
Float Sub-Menus

Description
Adds support for having sub-menus in float menus.
Update: Now also includes a search field and divider bar for float menus.

This is intended as a library mod, allowing any mod developer to add sub-menus to their float menus.

For players
You only need this mod if another mod has a dependency on it.

If you get errors
If an error in the log mentions FloatMenu, FloatMenuOption or FloatMenuMakerMap, that does not mean that it is related to this mod. They are from vanilla, and you need to look further down in the error message. Only it the error mentions FloatSubMenu, FloatMenuSearch or FloatMenuFilter does it point to having anything to do with this mod.

For mod developers
Sub menus
Add an instance of the FloatSubMenu class in the list of FloatMenuOptions when creating a FloatMenu, and that option will open up a sub-menu when the mouse enters it. They can also be nested, by adding it to the list of options for another FloatSubMenu.

Search field
To add a quick search field that filters the menu items on the label, add an instance of the FloatMenuSearch class in the list of FloatMenuOptions when creating a FloatMenu. The constructor takes a bool, with true meaning that it does a tree search down into any sub-menus and false meaning that it only filters based on items at the same level.

Menu divider
To add menu dividers, add an instance of the FloatMenuDivider class in the list of FloatMenuOptions. The constructor takes an optional label string.

If you use the mod, please drop a comment - I would love to see what you have done with it. :)

Compatibility
The FloatSubMenu class has static factory methods that create either a FloatSubMenu or a normal FloatMenuOption that opens the sub menu when selected, depending on if any incompatible mods are loaded.
Use the CompatMMMCreate when adding sub-menus to the menu created by FloatMenuMakerMap, and CompatCreate otherwise.

Vanilla UI Expanded
Currently does not play nice with Vanilla UI Expanded in 1.3. I have contributed code to VUIE, and the maintainer has said they will incorporate it in their next update. Unfortunately that update will take a while. Since it won't be updated to 1.4 before that, it should be fairly future-proof to use this mod in 1.4.
The specific issues are that using dialog for menus does not work for menus using sub-menus, and the menu option to switch to dialog mode can appear multiple times in sub-menus.

For 1.3, I for now suggest detecting if VUIE is active, and falling back to opening a second menu instead if it is.
For 1.4, there should not be a problem.
Using the factory methods gives this behavior.

Achtung!
Achtung rewites the float menu shown when right-clicking on something on the map in a way that is not compatible with Float Sub-Menus. It should be compatible when used in other menus, though.

When adding menu items to the map right-click menu (the one generated by FloatMenuMakerMap), I suggest detecting if Achtung! is active, and falling back to opening a second menu instead if it is.
Using the (CompatMMMCreate variants of) the factory methods gives this behavior.

RimWorld 1.4
The constructors of the FloatMenuOption class have changed a little in 1.4. I have tried to make it compatible in way that lets the same source code using FloatSubMenu work for both 1.3 & 1.4. The arguments that were added in 1.4 can be passed in the 1.3 version, but will not have any effect.

Source
Source code at Github[github.com]
It is under a BSD license, so feel free to grab the source code if you prefer that to adding a dependency. Do note that if you do that, the compatibility issues with VUIE will not be resolved for you as it stands now. I could not figure out a way to make them compatible from my end that did not require invasive patching into VUIE. The plan is instead to contribute code to VUIE to add compatibility with this mod from there.
22 Comments
Kathanon  [author] 3 May @ 5:26pm 
Update:
- Added FloatMenuToggleOption - a menu option that does not close the menu, but instead toggles on/off.
Elroa 14 Apr @ 3:15pm 
For those who are currently not eligible for this mod, you can unsubscribe and subscribe again. I checked!
Kathanon  [author] 8 Apr @ 2:25pm 
Updated for RimWorld 1.5.
Kathanon  [author] 26 Mar @ 3:56pm 
Hi!

First, see the "If you get errors" section in the description.

I would not recommend using Achtung!, as it is badly out of date. As I understand it, the author does not really have time to support it any more.
「Brainiac」 26 Mar @ 11:14am 
Hello! I have an issue when play with these mods:
Vanilla Psycasts Expanded
Achtung!
Float Sub-Menus

When I choose steel construct and trying to order him move some where error occurs.

https://pastebin.com/Fvi79CDf

Can you help me please? Or I should contact with Achtung! author?
Evil Dr. House 28 Dec, 2022 @ 2:44pm 
i dont know if this is the mod that causes the problem tho i suspect so, when i right click a baby i get this message :
https://github.com/Szkielet0r/rimworld-/blob/main/well%2C%20this%20clearly%20doesnt%20work
Kathanon  [author] 2 Dec, 2022 @ 4:45pm 
@Zane
Thanks for telling me. :) Hope you find the problem.
FloatMenu and FloatMenuOption are from vanilla, this mod adds FloatSubMenu. I can understand the confusion.
Low Intelligence Specimen 2 Dec, 2022 @ 4:37pm 
nevermind, I just disabled it and still getting the errors. I guess float menus are seperate things
Low Intelligence Specimen 2 Dec, 2022 @ 4:28pm 
I get errors with this mod and 'better pawn control', when I try to change my assign policy
https://gist.github.com/be06e52ae35d563ceaf0df7e4d241364
Kathanon  [author] 26 Nov, 2022 @ 2:06am 
@lol
I updated Categorized Bill Menus with a fix (as that is where the error was).