mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 19:09:25 +02:00
multiplayer: fix the black screen - a cab and is_ready waiting on each other
The renderer draws nothing at all while simulation::is_ready is false, and that flag only goes up once the local player's cab is built. The previous commit made walking into a cab a crew request, so the cab of a claimed vehicle is created by Crews::reconcile() rather than by the command itself. reconcile() runs from the network housekeeping, which was gated on simulation::is_ready - so a host started with -v had its entervehicle turned into a claim, and then the cab waited for is_ready while is_ready waited for the cab. Black screen on both ends, since a client whose server never gets going has nothing to show either. - the housekeeping now waits for Global.simulation_loaded, which says the world exists, instead of simulation::is_ready, which says the player has a cab - in a session, a player with no cab counts as ready: they are an observer in the lobby, not a game still loading, and the world has to be drawn for them - entervehicle is only taken as a crew request when the session actually lists that vehicle; anything else stays an ordinary command, so a scenario that starts its host in something the roster does not cover still works
This commit is contained in:
@@ -120,10 +120,12 @@ void filter_commands(PeerId Peer, command_queue::commands_map &Commands)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (command->command == user_command::entervehicle)
|
||||
if ((command->command == user_command::entervehicle) && (Entities.id_of(command->payload) != ENTITY_NONE))
|
||||
{
|
||||
// the local player walked into a cab. that is a crew request; the cab
|
||||
// itself is built by the authority once the seat is granted
|
||||
// itself is built by the authority once the seat is granted.
|
||||
// a vehicle the session does not list falls through to the ordinary path,
|
||||
// so a scenario that starts its host in something unusual still works
|
||||
NetworkEntityId entity{ENTITY_NONE};
|
||||
auto const result = claim_by_name(Peer, command->payload, entity);
|
||||
if (result != claim_result::granted && result != claim_result::already_member)
|
||||
|
||||
Reference in New Issue
Block a user