Jump to content

[41.65] [Foraging] Forage Radius appears to be improperly reduced by 60% unless finding items.


Lumarin

Recommended Posts

    • Version?41.65
    • Singleplayer/Multiplayer?All
    • Host or dedicated?N/A
    • Mods?N/A
    • Reproduction steps:N/A    Details below:

 

Foraging radius is intended to increase by .5 tiles per level, but when I had reached level 3 Foraging, I noticed that my radius was still at 1.5-2 at nearly all times. I then additionally noticed that my radius expanded *massively* when finding a log in a forest, which tended to end up with me finding not only the log, but also several additional items at the same time as finding a single log. Doing some digging I found the modifiers to your overlayradius that determines how far your character may forage.

Disabling the modifiers that give penalties, I immediately went to maximum(10) radius, which is what I was seeing whenever I would find a Log for 1-2 seconds...

I then went through the list and read them and these appear to be the relevant sections of code:

    ISSearchManager.lua -

        Line 983 - itemSize = 1.0; being a static defined value except in instances where an item is being found, whereupon it then uses the weight value of the item instead

        Line 719 - size = ((self.itemSize + 1) / forageSystem.sizeMultiplier),

    forageSystem.lua

        Line 74 - sizeMultiplier = 5.0; being a static defined value, unless specifically defined with an item being searched(like grapefruits at 1.5, for example)

 

I disabled line 719 of ISSearchManager, and my foraging radius significantly expanded at the default, when it should have no effect if I'm not finding a large/small item that should impact the radius...

 

As these values are defaulted except during an active 'find' of an item with the eyeball showing and attempting to find the item, the value of line 719 of IsSearchManager.lua ends up like this:

(1+1)/5; or 2/5; or 0.4.

 

This value is active in perpetuity and multiplied to your overlayRadius in line 729:

        for _, modifier in pairs(modifiers) do overlayRadius = overlayRadius * modifier; end;

 

As such, all foraging radius is reduced by 60%, unless you're finding an item, in which case itemSize is the weight, and sizeMultiplier is the multiplier defined in forageDefinitions.lua.

 

I don't believe this is the intended effect for your search radius, as the code comments stipulate that your radius should increase by 0.5tile per level of foraging, and other such as traits/profession bonuses saying how many tiles they should increase the radius. Instead, currently, each level of foraging increases the radius by 0.2 tiles, ParkRanger/Lumberjack/Chef/Farmer/Fisherman/Veteran/Unemployed increase your radius by 0.4 tiles instead of 1.0 tiles, and so forth.

 

I believe the easiest fix to this would be to modify forageSystem.lua Line 74 to be sizeMultiplier = 2.0; instead of 5.0. As this would allow the size modifier to default to a value of 1, while not impacting increases/decreases to your overlay radius otherwise. This would, however, have an outsized effect on finding high weight items. Potentially modifying line 719 of ISSearchManager.lua to:

size         = (((self.itemSize / 3) + 1) / forageSystem.sizeMultiplier),

in addition to changing sizeMultiplier to 2, would alleviate maximizing your search radius to 10 every time you find a log(weight 9) or other heavy item, while still keeping in spirit the intention of making small items difficult to see, and large items easier to see. 3 may or may not be the best to divide by, so some fine tuning is likely to be required.

 

Alternatively,  refactoring the code to allow large items to be seen from further away instead of impacting your search radius *after* it's already within it, by making two separate radii or performing the calculations for finds *prior* to allowing them within the search radius may be better, such as by allowing all items to be 'seen'(but not found) within the full 10 tiles at all times, and then performing the itemsize/sizemultiplier calculations to determine if they activate your eyeball and can be found outside your normal search radius...

 

In any case, there's several options to take a look at this, and I'm only believing this as a bug as the comments directly contradict the code in this instance.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...