SuperTuxKart
|
This is the base class for kart controller - that can be a player or a a robot. More...
#include <controller.hpp>
Public Member Functions | |
Controller (AbstractKart *kart) | |
Constructor, saves the kart pointer and a pointer to the KartControl of the kart. | |
virtual void | reset ()=0 |
virtual void | update (int ticks)=0 |
virtual void | handleZipper (bool play_sound)=0 |
virtual void | collectedItem (const ItemState &item, float previous_energy=0)=0 |
virtual void | crashed (const AbstractKart *k)=0 |
virtual void | crashed (const Material *m)=0 |
virtual void | setPosition (int p)=0 |
virtual bool | isLocalPlayerController () const =0 |
This function checks if this is a local player. | |
virtual bool | isPlayerController () const =0 |
This function checks if this player is not an AI, i.e. | |
virtual bool | disableSlipstreamBonus () const =0 |
virtual bool | saveState (BareNetworkString *buffer) const =0 |
virtual void | rewindTo (BareNetworkString *buffer)=0 |
virtual void | rumble (float strength_low, float strength_high, uint16_t duration) |
virtual void | setControllerName (const std::string &name) |
Sets the controller name for this controller. | |
const std::string & | getControllerName () const |
Returns the name of this controller. | |
virtual bool | action (PlayerAction action, int value, bool dry_run=false)=0 |
Default: ignore actions. | |
virtual void | newLap (int lap)=0 |
Callback whenever a new lap is triggered. | |
virtual void | skidBonusTriggered ()=0 |
virtual void | finishedRace (float time)=0 |
Called whan this controller's kart finishes the last lap. | |
virtual KartControl * | getControls () |
Get a pointer on the kart controls. | |
void | setControls (KartControl *kc) |
virtual bool | canGetAchievements () const |
Only local players can get achievements. | |
virtual core::stringw | getName (bool include_handicap_string=true) const |
Display name of the controller. | |
AbstractKart * | getKart () const |
Returns the kart controlled by this controller. | |
Protected Attributes | |
AbstractKart * | m_kart |
Pointer to the kart that is controlled by this controller. | |
KartControl * | m_controls |
A pointer to the main controller, from which the kart takes it commands. | |
std::string | m_controller_name |
The name of the controller, mainly used for debugging purposes. | |
This is the base class for kart controller - that can be a player or a a robot.
|
pure virtual |
Default: ignore actions.
Only PlayerController get them.
Implemented in EndController, AIBaseController, GhostController, LocalPlayerController, and PlayerController.
|
inlinevirtual |
Only local players can get achievements.
Reimplemented in EndController, LocalPlayerController, and NetworkPlayerController.
|
pure virtual |
Implemented in LocalPlayerController.
|
pure virtual |
Implemented in SpareTireAI.
|
pure virtual |
Implemented in AIBaseController.
|
pure virtual |
Implemented in AIBaseController, and PlayerController.
|
pure virtual |
Called whan this controller's kart finishes the last lap.
Implemented in AIBaseController, GhostController, LocalPlayerController, and PlayerController.
|
virtual |
Display name of the controller.
Defaults to kart name; overriden by controller classes (such as player controllers) to display username.
Reimplemented in EndController, GhostController, LocalPlayerController, and PlayerController.
|
pure virtual |
Implemented in LocalPlayerController, and PlayerController.
|
pure virtual |
This function checks if this is a local player.
A local player will get special graphical effects enabled, has a camera, and sound effects will be played with normal volume.
Implemented in EndController, AIBaseController, GhostController, LocalPlayerController, NetworkAIController, NetworkPlayerController, and PlayerController.
|
pure virtual |
This function checks if this player is not an AI, i.e.
it is either a a local or a remote/networked player. This is tested e.g. by the AI for rubber-banding.
Implemented in EndController, AIBaseController, GhostController, LocalPlayerController, and PlayerController.
|
pure virtual |
Callback whenever a new lap is triggered.
Used by the AI to trigger a recomputation of the way to use.
Implemented in AIBaseLapController, EndController, ArenaAI, GhostController, and PlayerController.
|
pure virtual |
Implemented in SkiddingAI, ArenaAI, LocalPlayerController, NetworkAIController, PlayerController, SoccerAI, and SpareTireAI.
|
inlinevirtual |
Sets the controller name for this controller.
Reimplemented in AIBaseController.
|
pure virtual |
Implemented in LocalPlayerController, and PlayerController.
|
pure virtual |
Implemented in PlayerController.
|
pure virtual |
Implemented in AIBaseLapController, EndController, SkiddingAI, TestAI, ArenaAI, LocalPlayerController, NetworkAIController, NetworkPlayerController, PlayerController, SoccerAI, and SpareTireAI.