コード例 #1
0
ファイル: VentPatch.cs プロジェクト: webfussel/AmongUsMegaMod
        public static void Postfix(PlayerControl NMEAPOJFNKA)
        {
            PlayerVentTimeExtension.SetLastVent(NMEAPOJFNKA.PlayerId);

            if (TryGetSpecialRole(PlayerControl.LocalPlayer.PlayerId, out Seer seer))
            {
                seer.SendChatMessage(Seer.MessageType.ExitedVent);
            }
        }
コード例 #2
0
ファイル: VentPatch.cs プロジェクト: webfussel/AmongUsMegaMod
        public static bool Prefix(Vent __instance, ref float __result, [HarmonyArgument(0)] GameData.PlayerInfo pc, [HarmonyArgument(1)] out bool canUse, [HarmonyArgument(2)] out bool couldUse)
        {
            float         num         = float.MaxValue;
            PlayerControl localPlayer = pc.Object;

            if (SpecialRoleIsAssigned(out KeyValuePair <byte, Engineer> engineerKvp))
            {
                couldUse = (engineerKvp.Value.player.PlayerId == PlayerControl.LocalPlayer.PlayerId || localPlayer.Data.IsImpostor) && !localPlayer.Data.IsDead;
            }
            else
            {
                couldUse = localPlayer.Data.IsImpostor && !localPlayer.Data.IsDead;
            }
            canUse = couldUse;
            if ((DateTime.UtcNow - PlayerVentTimeExtension.GetLastVent(pc.Object.PlayerId)).TotalMilliseconds > 1000)
            {
                num     = Vector2.Distance(localPlayer.GetTruePosition(), __instance.transform.position);
                canUse &= num <= __instance.UsableDistance;
            }
            __result = num;
            return(false);
        }