1 package cz.cuni.amis.pogamut.ut2004.bot.impl; 2 3 import java.util.Random; 4 import java.util.logging.Level; 5 6 import cz.cuni.amis.pogamut.base.agent.navigation.IPathPlanner; 7 import cz.cuni.amis.pogamut.base.agent.navigation.PathExecutorState; 8 import cz.cuni.amis.pogamut.base.communication.command.IAct; 9 import cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation.AnnotationListenerRegistrator; 10 import cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation.EventListener; 11 import cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation.ObjectClassEventListener; 12 import cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation.ObjectClassListener; 13 import cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation.ObjectEventListener; 14 import cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation.ObjectListener; 15 import cz.cuni.amis.pogamut.base.utils.math.DistanceUtils; 16 import cz.cuni.amis.pogamut.base3d.worldview.IVisionWorldView; 17 import cz.cuni.amis.pogamut.base3d.worldview.object.ILocated; 18 import cz.cuni.amis.pogamut.unreal.agent.navigation.IUnrealPathExecutor; 19 import cz.cuni.amis.pogamut.ut2004.agent.module.sensomotoric.AdrenalineCombo; 20 import cz.cuni.amis.pogamut.ut2004.agent.module.sensomotoric.AgentConfig; 21 import cz.cuni.amis.pogamut.ut2004.agent.module.sensomotoric.Raycasting; 22 import cz.cuni.amis.pogamut.ut2004.agent.module.sensomotoric.Weaponry; 23 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.AgentInfo; 24 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.AgentStats; 25 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.CTF; 26 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.Game; 27 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.ItemDescriptors; 28 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.Items; 29 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.NavigationGraphBuilder; 30 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.Players; 31 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.Senses; 32 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.WeaponPrefs; 33 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.visibility.Visibility; 34 import cz.cuni.amis.pogamut.ut2004.agent.navigation.IUT2004GetBackToNavGraph; 35 import cz.cuni.amis.pogamut.ut2004.agent.navigation.IUT2004Navigation; 36 import cz.cuni.amis.pogamut.ut2004.agent.navigation.IUT2004PathExecutor; 37 import cz.cuni.amis.pogamut.ut2004.agent.navigation.IUT2004RunStraight; 38 import cz.cuni.amis.pogamut.ut2004.agent.navigation.UT2004AStarPathPlanner; 39 import cz.cuni.amis.pogamut.ut2004.agent.navigation.UT2004GetBackToNavGraph; 40 import cz.cuni.amis.pogamut.ut2004.agent.navigation.UT2004Navigation; 41 import cz.cuni.amis.pogamut.ut2004.agent.navigation.UT2004PathExecutor; 42 import cz.cuni.amis.pogamut.ut2004.agent.navigation.UT2004RunStraight; 43 import cz.cuni.amis.pogamut.ut2004.agent.navigation.floydwarshall.FloydWarshallMap; 44 import cz.cuni.amis.pogamut.ut2004.agent.navigation.loquenavigator.KefikRunner; 45 import cz.cuni.amis.pogamut.ut2004.agent.navigation.loquenavigator.LoqueNavigator; 46 import cz.cuni.amis.pogamut.ut2004.agent.navigation.stuckdetector.UT2004DistanceStuckDetector; 47 import cz.cuni.amis.pogamut.ut2004.agent.navigation.stuckdetector.UT2004PositionStuckDetector; 48 import cz.cuni.amis.pogamut.ut2004.agent.navigation.stuckdetector.UT2004TimeStuckDetector; 49 import cz.cuni.amis.pogamut.ut2004.bot.IUT2004BotController; 50 import cz.cuni.amis.pogamut.ut2004.bot.command.AdvancedLocomotion; 51 import cz.cuni.amis.pogamut.ut2004.bot.command.CompleteBotCommandsWrapper; 52 import cz.cuni.amis.pogamut.ut2004.bot.command.ImprovedShooting; 53 import cz.cuni.amis.pogamut.ut2004.communication.messages.ItemType; 54 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.GetPath; 55 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.AutoTraceRay; 56 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange; 57 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage; 58 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.NavPoint; 59 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.PathList; 60 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Self; 61 import cz.cuni.amis.pogamut.ut2004.communication.translator.itemdescriptor.ItemDescriptor; 62 63 /** 64 * The most advanced controller that is available. This controller contains all useful modules pre-instantiated. 65 * 66 * @author Jimmy 67 * 68 * @param <BOT> 69 */ 70 public class UT2004BotModuleController<BOT extends UT2004Bot> extends UT2004BotLogicController<BOT> { 71 72 /** 73 * Random number generator that is usually useful to have during decision making. 74 */ 75 protected Random random = new Random(System.currentTimeMillis()); 76 77 /** 78 * Command module that is internally using {@link UT2004PathExecutor} for path-following and {@link FloydWarshallMap} 79 * for path planning resulting in unified class that can solely handle navigation of the bot within the environment. 80 * <p><p> 81 * In contrast to {@link UT2004PathExecutor} methods 82 * of this module may be recalled every {@link UT2004BotModuleController#logic()} iteration even with 83 * the same argument (which is not true for {@link UT2004PathExecutor#followPath(cz.cuni.amis.pogamut.base.agent.navigation.IPathFuture)}. 84 * <p><p> 85 * Note that this class is actually initialized with instances of {@link UT2004BotModuleController#pathExecutor} and {@link UT2004BotModuleController#fwMap} 86 * so you must take care if using add/remove stuck detectors or reinitilize this property to your liking (you can do that in {@link UT2004BotModuleController#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage)} 87 * method. 88 * <p><p> 89 * May be used since first {@link UT2004BotModuleController#logic()} is called. 90 * <p><p> 91 * Initialized inside {@link UT2004BotModuleController#initializePathFinding(UT2004Bot)}. 92 */ 93 protected IUT2004Navigation navigation; 94 95 /** 96 * Memory module specialized on general info about the game - game type, time limit, frag limit, etc. 97 * <p><p> 98 * May be used since {@link IUT2004BotController#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage)} 99 * is called. 100 * <p><p> 101 * Initialized inside {@link UT2004BotModuleController#initializeModules(UT2004Bot)}. 102 */ 103 protected Game game; 104 105 /** 106 * Memory module specialized on general info about the agent whereabouts - location, rotation, health, current weapon, who is enemy/friend, etc. 107 * <p><p> 108 * May be used since first {@link Self} message is received, i.e, since the first {@link IUT2004BotController#botFirstSpawn(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage, Self)} 109 * is called. 110 * <p><p> 111 * Initialized inside {@link UT2004BotModuleController#initializeModules(UT2004Bot)}. 112 */ 113 protected AgentInfo info; 114 115 /** 116 * Memory module specialized on whereabouts of other players - who is visible, enemy / friend, whether bot can see anybody, etc. 117 * <p><p> 118 * May be used since {@link IUT2004BotController#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage)} 119 * is called. 120 * <p><p> 121 * Initialized inside {@link UT2004BotModuleController#initializeModules(UT2004Bot)}. 122 */ 123 protected Players players; 124 125 /** 126 * Sensory module that provides mapping between {@link ItemType} and {@link ItemDescriptor} providing 127 * an easy way to obtain item descriptors for various items in UT2004. 128 * <p><p> 129 * May be used since {@link IUT2004BotController#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage)} 130 * is called. 131 * <p><p> 132 * Initialized inside {@link UT2004BotModuleController#initializeModules(UT2004Bot)}. 133 */ 134 protected ItemDescriptors descriptors; 135 136 /** 137 * Memory module specialized on items on the map - which are visible and which are probably spawned. 138 * <p><p> 139 * May be used since {@link IUT2004BotController#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage)} 140 * is called. 141 * <p><p> 142 * Initialized inside {@link UT2004BotModuleController#initializeModules(UT2004Bot)}. 143 */ 144 protected Items items; 145 146 /** 147 * Memory module specialized on agent's senses - whether the bot has been recently killed, collide with level's geometry, etc. 148 * <p><p> 149 * May be used since {@link IUT2004BotController#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage)} 150 * is called. 151 * <p><p> 152 * Initialized inside {@link UT2004BotModuleController#initializeModules(UT2004Bot)}. 153 */ 154 protected Senses senses; 155 156 /** 157 * Memory module specialized on info about the bot's weapon and ammo inventory - it can tell you which weapons are loaded, melee/ranged, etc. 158 * <p><p> 159 * May be used since {@link IUT2004BotController#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage)} 160 * is called. 161 * <p><p> 162 * Initialized inside {@link UT2004BotModuleController#initializeModules(UT2004Bot)}. 163 */ 164 protected Weaponry weaponry; 165 166 /** 167 * Memory module specialized on the agent's configuration inside UT2004 - name, vision time, manual spawn, cheats (if enabled at GB2004). 168 * <p><p> 169 * May be used since {@link IUT2004BotController#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage)} 170 * is called. 171 * <p><p> 172 * Initialized inside {@link UT2004BotModuleController#initializeModules(UT2004Bot)}. 173 */ 174 protected AgentConfig config; 175 176 /** 177 * Support for creating rays used for raycasting (see {@link AutoTraceRay} that is being utilized). 178 * <p><p> 179 * May be used since {@link IUT2004BotController#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage)} 180 * is called. 181 * <p><p> 182 * Initialized inside {@link UT2004BotModuleController#initializeModules(UT2004Bot)}. 183 */ 184 protected Raycasting raycasting; 185 186 /** 187 * Wraps all available commands that can be issued to the virtual body of the bot inside UT2004. 188 * <p><p> 189 * May be used since since the first {@link IUT2004BotController#botFirstSpawn(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage, Self)} 190 * is called. 191 * <p><p> 192 * Initialized inside {@link UT2004BotModuleController#initializeModules(UT2004Bot)}. 193 */ 194 protected CompleteBotCommandsWrapper body; 195 196 /** 197 * Shortcut for <i>body.getAdvancedShooting()</i> that allows you to shoot at opponent. 198 * <p><p> 199 * Note: more weapon-handling methods are available through {@link UT2004BotModuleControllerNew#weaponry}. 200 * <p><p> 201 * May be used since since the first {@link IUT2004BotController#botFirstSpawn(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage, Self)} 202 * is called. 203 * <p><p> 204 * Initialized inside {@link UT2004BotModuleController#initializeModules(UT2004Bot)}. 205 */ 206 protected ImprovedShooting shoot; 207 208 /** 209 * Shortcut for <i>body.getAdvancedLocomotion()</i> that allows you to manually steer the movement through the environment. 210 * <p><p> 211 * Note: navigation is done via {@link UT2004BotModuleControllerNew#pathExecutor} that needs {@link PathHandle} from the {@link UT2004BotModuleControllerNew#pathPlanner}. 212 * <p><p> 213 * May be used since since the first {@link IUT2004BotController#botFirstSpawn(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage, Self)} 214 * is called. 215 * <p><p> 216 * Initialized inside {@link UT2004BotModuleController#initializeModules(UT2004Bot)}. 217 */ 218 protected AdvancedLocomotion move; 219 220 /** 221 * Module specialized on CTF games. Enabled only for CTF games, check {@link CTF#isEnabled()}. 222 * <p><p> 223 * Initialized inside {@link UT2004BotModuleController#initializeModules(UT2004Bot)}. 224 */ 225 protected CTF ctf; 226 227 /** 228 * Module for adrenaline combos. 229 */ 230 protected AdrenalineCombo combo; 231 232 /** 233 * Executor is used for following a path in the environment. 234 * <p><p> 235 * May be used since since the first {@link IUT2004BotController#botFirstSpawn(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage, Self)} 236 * is called. 237 * <p><p> 238 * Initialized inside {@link UT2004BotModuleController#initializePathFinding(UT2004Bot)}. 239 * <p><p> 240 * {@link UT2004PathExecutor#addStuckDetector(cz.cuni.amis.pogamut.base.agent.navigation.IStuckDetector)} is initialized with default stuck detectors: 241 * {@link UT2004TimeStuckDetector}, {@link UT2004PositionStuckDetector}, {@link UT2004DistanceStuckDetector}. 242 * <p><p> 243 * If one of stuck detectors (heuristicly) finds out that the bot has stuck somewhere, 244 * it reports it back to {@link UT2004PathExecutor} and the path executor will stop following the path switching 245 * itself to {@link PathExecutorState#STUCK}, which in turn allows us to issue another follow-path command in the right time. 246 */ 247 protected IUT2004PathExecutor<ILocated> pathExecutor = null; 248 249 /** 250 * Planner used to compute the path (consisting of navigation points) inside the map. 251 * <p><p> 252 * May be used since since the first {@link IUT2004BotController#botFirstSpawn(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage, Self)} 253 * is called. 254 * <p><p> 255 * Initialized inside {@link UT2004BotModuleController#initializePathFinding(UT2004Bot)}. 256 */ 257 protected IPathPlanner<ILocated> pathPlanner = null; 258 259 /** 260 * Navigation graph builder that may be used to manually extend the navigation graph of the UT2004. 261 * <p><p> 262 * May be used since {@link IUT2004BotController#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage)} 263 * is called. 264 * <p><p> 265 * Initialized inside {@link UT2004BotModuleController#initializeModules(UT2004Bot)}. 266 */ 267 protected NavigationGraphBuilder navBuilder = null; 268 269 /** 270 * Listener registrator that probes declared methods for the presence of {@link EventListener}, {@link ObjectClassEventListener}, 271 * {@link ObjectClassListener}, {@link ObjectEventListener} and {@link ObjectListener} annotations and automatically registers 272 * them as listeners on a specific events. 273 * <p><p> 274 * Note that this registrator is usable for 'this' object only! It will work only for 'this' object. 275 */ 276 protected AnnotationListenerRegistrator listenerRegistrator; 277 278 /** 279 * Weapon preferences for your bot. See {@link WeaponPrefs} class javadoc. It allows you to define preferences for 280 * weapons to be used at given distance (together with their firing modes). 281 */ 282 protected WeaponPrefs weaponPrefs; 283 284 /** 285 * Shortcut for the {@link UT2004Bot#getWorldView()}. 286 */ 287 protected IVisionWorldView world; 288 289 /** 290 * Shortcut for the {@link UT2004Bot#getAct()}. 291 */ 292 protected IAct act; 293 294 /** 295 * Module that is providing various statistics about the bot. You may also used it to output these stats (in CSV format) 296 * into some file using {@link AgentStats#startOutput(String)} or {@link AgentStats#startOutput(String, boolean)}. 297 */ 298 protected AgentStats stats; 299 300 /** 301 * Path-planner ({@link IPathPlanner} using {@link NavPoint}s), you may use it to find paths inside the environment wihtout 302 * waiting for round-trip of {@link GetPath} command and {@link PathList}s response from UT2004. It is much faster than 303 * {@link UT2004BotModuleController#pathPlanner} but you need to pass {@link NavPoint} instances to planner instead of 304 * {@link ILocated} ... to find the nearest {@link NavPoint} instance, {@link DistanceUtils} is a handy, check especially 305 * {@link DistanceUtils#getNearest(java.util.Collection, ILocated)}. 306 */ 307 protected FloydWarshallMap fwMap; 308 309 /** 310 * Navigation helper that is able to get your bot back to the nearest navigation graph so you can use {@link UT2004BotModuleController#navigation} 311 * without fear of catastrophe. 312 * <p><p> 313 * May be used since {@link IUT2004BotController#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage)} 314 * is called. 315 * <p><p> 316 * Initialized inside {@link UT2004BotModuleController#initializePathFinding(UT2004Bot)}. 317 */ 318 protected IUT2004GetBackToNavGraph getBackToNavGraph; 319 320 /** 321 * Navigation helper that can run-straight to some point with stuck detectors. 322 * <p><p> 323 * May be used since {@link IUT2004BotController#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage)} 324 * is called. 325 * <p><p> 326 * Initialized inside {@link UT2004BotModuleController#initializePathFinding(UT2004Bot)}. 327 */ 328 protected IUT2004RunStraight runStraight; 329 330 /** 331 * Module that provides visibility/cover information for the map. 332 * <p><p> 333 * May be used since {@link IUT2004BotController#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage)} 334 * is called. 335 * <p><p> 336 * Initialized inside {@link UT2004BotModuleController#initializeModules(UT2004Bot)}. 337 */ 338 protected Visibility visibility; 339 340 @Override 341 public void initializeController(BOT bot) { 342 super.initializeController(bot); 343 world = getWorldView(); 344 act = getAct(); 345 initializeModules(bot); 346 initializePathFinding(bot); 347 initializeListeners(bot); 348 } 349 350 /** 351 * Initializes {@link UT2004BotModuleControllerNew#listenerRegistrator} and calls {@link AnnotationListenerRegistrator#addListeners()} method 352 * to probe all declared methods for event-annotation presence. 353 * @param bot 354 */ 355 protected void initializeListeners(BOT bot) { 356 listenerRegistrator = new AnnotationListenerRegistrator(this, getWorldView(), bot.getLogger().getCategory("Listeners")); 357 listenerRegistrator.addListeners(); 358 } 359 360 /** 361 * Initializes path-finding modules: {@link UT2004BotModuleControllerNew#pathPlanner}, {@link UT2004BotModuleController#fwMap} and {@link UT2004BotModuleControllerNew#pathExecutor}. 362 * If you need different path planner / path executor - override this method and initialize your own modules. 363 * @param bot 364 */ 365 protected void initializePathFinding(BOT bot) { 366 pathPlanner = new UT2004AStarPathPlanner(bot); 367 fwMap = new FloydWarshallMap(bot); 368 pathExecutor = 369 new UT2004PathExecutor<ILocated>( 370 bot, 371 new LoqueNavigator<ILocated>(bot, bot.getLog()), 372 bot.getLog() 373 ); 374 375 // add stuck detectors that watch over the path-following, if it (heuristicly) finds out that the bot has stuck somewhere, 376 // it reports an appropriate path event and the path executor will stop following the path which in turn allows 377 // us to issue another follow-path command in the right time 378 pathExecutor.addStuckDetector(new UT2004TimeStuckDetector(bot, 3000, 100000)); // if the bot does not move for 3 seconds, considered that it is stuck 379 pathExecutor.addStuckDetector(new UT2004PositionStuckDetector(bot)); // watch over the position history of the bot, if the bot does not move sufficiently enough, consider that it is stuck 380 pathExecutor.addStuckDetector(new UT2004DistanceStuckDetector(bot)); // watch over distances to target 381 382 getBackToNavGraph = new UT2004GetBackToNavGraph(bot, info, move); 383 runStraight = new UT2004RunStraight(bot, info, move); 384 navigation = new UT2004Navigation(bot, pathExecutor, fwMap, getBackToNavGraph, runStraight); 385 } 386 387 /** 388 * Initializes memory/command modules of the bot. 389 * 390 * @param bot 391 */ 392 protected void initializeModules(BOT bot) { 393 game = new Game(bot); 394 info = new AgentInfo(bot, game); 395 visibility = new Visibility(bot, info); 396 ctf = new CTF(bot, info); 397 players = new Players(bot); 398 descriptors = new ItemDescriptors(bot); 399 weaponry = new Weaponry(bot, descriptors); 400 items = new Items(bot, info, game, weaponry, null); 401 senses = new Senses(bot, info, players); 402 config = new AgentConfig(bot); 403 raycasting = new Raycasting(bot); 404 body = new CompleteBotCommandsWrapper(bot, weaponry, null); 405 shoot = body.getImprovedShooting(); 406 move = body.getLocomotion(); 407 navBuilder = new NavigationGraphBuilder(bot); 408 stats = new AgentStats(bot); 409 weaponPrefs = new WeaponPrefs(weaponry, bot); 410 combo = new AdrenalineCombo(bot, info); 411 } 412 413 @Override 414 public void finishControllerInitialization() { 415 if (navBuilder.isUsed()) { 416 log.info("Navigation graph has been altered by 'navBuilder', triggering recomputation of Floyd-Warshall path matrix..."); 417 Level oldLevel = fwMap.getLog().getLevel(); 418 fwMap.getLog().setLevel(Level.FINER); 419 fwMap.refreshPathMatrix(); 420 fwMap.getLog().setLevel(oldLevel); 421 } 422 } 423 424 // 425 // 426 // MODULE GETTERS 427 // 428 // 429 430 public Random getRandom() { 431 return random; 432 } 433 434 public Game getGame() { 435 return game; 436 } 437 438 public AgentInfo getInfo() { 439 return info; 440 } 441 442 public Players getPlayers() { 443 return players; 444 } 445 446 public ItemDescriptors getDescriptors() { 447 return descriptors; 448 } 449 450 public Items getItems() { 451 return items; 452 } 453 454 public Senses getSenses() { 455 return senses; 456 } 457 458 public Weaponry getWeaponry() { 459 return weaponry; 460 } 461 462 public AgentConfig getConfig() { 463 return config; 464 } 465 466 public Raycasting getRaycasting() { 467 return raycasting; 468 } 469 470 public CompleteBotCommandsWrapper getBody() { 471 return body; 472 } 473 474 public ImprovedShooting getShoot() { 475 return shoot; 476 } 477 478 public AdvancedLocomotion getMove() { 479 return move; 480 } 481 482 public IUnrealPathExecutor<ILocated> getPathExecutor() { 483 return pathExecutor; 484 } 485 486 public IPathPlanner<ILocated> getPathPlanner() { 487 return pathPlanner; 488 } 489 490 public AdrenalineCombo getCombo() { 491 return combo; 492 } 493 494 public NavigationGraphBuilder getNavBuilder() { 495 return navBuilder; 496 } 497 498 public WeaponPrefs getWeaponPrefs() { 499 return weaponPrefs; 500 } 501 502 public IVisionWorldView getWorld() { 503 return world; 504 } 505 506 public AgentStats getStats() { 507 return stats; 508 } 509 510 public FloydWarshallMap getFwMap() { 511 return fwMap; 512 } 513 514 public IUT2004Navigation getNavigation() { 515 return navigation; 516 } 517 518 public Visibility getVisibility() { 519 return visibility; 520 } 521 522 }