View Javadoc

1   package cz.cuni.amis.pogamut.ut2004.bot.command;
2   
3   import java.util.logging.Logger;
4   
5   import javax.vecmath.Vector3d;
6   
7   import cz.cuni.amis.pogamut.base.communication.worldview.IWorldView;
8   import cz.cuni.amis.pogamut.base.communication.worldview.object.IWorldObjectEventListener;
9   import cz.cuni.amis.pogamut.base.communication.worldview.object.event.WorldObjectUpdatedEvent;
10  import cz.cuni.amis.pogamut.base3d.worldview.object.ILocated;
11  import cz.cuni.amis.pogamut.base3d.worldview.object.Location;
12  import cz.cuni.amis.pogamut.base3d.worldview.object.Rotation;
13  import cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot;
14  import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId;
15  import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Configuration;
16  import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.ContinuousMove;
17  import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Dodge;
18  import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Jump;
19  import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Move;
20  import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.TurnTo;
21  import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Item;
22  import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Player;
23  import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Self;
24  import javax.vecmath.Matrix3d;
25  
26  /**
27   * Class providing Pogamut2 UT2004 advanced locomotion commands for the bot -
28   * strafing, advanced turning, dodging...
29   *
30   * @author Michal 'Knight' Bida
31   */
32  public class AdvancedLocomotion extends SimpleLocomotion {
33  
34      /**
35       * Self object holding information about our agent. 
36  	 *
37       */
38      Self self = null;
39  
40      /**
41       * {@link Self} listener. this is needed because self can be updated during
42       * the simulation and in multiPogamut we are stuck with the old version
43       */
44      private class SelfListener implements IWorldObjectEventListener<Self, WorldObjectUpdatedEvent<Self>> {
45  
46          private IWorldView worldView;
47  
48          /**
49           * Constructor. Registers itself on the given WorldView object.
50           *
51           * @param worldView WorldView object to listent to.
52           */
53          public SelfListener(IWorldView worldView) {
54              this.worldView = worldView;
55              worldView.addObjectListener(Self.class, WorldObjectUpdatedEvent.class, this);
56          }
57  
58          @Override
59          public void notify(WorldObjectUpdatedEvent<Self> event) {
60              self = event.getObject();
61          }
62      }
63      /**
64       * {@link Self} listener
65       */
66      private SelfListener selfListener = null;
67      /**
68       * Used to set focus when strafing left and right, holds the distance of
69       * focus location.
70       */
71      private static final double FOCUS_DISTANCE = 3000;
72  
73      /**
74       * Makes the bot to move through first location to second location (may be
75       * specified directly or some ILocated object may be supplied - carefull
76       * with objects traversability). Usage is when you want to have your bot to
77       * move really smooth. Where is the problem? If you would want to achive the
78       * same thing with 2 moveTo functions (first move to location1, when there
79       * move to location2), there may be a little lag - you have to check if you
80       * are already at first location and etc. This function can solve this
81       * problem as the check is done in UnrealScript.
82       *
83       * (issues GB MOVE command)
84       *
85       * @param firstLocation First location we will go through.
86       * @param secondLocation Second location we will go to (after reaching first).
87       *
88       * @see moveContinuous()
89       */
90      public void moveAlong(ILocated firstLocation, ILocated secondLocation) {
91          Move moveAlong = new Move();
92  
93          moveAlong.setFirstLocation(firstLocation.getLocation());
94          moveAlong.setSecondLocation(secondLocation.getLocation());
95  
96          agent.getAct().act(moveAlong);
97      }
98  
99      /**
100      * This makes the bot to run straight ahead continuously. Will stop when
101      * other move command is issued - stopMovement, strafeTo, moveTo, moveAlong
102      * even turn commands will interrupt this.
103      *
104      * (issues GB CMOVE command)
105      *
106      * @see moveAlong(ILocated, ILocated)
107      *
108      */
109     public void moveContinuos() {
110         agent.getAct().act(new ContinuousMove());
111     }
112 
113     /**
114      * Bot strafes right. The length of the strafe is specified by distance
115      * attribute (in UT units, 1 UT unit equals roughly 1 cm). The bot will be
116      * looking to object specified by the attribute focusId.
117      *
118      * @param distance - how far the bot strafes (in UT units, 1 UT unit equals
119      * roughly 1 cm).
120      * @param focusId - UnrealId of the object that should be the bot focus.
121      * @see strafeLeft(double,ILocated)
122      */
123     public void strafeRight(double distance, UnrealId focusId) {
124         if (self == null) {
125             self = agent.getWorldView().getSingle(Self.class);
126         }
127         if (self != null) {
128             Location startLoc = self.getLocation();
129             Location directionVector = self.getRotation().toLocation();
130             Location targetVec = directionVector.cross(new Location(0, 0, 1)).getNormalized().scale(-distance);
131 
132             agent.getAct().act(
133                     new Move().setFirstLocation(startLoc.add(targetVec)).setFocusTarget(focusId));
134         }
135     }
136 
137     /**
138      * Bot strafes right. The length of the strafe is specified by distance
139      * attribute (in UT units, 1 UT unit equals roughly 1 cm). The bot will be
140      * looking to location specified by the attribute focusLocation.
141      *
142      * @param distance - how far the bot strafes (in UT units, 1 UT unit equals
143      * roughly 1 cm).
144      * @param focusLocation - location where the bot should look
145      * @see strafeLeft(double,ILocated)
146      */
147     public void strafeRight(double distance, ILocated focusLocation) {
148         if (self == null) {
149             self = agent.getWorldView().getSingle(Self.class);
150         }
151         if (self != null) {
152             Location startLoc = self.getLocation();
153             Location directionVector = self.getRotation().toLocation();
154             Location targetVec = directionVector.cross(new Location(0, 0, 1)).getNormalized().scale(-distance);
155 
156             agent.getAct().act(
157                     new Move().setFirstLocation(startLoc.add(targetVec)).setFocusLocation(focusLocation.getLocation()));
158         }
159     }
160 
161     /**
162      * Bot strafes right. The length of the strafe is specified by distance
163      * attribute (in UT units, 1 UT unit equals roughly 1 cm). Note that this
164      * will reset the bot focus. The bot will be looking straight ahead (however
165      * if the strafe is really long - more than 500 UT units - it will be
166      * visible the bot is turning slightly performing the strafe).
167      *
168      * @param distance - how far the bot strafes (in UT units, 1 UT unit equals
169      * roughly 1 cm).
170      * @see strafeLeft(double)
171      */
172     public void strafeRight(double distance) {
173         if (self == null) {
174             self = agent.getWorldView().getSingle(Self.class);
175         }
176         if (self != null) {
177             Location startLoc = self.getLocation();
178             Location directionVector = self.getRotation().toLocation();
179             Location targetVec = directionVector.cross(new Location(0, 0, 1)).getNormalized().scale(-distance);
180 
181             agent.getAct().act(
182                     new Move().setFirstLocation(startLoc.add(targetVec)).setFocusLocation(
183                     startLoc.add(directionVector.getNormalized().scale(
184                     FOCUS_DISTANCE))));
185         }
186     }
187 
188     /**
189      * Bot strafes left. The length of the strafe is specified by distance
190      * attribute (in UT units, 1 UT unit equals roughly 1 cm). The bot will be
191      * looking to object specified by the attribute focusId.
192      *
193      * @param distance - how far the bot strafes (in UT units, 1 UT unit equals
194      * roughly 1 cm).
195      * @param focusId - UnrealId of the object that should be the bot focus.
196      * @see strafeRight(double,ILocated)
197      */
198     public void strafeLeft(double distance, UnrealId focusId) {
199         if (self == null) {
200             self = agent.getWorldView().getSingle(Self.class);
201         }
202         if (self != null) {
203             Location startLoc = self.getLocation();
204             Location directionVector = self.getRotation().toLocation();
205             Location targetVec = directionVector.cross(new Location(0, 0, 1)).getNormalized().scale(distance);
206 
207             agent.getAct().act(
208                     new Move().setFirstLocation(startLoc.add(targetVec)).setFocusTarget(focusId));
209         }
210     }
211 
212     /**
213      * Bot strafes left. The length of the strafe is specified by distance
214      * attribute (in UT units, 1 UT unit equals roughly 1 cm). The bot will be
215      * looking to location specified by the attribute focusLocation.
216      *
217      * @param distance - how far the bot strafes (in UT units, 1 UT unit equals
218      * roughly 1 cm).
219      * @param focusLocation - location where the bot should look
220      * @see strafeRight(double,ILocated)
221      */
222     public void strafeLeft(double distance, ILocated focusLocation) {
223         if (self == null) {
224             self = agent.getWorldView().getSingle(Self.class);
225         }
226         if (self != null) {
227             Location startLoc = self.getLocation();
228             Location directionVector = self.getRotation().toLocation();
229             Location targetVec = directionVector.cross(new Location(0, 0, 1)).getNormalized().scale(distance);
230 
231             agent.getAct().act(
232                     new Move().setFirstLocation(startLoc.add(targetVec)).setFocusLocation(focusLocation.getLocation()));
233         }
234     }
235 
236     /**
237      * Bot strafes left. The length of the strafe is specified by distance
238      * attribute (in UT units, 1 UT unit equals roughly 1 cm). Note that this
239      * will reset the bot focus. The bot will be looking straight ahead (however
240      * if the strafe is really long - more than 500 UT units - it will be
241      * visible the bot is turning slightly performing the strafe).
242      *
243      * @param distance - how far the bot strafes (in UT units, 1 UT unit equals
244      * roughly 1 cm).
245      * @see strafeRight(double)
246      */
247     public void strafeLeft(double distance) {
248         if (self == null) {
249             self = agent.getWorldView().getSingle(Self.class);
250         }
251         if (self != null) {
252             Location startLoc = self.getLocation();
253             Location directionVector = self.getRotation().toLocation();
254             Location targetVec = directionVector.cross(new Location(0, 0, 1)).getNormalized().scale(distance);
255 
256             agent.getAct().act(
257                     new Move().setFirstLocation(startLoc.add(targetVec)).setFocusLocation(
258                     startLoc.add(directionVector.getNormalized().scale(
259                     FOCUS_DISTANCE))));
260         }
261     }
262 
263     /**
264      * Makes the bot to move to location while looking at focusLocation. (issues
265      * GB MOVE command)
266      *
267      * @param location Location we will strafe to.
268      * @param focusLocation Location we will look at while strafing.
269      *
270      * @see strafeTo(ILocated, UnrealId)
271      */
272     public void strafeTo(ILocated location, ILocated focusLocation) {
273         Move move = new Move().setFirstLocation(location.getLocation()).setFocusLocation(focusLocation.getLocation());
274         agent.getAct().act(move);
275     }
276 
277     /**
278      * Makes the bot to move at location, while looking at focus object. Note
279      * that when you support focus object, the bot will update his focus (place
280      * he is looking at) according to focus object location (this will be
281      * provided by GB UnrealScript code). Usefull when you want to track some
282      * player position while moving somewhere else. (issues GB MOVE command)
283      *
284      * @param location Location we will strafe to.
285      * @param focus Object with UrealId. We will look at this location while
286      * strafing. We will update our focus location according to the current
287      * position of this obejct in UT.
288      *
289      * @see strafeTo(ILocated, ILocated)
290      *
291      * @todo To check if supported object is also ILocated? see below
292      */
293     public void strafeTo(ILocated location, UnrealId focus) {
294         Move move = new Move().setFirstLocation(location.getLocation()).setFocusTarget(focus);
295         // TODO: To check if this object is also ILocated?
296         // How this could be done? We need to check if supported IWorldObject
297         // implements interface ILocated
298 		/*
299          * ILocated tmpILocatedCheck; if (tmpILocatedCheck.getClass() ==
300          * focus.getClass().getInterfaces()[0]) {
301          *
302          * }
303          */
304         agent.getAct().act(move);
305     }
306     
307     /**
308      * Makes the bot to move to location while looking at focusLocation. (issues
309      * GB MOVE command)
310      *
311      * @param firstLocation First location we will strafe through.
312      * @param secondLocation Second location we will strafe to (after reaching first).
313      * @param focusLocation Location we will look at while strafing.
314      *
315      * @see strafeTo(ILocated, UnrealId)
316      */
317     public void strafeAlong(ILocated firstLocation, ILocated secondLocation, ILocated focusLocation) {
318         Move move = new Move().setFirstLocation(firstLocation.getLocation()).setSecondLocation(secondLocation.getLocation()).setFocusLocation(focusLocation.getLocation());
319         agent.getAct().act(move);
320     }
321 
322     /**
323      * Makes the bot to move at location, while looking at focus object. Note
324      * that when you support focus object, the bot will update his focus (place
325      * he is looking at) according to focus object location (this will be
326      * provided by GB UnrealScript code). Usefull when you want to track some
327      * player position while moving somewhere else. (issues GB MOVE command)
328      * 
329      * This method allows you to specify one location to strafe to in advance.
330      * Usage is when you want to have your bot to
331      * move really smooth. Where is the problem? If you would want to achive the
332      * same thing with 2 moveTo functions (first move to location1, when there
333      * move to location2), there may be a little lag - you have to check if you
334      * are already at first location and etc. This function can solve this
335      * problem as the check is done in UnrealScript.
336      *
337      * @param firstLocation First location we will strafe through.
338      * @param secondLocation Second location we will strafe to (after reaching first).
339      * @param focus Object with UrealId. We will look at this location while strafing. We will update our focus location according to the current position of this obejct in UT.
340      * 
341      * @see strafeTo(ILocated, ILocated)
342      *
343      * @todo To check if supported object is also ILocated? see below
344      */
345     public void strafeAlong(ILocated firstLocation, ILocated secondLocation, UnrealId focus) {
346         Move move = new Move().setFirstLocation(firstLocation.getLocation()).setSecondLocation(secondLocation.getLocation()).setFocusTarget(focus);
347         // TODO: To check if this object is also ILocated?
348         // How this could be done? We need to check if supported IWorldObject
349         // implements interface ILocated
350 		/*
351          * ILocated tmpILocatedCheck; if (tmpILocatedCheck.getClass() ==
352          * focus.getClass().getInterfaces()[0]) {
353          *
354          * }
355          */
356         agent.getAct().act(move);
357     }
358     
359     
360 
361     /**
362      * Makes the bot to double jump instantly (issues GB JUMP command) with
363      * default settings.
364      *
365      * @todo How to convince javadoc see to link to method in super class
366      *
367      * @see jump()
368      * @see dodge(Vector3d)
369      */
370     public void doubleJump() {
371         Jump jump = new Jump();
372         jump.setDoubleJump(true);
373 
374         // TODO: [Michal Bida] remove when GB is fixed
375         jump.setForce((double) 680);
376 
377         agent.getAct().act(jump);
378     }
379 
380     /**
381      * Makes the bot to jump instantly (issues GB JUMP command) with custom
382      * settings. <p><p> See also {@link SimpleLocomotion#jump()}.
383      *
384      * @param doubleJump whether the bot should double jump
385      * @param secondJumpDelay If doubleJump, than after time specified here, the
386      * bot performs second jump of a double jump (if DoubleJump is true). Time
387      * is in seconds. GB2004 default is 0.5s.
388      * @param jumpZ than this is a force vector specifying how big the jump
389      * should be. Can't be set more than 2 * JumpZ = 680 for double jump.
390      *
391      * @see jump()
392      * @see dodge(Vector3d)
393      */
394     public void generalJump(boolean doubleJump, double secondJumpDelay, double jumpZ) {
395         Jump jump = new Jump();
396         jump.setDoubleJump(doubleJump);
397         if (doubleJump) {
398             jump.setDelay(secondJumpDelay);
399         }
400         jump.setForce(jumpZ);
401         agent.getAct().act(jump);
402     }
403 
404     /**
405      * Makes the bot to double jump instantly (issues GB JUMP command) with
406      * custom settings. <p><p> See also {@link SimpleLocomotion#jump()}.
407      *
408      * @param secondJumpDelay After time specified here, the bot performs second
409      * jump of a double jump (if DoubleJump is true). Time is in seconds. GB2004
410      * default is 0.5s.
411      * @param jumpZ Force vector specifying how big the jump should be. Can't be
412      * set more than 2 * JumpZ = 680 for double jump.
413      *
414      * @see jump()
415      * @see dodge(Vector3d)
416      */
417     public void doubleJump(double secondJumpDelay, double jumpZ) {
418         Jump jump = new Jump();
419         jump.setDoubleJump(true);
420         jump.setDelay(secondJumpDelay);
421         jump.setForce(jumpZ);
422         agent.getAct().act(jump);
423     }
424 
425     /**
426      * Makes the bot to dodge in the selected direction (this is in fact single
427      * jump that is executed to selected direction). Direction is absolute in
428      * this method. (issues GB DODGE command)
429      *
430      * @param direction Absolute vector (that will be normalized) that specifies
431      * direction of the jump.
432      * @param bDouble Wheter we want to perform double dodge.
433      * @see jump()
434      * @see doubleJump()
435      */
436     public void dodge(Location direction, boolean bDouble) {
437         direction = direction.getNormalized();
438         double alpha = Math.acos(self.getRotation().toLocation().getNormalized().dot(direction.getNormalized()));
439         double orientation = self.getRotation().toLocation().cross(new Location(0, 0, 1)).dot(direction);
440         if (orientation > 0) {
441             alpha = -alpha;
442         }
443 
444         Matrix3d rot = Rotation.constructXYRot(alpha);
445         direction = new Location(1, 0, 0).mul(rot);
446 
447         act.act(new Dodge().setDirection(direction).setDouble(bDouble));
448     }
449     
450     /**
451      * Dodges from specified location to the left of the bot.
452      * 
453      * @param inFrontOfTheBot Location to dodge from.
454      * @param bDouble Whether to perform double dodge.
455      */
456     public void dodgeLeft(ILocated inFrontOfTheBot, boolean bDouble) {
457         ILocated bot = self.getLocation();
458         Location direction = new Location(inFrontOfTheBot.getLocation().x - bot.getLocation().x, inFrontOfTheBot.getLocation().y - bot.getLocation().y, 0);
459         direction = direction.getNormalized();
460 
461         double x = direction.getX();
462         double y = direction.getY();
463 
464         direction = new Location(-y, x, 0);
465 
466         double alpha = Math.acos(self.getRotation().toLocation().getNormalized().dot(direction.getNormalized()));
467         double orientation = self.getRotation().toLocation().cross(new Location(0, 0, 1)).dot(direction);
468         if (orientation > 0) {
469             alpha = -alpha;
470         }
471 
472         Matrix3d rot = Rotation.constructXYRot(alpha);
473         direction = new Location(-1, 0, 0).mul(rot);
474 
475         this.act.act(new Dodge().setDirection(direction).setDouble(bDouble));
476     }
477 
478     /**
479      * Dodges from specified location to the right of the bot.
480      * 
481      * @param inFrontOfTheBot Location to dodge from.
482      * @param bDouble Whether to perform double dodge.
483      */
484     public void dodgeRight(ILocated inFrontOfTheBot, boolean bDouble) {
485         ILocated bot = self.getLocation();
486         Location direction = new Location(inFrontOfTheBot.getLocation().x - bot.getLocation().x, inFrontOfTheBot.getLocation().y - bot.getLocation().y, 0);
487         direction = direction.getNormalized();
488 
489         double x = direction.getX();
490         double y = direction.getY();
491 
492         direction = new Location(-y, x, 0);
493 
494         double alpha = Math.acos(self.getRotation().toLocation().getNormalized().dot(direction.getNormalized()));
495 
496         double orientation = self.getRotation().toLocation().cross(new Location(0, 0, 1)).dot(direction);
497         if (orientation > 0) {
498             alpha = -alpha;
499         }
500 
501         Matrix3d rot = Rotation.constructXYRot(alpha);
502         direction = new Location(1, 0, 0).mul(rot);
503 
504         this.act.act(new Dodge().setDirection(direction).setDouble(bDouble));
505     }
506 
507     /**
508      * Dodges from the specified location.
509      * 
510      * @param inFrontOfTheBot Location to dodge from.
511      * @param bDouble Whether to perform double dodge.
512      */
513     public void dodgeBack(ILocated inFrontOfTheBot, boolean bDouble) {
514         ILocated bot = self.getLocation();
515         Location direction = new Location(bot.getLocation().x - inFrontOfTheBot.getLocation().x, bot.getLocation().y - inFrontOfTheBot.getLocation().y, 0);
516         direction = direction.getNormalized();
517 
518         double alpha = Math.acos(self.getRotation().toLocation().getNormalized().dot(direction.getNormalized()));
519 
520         double orientation = self.getRotation().toLocation().cross(new Location(0, 0, 1)).dot(direction);
521         if (orientation > 0) {
522             alpha = -alpha;
523         }
524 
525         Matrix3d rot = Rotation.constructXYRot(alpha);
526         direction = new Location(1, 0, 0).mul(rot);
527 
528         this.act.act(new Dodge().setDirection(direction).setDouble(bDouble));
529     }
530 
531     /**
532      * Dodges towards the specified location.
533      * 
534      * @param inFrontOfTheBot Location to dodge to.
535      * @param bDouble Whether to perform double dodge.
536      */
537     public void dodgeTo(ILocated inFrontOfTheBot, boolean bDouble) {
538         ILocated bot = self.getLocation();
539         Location direction = new Location(inFrontOfTheBot.getLocation().x - bot.getLocation().x, inFrontOfTheBot.getLocation().y - bot.getLocation().y, 0);
540         direction = direction.getNormalized();
541 
542         double alpha = Math.acos(self.getRotation().toLocation().getNormalized().dot(direction.getNormalized()));
543 
544         double orientation = self.getRotation().toLocation().cross(new Location(0, 0, 1)).dot(direction);
545         if (orientation > 0) {
546             alpha = -alpha;
547         }
548 
549         Matrix3d rot = Rotation.constructXYRot(alpha);
550         direction = new Location(1, 0, 0).mul(rot);
551 
552         this.act.act(new Dodge().setDirection(direction).setDouble(bDouble));
553     }
554 
555     /**
556      * Makes the bot to dodge in the selected direction (this is in fact single
557      * jump that is executed to selected direction). Direction is relative to
558      * bot actual rotation! (issues GB DODGE command)
559      *
560      * @param direction Relative vector (that will be normalized) that specifies
561      * direction of the jump. Relative means that the bot current rotation will
562      * be added to the this vector. So to dodge ahead issue direction (1,0,0).
563      *
564      * @param bDouble Wheter we want to perform double dodge.
565      * @see jump()
566      * @see doubleJump()
567      */
568     public void dodgeRelative(Location direction, boolean bDouble) {
569         agent.getAct().act(new Dodge().setDirection(direction).setDouble(bDouble));
570     }
571 
572     /**
573      * Sets the speed multiplier for the bot. By this number the bots default
574      * speed will be multiplied by. (issues GB CONF command)
575      *
576      * @param speedMultiplier Ranges from 0.1 to 2 (max may be set in ini in
577      * [RemoteBot] MaxSpeed)
578      *
579      * @see setRotationSpeed(Rotation)
580      */
581     public void setSpeed(double speedMultiplier) {
582         Configuration configure = new Configuration();
583         configure.setSpeedMultiplier(speedMultiplier);
584         agent.getAct().act(configure);
585     }
586 
587     /**
588      * Sets the rotation speed (rotation rate) for the bot. Default rotation
589      * rate can be set in GameBots INI file in UT2004/System directory ( look
590      * for DefaultRotationRate attribute). Default rotation rate is now
591      * Pitch=3072, Yaw=60000, Roll=2048 (pitch = up/down, yaw = left/right, roll
592      * = equivalent of doing a cartwheel).
593      *
594      * (issues GB CONF command)
595      *
596      * @param newRotationRate Default is Pitch=3072, Yaw=60000, Roll=2048. To
597      * achieve best results we suggest to multiply the default setting.
598      *
599      * @see setSpeed(double)
600      */
601     public void setRotationSpeed(Rotation newRotationRate) {
602         Configuration configure = new Configuration();
603         configure.setRotationRate(newRotationRate);
604         agent.getAct().act(configure);
605     }
606 
607     /**
608      * Constructor. Setups the command module based on given agent and logger.
609      *
610      * @param agent AbstractUT2004Bot we will send commands for
611      * @param log Logger to be used for logging runtime/debug info.
612      */
613     public AdvancedLocomotion(UT2004Bot agent, Logger log) {
614         super(agent, log);
615         this.selfListener = new SelfListener(agent.getWorldView()); //register self listener
616     }
617 
618     @Override
619     public void jump() {
620         super.jump();
621     }
622 
623     /**
624      * Makes the bot to jump instantly (issues GB JUMP command) with custom
625      * settings. <p><p> See also {@link SimpleLocomotion#jump()}.
626      *
627      * @param jumpZ Force vector specifying how big the jump should be. Can't be
628      * set more than JumpZ = 340 for single jump.
629      *
630      * @see jump()
631      * @see dodge(Vector3d)
632      */
633     public void jump(double jumpZ) {
634         Jump jump = new Jump();
635         jump.setForce(jumpZ);
636         agent.getAct().act(jump);
637     }
638 
639     /**
640      * Makes the bot to jump (or double jump) instantly (issues GB JUMP command)
641      * with custom settings. <p><p> See also {@link SimpleLocomotion#jump()}.
642      *
643      * @param doubleJump whether to perform double jump
644      * @param secondJumpDelay After time specified here, the bot performs second
645      * jump of a double jump (if DoubleJump is true). Time is in seconds. GB2004
646      * default is 0.5s.
647      * @param jumpZ Force vector specifying how big the jump should be. Can't be
648      * set more than 2 * JumpZ = 680 for double jump.
649      *
650      * @see jump()
651      * @see dodge(Vector3d)
652      */
653     public void jump(boolean doubleJump, double secondJumpDelay, double jumpZ) {
654         Jump jump = new Jump();
655         jump.setDoubleJump(doubleJump);
656         jump.setDelay(secondJumpDelay);
657         jump.setForce(jumpZ);
658         agent.getAct().act(jump);
659     }
660 
661     @Override
662     public void moveTo(ILocated location) {
663         super.moveTo(location);
664     }
665 
666     @Override
667     public void setRun() {
668         super.setRun();
669     }
670 
671     @Override
672     public void setWalk() {
673         super.setWalk();
674     }
675 
676     @Override
677     public void stopMovement() {
678         super.stopMovement();
679     }
680 
681     @Override
682     public void turnHorizontal(int amount) {
683         super.turnHorizontal(amount);
684     }
685 
686     @Override
687     public void turnTo(ILocated location) {
688         super.turnTo(location);
689     }
690 
691     @Override
692     public void turnTo(Player player) {
693         super.turnTo(player);
694     }
695 
696     @Override
697     public void turnTo(Item item) {
698         super.turnTo(item);
699     }
700 
701     @Override
702     public void turnVertical(int amount) {
703         super.turnVertical(amount);
704     }
705 }