Hey thanks so much for this plugin! Just have one quick question if anyone else has messed around with using quick smelt and the furnace splitter. So i have the quick smelt set at 2.0 which makes it a little bit faster and i cant figure out if there is a way to get the furnace splitter to help with that. Since it burns faster i need the furnace splitter to add about 2% more wood each time. Anyone else have a fix for that?!
Compatibility with Quick Smelt pluginSuggestion
I am in the same spot.... Quick Smelt usage with Fyrnace Splitter also fouls up the time estimation..... Please someone deliver a fix for this.
I think you meant "with LESS wood". For as long as I remember playing (not that long), 90% of servers with Furnace Splitter + Quick Smelt, when you fill the furnace, you always have to take HALF of the wood away, because Admins leave Quick Smelt at 2x, which means Furnace Splitter is setting 2x more wood than necessary. PLEASE, give us a simple multiplier config option, and that would be it! Admins just had to adjust Quick Smelt multiplier with Furnace Splitter multiplier. It's just one variable.
In response to Ultramarino ():I think you meant "with LESS wood". For as long as I remember playing (not that long), 90% of server...
I just spend some hours, and now I know better: it's QuickSmelt that most Admins just dont know how to configure. Here is a link to a good config of QuickSmelt to work well with Furnace Spliter:
https://github.com/mspeedie/Rust-Plugin-Fixes/blob/master/QuickSmelt.json
In this config, just change all the "5000" values on the top to "5", which gives a more satisfing experience. Insta-crafting with 5000 is for newbies, I dont want the game that flat.
https://github.com/mspeedie/Rust-Plugin-Fixes/blob/master/QuickSmelt.json
In this config, just change all the "5000" values on the top to "5", which gives a more satisfing experience. Insta-crafting with 5000 is for newbies, I dont want the game that flat.
In response to Ultramarino ():I just spend some hours, and now I know better: it's QuickSmelt that most Admins just dont know how...
Welcome to the support category for Monument Finder. For help with this plugin, please create a new thread under this category along with details, any logs containing related errors, and any other information that may be considered beneficial in order to help resolve your issue.
If you need help with permissions, please see the Docs for a more information. For support with uMod, please use the General Support forums section. If you need help with a different plugin, please use the forums category specifically for that plugin.
If you need help with permissions, please see the Docs for a more information. For support with uMod, please use the General Support forums section. If you need help with a different plugin, please use the forums category specifically for that plugin.
I was able to set my config up so that it is using the right amount of wood at the right pace.
Here's my config file for 2x output. You need to edit the "Speed Multipliers" as well as "Fuel Usage Speed Modifier" to match whatever your QuickSmelt setting is.
https://github.com/Highweigh/rusty/blob/master/QuickSmelt.json
Here's my config file for 2x output. You need to edit the "Speed Multipliers" as well as "Fuel Usage Speed Modifier" to match whatever your QuickSmelt setting is.
https://github.com/Highweigh/rusty/blob/master/QuickSmelt.json
I noticed that theres a minor inconsistency when using Furnace Splitter with Quick Smelt, where the estimated time for smelting and the fuel needed were often incorrect, and usually by a significant margin when all of the Quick Smelt multipliers are used. I created a quick patch for this to fix the issue for the global Quick Smelt multipliers, and thought I'd contribute the changes I made. This patch was put together in a few hours, so it is a bit rudimentary, and it doesn't cover all the potential edge cases. It essentially grabs data from the config file for Quick Smelt, and then applies the relevent values to the fuel and time calculation.
I included the code for my changes instead of the entire file to discourage users from simply downloading the file and then flooding the forum when something breaks. This is my first post here so please let me know if there's a better way that you prefer for this type of thread. Here's the list of changes made:
First an extra library is included to enable referencing the config directory:
The new function LoadQuickSmelt() was added to the existing Loaded function:
And finally the GetOvenInfo function was modified to update the fuel and time values with the appropriate modifiers:
Hopefully this helps out a bit with updating the plugin, obviously some more loops will be needed to cover all the other types of containers that this applies to, and there is likely a better way to access the configuration for another plugin as well.
Let me know if you have any questions or feedback regarding this topic.
I included the code for my changes instead of the entire file to discourage users from simply downloading the file and then flooding the forum when something breaks. This is my first post here so please let me know if there's a better way that you prefer for this type of thread. Here's the list of changes made:
First an extra library is included to enable referencing the config directory:
using Oxide.Core.Configuration;Next a new region was added with functions to load in the Quick Smelt configuration data, and then parse out the required values, with much of the code coming straight from Quick Smelt:
#region QuickSmeltConfiguration
// Object to store relevant quick smelt modifiers
QuickSmeltConfig QSmelt = new QuickSmeltConfig();
private class QuickSmeltConfig
{
public float speed_multi = 1.0F;
public float fuel_multi = 1.0F;
public int fuel_usage = 1;
public int smelt_freq = 1;
}
// Configuration Object from QuickSmelt.cs
private static Configuration _config;
private class Configuration
{
[JsonProperty(PropertyName = "Use Permission")]
public bool UsePermission = true;
[JsonProperty(PropertyName = "Speed Multipliers", ObjectCreationHandling = ObjectCreationHandling.Replace)]
public Dictionary<string, float> SpeedMultipliers = new Dictionary<string, float>
{
{"global", 1.0f},
{"furnace.shortname", 1.0f}
};
[JsonProperty(PropertyName = "Fuel Usage Speed Multipliers",
ObjectCreationHandling = ObjectCreationHandling.Replace)]
public Dictionary<string, float> FuelSpeedMultipliers = new Dictionary<string, float>
{
{"global", 1.0f},
{"furnace.shortname", 1.0f}
};
[JsonProperty(PropertyName = "Fuel Usage Multipliers",
ObjectCreationHandling = ObjectCreationHandling.Replace)]
public Dictionary<string, int> FuelUsageMultipliers = new Dictionary<string, int>
{
{"global", 1},
{"furnace.shortname", 1}
};
[JsonProperty(PropertyName = "Output Multipliers", ObjectCreationHandling = ObjectCreationHandling.Replace)]
public Dictionary<string, Dictionary<string, float>> OutputMultipliers =
new Dictionary<string, Dictionary<string, float>>
{
{
"global", new Dictionary<string, float>
{
{"global", 1.0f}
}
},
{
"furnace.shortname", new Dictionary<string, float>
{
{"item.shortname", 1.0f}
}
}
};
[JsonProperty(PropertyName = "Whitelist", ObjectCreationHandling = ObjectCreationHandling.Replace)]
public Dictionary<string, List<string>> Whitelist = new Dictionary<string, List<string>>
{
{
"global", new List<string>
{
"item.shortname"
}
},
{
"furnace.shortname", new List<string>
{
"item.shortname"
}
}
};
[JsonProperty(PropertyName = "Blacklist", ObjectCreationHandling = ObjectCreationHandling.Replace)]
public Dictionary<string, List<string>> Blacklist = new Dictionary<string, List<string>>
{
{
"global", new List<string>
{
"item.shortname"
}
},
{
"furnace.shortname", new List<string>
{
"item.shortname"
}
}
};
[JsonProperty(PropertyName = "Smelting Frequencies (Smelt items every N smelting ticks)",
ObjectCreationHandling = ObjectCreationHandling.Replace)]
public Dictionary<string, int> SmeltingFrequencies = new Dictionary<string, int>
{
{"global", 1},
{"furnace.shortname", 1}
};
[JsonProperty(PropertyName = "Debug")]
public bool Debug = false;
}
// Modified function from quicksmelt to grab values, only use global versions, ignore output, whitelist, and blacklist
private void Awake()
{
float modifierF; // float modifier
int modifierI; // int modifier
if (!_config.SpeedMultipliers.TryGetValue("global", out modifierF))
modifierF = 0.5f / 1.0f;
QSmelt.speed_multi = 0.5f / modifierF;
if (!_config.FuelSpeedMultipliers.TryGetValue("global", out modifierF))
modifierF = 1.0f;
QSmelt.fuel_multi = modifierF;
if (!_config.FuelUsageMultipliers.TryGetValue("global", out modifierI))
modifierI = 1;
QSmelt.fuel_usage = modifierI;
if (!_config.SmeltingFrequencies.TryGetValue("global", out modifierI))
modifierI = 1;
QSmelt.smelt_freq = modifierI;
}
protected void LoadDefaultQSConfig() => _config = new Configuration();
// Patch to fix ETA and fuel usage calculation bug with QuickSmelt plugin
private void LoadQuickSmelt()
{
var quicksmeltfile = Interface.Oxide.ConfigDirectory + "\\QuickSmelt.json";
DynamicConfigFile quickSmeltConfig = new DynamicConfigFile(quicksmeltfile);
if (quickSmeltConfig.Exists() == true)
{
try
{
_config = quickSmeltConfig.ReadObject<Configuration>();
if (_config == null) throw new Exception();
}
catch
{
PrintError("The QuickSmelt configuration file contains an error. Using default configuration values.");
LoadDefaultQSConfig();
}
}
else
{
LoadDefaultQSConfig();
}
Awake();
Debug.Log("The QuickSmelt patch for Furnace Splitter was loaded successfully!");
}
#endregion QuickSmeltConfigurationThe new function LoadQuickSmelt() was added to the existing Loaded function:
private void Loaded()
{
storedData = Interface.Oxide.DataFileSystem.ReadObject<StoredData>(Name);
permission.RegisterPermission(permUse, this);
if (config == null)
{
// Default config not created, load existing config.
config = Config.ReadObject<PluginConfig>();
}
else
{
// Save default config.
Config.WriteObject(config);
}
// Load in patch for QuickSmelt
LoadQuickSmelt(); // <<------ This is the new function
}And finally the GetOvenInfo function was modified to update the fuel and time values with the appropriate modifiers:
public OvenInfo GetOvenInfo(BaseOven oven)
{
OvenInfo result = new OvenInfo();
var smeltTimes = GetSmeltTimes(oven);
if (smeltTimes.Count > 0)
{
// Patched calculations to work with QuickSmelt
var longestStack = smeltTimes.OrderByDescending(kv => kv.Value).First();
float fuelUnits = oven.fuelType.GetComponent<ItemModBurnable>().fuelAmount;
float neededFuel = (float)Math.Ceiling(longestStack.Value * QSmelt.fuel_multi * QSmelt.fuel_usage * QSmelt.smelt_freq * (0.5f * oven.cookingTemperature / 200.0f) / fuelUnits);
result.FuelNeeded = neededFuel;
result.ETA = longestStack.Value * QSmelt.speed_multi * QSmelt.smelt_freq;
}
return result;
}Hopefully this helps out a bit with updating the plugin, obviously some more loops will be needed to cover all the other types of containers that this applies to, and there is likely a better way to access the configuration for another plugin as well.
Let me know if you have any questions or feedback regarding this topic.
Hi ccdog,
Thank you for this great solution, a test on my Server was successful and the Update / Fix works for me.
The only Problem i have now is, that player who dont have Quicksmelt in theyre Permissions cant use Furnacesplitter anymore. The Ratio ist not corrrect. Can u help me out with that?
The Test was with 3x10 Stacks with HQM and small furnace. Problem the Furnace is out of wood.
Centix
Thank you for this great solution, a test on my Server was successful and the Update / Fix works for me.
The only Problem i have now is, that player who dont have Quicksmelt in theyre Permissions cant use Furnacesplitter anymore. The Ratio ist not corrrect. Can u help me out with that?
The Test was with 3x10 Stacks with HQM and small furnace. Problem the Furnace is out of wood.
Centix
Hello centix,
So that issue is from quicksmelt changing the smelting speed just from being loaded, even when it's multipliers are all set to 1, as it seems to override the smelting process manually. To compensate for this, quicksmelt uses a base speed multiplier of 0.5, which is divided by the user provided multiplier. I can fix this issue, but the method I used for checking if a quicksmelt configuration file exists isn't the best, as it can't tell if quicksmelt is actually loaded and in use.
Do you know of a better way to check if the quicksmelt plugin is running? I have been attempting to create an instance of PluginManager to check if quicksmelt is loaded, but that has been unsuccessful so far. Let me know if you find anything that can accomplish this, I'll continue looking through the oxide code and other mods in the meantime to see if I can find any solutions.
ccdog
Merged post
Nevermind, I looked around a bit more and found the reference for the root plugin manager from Interface.Oxide. I made modifications to the following parts of my original functions, as seen below:
This should fix the issue you had found, and also eliminate the creation of an unnecessary config file if QuickSmelt isn't being used. The only other area that could use improvement is that FurnaceSplitter still requires reloading if QuickSmelt is added, removed, or the config is modified. In the future this could probably be handled with hooks, but I'm still a bit new to this and I haven't fully figured out how to implement that yet.
Let me know if you have any other questions, or find any more bugs.
ccdog
Merged post
Hey centix,
Soon after my last post I realized that the latest fix didn't actually address the permissions issue that you were having, and instead it resolved an issue where this patch would cause problems if quicksmelt wasn't installed. I have since played around with the plugin a bit more to allow it to work with permissions, here's what I added to do this:
Overall this should generally fix the permissions issues you were experiencing on your server. The only potential issue that may arise is that it gets the permissions based on the owner of a particular oven, so I'm unsure of the behavior when someone without quicksmelt permissions uses an oven placed by someone with permissions. Odd behavior may also occur if someone with QuickSmelt permissions tries to use an oven that was placed by someone without permissions.
Unfortunately these issues seem much more troublesome to fix, as the GetOvenInfo method has no way to reference the player currently using the oven, and changing this would require overhauling the plugin which could potentially break other portions of the functionality, as well as other plugins which rely on Furnace Splitter.
Let me know if you have any issues applying this latest portion of the patch, and I'd appreciate any feedback if you find additional bugs or glitches, especially when sharing furnaces between players with different permissions, as I wasn't able to test this fully on my development server.
So that issue is from quicksmelt changing the smelting speed just from being loaded, even when it's multipliers are all set to 1, as it seems to override the smelting process manually. To compensate for this, quicksmelt uses a base speed multiplier of 0.5, which is divided by the user provided multiplier. I can fix this issue, but the method I used for checking if a quicksmelt configuration file exists isn't the best, as it can't tell if quicksmelt is actually loaded and in use.
Do you know of a better way to check if the quicksmelt plugin is running? I have been attempting to create an instance of PluginManager to check if quicksmelt is loaded, but that has been unsuccessful so far. Let me know if you find anything that can accomplish this, I'll continue looking through the oxide code and other mods in the meantime to see if I can find any solutions.
ccdog
Merged post
Nevermind, I looked around a bit more and found the reference for the root plugin manager from Interface.Oxide. I made modifications to the following parts of my original functions, as seen below:
private class QuickSmeltConfig
{
public float base_speed = 1.0F;
public float speed_multi = 1.0F;
public float fuel_multi = 1.0F;
public int fuel_usage = 1;
public int smelt_freq = 1;
}Added a base speed modifier, set to 0.5 if quicksmelt is loaded, 1.0 otherwise. // Modified function from quicksmelt to grab values, only use global versions, ignore output, whitelist, and blacklist
private void Awake()
{
float modifierF; // float modifier
int modifierI; // int modifier
if (!_config.SpeedMultipliers.TryGetValue("global", out modifierF))
modifierF = QSmelt.base_speed / 1.0f;
QSmelt.speed_multi = QSmelt.base_speed / modifierF;
if (!_config.FuelSpeedMultipliers.TryGetValue("global", out modifierF))
modifierF = 1.0f;
QSmelt.fuel_multi = modifierF;
if (!_config.FuelUsageMultipliers.TryGetValue("global", out modifierI))
modifierI = 1;
QSmelt.fuel_usage = modifierI;
if (!_config.SmeltingFrequencies.TryGetValue("global", out modifierI))
modifierI = 1;
QSmelt.smelt_freq = modifierI;
}Adjusted the awake function to use the base speed modifier instead of the static value of 0.5 private void LoadQuickSmelt()
{
// Find if the Quicksmelt plugin exists and is loaded before checking the config file
Plugin QuickSmelt = Interface.Oxide.RootPluginManager.GetPlugin("QuickSmelt");
if (QuickSmelt)
{
// QuickSmelt plugin exists, check if it is loaded
try
{
if (QuickSmelt.IsLoaded)
{
var quicksmeltfile = Interface.Oxide.ConfigDirectory + "\\QuickSmelt.json";
DynamicConfigFile quickSmeltConfig = new DynamicConfigFile(quicksmeltfile);
if (quickSmeltConfig.Exists() == true)
{
try
{
_config = quickSmeltConfig.ReadObject<Configuration>();
if (_config == null) throw new Exception();
}
catch
{
PrintError("The QuickSmelt configuration file contains an error. Using default configuration values.");
LoadDefaultQSConfig();
}
}
else
{
LoadDefaultQSConfig();
}
// Set base speed modifier to 0.5 when using QuickSmelt
QSmelt.base_speed = 0.5F;
Awake();
}
}
catch
{
PrintError("An error was encountered while checking for the QuickSmelt Plugin. Using default configuration values.");
QSmelt = new QuickSmeltConfig();
}
}
else
{
// QuickSmelt not found, load in the default config in case it was previously loaded
QSmelt = new QuickSmeltConfig();
}
return;
}The LoadQuickSmelt method was altered to check for the quicksmelt plugin via the RootPluginManager, to prevent creating a new config file on servers without quicksmelt, and correctly apply the base speed modifier only when the plugin is loaded. public OvenInfo GetOvenInfo(BaseOven oven)
{
OvenInfo result = new OvenInfo();
var smeltTimes = GetSmeltTimes(oven);
if (smeltTimes.Count > 0)
{
var longestStack = smeltTimes.OrderByDescending(kv => kv.Value).First();
float fuelUnits = oven.fuelType.GetComponent<ItemModBurnable>().fuelAmount;
float neededFuel = (float)Math.Ceiling(longestStack.Value * QSmelt.fuel_multi * QSmelt.fuel_usage * QSmelt.smelt_freq * (QSmelt.base_speed * oven.cookingTemperature / 200.0f) / fuelUnits);
result.FuelNeeded = neededFuel;
result.ETA = longestStack.Value * QSmelt.speed_multi * QSmelt.smelt_freq;
}
return result;
}Added base speed modifier to the fuel calculation, as it was causing only half the needed fuel to be used when quicksmelt wasn't loaded.This should fix the issue you had found, and also eliminate the creation of an unnecessary config file if QuickSmelt isn't being used. The only other area that could use improvement is that FurnaceSplitter still requires reloading if QuickSmelt is added, removed, or the config is modified. In the future this could probably be handled with hooks, but I'm still a bit new to this and I haven't fully figured out how to implement that yet.
Let me know if you have any other questions, or find any more bugs.
ccdog
Merged post
Hey centix,
Soon after my last post I realized that the latest fix didn't actually address the permissions issue that you were having, and instead it resolved an issue where this patch would cause problems if quicksmelt wasn't installed. I have since played around with the plugin a bit more to allow it to work with permissions, here's what I added to do this:
// Boolean to store if quicksmelt exists, avoid constantly checking for QS plugin after loading
private bool QuickSmeltExists = false;
QuickSmeltConfig QSmelt_default = new QuickSmeltConfig();Added near the beginning of the plugin (right after #region QuickSmeltConfiguration), to store a default configuration for players that don't have quicksmelt permissions.
// Patch to fix ETA and fuel usage calculation bug with QuickSmelt plugin
private void LoadQuickSmelt()
{
// Find if the Quicksmelt plugin exists and is loaded before checking the config file
Plugin QuickSmelt = Interface.Oxide.RootPluginManager.GetPlugin("QuickSmelt");
if (QuickSmelt)
{
// QuickSmelt plugin exists, check if it is loaded
try
{
if (QuickSmelt.IsLoaded)
{
var quicksmeltfile = Interface.Oxide.ConfigDirectory + "\\QuickSmelt.json";
DynamicConfigFile quickSmeltConfig = new DynamicConfigFile(quicksmeltfile);
if (quickSmeltConfig.Exists() == true)
{
try
{
_config = quickSmeltConfig.ReadObject<Configuration>();
if (_config == null) throw new Exception();
}
catch
{
PrintError("The QuickSmelt configuration file contains an error. Using default configuration values.");
LoadDefaultQSConfig();
}
}
else
{
LoadDefaultQSConfig();
}
// Set base speed modifier to 0.5 when using QuickSmelt
QuickSmeltExists = true;
QSmelt.base_speed = 0.5F;
Awake();
}
}
catch
{
QuickSmeltExists = false;
PrintError("An error was encountered while checking for the QuickSmelt Plugin. Using default configuration values.");
QSmelt = new QuickSmeltConfig();
}
}
else
{
QuickSmeltExists = false;
// QuickSmelt not found, load in the default config in case it was previously loaded
QSmelt = new QuickSmeltConfig();
}
return;
}I revised LoadQuickSmelt to set 'QuickSmeltExists' to true if QuickSmelt is loaded, and false otherwise. private QuickSmeltConfig getQSConfig(BaseOven oven)
{
QuickSmeltConfig QS_config;
ulong id = oven.OwnerID;
// If owner of the furnace has QuickSmelt permission, use the quicksmelt permissioned settings
if (permission.UserHasPermission(id.ToString(), "quicksmelt.use") && QuickSmeltExists)
{
QS_config = QSmelt;
}
// If the oven owner doesn't have quicksmelt permissions or QuickSmelt isn't loaded, use the default settings
else
{
QS_config = QSmelt_default;
}
return QS_config;
}I added in a new method right after LoadQuickSmelt, which returns the proper configuration based on if the user has permissions or not. public OvenInfo GetOvenInfo(BaseOven oven)
{
OvenInfo result = new OvenInfo();
var smeltTimes = GetSmeltTimes(oven);
QuickSmeltConfig QS_config = getQSConfig(oven);
if (smeltTimes.Count > 0)
{
// Patched calculations to work with QuickSmelt
var longestStack = smeltTimes.OrderByDescending(kv => kv.Value).First();
float fuelUnits = oven.fuelType.GetComponent<ItemModBurnable>().fuelAmount;
float neededFuel = (float)Math.Ceiling(longestStack.Value * QS_config.fuel_multi * QS_config.fuel_usage * QS_config.smelt_freq * (QS_config.base_speed * oven.cookingTemperature / 200.0f) / fuelUnits);
result.FuelNeeded = neededFuel;
result.ETA = longestStack.Value * QS_config.speed_multi * QS_config.smelt_freq;
}
return result;
}I modified 'GetOvenInfo' to use include the use of QuickSmelt permissions, and I also renamed some variables accordingly.Overall this should generally fix the permissions issues you were experiencing on your server. The only potential issue that may arise is that it gets the permissions based on the owner of a particular oven, so I'm unsure of the behavior when someone without quicksmelt permissions uses an oven placed by someone with permissions. Odd behavior may also occur if someone with QuickSmelt permissions tries to use an oven that was placed by someone without permissions.
Unfortunately these issues seem much more troublesome to fix, as the GetOvenInfo method has no way to reference the player currently using the oven, and changing this would require overhauling the plugin which could potentially break other portions of the functionality, as well as other plugins which rely on Furnace Splitter.
Let me know if you have any issues applying this latest portion of the patch, and I'd appreciate any feedback if you find additional bugs or glitches, especially when sharing furnaces between players with different permissions, as I wasn't able to test this fully on my development server.
Hey can you post the hole .cs file or even post the hole code to replace?
i'm not sure where to add you changings
Thanks would be awesome :)
i'm not sure where to add you changings
Thanks would be awesome :)
Hey Roofers, I can indeed post the entire file, just be aware that if the plugin gets updated and this fix is not included, then you may need to manually add in the patch using steps listed previously (though this file should help if you're confused about where the patch should go).
I also still haven't gotten around to testing the behavior when using an oven owned by someone with different permissions, so I'd appreciate your feedback if you discover any more bugs.
I also still haven't gotten around to testing the behavior when using an oven owned by someone with different permissions, so I'd appreciate your feedback if you discover any more bugs.
Enjoy!
-ccdog
If sharing a modified version, please do so via PM, thanks!
Sorry about that Wulf, thanks for letting me know!
Hello ! someone have a functional version to share me please
I whould like a modified version if you can help with that. As my server has booth.