[Gcblue-commits] gcb_wx/scripts AI.py,1.4,1.5 UnitCommands.py,1.4,1.5
Status: Alpha
Brought to you by:
ddcforge
From: <ddc...@us...> - 2004-01-03 00:45:17
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv548/scripts Modified Files: AI.py UnitCommands.py Log Message: briefing camera features Index: AI.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/AI.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AI.py 2 Nov 2003 20:04:01 -0000 1.4 --- AI.py 3 Jan 2004 00:45:12 -0000 1.5 *************** *** 1,5 **** from UnitCommands import * ! # test AI script def Update(UnitInfo): if (UnitInfo.HasOrders()): --- 1,5 ---- from UnitCommands import * ! # test AI script, these need a lot of work def Update(UnitInfo): if (UnitInfo.HasOrders()): *************** *** 102,111 **** # 2nd param is affiliation, 3 is hostile, 0 (unknown) automatically included in search track = UI.GetClosestAirTrack(150,3) ! else: ! track = UI.GetClosestAirTrack(50,3) # surface only considers close air tracks if (track.IsValid()): return track.ID; else: ! track = UI.GetClosestSurfaceTrack(150,3) if (track.IsValid()): return track.ID; --- 102,111 ---- # 2nd param is affiliation, 3 is hostile, 0 (unknown) automatically included in search track = UI.GetClosestAirTrack(150,3) ! else: # surface ! track = UI.GetClosestAirTrack(50,3) # surface first considers close air tracks if (track.IsValid()): return track.ID; else: ! track = UI.GetClosestSurfaceTrack(200,3) if (track.IsValid()): return track.ID; *************** *** 131,136 **** if targetid == 0xFFFFFFFF: return targetrange = UI.GetRangeToTarget() ! if (targetrange > 50.0): TTI = UI.SetHeadingToInterceptTarget() UI.SetSpeedToMax() --- 131,147 ---- if targetid == 0xFFFFFFFF: return + + target_info = UI.GetTargetTrackInfo() + # check if effective weapon is available + launcher_info = UI.GetBestLauncher() + launcher = launcher_info.Launcher + if (launcher == -1): # if (no effective launcher is available) + UI.SetTarget(-1) # clear target + return + + # use weapon if in range + launch_range = launcher_info.Range_km # reference max range, use for launch decision targetrange = UI.GetRangeToTarget() ! if (targetrange > launch_range): TTI = UI.SetHeadingToInterceptTarget() UI.SetSpeedToMax() *************** *** 142,178 **** if (wait_count < 12): UI.SetVar(1,wait_count+1) # increment wait count - SetHeadingOffTarget(UI, 30.0) # set heading 30 deg from current target bearing UI.SetActionText('Atk-wait') ! SetFractionalSpeed(UI,0.5) return else: UI.SetVar(0,0) # re-engage target UI.SetVar(1,0) ! SetFractionalSpeed(UI,0.9) # attack target range_km = 0.0 ! launcher_info = UI.GetBestLauncher() ! launcher = launcher_info.Launcher ! if (launcher == -1): ! UI.SetTarget(-1) # clear target ! return launch_mode = launcher_info.LaunchMode # 0 - datum, 1 - seeker, 2 - other ! launch_range = launcher_info.Range_km ! if (targetrange <= launch_range): ! if launch_mode == 0: # datum launch ! track_info = UI.GetTargetTrackInfo() ! lat = track_info.Lat ! lon = track_info.Lon ! UI.SendDatumToLauncher(lon,lat,launcher) ! UI.Launch(launcher) UI.SetVar(0,1) ! UI.SetActionText('Datum launch') ! elif launch_mode == 1: # handoff to active seeker ! target_accepted = UI.HandoffTargetToLauncher(launcher) ! if (target_accepted): ! UI.Launch(launcher) ! UI.SetVar(0,1) ! UI.SetActionText('Handoff launch') else: TTI = UI.SetHeadingToInterceptTarget() --- 153,194 ---- if (wait_count < 12): UI.SetVar(1,wait_count+1) # increment wait count UI.SetActionText('Atk-wait') ! if UI.IsAir(): ! SetHeadingOffTarget(UI, 30.0) # set heading 30 deg from current target bearing ! SetFractionalSpeed(UI,0.5) return else: UI.SetVar(0,0) # re-engage target UI.SetVar(1,0) ! if UI.IsAir(): ! SetFractionalSpeed(UI,1.0) # attack target range_km = 0.0 ! launch_mode = launcher_info.LaunchMode # 0 - datum, 1 - seeker, 2 - other ! ! if target_info.IsAir(): ! launch_qty = 1 ! elif target_info.IsMissile(): ! launch_qty = 2 ! elif target_info.IsSurface(): ! launch_qty = 4 ! else: ! launch_qty = 0 ! ! if launch_mode == 0: # datum launch ! lat = target_info.Lat ! lon = target_info.Lon ! UI.SendDatumToLauncher(lon,lat,launcher) ! UI.Launch(launcher, launch_qty) ! UI.SetVar(0,1) ! UI.SetActionText('Datum launch') ! elif launch_mode == 1: # handoff to active seeker ! target_accepted = UI.HandoffTargetToLauncher(launcher) ! if (target_accepted): ! UI.Launch(launcher, launch_qty) UI.SetVar(0,1) ! UI.SetActionText('Handoff launch') else: TTI = UI.SetHeadingToInterceptTarget() Index: UnitCommands.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/UnitCommands.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UnitCommands.py 9 Dec 2003 00:36:03 -0000 1.4 --- UnitCommands.py 3 Jan 2004 00:45:12 -0000 1.5 *************** *** 28,32 **** def LaunchDatum(UI, lon, lat, launcher_num): UI.SendDatumToLauncher(lon,lat,launcher_num) ! UI.Launch(launcher_num) def TargetAndEngageWith(UI, target_id, launcher): --- 28,32 ---- def LaunchDatum(UI, lon, lat, launcher_num): UI.SendDatumToLauncher(lon,lat,launcher_num) ! UI.Launch(launcher_num, 1) def TargetAndEngageWith(UI, target_id, launcher): *************** *** 47,55 **** lon = track_info.Lon UI.SendDatumToLauncher(lon,lat,launcher) ! UI.Launch(launcher) else: # handoff to active seeker target_accepted = UI.HandoffTargetToLauncher(launcher) if (target_accepted): ! UI.Launch(launcher) else: UI.DisplayMessage('Handoff failed, may not be in seeker coverage.') --- 47,55 ---- lon = track_info.Lon UI.SendDatumToLauncher(lon,lat,launcher) ! UI.Launch(launcher,1) else: # handoff to active seeker target_accepted = UI.HandoffTargetToLauncher(launcher) if (target_accepted): ! UI.Launch(launcher,1) else: UI.DisplayMessage('Handoff failed, may not be in seeker coverage.') |