That works, but to open RimSearch you press z. When it opens, z replaces the default search string. I guess I need to clear the keyboard buffer or something? Or have it open after the key is released?
Edit: I figured it out myself, although I don't know if it's the best way to do it.
What I did is I found the part that checks for keypresses and changed
public override void GameComponentOnGUI()
{
//Check if our keybinding is pressed.
if(RimSearchDefOf.RimSearch_Search != null && RimSearchDefOf.RimSearch_Search.IsDownEvent)
{
//Is our SearchWindow on the stack?
if(Find.WindowStack.Windows.Count(window => window is SearchWindow) <= 0)
{
//If not open our window on the stack.
Find.WindowStack.Add(new SearchWindow());
}
}
}
private bool pressed = false;
public override void GameComponentOnGUI()
{
if (pressed == true && !RimSearchDefOf.RimSearch_Search.IsDownEvent)
{
pressed = false;
//Is our SearchWindow on the stack?
if(Find.WindowStack.Windows.Count(window => window is SearchWindow) <= 0)
{
//If not open our window on the stack.
Find.WindowStack.Add(new SearchWindow());
}
}
//Check if our keybinding is pressed.
if(RimSearchDefOf.RimSearch_Search != null && RimSearchDefOf.RimSearch_Search.IsDownEvent)
{
pressed = true;
}
}