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=base]+classtype[@name=abstract] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=base]+classtype[@name=abstract] END
15      
16   		/**
17           *  
18              				Abstract definition of the GameBots2004 message CONFCH.  
19              			
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Asynchronous message. Message sent when the bot configuration
25  		changed - each agent has a lot of parameters affecting his state
26  		in the environment. See each property for the details.
27  	
28           */
29   	public abstract class ConfigChange   
30    				extends 
31    				InfoMessage
32    						implements IWorldEvent, IWorldChangeEvent, ICompositeWorldObject
33    						
34  	    {
35   	
36      	/** Example how the message looks like - used during parser tests. */
37      	public static final String PROTOTYPE =
38      		"CONFCH {Id unreal_id}  {BotId unreal_id}  {ManualSpawn False}  {AutoTrace False}  {Name text}  {SpeedMultiplier 0}  {RotationRate 0,0,0}  {Invulnerable False}  {VisionTime 0}  {ShowDebug False}  {ShowFocalPoint False}  {DrawTraceLines False}  {SynchronousOff False}  {AutoPickupOff False}  {Action text} ";
39      
40      	
41      	
42      	/**
43      	 * Parameter-less contructor for the message.
44      	 */
45  		public ConfigChange()
46  		{
47  		}
48  	
49  				// abstract message, it does not have any more constructors				
50  			
51  	   		
52  			protected long SimTime;
53  				
54  			/**
55  			 * Simulation time in MILLI SECONDS !!!
56  			 */	
57  			@Override
58  			public long getSimTime() {
59  				return SimTime;
60  			}
61  						
62  			/**
63  			 * Used by Yylex to slip correct time of the object or programmatically.
64  			 */
65  			protected void setSimTime(long SimTime) {
66  				this.SimTime = SimTime;
67  			}
68  	   	
69   		/**
70           * Id of this config message. This Id is generated from BotId, string "_CONFCH" is added at the end. 
71           */
72          public abstract UnrealId getId()
73   	;
74  		    			
75   		/**
76           * Unique Id of the bot. 
77           */
78          public abstract UnrealId getBotId()
79   	;
80  		    			
81   		/**
82           * 
83  			True if we have to spawn the bot manually after each death
84  		 
85           */
86          public abstract boolean isManualSpawn()
87   	;
88  		    			
89   		/**
90           * 
91  			True if the bot is using auto ray tracing (is provided with
92  			synchronous ATR messages). See ATR messages for more
93  			details.
94  		 
95           */
96          public abstract boolean isAutoTrace()
97   	;
98  		    			
99   		/**
100          * The bot's name. 
101          */
102         public abstract String getName()
103  	;
104 		    			
105  		/**
106          * 
107 			Bots default speed will be multiplied by this number. Ranges from 0.1 to 2 (default, can be set in ini in [GameBots2004.RemoteBot] MaxSpeed).
108 		 
109          */
110         public abstract double getSpeedMultiplier()
111  	;
112 		    			
113  		/**
114          * 
115 			Bot rotation rate. Default rotation rate is: (Pitch=3072,Yaw=60000,Roll=2048) and may be configured in ini file in [GameBots2004.RemoteBot] DefaultRotationRate. (pitch - up/down, yaw - left/right, roll - equivalent of doing a cartwheel)
116 		 
117          */
118         public abstract Rotation getRotationRate()
119  	;
120 		    			
121  		/**
122          * 
123 			If bot is invulnerable (cannot die) or not.
124 		 
125          */
126         public abstract boolean isInvulnerable()
127  	;
128 		    			
129  		/**
130          * 
131 			The delay between two synchronous batches (can range from
132 			0.1 to 2 seconds).
133 		 
134          */
135         public abstract double getVisionTime()
136  	;
137 		    			
138  		/**
139          * 
140 			If some additional debug information will be shown in the
141 			UT2004 server console window.
142 		 
143          */
144         public abstract boolean isShowDebug()
145  	;
146 		    			
147  		/**
148          * 
149 			If true an actor visualizing the location the bot is
150 			actually looking at will appear in the game.
151 		 
152          */
153         public abstract boolean isShowFocalPoint()
154  	;
155 		    			
156  		/**
157          * 
158 			if the GB should draw lines representing the auto ray traces
159 			of the bot (for more information see ATR message).
160 		 
161          */
162         public abstract boolean isDrawTraceLines()
163  	;
164 		    			
165  		/**
166          * 
167 			It informs if sending of all GB synchronous messages is
168 			enabled or disabled.
169 		 
170          */
171         public abstract boolean isSynchronousOff()
172  	;
173 		    			
174  		/**
175          * 
176 			It enables/disables automatic pickup of the bot. If true the items can be picked up through PICK command.
177 		 
178          */
179         public abstract boolean isAutoPickupOff()
180  	;
181 		    			
182  		/**
183          * 
184 			Name of current BDI action.
185 		 
186          */
187         public abstract String getAction()
188  	;
189 		    			
190     	
191     	public static class ConfigChangeUpdate
192      extends GBObjectUpdate implements ICompositeWorldObjectUpdatedEvent, IGBWorldObjectEvent {	
193 			private ConfigChange object;
194 			private long time;
195 			private ITeamId teamId;
196 			
197 			public ConfigChangeUpdate
198     (ConfigChange source, long eventTime, ITeamId teamId) {
199 				this.object = source;
200 				this.time = eventTime;
201 				this.teamId = teamId;
202 			}
203 			
204 			/**
205 			 * Simulation time in MILLI SECONDS !!!
206 			 */ 
207 			@Override
208 			public long getSimTime() {
209 				return time;
210 			}
211 	
212 			@Override
213 			public IWorldObject getObject() {
214 				return object;
215 			}
216 	
217 			@Override
218 			public WorldObjectId getId() {
219 				return object.getId();
220 			}
221 	
222 			@Override
223 			public ILocalWorldObjectUpdatedEvent getLocalEvent() {
224 				return new ConfigChangeLocalImpl.ConfigChangeLocalUpdate
225     ((ConfigChangeLocal)object.getLocal(), time);
226 			}
227 	
228 			@Override
229 			public ISharedWorldObjectUpdatedEvent getSharedEvent() {
230 				return new ConfigChangeSharedImpl.ConfigChangeSharedUpdate
231     ((ConfigChangeShared)object.getShared(), time, teamId);
232 			}
233 	
234 			@Override
235 			public IStaticWorldObjectUpdatedEvent getStaticEvent() {
236 				return new ConfigChangeStaticImpl.ConfigChangeStaticUpdate
237     ((ConfigChangeStatic)object.getStatic(), time);
238 			}
239 			
240 		}
241     
242  		
243  	    public String toString() {
244             return
245             	super.toString() + "[" +
246             	
247 		              			"Id = " + String.valueOf(getId()
248  	) + " | " + 
249 		              		
250 		              			"BotId = " + String.valueOf(getBotId()
251  	) + " | " + 
252 		              		
253 		              			"ManualSpawn = " + String.valueOf(isManualSpawn()
254  	) + " | " + 
255 		              		
256 		              			"AutoTrace = " + String.valueOf(isAutoTrace()
257  	) + " | " + 
258 		              		
259 		              			"Name = " + String.valueOf(getName()
260  	) + " | " + 
261 		              		
262 		              			"SpeedMultiplier = " + String.valueOf(getSpeedMultiplier()
263  	) + " | " + 
264 		              		
265 		              			"RotationRate = " + String.valueOf(getRotationRate()
266  	) + " | " + 
267 		              		
268 		              			"Invulnerable = " + String.valueOf(isInvulnerable()
269  	) + " | " + 
270 		              		
271 		              			"VisionTime = " + String.valueOf(getVisionTime()
272  	) + " | " + 
273 		              		
274 		              			"ShowDebug = " + String.valueOf(isShowDebug()
275  	) + " | " + 
276 		              		
277 		              			"ShowFocalPoint = " + String.valueOf(isShowFocalPoint()
278  	) + " | " + 
279 		              		
280 		              			"DrawTraceLines = " + String.valueOf(isDrawTraceLines()
281  	) + " | " + 
282 		              		
283 		              			"SynchronousOff = " + String.valueOf(isSynchronousOff()
284  	) + " | " + 
285 		              		
286 		              			"AutoPickupOff = " + String.valueOf(isAutoPickupOff()
287  	) + " | " + 
288 		              		
289 		              			"Action = " + String.valueOf(getAction()
290  	) + " | " + 
291 		              		
292 				"]";           		
293         }
294  	
295  		
296  		public String toHtmlString() {
297  			return super.toString() + "[<br/>" +
298             	
299 		              			"<b>Id</b> = " + String.valueOf(getId()
300  	) + " <br/> " + 
301 		              		
302 		              			"<b>BotId</b> = " + String.valueOf(getBotId()
303  	) + " <br/> " + 
304 		              		
305 		              			"<b>ManualSpawn</b> = " + String.valueOf(isManualSpawn()
306  	) + " <br/> " + 
307 		              		
308 		              			"<b>AutoTrace</b> = " + String.valueOf(isAutoTrace()
309  	) + " <br/> " + 
310 		              		
311 		              			"<b>Name</b> = " + String.valueOf(getName()
312  	) + " <br/> " + 
313 		              		
314 		              			"<b>SpeedMultiplier</b> = " + String.valueOf(getSpeedMultiplier()
315  	) + " <br/> " + 
316 		              		
317 		              			"<b>RotationRate</b> = " + String.valueOf(getRotationRate()
318  	) + " <br/> " + 
319 		              		
320 		              			"<b>Invulnerable</b> = " + String.valueOf(isInvulnerable()
321  	) + " <br/> " + 
322 		              		
323 		              			"<b>VisionTime</b> = " + String.valueOf(getVisionTime()
324  	) + " <br/> " + 
325 		              		
326 		              			"<b>ShowDebug</b> = " + String.valueOf(isShowDebug()
327  	) + " <br/> " + 
328 		              		
329 		              			"<b>ShowFocalPoint</b> = " + String.valueOf(isShowFocalPoint()
330  	) + " <br/> " + 
331 		              		
332 		              			"<b>DrawTraceLines</b> = " + String.valueOf(isDrawTraceLines()
333  	) + " <br/> " + 
334 		              		
335 		              			"<b>SynchronousOff</b> = " + String.valueOf(isSynchronousOff()
336  	) + " <br/> " + 
337 		              		
338 		              			"<b>AutoPickupOff</b> = " + String.valueOf(isAutoPickupOff()
339  	) + " <br/> " + 
340 		              		
341 		              			"<b>Action</b> = " + String.valueOf(getAction()
342  	) + " <br/> " + 
343 		              		
344 				"<br/>]";     
345 		}
346  	 
347  	    public String toJsonLiteral() {
348             return "ConfigChange(null, "
349             		
350                    + ")";
351         }
352  	
353  		
354  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
355         	
356 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
357 		
358 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=base+classtype[@name=abstract]) ---
359 	        
360 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=base+classtype[@name=abstract]) ---        	            	
361  	
362 		}
363