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=composite]+classtype[@name=impl] BEGIN
13
14 // --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=composite]+classtype[@name=impl] END
15
16 /**
17 *
18 Composite implementation of the NAV abstract message. It wraps Local/Shared/Static parts in single object
19 allowing to presenting a nice facade for users.
20
21 *
22 * <p></p><p></p>
23 * Complete message documentation:
24 *
25 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.).
26
27 */
28 public class NavPointCompositeImpl
29 extends NavPoint
30 {
31
32
33
34 /**
35 * Parameter-less contructor for the message.
36 */
37 public NavPointCompositeImpl()
38 {
39 }
40
41
42 /**
43 * Composite-impl constructor. It assembles the message from its three fragments - local/shared/static.
44 *
45 * @param partLocal local-part of the message
46 * @param partShared shared-part of the message
47 * @param partStatic static-part of the message
48 */
49 public NavPointCompositeImpl(
50 NavPointLocalImpl partLocal,
51 NavPointSharedImpl partShared,
52 NavPointStaticImpl partStatic
53 ) {
54 this.partLocal = partLocal;
55 this.partShared = partShared;
56 this.partStatic = partStatic;
57 }
58
59 /**
60 * Cloning constructor.
61 *
62 * @param original
63 */
64 public NavPointCompositeImpl(NavPointCompositeImpl original) {
65 this.partLocal = partLocal;
66 this.partShared = partShared;
67 this.partStatic = partStatic;
68 }
69
70
71 @Override
72 public void setSimTime(long SimTime) {
73 super.setSimTime(SimTime);
74 }
75
76
77 protected
78 NavPointStaticImpl
79 partStatic;
80
81 @Override
82 public NavPointStatic getStatic() {
83 return partStatic;
84 }
85
86 protected
87 NavPointLocalImpl
88 partLocal;
89
90 @Override
91 public NavPointLocal getLocal() {
92 return partLocal;
93 }
94
95 NavPointSharedImpl
96 partShared;
97
98 @Override
99 public NavPointShared getShared() {
100 return partShared;
101 }
102
103
104
105 @Override
106
107 /**
108 *
109 A unique Id of this navigation point assigned by the game.
110
111 */
112 public UnrealId getId()
113 {
114 return
115
116 partStatic.
117 getId()
118 ;
119 }
120
121 @Override
122
123 /**
124 * Location of navigation point.
125 */
126 public Location getLocation()
127 {
128 return
129
130 partShared.
131 getLocation()
132 ;
133 }
134
135 @Override
136
137 /**
138 *
139 Velocity of the navigation point (if the navigation point is
140 currently moving). Not sent at the moment.
141
142 */
143 public Velocity getVelocity()
144 {
145 return
146
147 partShared.
148 getVelocity()
149 ;
150 }
151
152 @Override
153
154 /**
155 *
156 If the point is in the field of view of the bot.
157
158 */
159 public boolean isVisible()
160 {
161 return
162
163 partLocal.
164 isVisible()
165 ;
166 }
167
168 @Override
169
170 /**
171 *
172 Unique Id of the respawned item (the item respawns at this
173 point). Not sent if point is not an inventory spot. Sent only in HandShake.
174
175 */
176 public UnrealId getItem()
177 {
178 return
179
180 partStatic.
181 getItem()
182 ;
183 }
184
185 @Override
186
187 /**
188 *
189 Class of the item (e.g. xWeapons.FlakCannonPickup). Not sent if point is not an inventory spot. Sent only in HandShake.
190
191 */
192 public ItemType getItemClass()
193 {
194 return
195
196 partStatic.
197 getItemClass()
198 ;
199 }
200
201 @Override
202
203 /**
204 *
205 True if the item is spawned at the point. Not sent if point is not an inventory spot.
206
207 */
208 public boolean isItemSpawned()
209 {
210 return
211
212 partShared.
213 isItemSpawned()
214 ;
215 }
216
217 @Override
218
219 /**
220 *
221 True if this NavPoint is a Door and door is opened. Not sent if point is not a door.
222
223 */
224 public boolean isDoorOpened()
225 {
226 return
227
228 partShared.
229 isDoorOpened()
230 ;
231 }
232
233 @Override
234
235 /**
236 *
237 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.
238
239 */
240 public UnrealId getMover()
241 {
242 return
243
244 partStatic.
245 getMover()
246 ;
247 }
248
249 @Override
250
251 /**
252 *
253 Starting vector between MyLift location and LiftCenter location. Not sent if point is not a LiftCenter. Sent only in HandShake.
254
255 */
256 public Vector3d getLiftOffset()
257 {
258 return
259
260 partStatic.
261 getLiftOffset()
262 ;
263 }
264
265 @Override
266
267 /**
268 *
269 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.
270
271 */
272 public boolean isLiftJumpExit()
273 {
274 return
275
276 partStatic.
277 isLiftJumpExit()
278 ;
279 }
280
281 @Override
282
283 /**
284 *
285 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.
286
287 */
288 public boolean isNoDoubleJump()
289 {
290 return
291
292 partStatic.
293 isNoDoubleJump()
294 ;
295 }
296
297 @Override
298
299 /**
300 *
301 If this is an inventory spot (item is respawned at this point).
302
303 */
304 public boolean isInvSpot()
305 {
306 return
307
308 partStatic.
309 isInvSpot()
310 ;
311 }
312
313 @Override
314
315 /**
316 *
317 If this is a player start (players and/or bots are respawned at this point).
318
319 */
320 public boolean isPlayerStart()
321 {
322 return
323
324 partStatic.
325 isPlayerStart()
326 ;
327 }
328
329 @Override
330
331 /**
332 *
333 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!
334
335 */
336 public int getTeamNumber()
337 {
338 return
339
340 partStatic.
341 getTeamNumber()
342 ;
343 }
344
345 @Override
346
347 /**
348 * If this point marks a DominationPoint (for BotDoubleDomination game).
349 */
350 public boolean isDomPoint()
351 {
352 return
353
354 partStatic.
355 isDomPoint()
356 ;
357 }
358
359 @Override
360
361 /**
362 * Exported if this NavPoint is a DominationPoint (for BotDoubleDomination game) - which team controls this point.
363 */
364 public int getDomPointController()
365 {
366 return
367
368 partStatic.
369 getDomPointController()
370 ;
371 }
372
373 @Override
374
375 /**
376 *
377 If this point marks a door mover.
378
379 */
380 public boolean isDoor()
381 {
382 return
383
384 partStatic.
385 isDoor()
386 ;
387 }
388
389 @Override
390
391 /**
392 *
393 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).
394
395 */
396 public boolean isLiftCenter()
397 {
398 return
399
400 partStatic.
401 isLiftCenter()
402 ;
403 }
404
405 @Override
406
407 /**
408 *
409 If this point marks a lift exit (used to mark exit point of a lift mover).
410
411 */
412 public boolean isLiftExit()
413 {
414 return
415
416 partStatic.
417 isLiftExit()
418 ;
419 }
420
421 @Override
422
423 /**
424 *
425 If this point is an AI marker - marks an interesting spot in the environment. May be ambush point or sniping spot, etc.
426
427 */
428 public boolean isAIMarker()
429 {
430 return
431
432 partStatic.
433 isAIMarker()
434 ;
435 }
436
437 @Override
438
439 /**
440 *
441 If this point marks a jump spot (a special device that causes the bot to jump high or far).
442
443 */
444 public boolean isJumpSpot()
445 {
446 return
447
448 partStatic.
449 isJumpSpot()
450 ;
451 }
452
453 @Override
454
455 /**
456 *
457 If this point marks a jump pad (a special device that causes the bot to jump high or far).
458
459 */
460 public boolean isJumpPad()
461 {
462 return
463
464 partStatic.
465 isJumpPad()
466 ;
467 }
468
469 @Override
470
471 /**
472 *
473 If this point marks a jump destination - some place that can be reached by some special jump.
474
475 */
476 public boolean isJumpDest()
477 {
478 return
479
480 partStatic.
481 isJumpDest()
482 ;
483 }
484
485 @Override
486
487 /**
488 *
489 If this point marks a teleport.
490
491 */
492 public boolean isTeleporter()
493 {
494 return
495
496 partStatic.
497 isTeleporter()
498 ;
499 }
500
501 @Override
502
503 /**
504 *
505 If the type is AIMarker. The rotation the bot should be
506 facing, when doing the action specified by AIMarker. Sent only in HandShake.
507
508 */
509 public Rotation getRotation()
510 {
511 return
512
513 partStatic.
514 getRotation()
515 ;
516 }
517
518 @Override
519
520 /**
521 *
522 Some ambush point, where is good chance to intercept
523 approaching opponents. Sent only in HandShake.
524
525 */
526 public boolean isRoamingSpot()
527 {
528 return
529
530 partStatic.
531 isRoamingSpot()
532 ;
533 }
534
535 @Override
536
537 /**
538 * Point good for sniping. Sent only in HandShake.
539 */
540 public boolean isSnipingSpot()
541 {
542 return
543
544 partStatic.
545 isSnipingSpot()
546 ;
547 }
548
549 @Override
550
551 /**
552 * If item should be present at this navpoint it's instance will be here.
553 */
554 public Item getItemInstance()
555 {
556 return
557
558 partStatic.
559 getItemInstance()
560 ;
561 }
562
563 @Override
564
565 /**
566 * 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).
567 */
568 public Map<UnrealId, NavPointNeighbourLink> getOutgoingEdges()
569 {
570 return
571
572 partStatic.
573 getOutgoingEdges()
574 ;
575 }
576
577 @Override
578
579 /**
580 * 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).
581 */
582 public Map<UnrealId, NavPointNeighbourLink> getIncomingEdges()
583 {
584 return
585
586 partStatic.
587 getIncomingEdges()
588 ;
589 }
590
591 @Override
592
593 /**
594 *
595 Class of the weapon that should be prefered when using this
596 point for AIMarker specified action. Sent only in HandShake.
597
598 */
599 public String getPreferedWeapon()
600 {
601 return
602
603 partStatic.
604 getPreferedWeapon()
605 ;
606 }
607
608
609 public String toString() {
610 return
611 super.toString() + "[" +
612
613 "Static = " + String.valueOf(partStatic) + " | Local = " + String.valueOf(partLocal) + " | Shared = " + String.valueOf(partShared) + " ]" +
614
615 "]";
616 }
617
618
619 public String toHtmlString() {
620 return super.toString() + "[<br/>" +
621
622 "Static = " + String.valueOf(partStatic) + " <br/> Local = " + String.valueOf(partLocal) + " <br/> Shared = " + String.valueOf(partShared) + " ]" +
623
624 "<br/>]";
625 }
626
627
628 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
629
630 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
631
632 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---
633
634 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=composite+classtype[@name=impl]) ---
635
636 }
637