feat: implemented GameRoot::player_disconnected

stripped
Sara 2024-03-16 20:56:26 +01:00
parent 78c94e52f2
commit f8f92c1513
2 changed files with 7 additions and 1 deletions

View File

@ -50,6 +50,12 @@ void GameRoot::player_connected() {
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) {
Pair<PlayerInput*, IPlayer*> &found{this->players.get(id)};
this->add_child(player->to_node());

View File

@ -27,7 +27,7 @@ public:
virtual void _exit_tree() override;
void player_connected();
void player_disconnected();
void player_disconnected(uint32_t player_id);
bool initialize_player(IPlayer *player, uint32_t id);
void reset_game_mode();