static bool Prefix(MapRoom __instance, float DCEFKAOFGOG)
 {
     if (EngineerPlayer.IsPlayerEngineer(PlayerControl.LocalPlayer))
     {
         return(false);
     }
     return(true);
 }
 static void Prefix()
 {
     if (EngineerPlayer.IsPlayerEngineer(PlayerControl.LocalPlayer))
     {
         DestroyableSingleton <HudManager> .Instance.ShowMap((Action <MapBehaviour>) delegate(MapBehaviour m)
         {
             m.ShowInfectedMap();
             m.ColorControl.baseColor = EngineerRole.sabotageActive ? Color.gray : EngineerConfig.engineerColor;
         });
     }
 }
 static bool Prefix(MapRoom __instance)
 {
     if (EngineerPlayer.IsPlayerEngineer(PlayerControl.LocalPlayer) && EngineerPlayer.GetEngineerFromPlayer(PlayerControl.LocalPlayer).canRepair&& EngineerRole.sabotageActive)
     {
         EngineerPlayer.GetEngineerFromPlayer(PlayerControl.LocalPlayer).lastRepair = DateTime.UtcNow;
         ShipStatus.Instance.RpcRepairSystem(SystemTypes.Reactor, 16);
         return(false);
     }
     else if (EngineerPlayer.IsPlayerEngineer(PlayerControl.LocalPlayer))
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 4
0
 static void Postfix(IntroCutscene.CoBegin__d __instance)
 {
     foreach (EngineerPlayer engineer in EngineerPlayer.allEngineers)
     {
         engineer.lastRepair = DateTime.UtcNow;
     }
     if (EngineerPlayer.IsPlayerEngineer(PlayerControl.LocalPlayer))
     {
         __instance.__this.Title.Text                   = "Engineer";
         __instance.__this.Title.Color                  = EngineerConfig.engineerColor;
         __instance.__this.ImpostorText.Text            = "Maintain important systems on the ship";
         __instance.__this.BackgroundBar.material.color = EngineerConfig.engineerColor;
     }
 }
 static void Postfix(MapBehaviour __instance)
 {
     if (EngineerPlayer.IsPlayerEngineer(PlayerControl.LocalPlayer))
     {
         if (__instance.IsOpen && __instance.infectedOverlay.gameObject.active)
         {
             if (!EngineerRole.sabotageActive)
             {
                 __instance.ColorControl.baseColor = Color.gray;
             }
             else
             {
                 __instance.ColorControl.baseColor = EngineerConfig.engineerColor;
             }
             long  lastRepairTicks  = EngineerPlayer.GetEngineerFromPlayer(PlayerControl.LocalPlayer).lastRepair.Ticks;
             long  dateTimeNowTicks = DateTime.UtcNow.Ticks;
             float perc             = (dateTimeNowTicks - lastRepairTicks) / (TimeSpan.TicksPerSecond * EngineerConfig.engineerCooldown);
             if (perc > 1f)
             {
                 EngineerPlayer.GetEngineerFromPlayer(PlayerControl.LocalPlayer).canRepair = true;
             }
             foreach (MapRoom room in __instance.infectedOverlay.rooms)
             {
                 if (room.special != null)
                 {
                     if (!EngineerRole.sabotageActive)
                     {
                         room.special.material.SetFloat("_Desat", 1f);
                     }
                     else
                     {
                         room.special.material.SetFloat("_Desat", 0f);
                     }
                     room.special.enabled = true;
                     room.special.gameObject.SetActive(true);
                     room.special.gameObject.active = true;
                     if (!PlayerControl.LocalPlayer.Data.IsDead)
                     {
                         room.special.material.SetFloat("_Percent", 1f - perc);
                     }
                     else
                     {
                         room.special.material.SetFloat("_Percent", 1f);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 6
0
        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;

            couldUse = (EngineerPlayer.IsPlayerEngineer(PlayerControl.LocalPlayer) || 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);
        }
 static bool Prefix(MapRoom __instance)
 {
     if (EngineerPlayer.IsPlayerEngineer(PlayerControl.LocalPlayer) && EngineerPlayer.GetEngineerFromPlayer(PlayerControl.LocalPlayer).canRepair&& EngineerRole.sabotageActive)
     {
         System.Console.WriteLine(EngineerPlayer.GetEngineerFromPlayer(PlayerControl.LocalPlayer).canRepair);
         EngineerPlayer.GetEngineerFromPlayer(PlayerControl.LocalPlayer).lastRepair = DateTime.UtcNow;
         ShipStatus.Instance.RpcRepairSystem(SystemTypes.LifeSupp, 0 | 64);
         ShipStatus.Instance.RpcRepairSystem(SystemTypes.LifeSupp, 1 | 64);
         return(false);
     }
     else if (EngineerPlayer.IsPlayerEngineer(PlayerControl.LocalPlayer))
     {
         return(false);
     }
     return(true);
 }
 static bool Prefix(MapRoom __instance)
 {
     if (EngineerPlayer.IsPlayerEngineer(PlayerControl.LocalPlayer) && EngineerPlayer.GetEngineerFromPlayer(PlayerControl.LocalPlayer).canRepair&& EngineerRole.sabotageActive)
     {
         System.Console.WriteLine(EngineerPlayer.GetEngineerFromPlayer(PlayerControl.LocalPlayer).canRepair);
         EngineerPlayer.GetEngineerFromPlayer(PlayerControl.LocalPlayer).lastRepair = DateTime.UtcNow;
         SwitchSystem switchSystem = ShipStatus.Instance.Systems[SystemTypes.Electrical].Cast <SwitchSystem>();
         switchSystem.ActualSwitches = switchSystem.ExpectedSwitches;
         MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)RPC.CustomRPC.FixLights, Hazel.SendOption.None, -1);
         AmongUsClient.Instance.FinishRpcImmediately(writer);
         return(false);
     }
     else if (EngineerPlayer.IsPlayerEngineer(PlayerControl.LocalPlayer))
     {
         return(false);
     }
     return(true);
 }
 static void Postfix(MapBehaviour __instance)
 {
     if (EngineerPlayer.IsPlayerEngineer(PlayerControl.LocalPlayer))
     {
         if (__instance.IsOpen)
         {
             __instance.ColorControl.baseColor = EngineerConfig.engineerColor;
             foreach (MapRoom room in __instance.infectedOverlay.rooms)
             {
                 if (room.door != null)
                 {
                     room.door.enabled = false;
                     room.door.gameObject.SetActive(false);
                     room.door.gameObject.active = false;
                 }
             }
         }
     }
 }
Exemplo n.º 10
0
        static void Postfix(HudManager __instance)
        {
            if (AmongUsClient.Instance.GameState == InnerNetClient.GameStates.Started)
            {
                bool sabotageActive = false;
                foreach (PlayerTask task in PlayerControl.LocalPlayer.myTasks)
                {
                    if (task.TaskType == TaskTypes.FixLights || task.TaskType == TaskTypes.RestoreOxy || task.TaskType == TaskTypes.ResetReactor || task.TaskType == TaskTypes.ResetSeismic || task.TaskType == TaskTypes.FixComms)
                    {
                        sabotageActive = true;
                    }
                }
                EngineerRole.sabotageActive = sabotageActive;

                if (EngineerPlayer.IsPlayerEngineer(PlayerControl.LocalPlayer) || EngineerConfig.showEngineers)
                {
                    foreach (EngineerPlayer engineer in EngineerPlayer.allEngineers)
                    {
                        engineer.engineerControl.nameText.Color = EngineerConfig.engineerColor;
                    }
                    if (MeetingHud.Instance != null)
                    {
                        foreach (PlayerVoteArea player in MeetingHud.Instance.playerStates)
                        {
                            if (EngineerPlayer.IsPlayerEngineer(PlayerTools.getPlayerFromId((byte)player.TargetPlayerId)))
                            {
                                player.NameText.Color = EngineerConfig.engineerColor;
                            }
                        }
                    }
                }

                if (EngineerPlayer.IsPlayerEngineer(PlayerControl.LocalPlayer) && __instance.UseButton.isActiveAndEnabled)
                {
                    __instance.KillButton.gameObject.SetActive(true);
                    __instance.KillButton.isActive = true;
                    __instance.KillButton.SetCoolDown(0f, 30f);
                    __instance.KillButton.renderer.sprite = repairIco;
                    __instance.KillButton.renderer.color  = Palette.EnabledColor;
                    __instance.KillButton.renderer.material.SetFloat("_Desat", 0f);
                }
            }
        }