Aircraft Fuel State Discrepancy (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Tech Support



Message


DismalPseudoscience -> Aircraft Fuel State Discrepancy (1/5/2019 11:14:45 PM)

Hi all!

I've observed an apparent bug where aircraft are flying around with clearly positive fuel remaining, but a Lua call to their fuel state suggests 0 aviation fuel remaining.

In my scenario, I allow the player to spawn a flight of Tomcats with a special action, but I try to use Lua to take them away from the player once their fuel state is low (or if the player tries to land them to game my system and keep them permanently).

In my Lua action, the planes de-spawn once their fuel state is less than 1/3rd their maximum. However, they seem to reach this with ~85% of their fuel left according to the unit view in the sidebar. You can test this by starting my special action, and then flying the Tomcats around until they disappear.

I added an extra Tomcat for testing purposes (flying around over Iran in the save) and called its fuel state in the script consol, finding that it currently is airborne with 0 fuel! This explains why my Lua action de-spawns my planes so quickly, but why should this be happening? Am I misunderstanding the Lua around fuel states, or is this a bug?

Thank you!




Dimitris -> RE: Aircraft Fuel State Discrepancy (1/24/2019 5:21:11 AM)

Thanks, logged. We'll investigate as time permits.




michaelm75au -> RE: Aircraft Fuel State Discrepancy (1/24/2019 6:34:02 AM)

I think the issue is that only one 'fuel' is being returned. There should be 3 from the looks of it.

I'll change the table to use the combined fuel values, and probably add a new table item for the break down in case you want independent fuel levels.

I don't think multiple fuel levels of the same type were in place when the Lua fuel methods were first written.




michaelm75au -> RE: Aircraft Fuel State Discrepancy (1/24/2019 9:10:32 AM)

With the proposed change, 'fuel' may return an extended table.
quote:

{ [1] = { max = 7355, name = 'AviationFuel', type = 2001, current = 6986.43359375 }, [2] = { max = 810, name = 'AviationFuel', type = 2001, current = 0 }, [3] = { max = 810, name = 'AviationFuel', type = 2001, current = 0 }, [2001] = { max = 8975, name = 'AviationFuel', type = 2001, current = 6986.43359375 } }

The normal fuel type [2001] will be present with total of that fuel type, but there may be several other entries [1...] which will be the main fuel plus the drop tank capacity - in the attached example file from above, the Tomcat has 2 drop tanks (which appear to be empty now.




KnightHawk75 -> RE: Aircraft Fuel State Discrepancy (1/24/2019 5:23:34 PM)


quote:

ORIGINAL: michaelm75au

I think the issue is that only one 'fuel' is being returned. There should be 3 from the looks of it.

I'll change the table to use the combined fuel values, and probably add a new table item for the break down in case you want independent fuel levels.

I don't think multiple fuel levels of the same type were in place when the Lua fuel methods were first written.


Thank you, was just about to post about this issue too, lua returning only the first or random storage tank. Looking forward to the change, being able to enum through each tank is even better than what I was going to suggest.[sm=happy0065.gif]




michaelm75au -> RE: Aircraft Fuel State Discrepancy (1/25/2019 7:06:29 PM)

In order to mitigate breaking any old scripts using .fuel, I think I will change the .fuel method to just return the totals by fuel type so it looks like the original way, and add the 'tank' breakdown as a new method "fuels".
example
quote:


local plane = ScenEdit_GetUnit({name='panther #1', side='Iran'})
local fuel = plane.fuel

print 'Start'
print(fuel)
for i, tank in ipairs(plane.fuels) do
print("Tank #" .. i)
print(tank)
end

print 'Set '
plane = ScenEdit_SetUnit({name='panther #1', side='Iran', fuel={{2001,8200}} })
print(plane.fuel)
for i, tank in ipairs(plane.fuels) do
print("Tank #" .. i)
print(tank)
end

Start
{ [2001] = { type = 2001, current = 8500, name = 'AviationFuel', max = 10140 } }
Tank #1
{ type = 2001, current = 6065, name = 'AviationFuel', max = 6065 }
Tank #2
{ type = 2001, current = 1125, name = 'AviationFuel', max = 1125 }
Tank #3
{ type = 2001, current = 1125, name = 'AviationFuel', max = 1125 }
Tank #4
{ type = 2001, current = 185, name = 'AviationFuel', max = 1825 }

Set
{ [2001] = { type = 2001, current = 8085, name = 'AviationFuel', max = 10140 } }
Tank #1
{ type = 2001, current = 6065, name = 'AviationFuel', max = 6065 }
Tank #2
{ type = 2001, current = 1010, name = 'AviationFuel', max = 1125 }
Tank #3
{ type = 2001, current = 1010, name = 'AviationFuel', max = 1125 }
Tank #4
{ type = 2001, current = 0, name = 'AviationFuel', max = 1825 }





Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.8125