Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Aircraft Fuel State Discrepancy

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Air / Naval Operations >> Tech Support >> Aircraft Fuel State Discrepancy Page: [1]
Login
Message << Older Topic   Newer Topic >>
Aircraft Fuel State Discrepancy - 1/5/2019 11:14:45 PM   
DismalPseudoscience

 

Posts: 48
Joined: 10/10/2014
Status: offline
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!

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


Posts: 10915
Joined: 7/31/2005
Status: offline
Thanks, logged. We'll investigate as time permits.

_____________________________


(in reply to DismalPseudoscience)
Post #: 2
RE: Aircraft Fuel State Discrepancy - 1/24/2019 6:34:02 AM   
michaelm75au


Posts: 12400
Joined: 5/5/2001
From: Sydney, Australia
Status: offline
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.

< Message edited by michaelm75au -- 1/24/2019 7:43:24 AM >


_____________________________

Michael

(in reply to Dimitris)
Post #: 3
RE: Aircraft Fuel State Discrepancy - 1/24/2019 9:10:32 AM   
michaelm75au


Posts: 12400
Joined: 5/5/2001
From: Sydney, Australia
Status: offline
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.

_____________________________

Michael

(in reply to michaelm75au)
Post #: 4
RE: Aircraft Fuel State Discrepancy - 1/24/2019 5:23:34 PM   
KnightHawk75

 

Posts: 113
Joined: 11/15/2018
Status: offline

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.

(in reply to michaelm75au)
Post #: 5
RE: Aircraft Fuel State Discrepancy - 1/25/2019 7:06:29 PM   
michaelm75au


Posts: 12400
Joined: 5/5/2001
From: Sydney, Australia
Status: offline
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 }



< Message edited by michaelm75au -- 1/25/2019 8:47:46 PM >


_____________________________

Michael

(in reply to KnightHawk75)
Post #: 6
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Air / Naval Operations >> Tech Support >> Aircraft Fuel State Discrepancy Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.129