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 			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!
134 		 
135          */
136         public abstract int getTeamNumber()
137  	;
138 		    			
139  		/**
140          * If this point marks a DominationPoint (for BotDoubleDomination game). 
141          */
142         public abstract boolean isDomPoint()
143  	;
144 		    			
145  		/**
146          * Exported if this NavPoint is a DominationPoint (for BotDoubleDomination game) - which team controls this point. 
147          */
148         public abstract int getDomPointController()
149  	;
150 		    			
151  		/**
152          * 
153 			If this point marks a door mover.
154 		 
155          */
156         public abstract boolean isDoor()
157  	;
158 		    			
159  		/**
160          * 
161 			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).
162 		 
163          */
164         public abstract boolean isLiftCenter()
165  	;
166 		    			
167  		/**
168          * 
169 			If this point marks a lift exit (used to mark exit point of a lift mover).
170 		 
171          */
172         public abstract boolean isLiftExit()
173  	;
174 		    			
175  		/**
176          * 
177 			If this point is an AI marker - marks an interesting spot in the environment. May be ambush point or sniping spot, etc.
178 		 
179          */
180         public abstract boolean isAIMarker()
181  	;
182 		    			
183  		/**
184          * 
185 			If this point marks a jump spot (a special device that causes the bot to jump high or far).
186 		 
187          */
188         public abstract boolean isJumpSpot()
189  	;
190 		    			
191  		/**
192          * 
193 			If this point marks a jump pad (a special device that causes the bot to jump high or far).
194 		 
195          */
196         public abstract boolean isJumpPad()
197  	;
198 		    			
199  		/**
200          * 
201 			If this point marks a jump destination - some place that can be reached by some special jump.
202 		 
203          */
204         public abstract boolean isJumpDest()
205  	;
206 		    			
207  		/**
208          * 
209 			If this point marks a teleport. 
210 		 
211          */
212         public abstract boolean isTeleporter()
213  	;
214 		    			
215  		/**
216          * 
217 			If the type is AIMarker. The rotation the bot should be
218 			facing, when doing the action specified by AIMarker. Sent only in HandShake.
219 		 
220          */
221         public abstract Rotation getRotation()
222  	;
223 		    			
224  		/**
225          * 
226 			Some ambush point, where is good chance to intercept
227 			approaching opponents. Sent only in HandShake.
228 		 
229          */
230         public abstract boolean isRoamingSpot()
231  	;
232 		    			
233  		/**
234          * Point good for sniping. Sent only in HandShake. 
235          */
236         public abstract boolean isSnipingSpot()
237  	;
238 		    			
239  		/**
240          * If item should be present at this navpoint it's instance will be here. 
241          */
242         public abstract Item getItemInstance()
243  	;
244 		    			
245  		/**
246          * 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). 
247          */
248         public abstract Map<UnrealId, NavPointNeighbourLink> getOutgoingEdges()
249  	;
250 		    			
251  		/**
252          * 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). 
253          */
254         public abstract Map<UnrealId, NavPointNeighbourLink> getIncomingEdges()
255  	;
256 		    			
257  		/**
258          * 
259 			Class of the weapon that should be prefered when using this
260 			point for AIMarker specified action. Sent only in HandShake.
261 		 
262          */
263         public abstract String getPreferedWeapon()
264  	;
265 		    			
266  		
267  		@Override
268  		public boolean isDifferentFrom(IStaticWorldObject other)
269  		{
270  			if (other == null) //early fail
271  			{
272  				return true;
273  			}
274  			else if (other == this) //early out
275  			{
276  				return false;
277  			}
278  			else
279  			{
280  				NavPointStatic obj = (NavPointStatic) other;
281 
282  				
283  						if ( !(
284  	 			AdvancedEquals.equalsOrNull(this.getId()
285  	, obj.getId()
286  	)
287  	 		) )
288 						{
289 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Id on object class NavPointStatic");
290 							return true;
291 						}
292  					
293  						if ( !(
294  	 			AdvancedEquals.equalsOrNull(this.getItem()
295  	, obj.getItem()
296  	)
297  	 		) )
298 						{
299 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Item on object class NavPointStatic");
300 							return true;
301 						}
302  					
303  						if ( !(
304  	 			AdvancedEquals.equalsOrNull(this.getItemClass()
305  	, obj.getItemClass()
306  	)
307  	 		) )
308 						{
309 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property ItemClass on object class NavPointStatic");
310 							return true;
311 						}
312  					
313  						if ( !(
314  	 			AdvancedEquals.equalsOrNull(this.getMover()
315  	, obj.getMover()
316  	)
317  	 		) )
318 						{
319 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Mover on object class NavPointStatic");
320 							return true;
321 						}
322  					
323  						if ( !(
324  	 			AdvancedEquals.equalsOrNull(this.getLiftOffset()
325  	, obj.getLiftOffset()
326  	)
327  	 		) )
328 						{
329 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property LiftOffset on object class NavPointStatic");
330 							return true;
331 						}
332  					
333  						if ( !(this.isLiftJumpExit()
334  	
335  	 			== obj.isLiftJumpExit()
336  	) )
337 						{
338 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property LiftJumpExit on object class NavPointStatic");
339 							return true;
340 						}
341  					
342  						if ( !(this.isNoDoubleJump()
343  	
344  	 			== obj.isNoDoubleJump()
345  	) )
346 						{
347 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property NoDoubleJump on object class NavPointStatic");
348 							return true;
349 						}
350  					
351  						if ( !(this.getTeamNumber()
352  	
353  	 			== obj.getTeamNumber()
354  	) )
355 						{
356 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property TeamNumber on object class NavPointStatic");
357 							return true;
358 						}
359  					
360  						if ( !(this.isDomPoint()
361  	
362  	 			== obj.isDomPoint()
363  	) )
364 						{
365 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property DomPoint on object class NavPointStatic");
366 							return true;
367 						}
368  					
369  						if ( !(this.getDomPointController()
370  	
371  	 			== obj.getDomPointController()
372  	) )
373 						{
374 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property DomPointController on object class NavPointStatic");
375 							return true;
376 						}
377  					
378  						if ( !(this.isDoor()
379  	
380  	 			== obj.isDoor()
381  	) )
382 						{
383 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Door on object class NavPointStatic");
384 							return true;
385 						}
386  					
387  						if ( !(this.isLiftCenter()
388  	
389  	 			== obj.isLiftCenter()
390  	) )
391 						{
392 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property LiftCenter on object class NavPointStatic");
393 							return true;
394 						}
395  					
396  						if ( !(this.isLiftExit()
397  	
398  	 			== obj.isLiftExit()
399  	) )
400 						{
401 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property LiftExit on object class NavPointStatic");
402 							return true;
403 						}
404  					
405  						if ( !(this.isAIMarker()
406  	
407  	 			== obj.isAIMarker()
408  	) )
409 						{
410 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property AIMarker on object class NavPointStatic");
411 							return true;
412 						}
413  					
414  						if ( !(this.isJumpSpot()
415  	
416  	 			== obj.isJumpSpot()
417  	) )
418 						{
419 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property JumpSpot on object class NavPointStatic");
420 							return true;
421 						}
422  					
423  						if ( !(this.isJumpPad()
424  	
425  	 			== obj.isJumpPad()
426  	) )
427 						{
428 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property JumpPad on object class NavPointStatic");
429 							return true;
430 						}
431  					
432  						if ( !(this.isJumpDest()
433  	
434  	 			== obj.isJumpDest()
435  	) )
436 						{
437 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property JumpDest on object class NavPointStatic");
438 							return true;
439 						}
440  					
441  						if ( !(this.isTeleporter()
442  	
443  	 			== obj.isTeleporter()
444  	) )
445 						{
446 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Teleporter on object class NavPointStatic");
447 							return true;
448 						}
449  					
450  						if ( !(
451  	 			AdvancedEquals.equalsOrNull(this.getRotation()
452  	, obj.getRotation()
453  	)
454  	 		) )
455 						{
456 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property Rotation on object class NavPointStatic");
457 							return true;
458 						}
459  					
460  						if ( !(this.isRoamingSpot()
461  	
462  	 			== obj.isRoamingSpot()
463  	) )
464 						{
465 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property RoamingSpot on object class NavPointStatic");
466 							return true;
467 						}
468  					
469  						if ( !(this.isSnipingSpot()
470  	
471  	 			== obj.isSnipingSpot()
472  	) )
473 						{
474 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property SnipingSpot on object class NavPointStatic");
475 							return true;
476 						}
477  					
478  						if ( !(
479  	 			AdvancedEquals.equalsOrNull(this.getItemInstance()
480  	, obj.getItemInstance()
481  	)
482  	 		) )
483 						{
484 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property ItemInstance on object class NavPointStatic");
485 							return true;
486 						}
487  					
488  						//Skipping outgoing and incoming edges tests because the navGraph is sent only once
489  					
490  						//Skipping outgoing and incoming edges tests because the navGraph is sent only once
491  					
492  						if ( !(
493  	 			AdvancedEquals.equalsOrNull(this.getPreferedWeapon()
494  	, obj.getPreferedWeapon()
495  	)
496  	 		) )
497 						{
498 							System.out.println("!!!!!PROPERTY UPDATE ERROR!!!! on property PreferedWeapon on object class NavPointStatic");
499 							return true;
500 						}
501  					
502  			}
503  			return false;
504  		}
505  	 
506  		
507  	    public String toString() {
508             return
509             	super.toString() + "[" +
510             	
511 		              			"Id = " + String.valueOf(getId()
512  	) + " | " + 
513 		              		
514 		              			"Item = " + String.valueOf(getItem()
515  	) + " | " + 
516 		              		
517 		              			"ItemClass = " + String.valueOf(getItemClass()
518  	) + " | " + 
519 		              		
520 		              			"Mover = " + String.valueOf(getMover()
521  	) + " | " + 
522 		              		
523 		              			"LiftOffset = " + String.valueOf(getLiftOffset()
524  	) + " | " + 
525 		              		
526 		              			"LiftJumpExit = " + String.valueOf(isLiftJumpExit()
527  	) + " | " + 
528 		              		
529 		              			"NoDoubleJump = " + String.valueOf(isNoDoubleJump()
530  	) + " | " + 
531 		              		
532 		              			"TeamNumber = " + String.valueOf(getTeamNumber()
533  	) + " | " + 
534 		              		
535 		              			"DomPoint = " + String.valueOf(isDomPoint()
536  	) + " | " + 
537 		              		
538 		              			"DomPointController = " + String.valueOf(getDomPointController()
539  	) + " | " + 
540 		              		
541 		              			"Door = " + String.valueOf(isDoor()
542  	) + " | " + 
543 		              		
544 		              			"LiftCenter = " + String.valueOf(isLiftCenter()
545  	) + " | " + 
546 		              		
547 		              			"LiftExit = " + String.valueOf(isLiftExit()
548  	) + " | " + 
549 		              		
550 		              			"AIMarker = " + String.valueOf(isAIMarker()
551  	) + " | " + 
552 		              		
553 		              			"JumpSpot = " + String.valueOf(isJumpSpot()
554  	) + " | " + 
555 		              		
556 		              			"JumpPad = " + String.valueOf(isJumpPad()
557  	) + " | " + 
558 		              		
559 		              			"JumpDest = " + String.valueOf(isJumpDest()
560  	) + " | " + 
561 		              		
562 		              			"Teleporter = " + String.valueOf(isTeleporter()
563  	) + " | " + 
564 		              		
565 		              			"Rotation = " + String.valueOf(getRotation()
566  	) + " | " + 
567 		              		
568 		              			"RoamingSpot = " + String.valueOf(isRoamingSpot()
569  	) + " | " + 
570 		              		
571 		              			"SnipingSpot = " + String.valueOf(isSnipingSpot()
572  	) + " | " + 
573 		              		
574 		              			"PreferedWeapon = " + String.valueOf(getPreferedWeapon()
575  	) + " | " + 
576 		              		
577 				"]";           		
578         }
579  	
580  		
581  		public String toHtmlString() {
582  			return super.toString() + "[<br/>" +
583             	
584 		              			"<b>Id</b> = " + String.valueOf(getId()
585  	) + " <br/> " + 
586 		              		
587 		              			"<b>Item</b> = " + String.valueOf(getItem()
588  	) + " <br/> " + 
589 		              		
590 		              			"<b>ItemClass</b> = " + String.valueOf(getItemClass()
591  	) + " <br/> " + 
592 		              		
593 		              			"<b>Mover</b> = " + String.valueOf(getMover()
594  	) + " <br/> " + 
595 		              		
596 		              			"<b>LiftOffset</b> = " + String.valueOf(getLiftOffset()
597  	) + " <br/> " + 
598 		              		
599 		              			"<b>LiftJumpExit</b> = " + String.valueOf(isLiftJumpExit()
600  	) + " <br/> " + 
601 		              		
602 		              			"<b>NoDoubleJump</b> = " + String.valueOf(isNoDoubleJump()
603  	) + " <br/> " + 
604 		              		
605 		              			"<b>TeamNumber</b> = " + String.valueOf(getTeamNumber()
606  	) + " <br/> " + 
607 		              		
608 		              			"<b>DomPoint</b> = " + String.valueOf(isDomPoint()
609  	) + " <br/> " + 
610 		              		
611 		              			"<b>DomPointController</b> = " + String.valueOf(getDomPointController()
612  	) + " <br/> " + 
613 		              		
614 		              			"<b>Door</b> = " + String.valueOf(isDoor()
615  	) + " <br/> " + 
616 		              		
617 		              			"<b>LiftCenter</b> = " + String.valueOf(isLiftCenter()
618  	) + " <br/> " + 
619 		              		
620 		              			"<b>LiftExit</b> = " + String.valueOf(isLiftExit()
621  	) + " <br/> " + 
622 		              		
623 		              			"<b>AIMarker</b> = " + String.valueOf(isAIMarker()
624  	) + " <br/> " + 
625 		              		
626 		              			"<b>JumpSpot</b> = " + String.valueOf(isJumpSpot()
627  	) + " <br/> " + 
628 		              		
629 		              			"<b>JumpPad</b> = " + String.valueOf(isJumpPad()
630  	) + " <br/> " + 
631 		              		
632 		              			"<b>JumpDest</b> = " + String.valueOf(isJumpDest()
633  	) + " <br/> " + 
634 		              		
635 		              			"<b>Teleporter</b> = " + String.valueOf(isTeleporter()
636  	) + " <br/> " + 
637 		              		
638 		              			"<b>Rotation</b> = " + String.valueOf(getRotation()
639  	) + " <br/> " + 
640 		              		
641 		              			"<b>RoamingSpot</b> = " + String.valueOf(isRoamingSpot()
642  	) + " <br/> " + 
643 		              		
644 		              			"<b>SnipingSpot</b> = " + String.valueOf(isSnipingSpot()
645  	) + " <br/> " + 
646 		              		
647 		              			"<b>PreferedWeapon</b> = " + String.valueOf(getPreferedWeapon()
648  	) + " <br/> " + 
649 		              		
650 				"<br/>]";     
651 		}
652  	
653  		
654  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
655         	
656 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
657 		
658 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=static+classtype[@name=abstract]) ---
659 	        
660 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=static+classtype[@name=abstract]) ---        	            	
661  	
662 		}
663