예제 #1
0
        public void OnRoundStart()
        {
            Map.Broadcast(Plugin.Instance.Config.StartEvnet, $"");
            foreach (Door door in Map.Doors)
            {
                door.locked = true;
            }
            Timing.WaitForSeconds(Plugin.Instance.Config.StartEvnet);
            Warhead.Start();
            Map.Broadcast(5, Plugin.Instance.Config.eventstart);
            if (Plugin.Instance.Config.Warheadlock == true)
            {
                Warhead.IsLocked = true;
            }
            else
            {
                Warhead.IsLocked = false;
            }

            foreach (Door door in Map.Doors)
            {
                door.locked = false;
            }

            for (;;)
            {
                if (Warhead.IsDetonated == true)
                {
                    Map.Broadcast(5, Plugin.Instance.Config.eventend);
                    Timing.WaitForSeconds(10f);
                    RoundSummary.RoundLock = false;
                    RoundSummary.singleton.ForceEnd();
                }
            }
        }
예제 #2
0
        public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response)
        {
            if (!(sender as CommandSender).CheckPermission("ct.nuke"))
            {
                response = "You do not have permission to run this command! Missing permission: \"ct.nuke\"";
                return(false);
            }

            if (arguments.Count != 1)
            {
                response = "Usage: nuke start (value)";
                return(false);
            }

            if (!float.TryParse(arguments.At(0), out float nukeTimer) || (nukeTimer < 0.05 || nukeTimer > 142))
            {
                response = $"Invalid value for nuke timer: {arguments.At(0)}";
                return(false);
            }

            Warhead.Start();
            Warhead.DetonationTimer = nukeTimer;
            response = $"The warhead has started at {nukeTimer} seconds";
            return(true);
        }
 public static void Postfix(Scp018Grenade __instance)
 {
     if (CreativeToolbox.ConfigRef.Config.EnableScp018WarheadBounce)
     {
         Warhead.Start();
         Warhead.DetonationTimer = 0.05f;
     }
 }
예제 #4
0
        private IEnumerator <float> AutoNuke()
        {
            yield return(Timing.WaitForSeconds(1500f));

            Warhead.Start();
            Warhead.IsLocked = true;
            Map.Broadcast(10, $"<size=50><color=red>자동핵</color>이(가) <color=red>활성화</color> 되었습니다.</color></size>");
        }
        public static void Postfix(Scp018Grenade __instance)
        {
            if (!Instance.Config.EnableScp018WarheadBounce)
            {
                return;
            }

            Warhead.Start();
            Warhead.DetonationTimer = 0.05f;
        }
예제 #6
0
 internal void OnRoundStarted()
 {
     coroutine = Timing.CallDelayed(Autonuke.instance.Config.TimeUntilStart, () =>
     {
         if (!Warhead.IsInProgress)
         {
             Warhead.Start();
         }
         isAutoNukeGoingOff = true;
     });
 }
예제 #7
0
 public override void Process(Npc npc, Player player, Dictionary <string, string> args)
 {
     if (bool.Parse(args["instant"]))
     {
         Warhead.Detonate();
     }
     else
     {
         Warhead.Start();
     }
     Warhead.IsLocked = bool.Parse(args["lock"]);
 }
예제 #8
0
        public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response)
        {
            if (!(sender as CommandSender).CheckPermission("ct.nuke"))
            {
                response = "You do not have permission to run this command! Missing permission: \"ct.nuke\"";
                return(false);
            }

            if (arguments.Count != 0)
            {
                response = "Usage: nuke instant";
                return(false);
            }

            Warhead.Start();
            Warhead.DetonationTimer = 0.05f;
            response = "The warhead has exploded now";
            return(true);
        }
예제 #9
0
        public void RunWhenWarheadIsStopped(StoppingEventArgs ev)
        {
            if (!Instance.Config.EnableWarheadDetonationWhenCanceledChance || _isWarheadDetonated)
            {
                return;
            }

            int newChance = _randNum.Next(0, 100);

            if (newChance >= Instance.Config.InstantWarheadDetonationChance)
            {
                return;
            }

            Warhead.Start();
            Warhead.DetonationTimer = 0.05f;
            if (!Instance.Config.PreventCtBroadcasts)
            {
                Map.Broadcast(5,
                              "<color=red>Someone tried to disable the warhead but pressed the wrong button</color>");
            }
        }
예제 #10
0
 static void Main()
 {
     Warhead wh = new Warhead();
     wh.Start();
 }
예제 #11
0
        public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response)
        {
            if (!sender.CheckPermission("ast.warhead"))
            {
                response = "You can't use this command, you don't have \"ast.warhead\" permission.";
                return(false);
            }
            if (arguments.Count < 1)
            {
                response = "Subcommands (* = editable): detonationtimer (dt)*, realdetonationtimer (rdt), leverstatus (ls)*, buttonstatus (bs)*, detonated (d), isdetonating (isd), islocked (il)*, canbestarted (cbs)*, start, stop, detonate (det), shake";
                return(false);
            }
            else if (arguments.At(0) == "detonationtimer" || arguments.At(0) == "dt")
            {
                if (arguments.Count >= 2)
                {
                    if (float.TryParse(arguments.At(1), out float newdt))
                    {
                        Warhead.DetonationTimer = newdt;
                        float  dt = Warhead.DetonationTimer;
                        string sp;
                        if (dt != 1)
                        {
                            sp = "s";
                        }
                        else
                        {
                            sp = "";
                        }
                        response = $"The warhead will now detonate in T minus {dt} second{sp}.";
                        return(true);
                    }
                    else
                    {
                        float  dt = Warhead.DetonationTimer;
                        string sp;
                        if (dt != 1)
                        {
                            sp = "s";
                        }
                        else
                        {
                            sp = "";
                        }
                        response = $"Invalid number: \"{Command} dt >{arguments.At(1)}<\" The warhead will detonate in T minus {dt} second{sp}.";
                        return(false);
                    }
                }
                else
                {
                    float  dt = Warhead.DetonationTimer;
                    string sp;
                    if (dt != 1)
                    {
                        sp = "s";
                    }
                    else
                    {
                        sp = "";
                    }
                    response = $"The warhead will detonate in T minus {dt} second{sp}. To change this, send the command again with the new timer: \"{Command} dt [<new_timer>]\"";
                    return(true);
                }
            }
            else if (arguments.At(0) == "leverstatus" || arguments.At(0) == "ls")
            {
                if (arguments.Count >= 2)
                {
                    if (Boolean.TryParse(arguments.At(1), out bool tf))
                    {
                        Warhead.LeverStatus = tf;
                        bool ls = Warhead.LeverStatus;
                        if (ls)
                        {
                            response = "The warhead lever is now on \"enabled\"!";
                        }
                        else
                        {
                            response = "The warhead lever is now on \"disabled\"!";
                        }
                        return(true);
                    }
                    else
                    {
                        bool   ls = Warhead.LeverStatus;
                        string ed;
                        if (ls)
                        {
                            ed = "enabled";
                        }
                        else
                        {
                            ed = "disabled";
                        }

                        response = $"Invalid boolean (true/false): \"{Command} dt >{arguments.At(1)}<\" The warhead lever is on \"{ed}\".";
                        return(false);
                    }
                }
                else
                {
                    bool   ls = Warhead.LeverStatus;
                    string ed;
                    if (ls)
                    {
                        ed = "enabled";
                    }
                    else
                    {
                        ed = "disabled";
                    }
                    response = $"The warhead lever is on \"{ed}\". To edit this, send \"{Command} ls [<true/false>]\"";
                    return(true);
                }
            }
            else if (arguments.At(0) == "buttonstatus" || arguments.At(0) == "bs")
            {
                if (arguments.Count >= 2)
                {
                    if (bool.TryParse(arguments.At(1), out bool tf))
                    {
                        Warhead.IsKeycardActivated = tf;
                        bool bs = Warhead.IsKeycardActivated;
                        if (bs)
                        {
                            response = "The warhead button cover is open";
                        }
                        else
                        {
                            response = "The warhead button cover is closed";
                        }
                        return(true);
                    }
                    else
                    {
                        bool   bs = Warhead.IsKeycardActivated;
                        string ed;
                        if (bs)
                        {
                            ed = "open";
                        }
                        else
                        {
                            ed = "closed";
                        }

                        response = $"Invalid boolean (true/false): \"{Command} bs >{arguments.At(1)}<\" The warhead button cover is {ed}.";
                        return(false);
                    }
                }
                else
                {
                    bool   bs = Warhead.IsKeycardActivated;
                    string ed;
                    if (bs)
                    {
                        ed = "open";
                    }
                    else
                    {
                        ed = "closed";
                    }
                    response = $"The warhead button cover is {ed}. To edit this, send \"{Command} bs [<true/false>]\"";
                    return(true);
                }
            }
            else if (arguments.At(0) == "detonated" || arguments.At(0) == "d")
            {
                bool   d = Warhead.IsDetonated;
                string ed;
                if (d)
                {
                    ed = "";
                }
                else
                {
                    ed = "n\'t";
                }
                response = $"The warhead was{ed} detonated.";
                return(true);
            }
            else if (arguments.At(0) == "isdetonating" || arguments.At(0) == "isd")
            {
                bool   d = Warhead.IsInProgress;
                string ed;
                if (d)
                {
                    ed = "";
                }
                else
                {
                    ed = "n\'t";
                }
                response = $"The warhead detonation is{ed} in progress.";
                return(true);
            }
            else if (arguments.At(0) == "realdetonationtimer" || arguments.At(0) == "rdt")
            {
                string sp;
                if (Warhead.RealDetonationTimer != 1)
                {
                    sp = "s";
                }
                else
                {
                    sp = "";
                }
                response = $"The warhead will detonate in T minus {Warhead.RealDetonationTimer} second{sp}.";
                return(true);
            }
            else if (arguments.At(0) == "islocked" || arguments.At(0) == "il")
            {
                if (arguments.Count >= 2)
                {
                    if (bool.TryParse(arguments.At(1), out bool tf))
                    {
                        Warhead.IsLocked = tf;
                        bool bs = Warhead.IsLocked;
                        if (bs)
                        {
                            response = "The warhead is locked";
                        }
                        else
                        {
                            response = "The warhead isn't locked";
                        }
                        return(true);
                    }
                    else
                    {
                        bool   il = Warhead.IsLocked;
                        string ed;
                        if (il)
                        {
                            ed = " locked";
                        }
                        else
                        {
                            ed = "n't locked";
                        }
                        response = $"Invalid boolean (true/false): \"{Command} bs >{arguments.At(1)}<\" The warhead is{ed}.";
                        return(false);
                    }
                }
                else
                {
                    bool   il = Warhead.IsLocked;
                    string ed;
                    if (il)
                    {
                        ed = " locked";
                    }
                    else
                    {
                        ed = "n't locked";
                    }
                    response = $"The warhead is{ed}. To edit this, send \"{Command} il [<true/false>]\"";
                    return(true);
                }
            }
            else if (arguments.At(0) == "canbestarted" || arguments.At(0) == "cbs")
            {
                bool   d = Warhead.CanBeStarted;
                string ed;
                if (d)
                {
                    ed = "be started";
                }
                else
                {
                    ed = "be resumed";
                }
                response = $"The warhead detonation can {ed}";
                return(true);
            }
            else if (arguments.At(0) == "start")
            {
                Warhead.Start();
                if (Warhead.CanBeStarted)
                {
                    response = $"Detonation sequence started, T minus {Warhead.DetonationTimer} seconds";
                }
                else
                {
                    response = $"Detonation sequence resumed, T minus {Warhead.DetonationTimer} seconds";
                }
                return(true);
            }
            else if (arguments.At(0) == "stop")
            {
                Warhead.Stop();
                response = $"Detonation cancelled, restarting systems";
                return(true);
            }
            else if (arguments.At(0) == "detonate" || arguments.At(0) == "det")
            {
                Warhead.Detonate();
                response = $"Warhead detonated";
                return(true);
            }
            else if (arguments.At(0) == "shake")
            {
                Warhead.Shake();
                response = $"Shake effect played";
                return(true);
            }
            else
            {
                response = "Invalid subcommand. Subcommands (* = editable): detonationtimer (dt)*, realdetonationtimer (rdt), leverstatus (ls)*, buttonstatus (bs)*, detonated (d), isdetonating (isd), islocked (il)*, canbestarted (cbs)*, start, stop, detonate (det), shake";
                return(false);
            }
        }
예제 #12
0
 public void OnStopping(StoppingEventArgs ev)
 {
     Warhead.Start();
 }