HoverRace  2.0
PlayerPeer.h
Go to the documentation of this file.
1 
2 // PlayerPeer.h
3 //
4 // Copyright (c) 2010, 2014-2016 Michael Imamura.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 
22 #pragma once
23 
24 #include <luabind/luabind.hpp>
25 #include <luabind/object.hpp>
26 
27 #include "../../../engine/Script/Handlers.h"
28 #include "../../../engine/Script/Peer.h"
29 
30 #include "HudPeer.h"
31 
32 namespace HoverRace {
33  namespace Client {
34  namespace HoverScript {
35  class MetaPlayer;
36  class SessionPeer;
37  }
38  }
39  namespace MainCharacter {
40  class MainCharacter;
41  }
42  namespace Player {
43  class Player;
44  }
45  namespace Script {
46  class Core;
47  }
48 }
49 
50 namespace HoverRace {
51 namespace Client {
52 namespace HoverScript {
53 
58 class PlayerPeer : public Script::Peer {
60 
61 public:
62  PlayerPeer(Script::Core &scripting, std::shared_ptr<Player::Player> player);
63  virtual ~PlayerPeer() { }
64 
65 public:
66  static void Register(Script::Core &scripting);
67 
68 public:
69  Player::Player *GetPlayer() const { return player.get(); }
70 
71  void SetMeta(MetaPlayer *meta) { this->meta = meta; }
72  void SetHud(std::shared_ptr<HudPeer> hud);
73 
74 protected:
75  MainCharacter::MainCharacter *VerifyAttached() const;
76 
77 public:
78  void LFinish();
79 
80  double LGetFuel() const;
81 
82  std::shared_ptr<HudPeer> LGetHud() const;
83 
84  int LGetIndex() const;
85 
86  const std::string &LGetName() const;
87 
88  void LGetPos();
89 
90 private:
91  std::shared_ptr<Player::Player> player;
93  std::shared_ptr<HudPeer> hud;
94 };
95 
96 } // namespace HoverScript
97 } // namespace Client
98 } // namespace HoverRace
void LGetPos(const FreeElement &actor, lua_State *L)
Definition: ElemBinding.cpp:52
virtual ~PlayerPeer()
Definition: PlayerPeer.h:63
Player::Player * GetPlayer() const
Definition: PlayerPeer.h:69
std::shared_ptr< HudPeer > hud
Definition: PlayerPeer.h:93
Scripting peer for players (main characters).
Definition: PlayerPeer.h:58
Native base class for scripted players.
Definition: MetaPlayer.h:41
Base class for script peers.
Definition: Peer.h:47
void SetMeta(MetaPlayer *meta)
Definition: PlayerPeer.h:71
Definition: Announcement.h:24
Base class for connected players.
Definition: Player.h:49
Definition: MainCharacter.h:62
std::shared_ptr< Player::Player > player
Definition: PlayerPeer.h:91
MetaPlayer * meta
Definition: PlayerPeer.h:92
A script environment.
Definition: Core.h:66