Update of /cvsroot/gcblue/gcb_wx/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11281/scripts
Modified Files:
AI.py HotKey.py
Log Message:
Index: AI.py
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/scripts/AI.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** AI.py 10 Sep 2005 21:48:58 -0000 1.24
--- AI.py 23 Mar 2006 01:11:43 -0000 1.25
***************
*** 283,287 ****
TI.SetUpdateInterval(30)
else:
! TI.SetUpdateInterval(5)
if (engage_mode == 1): # turn to target
--- 283,291 ----
TI.SetUpdateInterval(30)
else:
! if (closest_range < 20):
! TI.SetUpdateInterval(1)
! else:
! TI.SetUpdateInterval(5)
! UI.SetAllSensorState(1)
if (engage_mode == 1): # turn to target
***************
*** 503,506 ****
--- 507,511 ----
# overwhelmingly engaged, and not a stale track
# returns -1 if none
+ # modified to avoid wasting all missiles on first target of stream raid
def GetImmediateTarget(UI):
***************
*** 521,524 ****
--- 526,530 ----
best_target = -1
best_launcher = -1
+ best_engaged_count = 99
for n in range(0, nTracks):
***************
*** 526,532 ****
track_id = track_info.ID
staleness = current_time - track_info.Time
bearing_only = track_info.IsBearingOnly()
engaged_count = track_info.GetEngagedCount()
! if (track_info.IsAir() or track_info.IsMissile() or track_info.IsSub()):
max_engaged_count = 2
else:
--- 532,540 ----
track_id = track_info.ID
staleness = current_time - track_info.Time
+ is_destroyed = track_info.IsDestroyed()
bearing_only = track_info.IsBearingOnly()
engaged_count = track_info.GetEngagedCount()
! is_air_target = track_info.IsAir() or track_info.IsMissile()
! if (is_air_target or track_info.IsSub()):
max_engaged_count = 2
else:
***************
*** 534,538 ****
#UI.DisplayMessage('Track %d, %.0f/%d/%d' % (track_id, staleness, bearing_only, engaged_count))
! if ((engaged_count < max_engaged_count) and (staleness < 15.0) and (not bearing_only)):
UI.SetTarget(track_id)
launcher_info = UI.GetBestLauncher()
--- 542,546 ----
#UI.DisplayMessage('Track %d, %.0f/%d/%d' % (track_id, staleness, bearing_only, engaged_count))
! if ((engaged_count < max_engaged_count) and (staleness < 15.0) and (not bearing_only) and (not is_destroyed)):
UI.SetTarget(track_id)
launcher_info = UI.GetBestLauncher()
***************
*** 542,549 ****
target_range = UI.GetRangeToTarget()
launch_range = launcher_info.Range_km # reference max range, use for launch decision
! if ((target_range <= launch_range) and (target_range < best_range)):
best_range = target_range
best_target = track_id
best_launcher = launcher_idx
UI.SetTarget(best_target)
--- 550,572 ----
target_range = UI.GetRangeToTarget()
launch_range = launcher_info.Range_km # reference max range, use for launch decision
!
! is_better = (target_range <= launch_range) and (engaged_count < best_engaged_count)
! is_better = is_better or ((engaged_count == best_engaged_count) and (target_range < best_range))
!
! if (is_better):
best_range = target_range
best_target = track_id
best_launcher = launcher_idx
+ best_engaged_count = engaged_count
+
+ # Clear best if there is another unengaged air target close to the launch zone
+ near_launch_range = (target_range > launch_range) and (target_range < 1.75*launch_range)
+ if (near_launch_range and is_air_target and (launcher_idx == best_launcher) and \
+ (best_engaged_count > 0) and (engaged_count == 0)):
+ best_range = 1e6
+ best_target = -1
+ best_launcher = -1
+ best_engaged_count = 99
+
UI.SetTarget(best_target)
Index: HotKey.py
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/scripts/HotKey.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** HotKey.py 10 Sep 2005 21:48:58 -0000 1.6
--- HotKey.py 23 Mar 2006 01:11:43 -0000 1.7
***************
*** 20,23 ****
--- 20,25 ----
elif (key == 'h'):
UnitInfo.GetUserInput('SetHeading','Heading')
+ elif (key == 'i'):
+ UnitInfo.SendCommand('ShowPlatformDatabaseInfo')
elif (key == 'f'):
UnitInfo.SendCommand('ShowFlightPanel')
***************
*** 42,43 ****
--- 44,49 ----
msg = 'unrecognized key: %s' % key
UnitInfo.DisplayMessage(msg)
+
+ # Keys for non-platform object hooked, or not own alliance
+ # This needs to be reworked
+ #def ProcessHotKeyOther(key):
|