diff --git a/assets/opensb/interface/windowconfig/crafting.config.patch b/assets/opensb/interface/windowconfig/crafting.config.patch new file mode 100644 index 0000000..0728507 --- /dev/null +++ b/assets/opensb/interface/windowconfig/crafting.config.patch @@ -0,0 +1,10 @@ +// Default config for all crafting interfaces, vanilla and modded. + +{ "default" : { + // Disables the crafting timer if true. + "disableTimer" : false, + + // This is only used if the crafting timer is enabled. + // This is how many crafts are ran when the crafting timer wraps. + "craftCount" : 1 +} } \ No newline at end of file diff --git a/source/frontend/StarCraftingInterface.cpp b/source/frontend/StarCraftingInterface.cpp index 3156a78..b363b92 100644 --- a/source/frontend/StarCraftingInterface.cpp +++ b/source/frontend/StarCraftingInterface.cpp @@ -38,7 +38,9 @@ CraftingPane::CraftingPane(WorldClientPtr worldClient, PlayerPtr player, Json co auto assets = Root::singleton().assets(); // get the config data for this crafting pane, default to "bare hands" crafting auto baseConfig = settings.get("config", "/interface/windowconfig/crafting.config"); - m_settings = jsonMerge(assets->fetchJson(baseConfig), settings); + m_settings = jsonMerge(assets->json("/interface/windowconfig/crafting.config:default"), + jsonMerge(assets->fetchJson(baseConfig), settings)); + m_filter = StringSet::from(jsonToStringList(m_settings.get("filter", JsonArray()))); GuiReader reader; @@ -266,7 +268,7 @@ void CraftingPane::update(float dt) { // crafters gonna craft while (m_crafting && m_craftTimer.wrapTick()) { - craft(1); + craft(min(m_count, (int)m_settings.getInt("craftCount", 1))); } // update crafting icon, progress and buttons