Community Forum

motorized.motorTemperature.value in a MP session as a client

Forum Overview >> Scripting

Created17.12.2021 05:24

Olivier Beauchemin (obeauchemin) 17.12.2021 05:24
Hi guys,

I'm trying to find the answer to something weird in the code.
I'm currently testing a tool for exporting Telemetry data from the game, but there is a catch.

I have some problems with a specific set of values, like motor temperature & fuel consumption, but only in an MP session as a CLIENT.
If I test the script in a single-player environment or as a host, no problem at all.

As an example, here is the code where the script gets the motor temperature before passing it through a pipeline.
function FSTelemetry:ProcessMotorTemperature(motorized)
if motorized ~= nil and motorized.motorTemperature ~= nil then
FSContext.Telemetry.MotorTemperature = motorized.motorTemperature.value;
FSContext.Telemetry.MotorTemperature = 0;

In an MP session as a client, I get a STATIC value of 20. The value never changes. It stays on 20 all the time.
Otherwise, in single-player or as a host, the value is dynamic and quickly moves up or down.

I don't have any idea where the problem is. Is this a problem with the network code?
Maybe I should make a report to Giants?

If anyone has an idea, it would be nice to sort this problem.

Marciel Grutzmann (Marciel032) 17.12.2021 17:13
Hey, I finded in the class "Motorized" the start value of motorTemperature table:

spec.motorTemperature = {
value = 20,
valueSend = 20,
valueMax = 120,
valueMin = 20,
heatingPerMS = 0.0015,
coolingByWindPerMS = 0.001

it's start ever in value 20.

And the method "updateMotorTemperature" only is called when variable "isServer" is equals to true.

So, when you play as client, the value never change.

How to get the correct temperature? I dont no, but the cause of this inssue is this.

Olivier Beauchemin (obeauchemin) 17.12.2021 18:39
Ah, nice find !! So it's the same thing with fuel consumption. I'm sure there is a "isServer" that prevents fuel consumption to be updated when the player is a client. I think we could just overwrite the method with the same code, but without the isServer.

The question remains tho, why is there a isServer ...

EDIT: Same thing with Fuel Consumption, we don't know why the server only needs to execute this code:

if self.isServer then
self:updateConsumers(dt, accInput)

Note: Log in to post. Create a new account here.