public ProtocolController() { allDoors = Map.Doors.ToList();; foreach (Door door in allDoors) { switch (door.DoorName) { case ("GATE_A"): GateA = door; break; case ("GATE_B"): GateB = door; break; case ("CHECKPOINT_ENT"): CheckpointEZ = door; break; case ("CHECKPOINT_LCZ_A"): CheckpointA = door; break; case ("CHECKPOINT_LCZ_B"): CheckpointB = door; break; } } alpha = AlphaWarheadController.Host; alphaPanel = UnityEngine.Object.FindObjectOfType <AlphaWarheadNukesitePanel>(); }
private static bool Prefix(AlphaWarheadController __instance) { if (Recontainer079.isLocked) { return(false); } __instance.doorsOpen = false; ServerLogs.AddLog(ServerLogs.Modules.Warhead, "Countdown started.", ServerLogs.ServerLogType.GameEvent); if ((AlphaWarheadController._resumeScenario != -1 || __instance.scenarios_start[AlphaWarheadController._startScenario].SumTime() != (double)__instance.timeToDetonation) && (AlphaWarheadController._resumeScenario == -1 || __instance.scenarios_resume[AlphaWarheadController._resumeScenario].SumTime() != (double)__instance.timeToDetonation)) { return(false); } var ev = new StartingEventArgs(API.Features.Server.Host); Warhead.OnStarting(ev); if (!ev.IsAllowed) { return(false); } __instance.NetworkinProgress = true; return(false); }
public static bool Prefix(AlphaWarheadController __instance, GameObject disabler) { try { ServerLogs.AddLog(ServerLogs.Modules.Warhead, "Detonation cancelled.", ServerLogs.ServerLogType.GameEvent); if (!__instance.inProgress || __instance.timeToDetonation <= 10.0) { return(false); } if (__instance.timeToDetonation <= 15.0 && disabler != null) { __instance.GetComponent <PlayerStats>().TargetAchieve(disabler.GetComponent <NetworkIdentity>().connectionToClient, "thatwasclose"); } bool allow = true; Events.InvokeWarheadCancel(disabler, ref allow); return(allow && !EventPlugin.WarheadLocked); } catch (Exception exception) { Log.Error($"WarheadCancelledEvent error: {exception}"); return(true); } }
public static void Prefix(AlphaWarheadController __instance) { try { Events.InvokeWarheadDetonation(); } catch (Exception exception) { Log.Error($"WarheadDetonationEvent error: {exception}"); } }
public static void TriggerEvent(AlphaWarheadController ccm) { foreach (var type in types_update) { if (LabMod.GetObjectOfType(type) == null) { continue; } ((ILabModAlphaWarheadDetonate)LabMod.GetObjectOfType(type)).Event(ccm); } }
public void UnLock() { AlphaWarheadController[] WarheadController = Object.FindObjectsOfType <AlphaWarheadController>(); for (int k = 0; k < WarheadController.Length; k++) { AlphaWarheadController alphaWarheadController = WarheadController[k]; if (alphaWarheadController != null) { alphaWarheadController.SetLocked(false); } } }
public void Stop() { AlphaWarheadController[] WarheadController = Object.FindObjectsOfType <AlphaWarheadController>(); for (int j = 0; j < WarheadController.Length; j++) { AlphaWarheadController alphaWarheadController = WarheadController[j]; if (alphaWarheadController != null) { alphaWarheadController.CancelDetonation(); } } }
private static bool CancelDetonation(AlphaWarheadController __instance, GameObject disabler) { try { if (!__instance.inProgress || __instance.timeToDetonation <= 10.0 || __instance._isLocked) { return(true); } SynapseController.Server.Events.Map.InvokeWarheadDetonationCanceledEvent(out bool allow, ref disabler); return(allow); } catch (Exception e) { SynapseController.Server.Logger.Error($"Synapse-Event: WarheadDetonation failed!!\n{e}"); return(true); } }
public static void Postfix(AlphaWarheadController __instance) { Log.Debug($"[StartWarheadPatch] inprogess:{__instance.NetworkinProgress}"); if (Configs.cassie_subtitle && __instance.NetworkinProgress) { bool isresumed = AlphaWarheadController._resumeScenario != -1; double left = isresumed ? __instance.timeToDetonation : __instance.timeToDetonation - 4; double count = Math.Truncate(left / 10.0) * 10.0; if (!isresumed) { Methods.SendSubtitle(Subtitles.AlphaWarheadStart.Replace("{0}", count.ToString()), 15); } else { Methods.SendSubtitle(Subtitles.AlphaWarheadResume.Replace("{0}", count.ToString()), 10); } } }
private static bool Prefix(AlphaWarheadController __instance, GameObject disabler) { ServerLogs.AddLog(ServerLogs.Modules.Warhead, "Detonation cancelled.", ServerLogs.ServerLogType.GameEvent); if (!__instance.inProgress || __instance.timeToDetonation <= 10.0) { return(false); } if (__instance.timeToDetonation <= 15.0 && disabler != null) { __instance.GetComponent <PlayerStats>().TargetAchieve(disabler.GetComponent <NetworkIdentity>().connectionToClient, "thatwasclose"); } var ev = new StoppingEventArgs(API.Features.Player.Get(disabler) ?? API.Features.Server.Host); Warhead.OnStopping(ev); return(ev.IsAllowed && !API.Features.Warhead.IsWarheadLocked); }
public static bool Prefix(AlphaWarheadController __instance) { if (EventPlugin.WarheadStartEventPatchDisable) { return(true); } try { if (Recontainer079.isLocked) { return(false); } __instance.doorsOpen = false; ServerLogs.AddLog(ServerLogs.Modules.Warhead, "Countdown started.", ServerLogs.ServerLogType.GameEvent); if ((AlphaWarheadController._resumeScenario != -1 || __instance.scenarios_start[AlphaWarheadController._startScenario].SumTime() != (double)__instance.timeToDetonation) && (AlphaWarheadController._resumeScenario == -1 || __instance.scenarios_resume[AlphaWarheadController._resumeScenario].SumTime() != (double)__instance.timeToDetonation)) { return(false); } bool allow = true; Events.InvokeWarheadStart(null, ref allow); if (allow) { __instance.NetworkinProgress = true; } return(false); } catch (Exception exception) { Log.Error($"WarheadStartEvent error: {exception}"); return(true); } }
private static void AlphaWarheadController_Detonate(On.AlphaWarheadController.orig_Detonate orig, AlphaWarheadController self) { var evnt = new WarheadDetonateEvent(); EventManager.Manager.HandleEvent <IEventHandlerWarheadDetonate>(evnt); orig(self); }
/// <summary> /// Detonates the nuke. /// </summary> public static void DetonateNuke() => AlphaWarheadController.Detonate();
/// <summary> /// Stops the nuke. /// </summary> public static void StopNuke() => AlphaWarheadController.CancelDetonation();
/// <summary> /// Starts the nuke. /// </summary> public static void StartNuke() { AlphaWarheadController.InstantPrepare(); AlphaWarheadController.StartDetonation(); }
/// <summary> /// Starts the nuke. /// </summary> public static void StartNuke() => AlphaWarheadController.StartDetonation();