Page 1 of 1

Car energy readings?

Posted: Sat Feb 04, 2017 6:07 pm
by sillyfly
I'm trying to get car energy readings (i.e. the amount of fuel), but I get weird results, namely player.vehicle.energy seems to contain only three possible values depending on the driving direction - when not moving it always contains the value 2666.666, when going forward it's 166.666 and when going backwards it's 1416.666

Is this a bug? Could I be doing something wrong? (I only print the value of energy every 60 ticks, nothing else) Is there an alternative way of reading the energy buffer of a car?

Re: Car energy readings?

Posted: Sat Feb 04, 2017 7:47 pm
by Rseding91
Burner energy sources don't store the full buffer of energy in the property you're reading. There's a "remaining part of fuel being burnt" that gets transferred into the main energy buffer each tick. That's the progress bar you see when you open the car up.

I added LuaBurner for 0.15 that lets you read/write those properties in addition to the normal energy value.

Re: Car energy readings?

Posted: Sat Feb 04, 2017 7:58 pm
by sillyfly
Thanks.
So if I understand correctly, the values I was seeing were energy consumed per tick? Why would it be larger when standing still or going backwards?

Re: Car energy readings?

Posted: Sat Feb 04, 2017 8:01 pm
by Rseding91
sillyfly wrote:Thanks.
So if I understand correctly, the values I was seeing were energy consumed per tick? Why would it be larger when standing still or going backwards?
Cars only consume power when moving based off how fast they're trying to move. Cars move slowly going backwards and not at all when not moving.

Re: Car energy readings?

Posted: Sat Feb 04, 2017 8:03 pm
by sillyfly
Ok, makes sense.