1// SuperTux
2// Copyright (C) 2015 Ingo Ruhnke <grumbel@gmail.com>
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#include "scripting/player.hpp"
18
19#include "object/player.hpp"
20
21namespace scripting {
22
23bool
24Player::add_bonus(const std::string& bonus)
25{
26 SCRIPT_GUARD_DEFAULT;
27 return object.add_bonus(bonus);
28}
29
30bool
31Player::set_bonus(const std::string& bonus)
32{
33 SCRIPT_GUARD_DEFAULT;
34 return object.set_bonus(bonus);
35}
36
37void
38Player::add_coins(int count)
39{
40 SCRIPT_GUARD_VOID;
41 object.add_coins(count);
42}
43
44int
45Player::get_coins() const
46{
47 SCRIPT_GUARD_DEFAULT;
48 return object.get_coins();
49}
50
51void
52Player::make_invincible()
53{
54 SCRIPT_GUARD_VOID;
55 object.make_invincible();
56}
57
58void
59Player::deactivate()
60{
61 SCRIPT_GUARD_VOID;
62 object.deactivate();
63}
64
65void
66Player::activate()
67{
68 SCRIPT_GUARD_VOID;
69 object.activate();
70}
71
72void
73Player::walk(float speed)
74{
75 SCRIPT_GUARD_VOID;
76 object.walk(speed);
77}
78
79void
80Player::set_dir(bool right)
81{
82 SCRIPT_GUARD_VOID;
83 object.set_dir(right);
84}
85
86void
87Player::set_visible(bool visible)
88{
89 SCRIPT_GUARD_VOID;
90 object.set_visible(visible);
91}
92
93bool
94Player::get_visible() const
95{
96 SCRIPT_GUARD_DEFAULT;
97 return object.get_visible();
98}
99
100void
101Player::kill(bool completely)
102{
103 SCRIPT_GUARD_VOID;
104 object.kill(completely);
105}
106
107void
108Player::set_ghost_mode(bool enable)
109{
110 SCRIPT_GUARD_VOID;
111 object.set_ghost_mode(enable);
112}
113
114bool
115Player::get_ghost_mode() const
116{
117 SCRIPT_GUARD_DEFAULT;
118 return object.get_ghost_mode();
119}
120
121void
122Player::kick()
123{
124 SCRIPT_GUARD_VOID;
125 object.kick();
126}
127
128void
129Player::do_cheer()
130{
131 SCRIPT_GUARD_VOID;
132 object.do_cheer();
133}
134
135void
136Player::do_duck()
137{
138 SCRIPT_GUARD_VOID;
139 object.do_duck();
140}
141
142void
143Player::do_standup()
144{
145 SCRIPT_GUARD_VOID;
146 object.do_standup();
147}
148
149void
150Player::do_backflip()
151{
152 SCRIPT_GUARD_VOID;
153 object.do_backflip();
154}
155
156void
157Player::do_jump(float yspeed)
158{
159 SCRIPT_GUARD_VOID;
160 object.do_jump(yspeed);
161}
162
163void
164Player::trigger_sequence(const std::string& sequence_name)
165{
166 SCRIPT_GUARD_VOID;
167 object.trigger_sequence(sequence_name);
168}
169
170void
171Player::use_scripting_controller(bool use_or_release)
172{
173 SCRIPT_GUARD_VOID;
174 object.use_scripting_controller(use_or_release);
175}
176
177void
178Player::do_scripting_controller(const std::string& control, bool pressed)
179{
180 SCRIPT_GUARD_VOID;
181 object.do_scripting_controller(control, pressed);
182}
183
184float
185Player::get_velocity_x() const
186{
187 SCRIPT_GUARD_DEFAULT;
188 return object.get_physic().get_velocity_x();
189}
190
191float
192Player::get_velocity_y() const
193{
194 SCRIPT_GUARD_DEFAULT;
195 return object.get_physic().get_velocity_y();
196}
197
198bool
199Player::has_grabbed(const std::string& name) const
200{
201 SCRIPT_GUARD_DEFAULT;
202 return object.has_grabbed(name);
203}
204
205} // namespace scripting
206
207/* EOF */
208