ThatTonybo / BeamAdvisor

ETS2/ATS inspired information+navigation widget for BeamNG.drive
6 stars 4 forks source link

Fixed wrong gear selection on automatic/sequential transmissions and neutral disappear bug. #10

Closed MostOriginalIGN closed 2 years ago

MostOriginalIGN commented 2 years ago

Fixes issues #1 and #8.

MostOriginalIGN commented 2 years ago

Found out this accidentally fixes #2 also!

ThatTonybo commented 2 years ago

Please test code you want to push to a repo. If you did, you would know that streams.engineInfo[13] (transmission type) always returns manual and cannot be used. However, your use of streams.engineInfo[5] is very cool as it seems to provide the "D"/number and know what gearbox is used.

I was planning to write some Lua to work out the gearbox type next update, however for the time being I will implement this locally and push in the next update, won't merge the pull request as such but the code is in use and you'll be credited.

Thanks for the contribution 🙂

MostOriginalIGN commented 2 years ago

I have tested the code in all scenarios and found no bugs. Manual, automatic, and electric vehicles but that's just automatic. I should have included screenshots. stream.engineinfo[13] returned manual and auto when I tested it with logs. That's why I implemented into the code. I will include screenshots as soon as I can

MostOriginalIGN commented 2 years ago

https://streamable.com/j6v41f

ThatTonybo commented 2 years ago

I've been making the mod for 3 months now and stream.engineInfo[13] has never returned anything other than manual for myself and any other user. The video you showed is working as the manual portion of your code uses streams.engineInfo[5], which outputs the correct gearbox string for every vehicle - as shown, it outputs D/N/P/R for auto and such for manual.

MostOriginalIGN commented 2 years ago

OH. I just did some testing and I stand corrected. I did not check if stream.engineInfo[13] was doing something. I thought it was geartxt = ["P","R","N","D","2","1"][Math.round(streams.electrics.gear_A*5)]; doing it. Since i was testing streams.engineInfo[5] with the default vehicle, I thought it only returned ints since it gave 0 and -1. I did not thoroughly check what each part of my code was actually doing that what I thought it was was doing mb.

In the docs it said Manual/Auto/DCT/CVT so I thought it did just that. Perhaps there are certain transmissions/cars which do return Auto, DCR, or CVT.

ThatTonybo commented 2 years ago

No worries. I'm not really sure why it returns manual for every vehicle, though I suspect it's just old code that broke one update, like beams_total elsewhere. May add some Lua to work the gearbox type out soon. Still, the discovery of streams.engineInfo[5] is a good one :)

ThatTonybo commented 2 years ago

Closing as code has been merged locally and will be pushed soon :)