michaelm75au
Posts: 13500
Joined: 5/5/2001 From: Melbourne, 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
|