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

* committing for a restore point

parent 2fb857e7
No related branches found
No related tags found
No related merge requests found
......@@ -230,7 +230,7 @@ setupNum = _gt_activeNode.getVar("setupNum")
if borg.redUnitStatus[state.getCurrentUnitName()]==setupNum:
rn = PythonUtilities._py_getRandomNumber("UNIFORM", [0.0, 1.0])
rn = (1.5 + rn * 2.5) * 14400.0
# rn = 60.0
rn = 60.0
# SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_ConvoyReturn", [], rn)
# printMessage("Convoy setup complete: "+str(state.getCurrentUnitName()), True)
# borg.delay=0
......
......@@ -274,67 +274,66 @@ UtilityFuncsExp.scheduleEvent(
0.001,
al)
al = ArrayList()
al.add("bigellipse")
al.add("FIRE_CONTROL_RADAR")
al.add("FIRE_CONTROL_RADAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
UtilityFuncsExp.scheduleEvent(
dm,
info.getMyAssignedName(),
"GoalTracker_CreateConvoy",
5,
al)
al = ArrayList()
al.add("bigbox")
al.add("FIRE_CONTROL_RADAR")
#al = ArrayList()
#al.add("bigellipse")
#al.add("FIRE_CONTROL_RADAR")
#al.add("FIRE_CONTROL_RADAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#
#UtilityFuncsExp.scheduleEvent(
# dm,
# info.getMyAssignedName(),
# "GoalTracker_CreateConvoy",
# 5,
# al)
#al = ArrayList()
#al.add("bigbox")
#al.add("FIRE_CONTROL_RADAR")
#al.add("TARGET_ACQ_RADAR")
#al.add("SPT_VEH")
al.add("TARGET_ACQ_RADAR")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("SPT_VEH")
al.add("TELAR")
al.add("TELAR")
al.add("TELAR")
UtilityFuncsExp.scheduleEvent(
dm,
info.getMyAssignedName(),
"GoalTracker_CreateConvoy",
10,
al)
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("SPT_VEH")
#al.add("TELAR")
#al.add("TELAR")
#al.add("TELAR")
#
#UtilityFuncsExp.scheduleEvent(
# dm,
# info.getMyAssignedName(),
# "GoalTracker_CreateConvoy",
# 10,
# al)
</Code>
<Import />
</HTNNode>
......@@ -373,14 +372,22 @@ goalContainer.getCurrentExecutingStack().addReplanTrigger("GoalTracker_ReclaimCo
<Code IsFile="false">import mtry.cxxi.model.HierarchicalTaskNetwork.PythonUtilities.PythonUnit as PythonUnit
from HTNBehaviors import SendEntityEventDelay
# an index for the convoy
convoyIndex = _gt_activeNode.getVar("convoyIndex")
# a list of the profiles the are part of this convoy
profiles = state.getLastTriggerParams()[0]
# formation name to use. formation is the first string in the
# profile list
formName = profiles.get(0)
profiles.remove(0)
# create a list of members
memberList = ArrayList()
# entities are stored in the borg in a dictionary by profiles
# loop through the list of desired profiles and pull those entities
# to add to the member list
for profile in profiles:
if len(borg.redProfiles[profile])&gt;0:
entityName = borg.redProfiles[profile].pop(0)
......@@ -395,25 +402,13 @@ for profile in profiles:
else:
printMessage("No more "+profile+" entities left.", True)
# create the tactical unit from the member list
tu = PythonUnit._py_createTacticalUnitMtry("CONVOY_"+str(convoyIndex), memberList)
#borg.redConvoys[tu.getName()] = tu
#borg.redConvoysWaiting[tu.getName()] = []
#
#destName = borg.redDestinations[0]
#del borg.redDestinations[0]
#borg.redDestinations.append(destName)
#
#borg.redConvoyDest[tu.getName()] = destName
#borg.redFormsByUnit[tu.getName()] = formName
# increment the convoy index
_gt_activeNode.putVar("convoyIndex", convoyIndex+1)
#
#SendUnitEventDelay(tu.getName(), "GoalTracker_Assemble", [], 1)
#
#printMessage("Convoy created: "+str(tu.getName())+" DEST: "+destName, True)
#
# go to making the convoy move (still in this tree)
SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_MoveConvoy", [tu.getName(), formName], 1)
</Code>
<Import />
......@@ -430,16 +425,12 @@ SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_MoveConvoy", [tu.get
<Code IsFile="false">import cxxi.model.knowledge.group.holders.NewUnitHolder as NewUnitHolder
from HTNBehaviors import SendEntityEventDelay
# get the unity, the name of the unit is the first parameter
unit = NewUnitHolder.retrieveUnitByName(state.getLastTriggerParams()[0].get(0))
#for m in unit.getMembers():
# borg.redProfiles[m.getProfile().getName()].append(m.getAssignedName())
# unit.dismissMember(m)
printMessage("Unit reclaimed", True)
formName = borg.redFormsByUnit[unit.getName()]
#SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_MoveConvoy", [unit.getName(), formName], 5)
</Code>
<Import />
</HTNNode>
......@@ -456,26 +447,34 @@ formName = borg.redFormsByUnit[unit.getName()]
from HTNBehaviors import SendUnitEventDelay
import cxxi.model.behavior.PythonUtilities as PythonUtilities
# get the unit name (first trigger param)
unitName = state.getLastTriggerParams()[0].get(0)
# get the formation name (second trigger param)
formName = state.getLastTriggerParams()[0].get(1)
# get the actual unit
tu = NewUnitHolder.retrieveUnitByName(unitName)
# add the unit to the list of convoys
borg.redConvoys[tu.getName()] = tu
# create a dictionary entry for the unit
borg.redConvoysWaiting[tu.getName()] = []
#destName = "PATH_DEST"+str(convoyIndex+1)
# get the destination for the convoy
# then move it to the back
destName = borg.redDestinations[0]
del borg.redDestinations[0]
borg.redDestinations.append(destName)
# set the convoys destination and formation
# in the borg
borg.redConvoyDest[tu.getName()] = destName
borg.redFormsByUnit[tu.getName()] = formName
# randomize the speed
randSpd = PythonUtilities._py_getRandomNumber("UNIFORM", [0.0, 1.0])
randSpd = 10.0 + (40.0 * randSpd)
# start the assembly
SendUnitEventDelay(tu.getName(), "GoalTracker_Assemble", [randSpd], 1)
printMessage("Convoy move: "+str(tu.getName())+" DEST: "+destName, True)
......
......@@ -56,26 +56,26 @@ UtilityFuncsExp.addGoal(
None)
# draw for number of fakeys
numFakeConvoys = GetRandomInt(0, 2)
fakeConvoys = []
if numFakeConvoys==1:
fakeConvoys.append(fakeConvoy1)
elif numFakeConvoys==2:
fakeConvoys.append(fakeConvoy1)
fakeConvoys.append(fakeConvoy2)
#numFakeConvoys = GetRandomInt(0, 2)
#fakeConvoys = []
#if numFakeConvoys==1:
# fakeConvoys.append(fakeConvoy1)
#elif numFakeConvoys==2:
# fakeConvoys.append(fakeConvoy1)
# fakeConvoys.append(fakeConvoy2)
# create the fake convoys if any
ctr = 10
for fakeConvoy in fakeConvoys:
entityList = ConvertToJavaListRandom(fakeConvoy, 4, 25)
fakeConvoyLeader = fakeConvoy[0]
UtilityFuncsExp.addGoal(
entityList.get(0),
ctr,
borg.goalPath + "Red/RandomMove.xml",
[1, entityList, True],
None)
ctr = ctr + 10
#ctr = 10
#for fakeConvoy in fakeConvoys:
# entityList = ConvertToJavaListRandom(fakeConvoy, 4, 25)
# fakeConvoyLeader = fakeConvoy[0]
# UtilityFuncsExp.addGoal(
# entityList.get(0),
# ctr,
# borg.goalPath + "Red/RandomMove.xml",
# [1, entityList, True],
# None)
# ctr = ctr + 10
# common trees for all entities or entities with specific combos
for entity in PlayBoard.getSingleton().getAllEntities():
......@@ -98,13 +98,13 @@ for entity in PlayBoard.getSingleton().getAllEntities():
None)
# random movers
ctr = 10
for vehicle in randomMoveVeh:
UtilityFuncsExp.addGoal(
vehicle,
ctr,
borg.goalPath + "Red/RandomMove.xml",
[-1, None, False],
None)
ctr = ctr + 10
#ctr = 10
#for vehicle in randomMoveVeh:
# UtilityFuncsExp.addGoal(
# vehicle,
# ctr,
# borg.goalPath + "Red/RandomMove.xml",
# [-1, None, False],
# None)
# ctr = ctr + 10
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