RimWorld Mods

Dynamic Trade Interface Mod

Author of the Dynamic Trade Interface Mod: Zeracronius

Originally inspired by Trade UI Revised, the Dynamic Trade Interface Mod has been written from scatch to provide a customizable and high performance trade interface that other mods can easily extend with additional columns.

Dynamic Trade Interface Mod features

  • Pick and choose what columns and their order.
  • Sort Ascending or descending by clicking columns. (Multiple by holding shift)
  • Double arrow buttons will sell or buy all affordable on first click. Max or Min on second click or if holding shift.
  • Permanently hide everything trader is unwilling to buy.
  • Show only trade buttons near the cursor for better performance. (Buttons are heavy!)
  • Resizable.
  • Designed with performance in mind.
  • Use vanilla any time by holding control as the window opens.
  • Can be added or removed any time!

Out of the box:

  • Durability column.
  • Price per weight column.
  • Label variant of counter column.
  • Xenotype support.
  • Support for Random’s Gene Assistant
  • Support for DragSelect
  • Support for Show Known Techprints

Compatibility notes

Limitations: due to how Rimworld’s UI system works, controls will lose focus if any other control is made visible or invisible ahead of it. Generally to the left and up. This means that for example, putting the buttons to the left of the input counter boxes will cause them to unfocus when buttons change.

Extendability (For modders)

XSD files are bundled with the mod describing how to define a TradeColumnDef.
Based on a number of method handlers, column behaviour can be easily referenced in C#.
Because it doesn’t use any custom typings, it can all be defined without any need for assembly references or otherwise.

The following C# handlers can be defined:

  • static void PostOpen(IEnumerable rows, Transactor transactor)
    Called twice after the window is opened initially, for Colony and Trader respectively. Useful for preparing cache.
  • static void PostClosed(IEnumerable rows, Transactor transactor)
    Called twice after the window is closed, for Colony and Trader respectively. Useful for cleaning up cache.
  • static void Draw(ref Rect cell, Tradeable row, Transactor transactor, ref bool refresh)
    Called every frame for each row to draw column cells.
  • static Func<Tradeable, IComparable> OrderbyValue(Transactor transactor)
    Called once when the table is prepared to provide a sorting value selection function.

All source code can be found on Github

Preview and icons by Madman666.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get your RimWorld T-Shirt!

Dress in RimWorld style. For you or your loved ones!