feat: added player_spawned signal to GameRoot

stripped
Sara 2024-03-21 22:50:49 +01:00
parent b75c0006d6
commit d095d9f2de
1 changed files with 2 additions and 0 deletions

View File

@ -21,6 +21,7 @@ void GameRoot::_bind_methods() {
GDFUNCTION(reset_game_mode); GDFUNCTION(reset_game_mode);
GDSIGNAL("player_connected", PropertyInfo(Variant::OBJECT, "player_input", PROPERTY_HINT_NODE_TYPE, "PlayerInput")); GDSIGNAL("player_connected", PropertyInfo(Variant::OBJECT, "player_input", PROPERTY_HINT_NODE_TYPE, "PlayerInput"));
GDSIGNAL("player_disconnected", PropertyInfo(Variant::OBJECT, "player_input", PROPERTY_HINT_NODE_TYPE, "PlayerInput")); GDSIGNAL("player_disconnected", PropertyInfo(Variant::OBJECT, "player_input", PROPERTY_HINT_NODE_TYPE, "PlayerInput"));
GDSIGNAL("player_spawned", PropertyInfo(Variant::OBJECT, "player_info", PROPERTY_HINT_NODE_TYPE, "Node"));
} }
GameRoot *GameRoot::get_singleton() { GameRoot *GameRoot::get_singleton() {
@ -84,6 +85,7 @@ bool GameRoot::initialize_player(IPlayer *player, uint32_t id) {
player->player_id = id; player->player_id = id;
this->add_child(player->to_node()); this->add_child(player->to_node());
player->setup_player_input(found.first); player->setup_player_input(found.first);
this->emit_signal("player_spawned", player->to_node());
return true; return true;
} }