I find there is slight confusion about whether the standard values of the configuration are the native values. Natively horses decay faster while inside so shouldn't "DecayMultiplierInside" be greater than 1? Also how do I only affect horses and leave all the other vehicles completely over to the native decay?
Thanks a lot in advance!
How to only affect horses?Fixed
Looks like you found a bug. Seems I read the decompiled code for Horses wrong.
float num = 1f / decayminutes;
float num2 = ((!IsOutside()) ? 1f : 0.5f);
Hurt(MaxHealth() * num * num2, DamageType.Decay, this, useProtection: false);Unfortunately the decompiler obfuscated the code a bit by unnecessarily inverting the condition. It would be more readable to say float num = IsOutside() ? 0.5f : 1. This means the default DecayMultiplierInside should be 2.0 for inside, not 0.5.
Aside from the above bug, the default configuration should be the same as vanilla for all vehicles that the plugin recognizes. I wrote the custom decay based on the vanilla code. In fact, you can get performance benefits from allowing the plugin to manage decay, by tuning down its frequency.
If you are wondering, the plugin does compensate for scheduling changes you make. For instance, if you decrease the frequency of decay, the plugin will compensate by increasing damage dealt when decay does hit. That allows you to change the decay frequency, in order to improve performance, without changing the average damage over time. If you want to watch the decay in action live, you can remove the // from the // #define DEBUG_SHOW line at the beginning of the cs file, causing admins to see decay debug info for nearby vehicles, when decay is scheduled to take place.
If you want to reduce the risk of bugs being present for other vehicle types, I could probably add a config option to each vehicle type to determine whether the plugin even affects them.
Hi! Thanks a lot for the super fast message and fix! Awesome, that it raises performance indeed. But yes, I think if someone wants to be absolutely sure that the native behaviour is used on all vehicles he doesn't want affected (even if that increases performance with regards to your plugin) it would be great to be able to configure that. Also in case he's not looking into this a lot and Facepunch changes something.
BTW, does the plugin affect boats (the ones that spawn at the beaches)? Because I had a strange situation that my boat disappeared after a few (RT) days while it was full-health and inside. To be fair it *could* have been stolen, but I see the chance as small and the boats shouldn't decay indoors afaik. Can you check for that?
EDIT:
And so if I understand you correctly, I can change DecayIntervalSeconds and the plugin will compensate for the difference, resulting in the same damage being dealt? That's actually really great. I will test that, as soon as we have this above described oddity resolved.
Yes, but if I recall correctly, boats in deep water don't run the inside check in vanilla, though this plugin alters that, in order to run the inside check regardless of water depth. This differs from vanilla, and I forgot about it, but I see it in the docs.
Yes, you can increase DecayIntervalSeconds to simply improve performance, without really impacting behavior.
I added a config option in v2.3.0 which allows you to exempt specific vehicle types from having their decay controlled by the plugin.