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=event]+classtype[@name=impl] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=event]+classtype[@name=impl] END
15      
16   		/**
17           *  
18           			Definition of the event VCH.
19           		
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Asynchronous message. Some part of the bot body changed the
25  		zone.
26  	
27           */
28   	public class VolumeChanged 
29    				extends InfoMessage
30      			implements IWorldEvent, IWorldChangeEvent
31      			
32  	    {
33   	
34      	/** Example how the message looks like - used during parser tests. */
35      	public static final String PROTOTYPE =
36      		"VCH {Id text}  {ZoneVelocity 0,0,0}  {ZoneGravity 0,0,0}  {GroundFriction 0}  {FluidFriction 0}  {TerminalVelocity 0}  {WaterVolume False}  {PainCausing False}  {Destructive False}  {DamagePerSec 0}  {DamageType text}  {NoInventory False}  {MoveProjectiles False}  {NeutralZone False} ";
37      
38      	
39      	
40      	/**
41      	 * Parameter-less contructor for the message.
42      	 */
43  		public VolumeChanged()
44  		{
45  		}
46  	
47      	
48      	
49      	
50      	/**
51  		 * Creates new instance of the message VolumeChanged.
52  		 * 
53  		Asynchronous message. Some part of the bot body changed the
54  		zone.
55  	
56  		 * Corresponding GameBots message
57  		 *   
58  		 *   is
59  		 *   VCH.
60  		 * 
61   	  	 * 
62  		 *   
63  		 *     @param Id Id of the zone entered.
64  		 *   
65  		 * 
66  		 *   
67  		 *     @param ZoneVelocity 
68  			Zone velocity (?).
69  		
70  		 *   
71  		 * 
72  		 *   
73  		 *     @param ZoneGravity 
74  			Gravity in this zone.
75  		
76  		 *   
77  		 * 
78  		 *   
79  		 *     @param GroundFriction 
80  			Friction of the floor.
81  		
82  		 *   
83  		 * 
84  		 *   
85  		 *     @param FluidFriction 
86  			Friction of the fluid.
87  		
88  		 *   
89  		 * 
90  		 *   
91  		 *     @param TerminalVelocity 
92  			Terminal velocity (?).
93  		
94  		 *   
95  		 * 
96  		 *   
97  		 *     @param WaterVolume 
98  			If this zone is a water.
99  		
100 		 *   
101 		 * 
102 		 *   
103 		 *     @param PainCausing 
104 			True or false if we get some damage when we stay in this
105 			zone.
106 		
107 		 *   
108 		 * 
109 		 *   
110 		 *     @param Destructive 
111 			If this zone kills most of the actors instantly.
112 		
113 		 *   
114 		 * 
115 		 *   
116 		 *     @param DamagePerSec 
117 			Amount of damage we will suffer per second if we stay in this zone.
118 		
119 		 *   
120 		 * 
121 		 *   
122 		 *     @param DamageType 
123 			Type of the damage in this zone.
124 		
125 		 *   
126 		 * 
127 		 *   
128 		 *     @param NoInventory 
129 			If the inventory is allowed here.
130 		
131 		 *   
132 		 * 
133 		 *   
134 		 *     @param MoveProjectiles 
135 			If this velocity zone should impart velocity to projectiles and effects.
136 		
137 		 *   
138 		 * 
139 		 *   
140 		 *     @param NeutralZone 
141 			Players can't take damage in this zone.
142 		
143 		 *   
144 		 * 
145 		 */
146 		public VolumeChanged(
147 			String Id,  Velocity ZoneVelocity,  Velocity ZoneGravity,  double GroundFriction,  double FluidFriction,  double TerminalVelocity,  boolean WaterVolume,  boolean PainCausing,  boolean Destructive,  double DamagePerSec,  String DamageType,  boolean NoInventory,  boolean MoveProjectiles,  boolean NeutralZone
148 		) {
149 			
150 					this.Id = Id;
151 				
152 					this.ZoneVelocity = ZoneVelocity;
153 				
154 					this.ZoneGravity = ZoneGravity;
155 				
156 					this.GroundFriction = GroundFriction;
157 				
158 					this.FluidFriction = FluidFriction;
159 				
160 					this.TerminalVelocity = TerminalVelocity;
161 				
162 					this.WaterVolume = WaterVolume;
163 				
164 					this.PainCausing = PainCausing;
165 				
166 					this.Destructive = Destructive;
167 				
168 					this.DamagePerSec = DamagePerSec;
169 				
170 					this.DamageType = DamageType;
171 				
172 					this.NoInventory = NoInventory;
173 				
174 					this.MoveProjectiles = MoveProjectiles;
175 				
176 					this.NeutralZone = NeutralZone;
177 				
178 		}
179     
180     	/**
181 		 * Cloning constructor from the full message.
182 		 *
183 		 * @param original
184 		 */
185 		public VolumeChanged(VolumeChanged original) {		
186 			
187 					this.Id = original.getId()
188  	;
189 				
190 					this.ZoneVelocity = original.getZoneVelocity()
191  	;
192 				
193 					this.ZoneGravity = original.getZoneGravity()
194  	;
195 				
196 					this.GroundFriction = original.getGroundFriction()
197  	;
198 				
199 					this.FluidFriction = original.getFluidFriction()
200  	;
201 				
202 					this.TerminalVelocity = original.getTerminalVelocity()
203  	;
204 				
205 					this.WaterVolume = original.isWaterVolume()
206  	;
207 				
208 					this.PainCausing = original.isPainCausing()
209  	;
210 				
211 					this.Destructive = original.isDestructive()
212  	;
213 				
214 					this.DamagePerSec = original.getDamagePerSec()
215  	;
216 				
217 					this.DamageType = original.getDamageType()
218  	;
219 				
220 					this.NoInventory = original.isNoInventory()
221  	;
222 				
223 					this.MoveProjectiles = original.isMoveProjectiles()
224  	;
225 				
226 					this.NeutralZone = original.isNeutralZone()
227  	;
228 				
229 			this.SimTime = original.getSimTime();			
230 		}
231 		
232 	   		
233 			protected long SimTime;
234 				
235 			/**
236 			 * Simulation time in MILLI SECONDS !!!
237 			 */	
238 			@Override
239 			public long getSimTime() {
240 				return SimTime;
241 			}
242 						
243 			/**
244 			 * Used by Yylex to slip correct time of the object or programmatically.
245 			 */
246 			protected void setSimTime(long SimTime) {
247 				this.SimTime = SimTime;
248 			}
249 	   	
250     	
251 	    /**
252          * Id of the zone entered. 
253          */
254         protected
255          String Id =
256        	null;
257 	
258  		/**
259          * Id of the zone entered. 
260          */
261         public  String getId()
262  	 {
263     					return Id;
264     				}
265     			
266     	
267 	    /**
268          * 
269 			Zone velocity (?).
270 		 
271          */
272         protected
273          Velocity ZoneVelocity =
274        	null;
275 	
276  		/**
277          * 
278 			Zone velocity (?).
279 		 
280          */
281         public  Velocity getZoneVelocity()
282  	 {
283     					return ZoneVelocity;
284     				}
285     			
286     	
287 	    /**
288          * 
289 			Gravity in this zone.
290 		 
291          */
292         protected
293          Velocity ZoneGravity =
294        	null;
295 	
296  		/**
297          * 
298 			Gravity in this zone.
299 		 
300          */
301         public  Velocity getZoneGravity()
302  	 {
303     					return ZoneGravity;
304     				}
305     			
306     	
307 	    /**
308          * 
309 			Friction of the floor.
310 		 
311          */
312         protected
313          double GroundFriction =
314        	0;
315 	
316  		/**
317          * 
318 			Friction of the floor.
319 		 
320          */
321         public  double getGroundFriction()
322  	 {
323     					return GroundFriction;
324     				}
325     			
326     	
327 	    /**
328          * 
329 			Friction of the fluid.
330 		 
331          */
332         protected
333          double FluidFriction =
334        	0;
335 	
336  		/**
337          * 
338 			Friction of the fluid.
339 		 
340          */
341         public  double getFluidFriction()
342  	 {
343     					return FluidFriction;
344     				}
345     			
346     	
347 	    /**
348          * 
349 			Terminal velocity (?).
350 		 
351          */
352         protected
353          double TerminalVelocity =
354        	0;
355 	
356  		/**
357          * 
358 			Terminal velocity (?).
359 		 
360          */
361         public  double getTerminalVelocity()
362  	 {
363     					return TerminalVelocity;
364     				}
365     			
366     	
367 	    /**
368          * 
369 			If this zone is a water.
370 		 
371          */
372         protected
373          boolean WaterVolume =
374        	false;
375 	
376  		/**
377          * 
378 			If this zone is a water.
379 		 
380          */
381         public  boolean isWaterVolume()
382  	 {
383     					return WaterVolume;
384     				}
385     			
386     	
387 	    /**
388          * 
389 			True or false if we get some damage when we stay in this
390 			zone.
391 		 
392          */
393         protected
394          boolean PainCausing =
395        	false;
396 	
397  		/**
398          * 
399 			True or false if we get some damage when we stay in this
400 			zone.
401 		 
402          */
403         public  boolean isPainCausing()
404  	 {
405     					return PainCausing;
406     				}
407     			
408     	
409 	    /**
410          * 
411 			If this zone kills most of the actors instantly.
412 		 
413          */
414         protected
415          boolean Destructive =
416        	false;
417 	
418  		/**
419          * 
420 			If this zone kills most of the actors instantly.
421 		 
422          */
423         public  boolean isDestructive()
424  	 {
425     					return Destructive;
426     				}
427     			
428     	
429 	    /**
430          * 
431 			Amount of damage we will suffer per second if we stay in this zone.
432 		 
433          */
434         protected
435          double DamagePerSec =
436        	0;
437 	
438  		/**
439          * 
440 			Amount of damage we will suffer per second if we stay in this zone.
441 		 
442          */
443         public  double getDamagePerSec()
444  	 {
445     					return DamagePerSec;
446     				}
447     			
448     	
449 	    /**
450          * 
451 			Type of the damage in this zone.
452 		 
453          */
454         protected
455          String DamageType =
456        	null;
457 	
458  		/**
459          * 
460 			Type of the damage in this zone.
461 		 
462          */
463         public  String getDamageType()
464  	 {
465     					return DamageType;
466     				}
467     			
468     	
469 	    /**
470          * 
471 			If the inventory is allowed here.
472 		 
473          */
474         protected
475          boolean NoInventory =
476        	false;
477 	
478  		/**
479          * 
480 			If the inventory is allowed here.
481 		 
482          */
483         public  boolean isNoInventory()
484  	 {
485     					return NoInventory;
486     				}
487     			
488     	
489 	    /**
490          * 
491 			If this velocity zone should impart velocity to projectiles and effects.
492 		 
493          */
494         protected
495          boolean MoveProjectiles =
496        	false;
497 	
498  		/**
499          * 
500 			If this velocity zone should impart velocity to projectiles and effects.
501 		 
502          */
503         public  boolean isMoveProjectiles()
504  	 {
505     					return MoveProjectiles;
506     				}
507     			
508     	
509 	    /**
510          * 
511 			Players can't take damage in this zone.
512 		 
513          */
514         protected
515          boolean NeutralZone =
516        	false;
517 	
518  		/**
519          * 
520 			Players can't take damage in this zone.
521 		 
522          */
523         public  boolean isNeutralZone()
524  	 {
525     					return NeutralZone;
526     				}
527     			
528  		
529  	    public String toString() {
530             return
531             	super.toString() + "[" +
532             	
533 		              			"Id = " + String.valueOf(getId()
534  	) + " | " + 
535 		              		
536 		              			"ZoneVelocity = " + String.valueOf(getZoneVelocity()
537  	) + " | " + 
538 		              		
539 		              			"ZoneGravity = " + String.valueOf(getZoneGravity()
540  	) + " | " + 
541 		              		
542 		              			"GroundFriction = " + String.valueOf(getGroundFriction()
543  	) + " | " + 
544 		              		
545 		              			"FluidFriction = " + String.valueOf(getFluidFriction()
546  	) + " | " + 
547 		              		
548 		              			"TerminalVelocity = " + String.valueOf(getTerminalVelocity()
549  	) + " | " + 
550 		              		
551 		              			"WaterVolume = " + String.valueOf(isWaterVolume()
552  	) + " | " + 
553 		              		
554 		              			"PainCausing = " + String.valueOf(isPainCausing()
555  	) + " | " + 
556 		              		
557 		              			"Destructive = " + String.valueOf(isDestructive()
558  	) + " | " + 
559 		              		
560 		              			"DamagePerSec = " + String.valueOf(getDamagePerSec()
561  	) + " | " + 
562 		              		
563 		              			"DamageType = " + String.valueOf(getDamageType()
564  	) + " | " + 
565 		              		
566 		              			"NoInventory = " + String.valueOf(isNoInventory()
567  	) + " | " + 
568 		              		
569 		              			"MoveProjectiles = " + String.valueOf(isMoveProjectiles()
570  	) + " | " + 
571 		              		
572 		              			"NeutralZone = " + String.valueOf(isNeutralZone()
573  	) + " | " + 
574 		              		
575 				"]";           		
576         }
577  	
578  		
579  		public String toHtmlString() {
580  			return super.toString() + "[<br/>" +
581             	
582 		              			"<b>Id</b> = " + String.valueOf(getId()
583  	) + " <br/> " + 
584 		              		
585 		              			"<b>ZoneVelocity</b> = " + String.valueOf(getZoneVelocity()
586  	) + " <br/> " + 
587 		              		
588 		              			"<b>ZoneGravity</b> = " + String.valueOf(getZoneGravity()
589  	) + " <br/> " + 
590 		              		
591 		              			"<b>GroundFriction</b> = " + String.valueOf(getGroundFriction()
592  	) + " <br/> " + 
593 		              		
594 		              			"<b>FluidFriction</b> = " + String.valueOf(getFluidFriction()
595  	) + " <br/> " + 
596 		              		
597 		              			"<b>TerminalVelocity</b> = " + String.valueOf(getTerminalVelocity()
598  	) + " <br/> " + 
599 		              		
600 		              			"<b>WaterVolume</b> = " + String.valueOf(isWaterVolume()
601  	) + " <br/> " + 
602 		              		
603 		              			"<b>PainCausing</b> = " + String.valueOf(isPainCausing()
604  	) + " <br/> " + 
605 		              		
606 		              			"<b>Destructive</b> = " + String.valueOf(isDestructive()
607  	) + " <br/> " + 
608 		              		
609 		              			"<b>DamagePerSec</b> = " + String.valueOf(getDamagePerSec()
610  	) + " <br/> " + 
611 		              		
612 		              			"<b>DamageType</b> = " + String.valueOf(getDamageType()
613  	) + " <br/> " + 
614 		              		
615 		              			"<b>NoInventory</b> = " + String.valueOf(isNoInventory()
616  	) + " <br/> " + 
617 		              		
618 		              			"<b>MoveProjectiles</b> = " + String.valueOf(isMoveProjectiles()
619  	) + " <br/> " + 
620 		              		
621 		              			"<b>NeutralZone</b> = " + String.valueOf(isNeutralZone()
622  	) + " <br/> " + 
623 		              		
624 				"<br/>]";     
625 		}
626  	 
627  	    public String toJsonLiteral() {
628             return "VolumeChanged(null, "
629             		
630                    + ")";
631         }
632  	
633  		
634  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
635         	
636 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
637 		
638 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
639 	        
640 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---        	            	
641  	
642 		}
643