Add default crafting config values
This commit is contained in:
parent
c127b50303
commit
4c636e911c
10
assets/opensb/interface/windowconfig/crafting.config.patch
Normal file
10
assets/opensb/interface/windowconfig/crafting.config.patch
Normal file
@ -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
|
||||
} }
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user