[Gcblue-commits] gcb_wx/scripts AI.py,1.11,1.12 UnitCommands.py,1.7,1.8
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-08-09 02:35:24
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2303/scripts Modified Files: AI.py UnitCommands.py Log Message: Index: AI.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/AI.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** AI.py 23 Jul 2004 00:45:47 -0000 1.11 --- AI.py 9 Aug 2004 02:35:14 -0000 1.12 *************** *** 20,23 **** --- 20,25 ---- elif (order_name == 'Land'): Land(UnitInfo, Order.data) + elif (order_name == 'LandHelo'): + LandHelo(UnitInfo, Order.data) elif (order_name == 'Nav'): lon = Order.dest.Lon *************** *** 205,208 **** --- 207,273 ---- else: UI.SetUpdate(10) + + + + # modified this to adjust altitude based on altitude of landing + # site + def LandHelo(UI,dest_id): + if (not UI.IsHelo()): + UI.DisplayMessage('LandHelo called with non-helo unit') + return + + # 0 - init, 1 - distant, 2 - init approach, 3 - final approach + land_state = UI.GetVar(0) + track_info = UI.GetTrackById(dest_id) + + alt_m = track_info.Alt + if (track_info.ID == -1): + UI.DisplayMessage('Bad track ID for landing') + UI.CompletedOrder() + return # invalid id + + landing_data = UI.GetLandingData(dest_id) + if (landing_data.ID == -1): + UI.DisplayMessage('Invalid landing platform') + UI.CompletedOrder() + return # invalid id + + track_info.Lat = landing_data.Lat + track_info.Lon = landing_data.Lon + track_info.Alt = landing_data.Alt + + # adjust track location based on approach state + if (land_state <= 1): + if (land_state == 0): + UI.DisplayMessage('Landing helo on platform %d' % track_info.ID) + + UI.SetAlt(300 + alt_m) + SetFractionalSpeed(UI, 0.7) + UI.SetVar(0, 1) + elif (land_state == 2): + UI.SetSpeed(track_info.Speed + 5) + elif (land_state >= 3): + #UI.DisplayMessage('Final descent, platform %d' % track_info.ID) + UI.SetAlt(6 + alt_m) + UI.SetSpeed(track_info.Speed + 3) + if(UI.GetLandingState()==0): + UI.SetLandingState(1) # gear down + + + TTI = UI.SetHeadingToInterceptTrack(track_info) + + if (TTI <= 10): + if (land_state == 1): + land_state = 2 + elif (land_state == 2) and (TTI <= 1): + land_state = 3 + UI.SetVar(0, land_state) + UI.SetUpdate(3) + elif (TTI <= 20): + UI.SetUpdate(3) + else: + UI.SetUpdate(10) + + Index: UnitCommands.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/UnitCommands.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** UnitCommands.py 23 Jul 2004 00:45:47 -0000 1.7 --- UnitCommands.py 9 Aug 2004 02:35:14 -0000 1.8 *************** *** 6,10 **** def AddLandingOrder(UI, dest_id): ! UI.AddOrder('Land', dest_id) def ClearOrders(UI): --- 6,14 ---- def AddLandingOrder(UI, dest_id): ! if (UI.IsHelo()): ! UI.AddOrder('LandHelo', dest_id) ! else: ! UI.AddOrder('Land', dest_id) ! def ClearOrders(UI): |