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