Funbit / ets2-telemetry-server

ETS2/ATS Telemetry Web Server + Mobile Dashboard
GNU General Public License v3.0
623 stars 206 forks source link

Request for plugin source code #76

Closed jammerxd closed 8 years ago

jammerxd commented 8 years ago

May I have the source code for the ETS2/ATS plugin DLL please?

mike-koch commented 8 years ago

The DLL source files can be viewed at nlhans/ets2-sdk-plugin.

jammerxd commented 8 years ago

Ah ok, I am having trouble with job data being cleared after going through the income and exp screen when on quick and freight market jobs. Does a user really have to go back into the map(click DRIVE) after the income and exp screen to clear the job data (which can't be done if you don't own your own truck and is annoying for people who do own their own truck)?

mike-koch commented 8 years ago

I can't say if the code is running correctly; however looking at the implementation, it looks like the telemetry DLL uses the following logic to determine if a job is still active:

  1. If we were previously "on job", but there is no trailer attached and we are between 0 and .1 "game units" away from the drop-off zone, we are no longer "on job".
  2. If we're not on the job, count ten frames. After the ten frames, clear out job information.
  3. Otherwise, if our job income is > 0 and a trailer is attached, we are "on job"

(see https://github.com/nlhans/ets2-sdk-plugin/blob/master/ets2-telemetry/src/ets2-telemetry.cpp#L95-L132 for the actual code)

So ideally, it should take ~10 scans for the plugin to clear the job data after completion. My best guess is that something in step 1 is returning false, such as the distance check. Honestly, it's quite difficult to step through the plugin's code as the game is running as you cannot use a debugger (since you have to build the DLL first).

Funbit commented 8 years ago

@jammerxd The original plugin source code is located here (as @mike-koch already mentioned) https://github.com/nlhans/ets2-sdk-plugin

However, it is not compatible with the telemetry server. I use my own fork: https://github.com/Funbit/ets2-sdk-plugin

Also, I'm not sure why nlhans added that 10 scans, but I have managed to achieve job reset without it: https://github.com/Funbit/ets2-sdk-plugin/commit/e078a27ea0055a06d2924e130cdf177797d9edb5

The updated telemetry server (3.2.1) has this fix. Works for me, please let me know if it works for you.

Funbit commented 8 years ago

Updated server to 3.2.2 (fixed occasional bug with job info reset on new jobs).