Hello, I wish to create a 0.5x server, and upon attempting to use this the game creates stackable objects such as ropes and propane tanks displayed as 0 quantity, this was expected, but the quantity remains 0 even when more are stacked, and even though it's 0 quantity they still recycle for a full amount and used as such.
There's also other flaws such as whole items always appearing instead of only appearing 50% of the time (or whatever the rate you choose, I chose mine to be 0.5); anyone know of a reasonable workaround for this?
I've tried to edit the code myself and change the spawn function to only happen half the time; but it doesn't appear to work; I honestly don't have very much coding experience in this specific field, but will delve deeper with some pointers in the right direction...
I honestly don't even need this whole mod in its entirely, would love for someone to point out how to widdle down to the bare bone basics of me checking a containers stack size, if it's greater than or equal to 2, then half it; and if it's a stack of one (possibly being a non stackable item), have a 50% chance to simply not even spawn it in the first place.
Using a fraction for the multiplier value.
Hey, was able to figure it out myself through a lot of struggle and trying different things, if you plug this bit and replace two lines of code with these ones at around line 460 you will be able to achieve what I was seeking, not sure where to submit this to a commit.
[code]
float fractionValue = item.amount * multiplier;
item.amount = _configuration.Settings.LimitToStacksizes ? (int)Math.Min(fractionValue, maxAmount)
: (int)(fractionValue);
if (fractionValue > 0 && fractionValue < 1)
{
if (UnityEngine.Random.Range(0f, 1f) < fractionValue)
{
item.amount = 1;
} else {
item.Remove(0f);
}
}[/code]
It introduces a fractionValue float to be used in the item amount setting function; the value is stored because the function typecasts the float into int so it's no longer useful to use, so we bring down the float to see if it is indeed a fraction, and if it is, it will perform a percent chance to keep or remove the item, based on the reduction value set in the script parameters, I reduce my loot by 50%, so the chance of actual loot spawning is reduced to 50%. If spawn rated was reduced to 1/4 for example, loot chance would be 25%.
It introduces a fractionValue float to be used in the item amount setting function; the value is stored because the function typecasts the float into int so it's no longer useful to use, so we bring down the float to see if it is indeed a fraction, and if it is, it will perform a percent chance to keep or remove the item, based on the reduction value set in the script parameters, I reduce my loot by 50%, so the chance of actual loot spawning is reduced to 50%. If spawn rated was reduced to 1/4 for example, loot chance would be 25%.