| 1564 | } |
| 1565 | |
| 1566 | void MpLevelHandler::HandlePlayerMorphTo(Actors::Player* player, PlayerType type) |
| 1567 | { |
| 1568 | // TODO: Only called by PlayerOnServer |
| 1569 | if (_isServer) { |
| 1570 | auto* mpPlayer = static_cast<MpPlayer*>(player); |
| 1571 | auto peerDesc = mpPlayer->GetPeerDescriptor(); |
| 1572 | |
| 1573 | String metadataPath = fs::FromNativeSeparators(mpPlayer->_metadata->Path); |
| 1574 | |
| 1575 | MemoryStream packet(9 + metadataPath.size()); |
| 1576 | packet.WriteVariableUint32(mpPlayer->_playerIndex); |
| 1577 | packet.WriteValue<std::uint8_t>(0); // Flags (Reserved) |
| 1578 | packet.WriteVariableUint32((std::uint32_t)metadataPath.size()); |
| 1579 | packet.Write(metadataPath.data(), (std::uint32_t)metadataPath.size()); |
| 1580 | _networkManager->SendTo([otherPeer = peerDesc->RemotePeer](const Peer& peer) { |
| 1581 | return (peer != otherPeer); |
| 1582 | }, NetworkChannel::Main, (std::uint8_t)ServerPacketType::ChangeRemoteActorMetadata, packet); |
| 1583 | |
| 1584 | if (peerDesc->RemotePeer) { |
| 1585 | MemoryStream packet2(6); |
| 1586 | packet2.WriteValue<std::uint8_t>((std::uint8_t)PlayerPropertyType::PlayerType); |
| 1587 | packet2.WriteVariableUint32(mpPlayer->_playerIndex); |
| 1588 | packet2.WriteValue<std::uint8_t>((std::uint8_t)type); |
| 1589 | _networkManager->SendTo(peerDesc->RemotePeer, NetworkChannel::Main, (std::uint8_t)ServerPacketType::PlayerSetProperty, packet2); |
| 1590 | } |
| 1591 | } |
| 1592 | } |
| 1593 | |
| 1594 | void MpLevelHandler::HandlePlayerSetDizzy(Actors::Player* player, float timeLeft) |
| 1595 | { |
no test coverage detected