Jump to content

How to fix links in the Database


Recommended Posts

When a mod adds a new building, the Database will automatically add the building. However unlike the Klei buildings, the modded building can't be clicked. The page is there however since you can click on a constructed building and then on the Database button.

 

The fix is this simple:

public static string DisplayName
{
    get { return "<link=\"" + ID + "\">" + Name + "</link>"; }
}
  • Add this to the config class for your new building
  • ID is the string ID (first argument) when calling BuildingTemplates.CreateBuildingDef
  • Name is a private const string, which contains the name you want to display on the screen
  • DisplayName is the only way to get the name to display, meaning it will add a link whenever Klei buildings adds a link

 

The beauty of this solution is that the property isn't building specific and can be copy pasted to new buildings without modifications. Not only is this easy to use and very readable, it will ensure the link is set up correctly each time. It's actually surprisingly easy to mistype this line even if you know what it is supposed to say.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...