Skip to content
Snippets Groups Projects
Commit 5c0abaae authored by Reeves, David E's avatar Reeves, David E
Browse files

* attack logic in

parent 63d6fe06
No related branches found
No related tags found
No related merge requests found
...@@ -441,6 +441,13 @@ else: ...@@ -441,6 +441,13 @@ else:
randVal = PythonUtilities._py_getRandomNumber("UNIFORM", [0.0, 1.0]) randVal = PythonUtilities._py_getRandomNumber("UNIFORM", [0.0, 1.0])
randSpd = borg.params_randSpdMin + (borg.params_randSpdVar * randVal) randSpd = borg.params_randSpdMin + (borg.params_randSpdVar * randVal)
# check for attack time
if borg.isAttackRun and Schedule.getSimTime() >= borg.params_attackTime:
# attack time clip the list
ind = len(borg.redConvoyDest[state.getCurrentUnit().getName()])-1
lastName = borg.redConvoyDest[state.getCurrentUnit().getName()][ind]
borg.redConvoyDest[state.getCurrentUnit().getName()]=[lastName]
destName = borg.redConvoyDest[state.getCurrentUnit().getName()][0] destName = borg.redConvoyDest[state.getCurrentUnit().getName()][0]
del borg.redConvoyDest[state.getCurrentUnit().getName()][0] del borg.redConvoyDest[state.getCurrentUnit().getName()][0]
...@@ -470,6 +477,7 @@ if state.isCommander(): ...@@ -470,6 +477,7 @@ if state.isCommander():
<Code IsFile="false">import cxxi.model.behavior.PythonUtilities as PythonUtilities <Code IsFile="false">import cxxi.model.behavior.PythonUtilities as PythonUtilities
from HTNBehaviors import SendEntityEventDelay from HTNBehaviors import SendEntityEventDelay
from HTNBehaviors import ConvertToJavaList from HTNBehaviors import ConvertToJavaList
import simkit.Schedule as Schedule
# complete the wait process # complete the wait process
...@@ -485,6 +493,13 @@ else: ...@@ -485,6 +493,13 @@ else:
randVal = PythonUtilities._py_getRandomNumber("UNIFORM", [0.0, 1.0]) randVal = PythonUtilities._py_getRandomNumber("UNIFORM", [0.0, 1.0])
randSpd = borg.params_randSpdMin + (borg.params_randSpdVar * randVal) randSpd = borg.params_randSpdMin + (borg.params_randSpdVar * randVal)
# check for attack time
if borg.isAttackRun and Schedule.getSimTime() &gt;= borg.params_attackTime:
# attack time clip the list
ind = len(borg.redConvoyDest[state.getCurrentUnit().getName()])-1
lastName = borg.redConvoyDest[state.getCurrentUnit().getName()][ind]
borg.redConvoyDest[state.getCurrentUnit().getName()]=[lastName]
destName = borg.redConvoyDest[state.getCurrentUnit().getName()][0] destName = borg.redConvoyDest[state.getCurrentUnit().getName()][0]
del borg.redConvoyDest[state.getCurrentUnit().getName()][0] del borg.redConvoyDest[state.getCurrentUnit().getName()][0]
...@@ -494,6 +509,7 @@ borg.delay=1.0 ...@@ -494,6 +509,7 @@ borg.delay=1.0
# log data # log data
if state.isCommander(): if state.isCommander():
SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_LogMsg", ["UnitLogger", "UNIT_NAME\tACTION\tDATA", ConvertToJavaList([ state.getCurrentUnitName(), "WAIT_AT_BASE_COMPLETE" "" ])], 0) SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_LogMsg", ["UnitLogger", "UNIT_NAME\tACTION\tDATA", ConvertToJavaList([ state.getCurrentUnitName(), "WAIT_AT_BASE_COMPLETE" "" ])], 0)
</Code> </Code>
<Import /> <Import />
</HTNNode> </HTNNode>
......
...@@ -34,10 +34,10 @@ borg.goalPath = "HTN/Trees/" ...@@ -34,10 +34,10 @@ borg.goalPath = "HTN/Trees/"
# Scenario Parameters # Scenario Parameters
################################################################################################################################################################# #################################################################################################################################################################
# will the entities move to attack positions at the end of training? # will the entities move to attack positions at the end of training?
borg.isAttackRun = False borg.isAttackRun = True
# attack time after which all vehicles will go to attack positions # attack time after which all vehicles will go to attack positions
# note: This is not an interrupt, convoys will finish what they were doing first # note: This is not an interrupt, convoys will finish what they were doing first
borg.params_attackTime = 10 borg.params_attackTime = 30
# red training positions # red training positions
borg.redDestinations=["TRAINING01", "TRAINING02", "TRAINING03", "TRAINING04", "TRAINING05", "TRAINING06", "TRAINING07", "TRAINING08", "TRAINING09", "TRAINING10", "TRAINING11", "TRAINING12", ] borg.redDestinations=["TRAINING01", "TRAINING02", "TRAINING03", "TRAINING04", "TRAINING05", "TRAINING06", "TRAINING07", "TRAINING08", "TRAINING09", "TRAINING10", "TRAINING11", "TRAINING12", ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment