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); }
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); } } } } } }
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); }