home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer 1999 November
/
CD-Gamer_1999-11_02_cd.bin
/
games
/
fleetcom
/
data1.cab
/
Doctrines_Files
/
SubDef.txt
< prev
next >
Wrap
Text File
|
1999-07-22
|
9KB
|
355 lines
TITLE SubDef
; Timer 1 : Comms Intvl Surface Timer
; Timer 2 : Comms Intvl Submerge Timer
; Var 1 : Comms Intvl
; Var 2 : Running depth
; Var 3 : Speed limit storage
; Var 4 : Boolean that indicates sub hit last waypoint of user tactic
; Var 5 : integer value that indicates sub is prosecuting target automatically
; Var 6 : Boolean when 1 means we should stay at comms depth
; var 7 : integer value that indicates sub is avoiding a target automatically
; var 8 : indicates that user ordered us to come to comms depth
;this timer8 = -1 should always be true - we always want
;to execute this doctrine!
RULE sub default tactic
IF TIMER8 = -1 THEN
;DEBUG "executing sub default tactic!"
RULE Set up comms intvl
IF INIT = 1 THEN
RULE Check Default Intvl Set
IF VAR1 = -1 OR VAR1 = 0 THEN
; set default 2 hour comms intvl
DEBUG "Doctrine: Using default comms intvl"
VAR_SET 1 7200
END
DEBUG "Doctrine: Initializing all vars"
VAR_SET 2 -150
VAR_SET 3 0
VAR_SET 4 0
VAR_SET 5 0
VAR_SET 6 0
VAR_SET 7 0
VAR_SET 8 0
END
RULE print out
IF ORDER != NONE THEN
DEBUG "We have an order!"
DEBUG ORDER
END
;we need to set to ent mode because var8 is an entity variable
SETENTMODE
RULE Set Tactic
IF ( ( NEWTRACK = 1 AND ORDER = NONE ) OR ORDER = ENGAGE ) AND VAR8 = 0 AND LOSTTRACK != 1 THEN
DEBUG "Got into order block!!!"
SETENTMODE
DEBUG "ORDER :"
DEBUG ORDER
; if we have an order on a valid target, then lets submerge first
; we check the class because if its an air contact and the air contact is far away,
; we don't want to have to submerge...
RULE Resubmerge and Reset
IF VAR2 != O AND ( ORDER != NONE OR CLASS = SURF OR CLASS = SUB ) THEN
SETENTMODE
DEBUG "Doctrine: resubmerge for orders!"
DEBUG VAR2
RULE check var2
IF VAR2 > -100 THEN
VAR_SET 2 -150
END
DEBUG "ALT:"
DEBUG ALT
DEBUG "PERIDEPTH"
DEBUG PERIDEPTH
RULE resubmerge if needed
IF ALT > -100 OR ALT = -100 THEN
SETENTMODE
PRIORITY 255
PERSIST 0
RULE set depth
IF VAR2 != 0 THEN
SETALT VAR2 ; restore stored depth
ELSE
SETALT -150
END
END
VAR_SET 2 0 ; clear var2
SET_TIMER 1 -1 ; clear timer
SET_TIMER 2 -1
SENSOR Radar 0
VAR_SET 6 0
END
RULE reset timers if we have an order!
IF ORDER != NONE THEN
SETENTMODE
SET_TIMER 1 -1 ; clear timer
SET_TIMER 2 -1
END
;if we have an air contact within 10 nmi we should go deep
RULE Avoid Air
IF ( CLASS = AIR OR CLASS = HELO ) AND ( RNG < 20000 ) THEN
SETSOLNMODE
RULE loading sub avoid doctrine for first time!
IF DOCTRINENAME != "SubAvoidAir" THEN
SETENTMODE
VAR_ADD 5 1
VAR_ADD 7 1
END
DEBUG "Doctrine: sub avoid air"
TACTIC SubAvoidAir
END
RULE Avoid Torp
IF CLASS = WEAP THEN
SETSOLNMODE
RULE loading sub avoid weapon doctrine for first time!
IF DOCTRINENAME != "SubAvoidWeap" THEN
SETENTMODE
VAR_ADD 5 1
VAR_ADD 7 1
END
DEBUG "Doctrine: sub avoid weapon"
;EXPR {0,10} > 5
;RULE fire back
;IF CLASS = WEAP THEN
; DEBUG "Firing Back!"
; FIRE_BEST
;END
TACTIC SubAvoidWeap
END
RULE Prosecute Surf
IF CLASS = SURF THEN
SETSOLNMODE
RULE loading surf attack doctrine for first time!
IF DOCTRINENAME != "SubAtkSurf" THEN
SETENTMODE
VAR_ADD 5 1
END
DEBUG "Doctrine: sub attack surf"
TACTIC SubAtkSurf
END
RULE Prosecute Sub
IF CLASS = SUB THEN
SETSOLNMODE
RULE loading sub attack doctrine for first time!
IF DOCTRINENAME != "SubAtkSub" THEN
SETENTMODE
VAR_ADD 5 1
END
DEBUG "Doctrine: sub attack sub"
DEBUG VAR5
DEBUG ALLIANCE
TACTIC SubAtkSub
END
RULE unknown contact
IF CLASS != SUB AND CLASS != SURF AND CLASS != WEAP AND CLASS != AIR AND CLASS != HELO THEN
DEBUG "Doctrine: unknown contact!"
END
ELSE
SETENTMODE
RULE lost track
IF LOSTTRACK = 1 THEN
DEBUG "Doctrine: Lost Track!"
SETENTMODE
VAR_SUB 5 1
;check 5 and make sure its not below zero
RULE check var5
IF VAR5 < 0 THEN
SETENTMODE
VAR_SET 5 0
END
;lets check the soln doctrine - if its avoidance then decrement avoidance var
SETSOLNMODE
RULE check avoid
IF DOCTRINENAME = "SubAvoidWeap" OR DOCTRINENAME = "SubAvoidAir" THEN
SETENTMODE
VAR_SUB 7 1
END
RULE check var7
IF VAR7 < 0 THEN
SETENTMODE
VAR_SET 7 0
END
;finished auto command so lets set var2 = 0 so comms cycle can continue again
RULE reset var2
IF VAR5 = 0 THEN
SETENTMODE
VAR_SET 2 0
END
END
; done transiting so turn off var8
RULE end transit order
IF ORDER = MOVE AND VAR4 = 1 THEN
SETENTMODE
VAR_SET 8 0
VAR_SET 2 0
END
;if we are not engaging someone or coming to comms depth
RULE start comms if no auto tactic
IF VAR5 = 0 OR VAR8 = 1 THEN
SETENTMODE
RULE execute comms sequence
;lets make sure the user has not ordered our guy to do anything
;if order is move and VAR4 = 1 then the sub just finished transiting,
;so he should come to comms depth
IF ( ORDER = NONE OR ( ORDER = MOVE AND VAR4 = 1 ) OR VAR8 = 1 ) AND VAR6 = 0 THEN
;sub has no orders so it can do comms sequence
DEBUG "Doctrine: enter comms sequence"
SETENTMODE
;sub just executed an order, so now we should set timer for next comms period
;var2 = 0 when we finished executing an order
DEBUG "about to try to reset comms timer!"
DEBUG "VAR2 :"
DEBUG VAR2
RULE reset comms timer
IF TIMER1 = -1 AND TIMER2 = -1 AND ALT < -100 AND VAR2 = O AND VAR8 = 0 THEN
SETENTMODE
DEBUG "Doctrine: reset comms timer"
SET_TIMER 1 VAR1 ; set timer for next comms interval
DEBUG "Doctrine: Here is var1"
DEBUG VAR1
DEBUG "Doctrine: setting var2"
VAR_SET 2 ALT ; store current alt
END
RULE comms interval timer has just fired
IF TIMER1 = 0 THEN
SETENTMODE
DEBUG "Doctrine: Coming to comms depth"
DEBUG "Doctrine: setting var2"
DEBUG TIMER2
VAR_SET 2 ALT ; store current alt
DEBUG VAR2
RULE check speed
IF SPD < 1 THEN
SETENTMODE
PERSIST 0
PRIORITY 255
SETSPD 3
END
PRIORITY 255
PERSIST 0 ; prevent this rule from timing out
SETALT PERIDEPTH ; come to periscope depth
END
RULE Rising to comms depth
IF TIMER1 = -1 AND TIMER2 = -1 AND VAR1 > 0 THEN
; we must be on our way to comms depth
RULE reached comms depth?
IF ALT > PERIDEPTH OR ALT = PERIDEPTH THEN
DEBUG "Doctrine: Reached Comms Depth"
SETENTMODE
SET_TIMER 2 {300,600} ; stay at comms depth 5-10 mins
END
END
RULE resubmerge timer has just fired
IF TIMER2 = 0 THEN
SETENTMODE
DEBUG "Doctrine: Resubmerging!"
DEBUG VAR2
PERSIST 0
PRIORITY 255
RULE check var2
IF VAR2 != 0 THEN
SETALT VAR2 ; restore stored depth
ELSE
SETALT -150
VAR_SET 2 -150
END
RULE set timer for resubmerge
IF VAR2 < -100 THEN
SETENTMODE
SET_TIMER 1 VAR1 ; set timer for next comms interval
END
SENSOR Radar 0
VAR_SET 8 0
END
RULE Limit speed at PD
IF ALT > -70 AND SPD > 5 THEN
SETENTMODE
DEBUG "Doctrine: Limit Speed at PD!"
RULE Store old speed
IF VAR3 = 0 THEN
SETENTMODE
DEBUG "Storing speed in Var3"
DEBUG SPD
VAR_SET 3 SPD
END
PRIORITY 255
SETSPD 5
END
RULE Restore speed after submerge
IF ALT < -70 AND VAR3 != 0 THEN
SETENTMODE
DEBUG "Doctrine: Restore speed after submerge"
PRIORITY 255
SETSPD VAR3
DEBUG VAR3
VAR_SET 3 0
END
DEBUG "Doctrine: Leave comms sequence"
ELSE
SETENTMODE
; we have an order, so lets submerge first
RULE Resubmerge for order
IF VAR2 != O AND ORDER != NONE THEN
SETENTMODE
DEBUG "Doctrine: resubmerge for orders 2!"
DEBUG "VAR2"
DEBUG VAR2
PERSIST 0
RULE set resubmerge depth
IF ORDER = SCRAM THEN
SETENTMODE
PERSIST 0
PRIORITY 255
MIN_ALT
ELSE
SETENTMODE
PERSIST 0
PRIORITY 255
RULE set depth check var2
IF VAR2 != 0 THEN
SETALT VAR2 ; restore stored depth
ELSE
SETALT -150
END
END
VAR_SET 2 0 ; clear var2
SET_TIMER 1 -1
SET_TIMER 2 -1
SENSOR Radar 0
VAR_SET 6 0
VAR_SET 8 0
ELSE
SETENTMODE
;this means VAR6 = 1 so we want to stay at comms depth
RULE stay at comms depth
DEBUG "Doctrine: stay at comms depth rule"
IF ORDER = NONE THEN
SETENTMODE
PRIORITY 255
PERSIST 0 ; prevent this rule from timing out
SETALT PERIDEPTH ; come to periscope depth
END
END ;if we have an order resubmerge
END ;if should do comms depth sequence
ELSE
DEBUG "Doctrine: VAR5 IS NON-ZERO!"
END ;if VAR5 =0
END
END ;sub default rule