This feature has been released and is available for mods to be used. The documentation is available here.
How to enable
Open ini setting file, search [Experimental] section and set
Code: Select all
CustomBooksImport=True
- Place a new book file with .TXT extension inside StreamingAssets/Books. Example: StreamingAssets/Books/ExampleBook.TXT.
- Create a json file inside StreamingAssets/Books/Mapping. Example: StreamingAssets/Books/Mapping/ExampleBooksPack.json.
This file must contain an array of objects, one for each book that is to be announced to the game.Name is the filename without extension.Code: Select all
[{ "Name": "ExampleBook.TXT", "Title": "An Example Book" "ID": 1531909675 }]
Title is a readable name for the book, shown in game. The reason to have it here is to access it without loading the entire book resource.
ID An unique ID for the book between 1 and 2147483647 (generate with google).
IsUnique If true this book is not found inside random loots or bookshelves and must be made available directly by mods.
WhenVarSet Book is available only when this global variable is set.
Custom books can be provided from mods (.dfmod) simulating loose files structure. Specifically, place mapping json files inside a directory that ends with Books/Mapping.
For example, you should have something like this:
Code: Select all
<root>/ReadMe.txt
<root>/ExampleMod.dfmod.json
<root>/modsettings.json
<root>/Books/ExampleBook.TXT
<root>/Books/Mapping/ExampleBooksPack.json
- Custom books can be read from booshelves.
- Custom books can be found inside random loots and added to inventory as items. If mod provider is removed, books inside inventory become unreadable claiming to be ruined.
- Custom books can be made available by mods
Code: Select all
GameManager.Instance.PlayerEntity.Items.AddItem(ItemBuilder.CreateBook("ExampleBook"));