RimWorld
371 个评价
Float Sub-Menus
   
奖励
收藏
已收藏
取消收藏
Mod, 1.3, 1.4, 1.5
文件大小
发表于
更新日期
949.574 KB
2022 年 9 月 17 日 上午 2:37
5 月 3 日 下午 5:23
13 项改动说明 ( 查看 )

订阅以下载
Float Sub-Menus

描述
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 条留言
Kathanon  [作者] 5 月 3 日 下午 5:26 
Update:
- Added FloatMenuToggleOption - a menu option that does not close the menu, but instead toggles on/off.
Elroa 4 月 14 日 下午 3:15 
For those who are currently not eligible for this mod, you can unsubscribe and subscribe again. I checked!
Kathanon  [作者] 4 月 8 日 下午 2:25 
Updated for RimWorld 1.5.
Kathanon  [作者] 3 月 26 日 下午 3:56 
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」 3 月 26 日 上午 11:14 
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?
Skeletal Husaria 2022 年 12 月 28 日 下午 2:44 
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  [作者] 2022 年 12 月 2 日 下午 4:45 
@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 2022 年 12 月 2 日 下午 4:37 
nevermind, I just disabled it and still getting the errors. I guess float menus are seperate things
Low Intelligence Specimen 2022 年 12 月 2 日 下午 4:28 
I get errors with this mod and 'better pawn control', when I try to change my assign policy
https://gist.github.com/be06e52ae35d563ceaf0df7e4d241364
Kathanon  [作者] 2022 年 11 月 26 日 上午 2:06 
@lol
I updated Categorized Bill Menus with a fix (as that is where the error was).