View Javadoc

1   package cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages;
2    		
3    		// --- IMPORTS FROM /messages/settings/javasettings/javaimport BEGIN
4   			import java.util.*;import javax.vecmath.*;import cz.cuni.amis.pogamut.base.communication.messages.*;import cz.cuni.amis.pogamut.base.communication.worldview.*;import cz.cuni.amis.pogamut.base.communication.worldview.event.*;import cz.cuni.amis.pogamut.base.communication.worldview.object.*;import cz.cuni.amis.pogamut.multi.communication.worldview.object.*;import cz.cuni.amis.pogamut.base.communication.translator.event.*;import cz.cuni.amis.pogamut.multi.communication.translator.event.*;import cz.cuni.amis.pogamut.base3d.worldview.object.*;import cz.cuni.amis.pogamut.base3d.worldview.object.event.*;import cz.cuni.amis.pogamut.ut2004.communication.messages.*;import cz.cuni.amis.pogamut.ut2004.communication.worldview.objects.*;import cz.cuni.amis.pogamut.ut2004multi.communication.worldview.objects.*;import cz.cuni.amis.pogamut.ut2004.communication.translator.itemdescriptor.*;import cz.cuni.amis.pogamut.ut2004.communication.messages.ItemType.Category;import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId;import cz.cuni.amis.utils.exception.*;import cz.cuni.amis.pogamut.base.communication.translator.event.IWorldObjectUpdateResult.Result;import cz.cuni.amis.utils.SafeEquals;import cz.cuni.amis.pogamut.base.agent.*;import cz.cuni.amis.pogamut.multi.agent.*;import cz.cuni.amis.pogamut.multi.communication.worldview.property.*;import cz.cuni.amis.pogamut.ut2004multi.communication.worldview.property.*;import cz.cuni.amis.utils.token.*;import cz.cuni.amis.utils.*;
5   		// --- IMPORTS FROM /messages/settings/javasettings/javaimport END
6   		
7   		
8   		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name='all'] BEGIN
9   				
10  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name='all'] END
11  		
12  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=static]+classtype[@name=abstract] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=static]+classtype[@name=abstract] END
15      
16   		/**
17           *  
18              				Abstract definition of the static part of the GameBots2004 message NAV.  
19              			
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Synchronous message - however only NavPoints marking item pickup locations are exported synchronously. Other NavPoints are not exported synchronously at all, even if the bot can actually see them (but note that ALL NavPoints are exported in the handshake between bot and the server). Exporting NavPoints synchronously took a lot of UT server resources with limited information gain (in Pogamut there is now available visibility matrix holding static information which points can be seen from other points). NavPoint carries information about UT navigation point - location, paths and some additional information are stored there (if it is an ambush point, or sniper point, etc.).
25     
26           */
27   	public abstract class NavPointStatic 
28    						extends InfoMessage
29    						implements IStaticWorldObject
30    						
31  	    {
32   	
33      	
34      	
35      	/**
36      	 * Parameter-less contructor for the message.
37      	 */
38  		public NavPointStatic()
39  		{
40  		}
41  		
42  				// abstract definition of the static-part of the message, no more constructors is needed
43  			
44  	   		
45  			protected long SimTime;
46  				
47  			/**
48  			 * Simulation time in MILLI SECONDS !!!
49  			 */	
50  			@Override
51  			public long getSimTime() {
52  				return SimTime;
53  			}
54  						
55  			/**
56  			 * Used by Yylex to slip correct time of the object or programmatically.
57  			 */
58  			protected void setSimTime(long SimTime) {
59  				this.SimTime = SimTime;
60  			}
61  	   	
62  	    			
63  	    				@Override
64  		    			public abstract 
65  		    			NavPointStatic clone();
66  		    			
67  						@Override
68  						public Class getCompositeClass() {
69  							return NavPoint.class;
70  						}
71  	
72  						
73  		    			
74   		/**
75           * 
76  			A unique Id of this navigation point assigned by the game.
77  		 
78           */
79          public abstract UnrealId getId()
80   	;
81  		    			
82   		/**
83           * 
84  			Unique Id of the respawned item (the item respawns at this
85  			point). Not sent if point is not an inventory spot. Sent only in HandShake.
86  		 
87           */
88          public abstract UnrealId getItem()
89   	;
90  		    			
91   		/**
92           * 
93              Class of the item (e.g. xWeapons.FlakCannonPickup). Not sent if point is not an inventory spot. Sent only in HandShake.
94           
95           */
96          public abstract ItemType getItemClass()
97   	;
98  		    			
99   		/**
100          * 
101             If this NavPoint is marking some mover, the mover id will be here. Not sent if point is not a Door, a LiftCenter or a LiftExit. Sent only in HandShake.
102          
103          */
104         public abstract UnrealId getMover()
105  	;
106 		    			
107  		/**
108          * 
109             Starting vector between MyLift location and LiftCenter location. Not sent if point is not a LiftCenter. Sent only in HandShake.
110          
111          */
112         public abstract Vector3d getLiftOffset()
113  	;
114 		    			
115  		/**
116          * 
117             Boolean. If we can/should exit the lift by a jump when near the destination place. Not sent if point is not a LiftExit. Sent only in HandShake.
118          
119          */
120         public abstract boolean isLiftJumpExit()
121  	;
122 		    			
123  		/**
124          * 
125             Boolean. If we should or not use double jump when exiting lift with a jump. Not sent if point is not a LiftExit. Sent only in HandShake.
126          
127          */
128         public abstract boolean isNoDoubleJump()
129  	;
130 		    			
131  		/**
132          * 
133 			If this is an inventory spot (item is respawned at this point).
134 		 
135          */
136         public abstract boolean isInvSpot()
137  	;
138 		    			
139  		/**
140          * 
141 			If this is a player start (players and/or bots are respawned at this point).
142 		 
143          */
144         public abstract boolean isPlayerStart()
145  	;
146 		    			
147  		/**
148          * 
149 			Will be sent if this is a player start. In Team games (team deathmatch, capture the flag, domination) holds information about which team respawns at this player start spot. In non-team games will return 0!
150 		 
151          */
152         public abstract int getTeamNumber()
153  	;
154 		    			
155  		/**
156          * If this point marks a DominationPoint (for BotDoubleDomination game). 
157          */
158         public abstract boolean isDomPoint()
159  	;
160 		    			
161  		/**
162          * 
163 			If this point marks a door mover.
164 		 
165          */
166         public abstract boolean isDoor()
167  	;
168 		    			
169  		/**
170          * 
171 			If this point marks a lift center (used to mark center of a lift mover, note that this point will be always moved with the lift).
172 		 
173          */
174         public abstract boolean isLiftCenter()
175  	;
176 		    			
177  		/**
178          * 
179 			If this point marks a lift exit (used to mark exit point of a lift mover).
180 		 
181          */
182         public abstract boolean isLiftExit()
183  	;
184 		    			
185  		/**
186          * 
187 			If this point is an AI marker - marks an interesting spot in the environment. May be ambush point or sniping spot, etc.
188 		 
189          */
190         public abstract boolean isAIMarker()
191  	;
192 		    			
193  		/**
194          * 
195 			If this point marks a jump spot (a special device that causes the bot to jump high or far).
196 		 
197          */
198         public abstract boolean isJumpSpot()
199  	;
200 		    			
201  		/**
202          * 
203 			If this point marks a jump pad (a special device that causes the bot to jump high or far).
204 		 
205          */
206         public abstract boolean isJumpPad()
207  	;
208 		    			
209  		/**
210          * 
211 			If this point marks a jump destination - some place that can be reached by some special jump.
212 		 
213          */
214         public abstract boolean isJumpDest()
215  	;
216 		    			
217  		/**
218          * 
219 			If this point marks a teleport. 
220 		 
221          */
222         public abstract boolean isTeleporter()
223  	;
224 		    			
225  		/**
226          * 
227 			If the type is AIMarker. The rotation the bot should be
228 			facing, when doing the action specified by AIMarker. Sent only in HandShake.
229 		 
230          */
231         public abstract Rotation getRotation()
232  	;
233 		    			
234  		/**
235          * 
236 			Some ambush point, where is good chance to intercept
237 			approaching opponents. Sent only in HandShake.
238 		 
239          */
240         public abstract boolean isRoamingSpot()
241  	;
242 		    			
243  		/**
244          * Point good for sniping. Sent only in HandShake. 
245          */
246         public abstract boolean isSnipingSpot()
247  	;
248 		    			
249  		/**
250          * If item should be present at this navpoint it's instance will be here. 
251          */
252         public abstract Item getItemInstance()
253  	;
254 		    			
255  		/**
256          * Maps edge-LEADING_TO-navpoint-UnrealId to neighbour link, those are outgoing edges (those edges that originates in this navpoint going to another one, those you may usually travel). 
257          */
258         public abstract Map<UnrealId, NavPointNeighbourLink> getOutgoingEdges()
259  	;
260 		    			
261  		/**
262          * Maps edge-ORIGINATES_FROM-navpoint-UnrealId to neighbour link, those are incoming edges (those edges that originates in different navpoint and ends here, do not use this to ask whether you can get to navpoint of specific unreal id, use OutgoingEdges instead). 
263          */
264         public abstract Map<UnrealId, NavPointNeighbourLink> getIncomingEdges()
265  	;
266 		    			
267  		/**
268          * 
269 			Class of the weapon that should be prefered when using this
270 			point for AIMarker specified action. Sent only in HandShake.
271 		 
272          */
273         public abstract String getPreferedWeapon()
274  	;
275 		    			
276  		
277  		@Override
278  		public boolean isDifferentFrom(IStaticWorldObject other)
279  		{
280  			if (other == null) //early fail
281  			{
282  				return true;
283  			}
284  			else if (other == this) //early out
285  			{
286  				return false;
287  			}
288  			else
289  			{
290  				NavPointStatic obj = (NavPointStatic) other;
291 
292  				
293  						if ( !(
294  	 			AdvancedEquals.equalsOrNull(this.getId()
295  	, obj.getId()
296  	)
297  	 		) )
298 						{
299 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Id on object class NavPointStatic");
300 							return true;
301 						}
302  					
303  						if ( !(
304  	 			AdvancedEquals.equalsOrNull(this.getItem()
305  	, obj.getItem()
306  	)
307  	 		) )
308 						{
309 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Item on object class NavPointStatic");
310 							return true;
311 						}
312  					
313  						if ( !(
314  	 			AdvancedEquals.equalsOrNull(this.getItemClass()
315  	, obj.getItemClass()
316  	)
317  	 		) )
318 						{
319 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property ItemClass on object class NavPointStatic");
320 							return true;
321 						}
322  					
323  						if ( !(
324  	 			AdvancedEquals.equalsOrNull(this.getMover()
325  	, obj.getMover()
326  	)
327  	 		) )
328 						{
329 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Mover on object class NavPointStatic");
330 							return true;
331 						}
332  					
333  						if ( !(
334  	 			AdvancedEquals.equalsOrNull(this.getLiftOffset()
335  	, obj.getLiftOffset()
336  	)
337  	 		) )
338 						{
339 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property LiftOffset on object class NavPointStatic");
340 							return true;
341 						}
342  					
343  						if ( !(this.isLiftJumpExit()
344  	
345  	 			== obj.isLiftJumpExit()
346  	) )
347 						{
348 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property LiftJumpExit on object class NavPointStatic");
349 							return true;
350 						}
351  					
352  						if ( !(this.isNoDoubleJump()
353  	
354  	 			== obj.isNoDoubleJump()
355  	) )
356 						{
357 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property NoDoubleJump on object class NavPointStatic");
358 							return true;
359 						}
360  					
361  						if ( !(this.isInvSpot()
362  	
363  	 			== obj.isInvSpot()
364  	) )
365 						{
366 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property InvSpot on object class NavPointStatic");
367 							return true;
368 						}
369  					
370  						if ( !(this.isPlayerStart()
371  	
372  	 			== obj.isPlayerStart()
373  	) )
374 						{
375 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property PlayerStart on object class NavPointStatic");
376 							return true;
377 						}
378  					
379  						if ( !(this.getTeamNumber()
380  	
381  	 			== obj.getTeamNumber()
382  	) )
383 						{
384 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property TeamNumber on object class NavPointStatic");
385 							return true;
386 						}
387  					
388  						if ( !(this.isDomPoint()
389  	
390  	 			== obj.isDomPoint()
391  	) )
392 						{
393 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property DomPoint on object class NavPointStatic");
394 							return true;
395 						}
396  					
397  						if ( !(this.isDoor()
398  	
399  	 			== obj.isDoor()
400  	) )
401 						{
402 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Door on object class NavPointStatic");
403 							return true;
404 						}
405  					
406  						if ( !(this.isLiftCenter()
407  	
408  	 			== obj.isLiftCenter()
409  	) )
410 						{
411 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property LiftCenter on object class NavPointStatic");
412 							return true;
413 						}
414  					
415  						if ( !(this.isLiftExit()
416  	
417  	 			== obj.isLiftExit()
418  	) )
419 						{
420 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property LiftExit on object class NavPointStatic");
421 							return true;
422 						}
423  					
424  						if ( !(this.isAIMarker()
425  	
426  	 			== obj.isAIMarker()
427  	) )
428 						{
429 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property AIMarker on object class NavPointStatic");
430 							return true;
431 						}
432  					
433  						if ( !(this.isJumpSpot()
434  	
435  	 			== obj.isJumpSpot()
436  	) )
437 						{
438 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property JumpSpot on object class NavPointStatic");
439 							return true;
440 						}
441  					
442  						if ( !(this.isJumpPad()
443  	
444  	 			== obj.isJumpPad()
445  	) )
446 						{
447 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property JumpPad on object class NavPointStatic");
448 							return true;
449 						}
450  					
451  						if ( !(this.isJumpDest()
452  	
453  	 			== obj.isJumpDest()
454  	) )
455 						{
456 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property JumpDest on object class NavPointStatic");
457 							return true;
458 						}
459  					
460  						if ( !(this.isTeleporter()
461  	
462  	 			== obj.isTeleporter()
463  	) )
464 						{
465 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Teleporter on object class NavPointStatic");
466 							return true;
467 						}
468  					
469  						if ( !(
470  	 			AdvancedEquals.equalsOrNull(this.getRotation()
471  	, obj.getRotation()
472  	)
473  	 		) )
474 						{
475 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Rotation on object class NavPointStatic");
476 							return true;
477 						}
478  					
479  						if ( !(this.isRoamingSpot()
480  	
481  	 			== obj.isRoamingSpot()
482  	) )
483 						{
484 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property RoamingSpot on object class NavPointStatic");
485 							return true;
486 						}
487  					
488  						if ( !(this.isSnipingSpot()
489  	
490  	 			== obj.isSnipingSpot()
491  	) )
492 						{
493 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property SnipingSpot on object class NavPointStatic");
494 							return true;
495 						}
496  					
497  						if ( !(
498  	 			AdvancedEquals.equalsOrNull(this.getItemInstance()
499  	, obj.getItemInstance()
500  	)
501  	 		) )
502 						{
503 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property ItemInstance on object class NavPointStatic");
504 							return true;
505 						}
506  					
507  						//Skipping outgoing and incoming edges tests because the navGraph is sent only once
508  					
509  						//Skipping outgoing and incoming edges tests because the navGraph is sent only once
510  					
511  						if ( !(
512  	 			AdvancedEquals.equalsOrNull(this.getPreferedWeapon()
513  	, obj.getPreferedWeapon()
514  	)
515  	 		) )
516 						{
517 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property PreferedWeapon on object class NavPointStatic");
518 							return true;
519 						}
520  					
521  			}
522  			return false;
523  		}
524  	 
525  		
526  	    public String toString() {
527             return
528             	super.toString() + "[" +
529             	
530 		              			"Id = " + String.valueOf(getId()
531  	) + " | " + 
532 		              		
533 		              			"Item = " + String.valueOf(getItem()
534  	) + " | " + 
535 		              		
536 		              			"ItemClass = " + String.valueOf(getItemClass()
537  	) + " | " + 
538 		              		
539 		              			"Mover = " + String.valueOf(getMover()
540  	) + " | " + 
541 		              		
542 		              			"LiftOffset = " + String.valueOf(getLiftOffset()
543  	) + " | " + 
544 		              		
545 		              			"LiftJumpExit = " + String.valueOf(isLiftJumpExit()
546  	) + " | " + 
547 		              		
548 		              			"NoDoubleJump = " + String.valueOf(isNoDoubleJump()
549  	) + " | " + 
550 		              		
551 		              			"InvSpot = " + String.valueOf(isInvSpot()
552  	) + " | " + 
553 		              		
554 		              			"PlayerStart = " + String.valueOf(isPlayerStart()
555  	) + " | " + 
556 		              		
557 		              			"TeamNumber = " + String.valueOf(getTeamNumber()
558  	) + " | " + 
559 		              		
560 		              			"DomPoint = " + String.valueOf(isDomPoint()
561  	) + " | " + 
562 		              		
563 		              			"Door = " + String.valueOf(isDoor()
564  	) + " | " + 
565 		              		
566 		              			"LiftCenter = " + String.valueOf(isLiftCenter()
567  	) + " | " + 
568 		              		
569 		              			"LiftExit = " + String.valueOf(isLiftExit()
570  	) + " | " + 
571 		              		
572 		              			"AIMarker = " + String.valueOf(isAIMarker()
573  	) + " | " + 
574 		              		
575 		              			"JumpSpot = " + String.valueOf(isJumpSpot()
576  	) + " | " + 
577 		              		
578 		              			"JumpPad = " + String.valueOf(isJumpPad()
579  	) + " | " + 
580 		              		
581 		              			"JumpDest = " + String.valueOf(isJumpDest()
582  	) + " | " + 
583 		              		
584 		              			"Teleporter = " + String.valueOf(isTeleporter()
585  	) + " | " + 
586 		              		
587 		              			"Rotation = " + String.valueOf(getRotation()
588  	) + " | " + 
589 		              		
590 		              			"RoamingSpot = " + String.valueOf(isRoamingSpot()
591  	) + " | " + 
592 		              		
593 		              			"SnipingSpot = " + String.valueOf(isSnipingSpot()
594  	) + " | " + 
595 		              		
596 		              			"PreferedWeapon = " + String.valueOf(getPreferedWeapon()
597  	) + " | " + 
598 		              		
599 				"]";           		
600         }
601  	
602  		
603  		public String toHtmlString() {
604  			return super.toString() + "[<br/>" +
605             	
606 		              			"<b>Id</b> = " + String.valueOf(getId()
607  	) + " <br/> " + 
608 		              		
609 		              			"<b>Item</b> = " + String.valueOf(getItem()
610  	) + " <br/> " + 
611 		              		
612 		              			"<b>ItemClass</b> = " + String.valueOf(getItemClass()
613  	) + " <br/> " + 
614 		              		
615 		              			"<b>Mover</b> = " + String.valueOf(getMover()
616  	) + " <br/> " + 
617 		              		
618 		              			"<b>LiftOffset</b> = " + String.valueOf(getLiftOffset()
619  	) + " <br/> " + 
620 		              		
621 		              			"<b>LiftJumpExit</b> = " + String.valueOf(isLiftJumpExit()
622  	) + " <br/> " + 
623 		              		
624 		              			"<b>NoDoubleJump</b> = " + String.valueOf(isNoDoubleJump()
625  	) + " <br/> " + 
626 		              		
627 		              			"<b>InvSpot</b> = " + String.valueOf(isInvSpot()
628  	) + " <br/> " + 
629 		              		
630 		              			"<b>PlayerStart</b> = " + String.valueOf(isPlayerStart()
631  	) + " <br/> " + 
632 		              		
633 		              			"<b>TeamNumber</b> = " + String.valueOf(getTeamNumber()
634  	) + " <br/> " + 
635 		              		
636 		              			"<b>DomPoint</b> = " + String.valueOf(isDomPoint()
637  	) + " <br/> " + 
638 		              		
639 		              			"<b>Door</b> = " + String.valueOf(isDoor()
640  	) + " <br/> " + 
641 		              		
642 		              			"<b>LiftCenter</b> = " + String.valueOf(isLiftCenter()
643  	) + " <br/> " + 
644 		              		
645 		              			"<b>LiftExit</b> = " + String.valueOf(isLiftExit()
646  	) + " <br/> " + 
647 		              		
648 		              			"<b>AIMarker</b> = " + String.valueOf(isAIMarker()
649  	) + " <br/> " + 
650 		              		
651 		              			"<b>JumpSpot</b> = " + String.valueOf(isJumpSpot()
652  	) + " <br/> " + 
653 		              		
654 		              			"<b>JumpPad</b> = " + String.valueOf(isJumpPad()
655  	) + " <br/> " + 
656 		              		
657 		              			"<b>JumpDest</b> = " + String.valueOf(isJumpDest()
658  	) + " <br/> " + 
659 		              		
660 		              			"<b>Teleporter</b> = " + String.valueOf(isTeleporter()
661  	) + " <br/> " + 
662 		              		
663 		              			"<b>Rotation</b> = " + String.valueOf(getRotation()
664  	) + " <br/> " + 
665 		              		
666 		              			"<b>RoamingSpot</b> = " + String.valueOf(isRoamingSpot()
667  	) + " <br/> " + 
668 		              		
669 		              			"<b>SnipingSpot</b> = " + String.valueOf(isSnipingSpot()
670  	) + " <br/> " + 
671 		              		
672 		              			"<b>PreferedWeapon</b> = " + String.valueOf(getPreferedWeapon()
673  	) + " <br/> " + 
674 		              		
675 				"<br/>]";     
676 		}
677  	
678  		
679  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
680         	
681 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
682 		
683 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=static+classtype[@name=abstract]) ---
684 	        
685 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=static+classtype[@name=abstract]) ---        	            	
686  	
687 		}
688