EpochModTeam / Epoch

Epoch Survival Game Mode for ARMA 3
http://epochmod.com/
Other
91 stars 82 forks source link

Mass check #997

Closed 82ndab-Bravo17 closed 5 years ago

82ndab-Bravo17 commented 5 years ago

This should always work, I think the original will fail with 1.65 and 1.64999999

Not sure what the lightest object is, so may need to adjust the 0.005

vbawol commented 5 years ago

Thanks for the PR @82ndab-Bravo17! The recent change to using ToFixed and isEqualto should have solved this issue already.

The idea is that it does not need to be that accurate we could even round to the nearest whole number. Also, IsEqualTo is a bit more forgiving for cases where the input types might be mixed or nil.

Ignatz-HeMan commented 5 years ago

ToFixed do not only cut the decimals. It also round it. But I must admint, that I was also not sure after your Pull Request. But I have double checked it. Anyway, thx for your attention in this! image

82ndab-Bravo17 commented 5 years ago

Sorry, example was a decimal point off. 1.645 will round to 1.65 1.644999999999999 will round to 1.64, (unless Arma doesn't round correctly!)

Ignatz-HeMan commented 5 years ago

But thats what expected, or not? Round it to 2 decimals and check, if it do match. Or do you still have problems with the current (experimental) code?

Ignatz-HeMan commented 5 years ago

Ah now I understand what you mean... The logs I have seen (with a login issue) had always the same mass within 2 decimals. So I have limited to 2 decimals. Because that, I am sure this should fix it. Do you still have login issues caused by the masscheck?

82ndab-Bravo17 commented 5 years ago

I don't think we have had any issues with it, it was just to rule out any potential issues with rounding, which can cause unexpected results in some, admittedly rare, cases.

I haven't seen the logs that you have, so I may well be being over cautious.

Ignatz-HeMan commented 5 years ago

The logs I have seen have provided a valid masscheck (55.45 != 55.45 for example), but the script said "false". So round to 2 decimals should (hopefully) work.

Let's wait, if we still get issues. If so, we can come back to your idea...

morgoth0 commented 5 years ago

Had this on one of my servers today:

20:50:42 "DEBUG: Checking Player Object: OK" 20:50:42 "DEBUG: Checking Player PosVar: OK" 20:50:42 "DEBUG: Final Player mass check: FAILED (531.7 != 532.7)"

Will add this projected fix to test

Ignatz-HeMan commented 5 years ago

You had this issue with the original fix from the exp files? https://github.com/EpochModTeam/Epoch/commit/12f5fd6eaf85072baf51e1999358e1fd245dcf46

morgoth0 commented 5 years ago

Unknown, if you remember I had altered player_login.fsm in the past just to remove the mass check. Thing is that I forgot to do that in the 1.3 upgrade...

Issue now though is the mass check is 1 off... not just decimal places. Not sure whether this fix will fix it.

Ignatz-HeMan commented 5 years ago

@morgoth0 maybe you have a loadout with Glasses from an additional Addon? Mass = 1, I have often seen for Glasses. Maybe your client is missing this addon?!

82ndab-Bravo17 commented 5 years ago

This will only help in cases where the two values are very close, but where the rounding process makes them further apart than they actually are. If they are out by 1 then this test will still fail, as it should.