feat: implemented GameRoot::player_disconnected
parent
78c94e52f2
commit
f8f92c1513
|
@ -50,6 +50,12 @@ void GameRoot::player_connected() {
|
||||||
this->emit_signal(StringName("player_connected"), input);
|
this->emit_signal(StringName("player_connected"), input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameRoot::player_disconnected(uint32_t player_id) {
|
||||||
|
if(!this->players.has(player_id))
|
||||||
|
return;
|
||||||
|
this->players.get(player_id).second = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool GameRoot::initialize_player(IPlayer *player, uint32_t id) {
|
bool GameRoot::initialize_player(IPlayer *player, uint32_t id) {
|
||||||
Pair<PlayerInput*, IPlayer*> &found{this->players.get(id)};
|
Pair<PlayerInput*, IPlayer*> &found{this->players.get(id)};
|
||||||
this->add_child(player->to_node());
|
this->add_child(player->to_node());
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
virtual void _exit_tree() override;
|
virtual void _exit_tree() override;
|
||||||
|
|
||||||
void player_connected();
|
void player_connected();
|
||||||
void player_disconnected();
|
void player_disconnected(uint32_t player_id);
|
||||||
bool initialize_player(IPlayer *player, uint32_t id);
|
bool initialize_player(IPlayer *player, uint32_t id);
|
||||||
|
|
||||||
void reset_game_mode();
|
void reset_game_mode();
|
||||||
|
|
Loading…
Reference in New Issue