View Javadoc

1   package cz.cuni.amis.pogamut.ut2004.bot.command;
2   
3   import java.util.logging.Logger;
4   
5   import cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot;
6   import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Configuration;
7   import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.SetSkin;
8   
9   /**
10   * Class providing Pogamut2 UT2004 configure commands. Changing of the bot
11   * attributes like name, speed, etc. Changing the bot appearance.
12   * 
13   * @author Michal 'Knight' Bida
14   */
15  public class ConfigureCommands extends BotCommands {
16  
17  	/**
18  	 * Changes the configuration of the bot. How to use this. First you need to
19  	 * create your own Pogamut GB configuration command, you need to import
20  	 * cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.*; Then
21  	 * create your own Configuration command with new, set the fields you want
22  	 * to change and then use this method to send it to UT2004.
23  	 * 
24  	 * Example: Configuration conf = new Configuration();
25  	 * conf.setName("MyName"); configure(conf);
26  	 * 
27  	 * Note: The Id parameter cannot be changed, it is there for control server,
28  	 * so the server can configure the bots by the Id. Also some other
29  	 * configuration parameters may only be set when the game features
30  	 * particular rules (e.g. you cannot set invulnerability of the bot, when
31  	 * the cheating is off). See help in the documentation of Configuration
32  	 * command.
33  	 * 
34  	 * (issues GB CONF command)
35  	 * 
36  	 * @param config
37  	 *            Actual Pogamut GB Configuration command. Set all desired
38  	 *            fields you want to change.
39  	 * 
40  	 */
41  	public void configure(Configuration config) {
42  		agent.getAct().act(config);
43  	}
44  
45  	/**
46  	 * Changes the bot appearance. Note that the bot will respawn after this
47  	 * command so the change of the skin can be visible.
48  	 * 
49  	 * Set the appearance through skin attribute (e.g. "HumanMaleA.MercMaleA").
50  	 * Find all packages and skins through unrealEd (Actor browser, search in
51  	 * UT2004/Animations folder) or look in GB user documentation on the web.
52  	 * Supported bot skins are Aliens (Aliens.), Bots (Bot.), human males
53  	 * (HumanMaleA.), human females (HumanFemaleA. ), juggernauts (Jugg.).
54  	 * Skaarj skins are not supported at the time being.
55  	 * 
56  	 * (issues GB SETSKIN command)
57  	 * 
58  	 * @param skin
59  	 *            New desired skin of the bot.
60  	 * 
61  	 */
62  	public void setBotAppearance(String skin) {
63  		agent.getAct().act(new SetSkin().setSkin(skin));
64  	}
65  
66  	/**
67  	 * Constructor. Setups the command module based on given agent and logger.
68  	 * 
69  	 * @param agent
70  	 *            AbstractUT2004Bot we will send commands for
71  	 * @param log
72  	 *            Logger to be used for logging runtime/debug info.
73  	 */
74  	public ConfigureCommands(UT2004Bot agent, Logger log) {
75  		super(agent, log);
76  	}
77  
78  }