Remove bogus assert
[supertux.git] / src / scripting / player.hpp
1 //  SuperTux
2 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
3 //
4 //  This program is free software: you can redistribute it and/or modify
5 //  it under the terms of the GNU General Public License as published by
6 //  the Free Software Foundation, either version 3 of the License, or
7 //  (at your option) any later version.
8 //
9 //  This program is distributed in the hope that it will be useful,
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 //  GNU General Public License for more details.
13 //
14 //  You should have received a copy of the GNU General Public License
15 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 #ifndef HEADER_SUPERTUX_SCRIPTING_PLAYER_HPP
18 #define HEADER_SUPERTUX_SCRIPTING_PLAYER_HPP
19
20 #ifndef SCRIPTING_API
21 #include <string>
22 #endif
23
24 namespace scripting {
25
26 class Player
27 {
28 public:
29 #ifndef SCRIPTING_API
30   virtual ~Player()
31   {}
32 #endif
33
34   /**
35    * Set tux bonus.
36    * This can be "grow", "fireflower" or "iceflower" at the moment
37    */
38   virtual bool add_bonus(const std::string& bonus) = 0;
39   /**
40    * Give tux more coins
41    */
42   virtual void add_coins(int count) = 0;
43   /**
44    * Make tux invincible for a short amount of time
45    */
46   virtual void make_invincible() = 0;
47   /**
48    * Deactivate user/scripting input for Tux
49    */
50   virtual void deactivate() = 0;
51   /**
52    * Give control back to user/scripting
53    */
54   virtual void activate() = 0;
55   /**
56    * Make Tux walk
57    */
58   virtual void walk(float speed) = 0;
59   /**
60    * Face Tux in the proper direction
61    */
62   virtual void set_dir(bool right) = 0;
63   /**
64    * Set player visible or invisible
65    */
66   virtual void set_visible(bool visible) = 0;
67   /**
68    * returns true if the player is currently visible (that is he was not set
69    * invisible by the set_visible method)
70    */
71   virtual bool get_visible() = 0;
72
73   /**
74    * Hurts a player, if completely=true then the player will be killed even
75    * if he had grow or fireflower bonus
76    */
77   virtual void kill(bool completely) = 0;
78
79   /**
80    * Switches ghost mode on/off.
81    * Lets Tux float around and through solid objects.
82    */
83   virtual void set_ghost_mode(bool enable) = 0;
84
85   /**
86    * Returns whether ghost mode is currently enabled
87    */
88   virtual bool get_ghost_mode() = 0;
89
90   /**
91    * start kick animation
92    */
93   virtual void kick() = 0;
94
95   /**
96    * play cheer animation.
97    * This might need some space and behave in an unpredictable way. Best to use this at level end.
98    */
99   virtual void do_cheer() = 0;
100
101   /**
102    * duck down if possible.
103    * this won't last long as long as input is enabled.
104    */
105   virtual void do_duck() = 0;
106
107   /**
108    * stand back up if possible.
109    */
110   virtual void do_standup() = 0;
111
112   /**
113    * do a backflip if possible.
114    */
115   virtual void do_backflip() = 0;
116
117   /**
118    * jump in the air if possible
119    * sensible values for yspeed are negative - unless we want to jump into the ground of course
120    */
121   virtual void do_jump(float yspeed) = 0;
122
123   /**
124    * Orders the current GameSession to start a sequence
125    */
126   virtual void trigger_sequence(std::string sequence_name) = 0;
127
128   /**
129    * Uses a scriptable controller for all user input (or restores controls)
130    */
131   virtual void use_scripting_controller(bool use_or_release) = 0;
132
133   /**
134    * Instructs the scriptable controller to press or release a button
135    */
136   virtual void do_scripting_controller(std::string control, bool pressed) = 0;
137
138 };
139
140 }
141
142 #endif
143
144 /* EOF */