Skip to content
This repository has been archived by the owner on Mar 3, 2021. It is now read-only.

Commit

Permalink
Remove SetInfectedAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
js6pak committed Mar 1, 2021
1 parent c09b86c commit a3a9de8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 31 deletions.
8 changes: 0 additions & 8 deletions src/Impostor.Api/Games/IGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Impostor.Api.Innersloth;
using Impostor.Api.Net;
using Impostor.Api.Net.Inner;
using Impostor.Api.Net.Inner.Objects;
using Impostor.Api.Net.Messages;

namespace Impostor.Api.Games
Expand Down Expand Up @@ -56,13 +55,6 @@ public interface IGame
/// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
ValueTask SyncSettingsAsync();

/// <summary>
/// Sets the specified list as Impostor on all connected players.
/// </summary>
/// <param name="players">List of players to be Impostor.</param>
/// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
ValueTask SetInfectedAsync(IEnumerable<IInnerPlayerControl> players);

/// <summary>
/// Send the message to all players.
/// </summary>
Expand Down
24 changes: 1 addition & 23 deletions src/Impostor.Server/Net/State/Game.Api.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
using System.Collections.Generic;
using System.IO;
using System.IO;
using System.Net;
using System.Threading.Tasks;
using Impostor.Api;
using Impostor.Api.Games;
using Impostor.Api.Innersloth;
using Impostor.Api.Net;
using Impostor.Api.Net.Inner;
using Impostor.Api.Net.Inner.Objects;
using Impostor.Server.Net.Inner;

namespace Impostor.Server.Net.State
Expand Down Expand Up @@ -46,25 +44,5 @@ public async ValueTask SyncSettingsAsync()
await FinishRpcAsync(writer);
}
}

public async ValueTask SetInfectedAsync(IEnumerable<IInnerPlayerControl> players)
{
if (Host.Character == null)
{
throw new ImpostorException("Attempted to set infected when the host was not spawned.");
}

using (var writer = StartRpc(Host.Character.NetId, RpcCalls.SetInfected))
{
writer.Write((byte)Host.Character.NetId);

foreach (var player in players)
{
writer.Write((byte)player.PlayerId);
}

await FinishRpcAsync(writer);
}
}
}
}

0 comments on commit a3a9de8

Please sign in to comment.