feat: added player_spawned signal to GameRoot
parent
b75c0006d6
commit
d095d9f2de
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue