/* * A poorly timed movement packet will cause major problems when docking because the remote * player will think that the player is no longer in a vehicle. Unfortunetly, the game calls * the vehicle exit code before the animation completes so we need to suppress any side affects. * Two thing we want to protect against: * * 1) If a movement packet is received when docking, the player might exit the vehicle early * and it will show them sitting outside the vehicle during the docking animation. * * 2) If a movement packet is received when undocking, the player game object will be stuck in * place until after the player exits the vehicle. This causes the player body to strech to * the current cyclops position. */ public IEnumerator AllowMovementPacketsAfterDockingAnimation(PacketSuppressor <Movement> movementSuppressor, PacketSuppressor <VehicleMovement> vehicleMovementSuppressor) { yield return(new WaitForSeconds(3.0f)); movementSuppressor.Dispose(); vehicleMovementSuppressor.Dispose(); }
public static void Postfix(PacketSuppressor <ItemContainerRemove> __state) { if (__state != null) { __state.Dispose(); } }
public void BroadcastVehicleUndocking(VehicleDockingBay dockingBay, Vehicle vehicle, bool undockingStart) { NitroxId dockId; if (dockingBay.GetSubRoot() is BaseRoot) { dockId = NitroxEntity.GetId(dockingBay.GetComponentInParent <BaseRoot>().gameObject); } else if (dockingBay.GetSubRoot() is SubRoot) { dockId = NitroxEntity.GetId(dockingBay.GetSubRoot().gameObject); } else { dockId = NitroxEntity.GetId(dockingBay.GetComponentInParent <ConstructableBase>().gameObject); } NitroxId vehicleId = NitroxEntity.GetId(vehicle.gameObject); ushort playerId = multiplayerSession.Reservation.PlayerId; PacketSuppressor <Movement> movementSuppressor = packetSender.Suppress <Movement>(); PacketSuppressor <VehicleMovement> vehicleMovementSuppressor = packetSender.Suppress <VehicleMovement>(); if (!undockingStart) { movementSuppressor.Dispose(); vehicleMovementSuppressor.Dispose(); } VehicleUndocking packet = new VehicleUndocking(vehicleId, dockId, playerId, undockingStart); packetSender.Send(packet); }
public void BroadcastVehicleUndocking(VehicleDockingBay dockingBay, Vehicle vehicle, bool undockingStart) { NitroxId dockId = NitroxEntity.GetId(dockingBay.gameObject); NitroxId vehicleId = NitroxEntity.GetId(vehicle.gameObject); ushort playerId = multiplayerSession.Reservation.PlayerId; PacketSuppressor <Movement> movementSuppressor = packetSender.Suppress <Movement>(); PacketSuppressor <VehicleMovement> vehicleMovementSuppressor = packetSender.Suppress <VehicleMovement>(); if (!undockingStart) { movementSuppressor.Dispose(); vehicleMovementSuppressor.Dispose(); } VehicleUndocking packet = new VehicleUndocking(vehicleId, dockId, playerId, undockingStart); packetSender.Send(packet); }
/* A poorly timed movement packet will cause major problems when docking because the remote player will think that the player is no longer in a vehicle. Unfortunetly, the game calls the vehicle exit code before the animation completes so we need to suppress any side affects. Two thing we want to protect against: 1) If a movement packet is received when docking, the player might exit the vehicle early and it will show them sitting outside the vehicle during the docking animation. 2) If a movement packet is received when undocking, the player game object will be stuck in place until after the player exits the vehicle. This causes the player body to strech to the current cyclops position. */ IEnumerator AllowMovementPacketsAfterDockingAnimation(PacketSuppressor<Movement> movementSuppressor) { yield return new WaitForSeconds(3.0f); movementSuppressor.Dispose(); }