Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in fill percentage calculation #17

Closed
daFreeMan opened this issue Aug 17, 2022 · 15 comments
Closed

Error in fill percentage calculation #17

daFreeMan opened this issue Aug 17, 2022 · 15 comments
Labels
bug Something isn't working implemented This feature was accepted and implemented

Comments

@daFreeMan
Copy link

Describe the bug
Using the Kubota XTS446 Sprayer and Kubota XFT211 from the Kubota Equipment Pack by Iconik, both with the "XL" capacity, I have a total of 2000 liters capacity (5000 for the tank, 15000 for the sprayer).

Simple Inspector correctly shows the 20000 liters capacity, but reports it at 190% full. Since it can't figure out what to do with a value > 100%, it also shows the fill level in white text.

To Reproduce
Steps to reproduce the behavior:

  1. Purchase the two Kubota accessories and attach them to a tractor
  2. Load them with a liquid of your choice.
    1. I'm using liquid fertilizer, but I would think the error would happen with any liquid. I haven't tested.
  3. See error

Expected behavior
It should display 100% (colored green) when it's full

Screenshots
image

For reference, here are the 2 pieces of equipment in question:
image
image

Desktop (please complete the following information):

  • OS: Win10
  • Version:
    • SI: 1.0.1.8
    • FS: 1.6

Additional context
Note that I do not have this issue when using the John Deere R732i PowrSpray that comes with the PrecisionFarming mod and the base-game HARDI 1200l tank. Therefore, this does seem to be particular to these two mod items.

@jtsage
Copy link
Owner

jtsage commented Aug 17, 2022

Aye, I suspect Iconik did something a little different - I've not used this set up yet, but I totally dig that pack, so I'll take a look at what I'm missing and push it in the next update. I'll ping you again here when I have a chance to look at this.

@jtsage
Copy link
Owner

jtsage commented Aug 18, 2022

I'll keep playing with this, but I couldn't reproduce it on my end - same equipment purchased, fill level shows as 20k (100%).

@daFreeMan
Copy link
Author

Hrm, pretty weird. I get it consistently at my end. As soon as I get a chance, I'll try with a couple of different tractors. Maybe it's related to the motive power...

@daFreeMan
Copy link
Author

Here's a base-game Claas Axion 660:
image

And here's a different JCB (by the same modder as the one in the original):
image

@daFreeMan
Copy link
Author

Now it's really gone nuts!

image

@jtsage
Copy link
Owner

jtsage commented Sep 11, 2022

So, what you are saying is I clearly did not fix it. Gotcha. I'm actually in the middle of a massive re-write of this whole thing, I will take a much closer look at this sometime soon.

Just for reference, are you using any other script mods that might mess with fill types or levels? I do try and plan for any other mods that mess about in ways I didn't think of, always looking to expand the test list.

Thanks!

@daFreeMan
Copy link
Author

I'm running, 1.0.1.8, so I guess not. :(

Am I using other script mods? Yes. That will interfere with it, well, I haven't a clue. I've got a small collection of mods I'm using. I suppose I should test this out w/o them and see if I can find a conflict somewhere.

I'll report back.

@daFreeMan
Copy link
Author

daFreeMan commented Sep 12, 2022

Ah ha!!
image
image

Yet...
image
image

It's not a mod conflict. Seems that it's confused by the trailer fill limit setting.

This is in a test game with only simpleInspector and the Kubota pack installed, but I'd presume it's the same with all the other mods, too.

What's odd is that SI does a much better job of showing fill percentage on wagons & trailers than the base-game fill bar does. It actually correctly calculates fill based on the weight max, showing it at 100% when the little Max icon shows up on the base game bar even though the base-game bar does not show it at 100%. It also shows 50% fill based (pretty closely, at least - haven't done the math to know for sure) when it's 1/2 full based on weight, not defined capacity.

@jtsage
Copy link
Owner

jtsage commented Sep 12, 2022

Aww... I had kind of hoped it wasn't that bit, there is some, er... "interesting" math there - but, this is awesome, it gives me a great way to test, and where to fix it. Thanks so much for keeping at it! (and of course, that option is off by default, which is why my quick testing never brought it up before.)

@jtsage
Copy link
Owner

jtsage commented Sep 12, 2022

Anyway, the root of the problem is I am nearly certain (without being at the right computer to check), that I only grab the weight limit from one of the implements, not ## implements with that type of fill, so, in a sense, it having 190% of what it could hold is correct, just not a useful statistic :)

@jtsage
Copy link
Owner

jtsage commented Sep 13, 2022

So, it turns out it wasn't totally my fault - just mostly. The kubota pack makes use of updateMass="false" in the fillUnit's for the XL versions, so they can far exceed the amount they "should" be able to hold with that setting on. So, I changed that section of the code to also ignore the additional mass when that setting is toggled - that should fix the percentage calculation.

I am in the middle of a partial re-write of the whole thing, so this fix isn't in the main branch yet - if you want to test, https://github.com/jtsage/FS22_simpleInspector/raw/dev_modules/FS22_SimpleInspector.zip will get you the zip - just keep in mind the version number will be the same, but it won't work with anybody who doesn't have the same download.

I hope to have the changes in there mostly sorted by this weekend so I can send them off to giants.

@daFreeMan
Copy link
Author

Sorry to hear it was in an "interesting" bit of code. :) those are always the least amount of fun. The rewrite should, I'm sure get rid of some tech debt and make it easier to maintain in the future.

Glad you figured out what's going wrong on your end and that it wasn't all your fault.

I have the patch version downloaded and will give it a try next time I'm in the game. I'll keep an eye out for the next release version, and if you want someone to do some beta testing, feel free to give me a shout. I'm always good at finding the issues in other people's code. If only I were half decent at finding them in my own before the others do... 😆

@daFreeMan
Copy link
Author

Winner, winner, chicken dinner!
image
image

I also love the update color coding the fuel fill level!

I'd say you can close this one out unless you've got something else in relation to tweak.

@jtsage
Copy link
Owner

jtsage commented Sep 13, 2022

great. That version is probably just about ready - I just need to spend some time playing with it on and make sure I didn't mess something up. Probably a quick MP test too and it should be ready to go off for testing.

@jtsage jtsage added bug Something isn't working implemented This feature was accepted and implemented labels Sep 15, 2022
@jtsage
Copy link
Owner

jtsage commented Sep 18, 2022

correction pushed to modhub, should be out in a few days. Fwiw, the fuel level thing wasn't entirely intentional, but I like it too. Also, if you watch the colors, they now "stick" on the "good" side - i.e. that Liquid fertilizer will stay bright green for a bit and then ramp down quicker, it's not a totally linear progression anymore.

@jtsage jtsage closed this as completed Sep 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working implemented This feature was accepted and implemented
Projects
None yet
Development

No branches or pull requests

2 participants