Blueprints and flatpacks
This page uses Sprite from Unity. The glossary says what each one is.
A blueprint teaches the player to craft a furniture at a furniture bench, and a flatpack is the packed box form of a furniture that the player unpacks to place it. Define the furniture with Define first, then call DefineBlueprint when your mod loads. Call GiveBlueprint and GiveFlatpack when the player earns them.
FurnitureRegistry blueprints and flatpacks
This is the class for blueprints and flatpacks. DefineBlueprint adds a blueprint, GiveBlueprint teaches it, IsBlueprintKnown checks it, and GiveFlatpack puts flatpacks in the player’s inventory.
public static class FurnitureRegistry
{
public static string DefineBlueprint(string furnitureId, BlueprintDefinition definition);
public static bool GiveBlueprint(string furnitureId);
public static bool GiveBlueprint(string furnitureId, bool silent);
public static bool IsBlueprintKnown(string furnitureId);
public static bool GiveFlatpack(string furnitureId, int amount);
}
| Method | Returns | What it does |
|---|---|---|
DefineBlueprint(furnitureId, definition) | string | Adds the blueprint. Returns its id, or null when refused. |
GiveBlueprint(furnitureId) | bool | Teaches the blueprint to the player, with the game’s notice. |
GiveBlueprint(furnitureId, silent) | bool | Teaches the blueprint. With silent set to true, there is no notice. |
IsBlueprintKnown(furnitureId) | bool | true when the player knows the blueprint. |
GiveFlatpack(furnitureId, amount) | bool | Puts flatpacks in the player’s inventory, one furniture in each. |
BlueprintDefinition the description of one blueprint
You fill one in and pass it to FurnitureRegistry.DefineBlueprint. It says what the craft takes, how long it takes and how many pieces it makes.
public sealed class BlueprintDefinition
{
public string Title;
public string Details;
public Sprite Icon;
public Dictionary<int, int> Inputs = new Dictionary<int, int>();
public List<string> FurnitureInputs = new List<string>();
public float ProcessTime = 3600f;
public Skill Skill;
public int MinimumSkill;
public int Amount = 1;
public List<string> Pools = new List<string>();
}
| Property | Type | What it means |
|---|---|---|
Title | string | The name, 1 to 200 characters. null gives “ |
Details | string | The description, up to 2000 characters. null gives an empty description. |
Icon | Sprite | The picture. null uses the furniture’s picture. |
Inputs | Dictionary<int, int> | The items it takes, as item id to amount. Each amount is from 1 to 1000. Item 0 is the coin and item 1 is RM. |
FurnitureInputs | List<string> | The furniture ids it takes, one piece each. |
ProcessTime | float | The base craft time in seconds. It must be above 0 and at most 10000000. |
Skill | Skill | The skill needed. Skill.None for no skill. |
MinimumSkill | int | The skill level needed, from 0 up to Skills.MaxLevel. |
Amount | int | Pieces made by one craft, from 1 to 100. |
Pools | List<string> | The world pools the blueprint joins. See World spawning. |
Things to know
DefineBlueprintreturns the blueprint’s id, which looks likeobx:<mod id>/<key>/blueprint. AnullfurnitureIdreturnsnulland logs once, so a chain of calls after a refusedDefineis safe.- A furniture gets one blueprint. A second call gives back the first id and keeps the first definition. The second definition is still checked, so it can still throw.
- The game scales the craft time. It changes
ProcessTimeby the player’s skill, mushrooms and the difficulty. - Items and furniture in
InputsandFurnitureInputsare checked when the blueprint is first built, not inDefineBlueprint. - You do not need to handle saving for blueprints made with
DefineBlueprint. The framework removes each blueprint around a save and restores it afterwards. GiveBlueprintteaches the blueprint and shows the game’s “New item” notice. Withsilentset totrue, it teaches it without the notice, but the Items screen still marks it as new. (The silent version teaches it through the game’sTaskItemsManager.AddTaskItem. The Items screen marks it new because the game’s default is new when no task item info is passed.)IsBlueprintKnownistruewhen the player has the blueprint. It isfalsefor anullor unknown id, with no save loaded, and while a save is loading. A saved blueprint that did not build in this session still counts as known, whileGiveBlueprintreturnsfalsefor it. (It checks the player’s task items.)GiveFlatpackputsamountflatpacks in the player’s inventory, one furniture in each. Each flatpack is worthPriceOC + PriceRM * 10.- A flatpack is named
<title> in Furniture Flatpackand uses the game’s flatpack box picture. - A blueprint of a removed mod stays in the save, hidden. It can’t be crafted until the mod returns.
Limits
DefineBlueprintreturnsnullwhen the furniture features are not installed or a furniture has already been built. That is the same timing rule asDefine.DefineBlueprintthrows anArgumentNullExceptionfor anulldefinition.DefineBlueprintthrows anArgumentExceptionfor afurnitureIdthat was not defined withDefine, or for aTitleorDetailsoutside its length.DefineBlueprintthrows anArgumentExceptionforInputswith more than 16 entries, a key below 2 (item 0 is the coin and item 1 is RM), or an amount outside 1 to 1000.DefineBlueprintthrows anArgumentExceptionforFurnitureInputswith more than 8 entries, or with an entry that isnull, empty or repeated, or one that is a blueprint id or a badly formedobx:id.DefineBlueprintthrows anArgumentExceptionwhenProcessTimeis not a real number, is 0 or less, or is over 10000000. It also throws whenAmountis outside 1 to 100.DefineBlueprintthrows anArgumentExceptionwhenSkillis not defined, whenMinimumSkillis outside 0 toSkills.MaxLevel, or when it is above 0 withSkill.None.- A missing item, or a furniture input that does not load, is written to the log once and the blueprint does not build.
GiveBlueprintreturnsfalseand changes nothing for anullor unknown id, whenIsAvailableisfalse, for a furniture with no blueprint, or for a blueprint that does not build.GiveBlueprintalso returnsfalseand changes nothing while a save is not fully restored or is being written, when the game’s item manager is not loaded, or when the player already knows the blueprint. An error inside is logged once and returnsfalse.GiveFlatpackthrows anArgumentExceptionwhenamountis outside 1 to 100.GiveFlatpackreturnsfalseand adds nothing for anullor unknown id, a furniture that does not build, a save that is not fully restored or is being written, no inventory, a missing flatpack item, or when the inventory has no room for all of them.IsAvailablehas to betrueforDefine,DefineBlueprint,GiveBlueprint,MailBlueprintandAddFlatpackLoot.- You can’t make blueprints or flatpacks for the game’s own furniture, make more than one blueprint for a furniture, or take a blueprint away.
- A craft in progress when its mod is removed loses its inputs.
When the mod or the framework is removed, blueprints and flatpacks change like this:
| Case | Known blueprint | Craft in progress | Flatpack, packed | Flatpack, unpacked |
|---|---|---|---|---|
| Mod and framework present | It is listed and craftable. | The craft finishes with the mod furniture. | It is named <title> in Furniture Flatpack, and its value is kept. | The mod furniture goes to stock. |
| Mod removed, framework present | It is hidden. It stays in the save with its id, is not listed, and one warning goes to the log. | The craft ends with nothing, and the inputs already spent are lost. | It keeps the same name and value. | It shows as the template, keeping the mod’s id and title, and one warning goes to the log. |
| Mod and framework removed | It is hidden and kept. The framework does not run, so there is no warning. | The craft ends with nothing, and the inputs already spent are lost. | It keeps the same name and value. | It becomes the plain template. The mod’s id is lost at the next save. |
| Mod added back | It is listed and craftable again. | It was already lost. | It keeps the same name and value. | The stand-in in stock becomes the mod furniture on the next load. A plain template from an unpack made without the framework stays a template. |