Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenu
[oweals/minetest.git] / src / localplayer.h
1 /*
2 Minetest
3 Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef LOCALPLAYER_HEADER
21 #define LOCALPLAYER_HEADER
22
23 #include "player.h"
24 #include <list>
25
26 class ClientEnvironment;
27
28 class ClientActiveObject;
29
30 class LocalPlayer : public Player
31 {
32 public:
33         LocalPlayer(IGameDef *gamedef);
34         virtual ~LocalPlayer();
35
36         bool isLocal() const
37         {
38                 return true;
39         }
40         
41         ClientActiveObject *parent;
42
43         bool isAttached;
44
45         v3f overridePosition;
46         
47         void move(f32 dtime, ClientEnvironment *env, f32 pos_max_d,
48                         std::list<CollisionInfo> *collision_info);
49         void move(f32 dtime, ClientEnvironment *env, f32 pos_max_d);
50
51         void applyControl(float dtime);
52
53         v3s16 getStandingNodePos();
54
55         // Used to check if anything changed and prevent sending packets if not
56         v3f last_position;
57         v3f last_speed;
58         float last_pitch;
59         float last_yaw;
60         unsigned int last_keyPressed;
61
62         float camera_impact;
63
64 private:
65         // This is used for determining the sneaking range
66         v3s16 m_sneak_node;
67         // Whether the player is allowed to sneak
68         bool m_sneak_node_exists;
69         // Node below player, used to determine whether it has been removed,
70         // and its old type
71         v3s16 m_old_node_below;
72         std::string m_old_node_below_type;
73         // Whether recalculation of the sneak node is needed
74         bool m_need_to_get_new_sneak_node;
75         bool m_can_jump;
76 };
77
78 #endif
79