Some mods add extra vents that don't yet exist, this commit checks if a
given vent exists and if it doesn't, throw an AC violation instead of
disconnecting the player
One downside is that the Enter/ExitVent events are no longer called, but
this would require the vent in that event to become nullable
using System;
using System.Threading.Tasks;
using Impostor.Api.Events.Managers;
+using Impostor.Api.Innersloth;
using Impostor.Api.Net;
using Impostor.Api.Net.Custom;
using Impostor.Api.Net.Inner;
throw new ArgumentOutOfRangeException(nameof(call), call, null);
}
- var vent = Game.GameNet.ShipStatus!.Data.Vents[ventId];
+ if (!Game.GameNet.ShipStatus!.Data.Vents.TryGetValue(ventId, out var vent))
+ {
+ if (await sender.Client.ReportCheatAsync(call, "Client interacted with nonexistent vent"))
+ {
+ return false;
+ }
+
+ break;
+ }
switch (call)
{