Fix "respawn" code when falling too low

main
copygirl 5 years ago
parent 5b4890e136
commit 4962f514e0
  1. 13
      src/Player.cs

@ -40,17 +40,16 @@ public class Player : KinematicBody2D, IInitializer
public override void _Process(float delta) public override void _Process(float delta)
{ {
if (Network.IsAuthoratative && (Position.y > 9000)) {
Position = Vector2.Zero;
if (this is LocalPlayer localPlayer) localPlayer.Velocity = Vector2.Zero;
else Network.API.SendTo(this, new PositionChangedPacket(this), TransferMode.Reliable);
}
if (Network.IsMultiplayerReady) { if (Network.IsMultiplayerReady) {
if (Network.IsServer) Network.API.SendToEveryoneExcept(this, new PositionChangedPacket(this)); if (Network.IsServer) Network.API.SendToEveryoneExcept(this, new PositionChangedPacket(this));
else if (IsLocal) Network.API.SendToServer(new MovePacket(Position)); else if (IsLocal) Network.API.SendToServer(new MovePacket(Position));
} }
if (Network.IsAuthoratative && (Position.y > 9000)) {
if (this is LocalPlayer localPlayer) {
localPlayer.Position = Vector2.Zero;
localPlayer.Velocity = Vector2.Zero;
} else Network.API.SendTo(this, new PositionChangedPacket(this));
}
} }

Loading…
Cancel
Save