Exemplo n.º 1
0
        public void Execute(IRocketPlayer caller, params string[] command)
        {
            UnturnedPlayer uCaller = (UnturnedPlayer)caller;

            if (!uCaller.Player.quests.isMarkerPlaced)
            {
                UnturnedChat.Say(uCaller, "Please set a Marker on your map before using this command!", Color.red);
                return;
            }

            if (Vector3.Distance(uCaller.Player.quests.markerPosition, uCaller.Position) > Airstrikes.Instance.Configuration.Instance.MaxAirstrikeDistance)
            {
                UnturnedChat.Say(caller, $"The Airstrike is too far away! It has to be less than {Airstrikes.Instance.Configuration.Instance.MaxAirstrikeDistance} meters away!", Color.red);
                return;
            }

            if (Vector3.Distance(uCaller.Player.quests.markerPosition, uCaller.Position) < Airstrikes.Instance.Configuration.Instance.MinAirstrikeDistance)
            {
                UnturnedChat.Say(caller, $"The Airstrike is too close! It has to be at least {Airstrikes.Instance.Configuration.Instance.MinAirstrikeDistance} meters away!", Color.red);
                return;
            }

            Logger.LogWarning($"{uCaller.DisplayName} has started an Airstrike!");
            Airstrikes.Instance.StartCoroutine(Airstrikes.SendAirstrike(uCaller, uCaller.Player.quests.markerPosition));
        }
Exemplo n.º 2
0
        protected override void Load()
        {
            base.Load();
            Instance      = this;
            Vectors       = new List <Vector3>();
            PlayerVectors = new List <Vector3>();

            Logger.LogWarning("\n Loading Airstrikes, made by Mr.Kwabs...");
            Logger.LogWarning("\n General Options:");
            Logger.LogWarning($" Max Boom Distance: {Instance.Configuration.Instance.MaxBoomDistance} meters.");
            if (Instance.Configuration.Instance.BroadcastAirstrikes)
            {
                Logger.LogWarning(" Broadcasts Airstrikes: Enabled.");
            }
            else
            {
                Logger.LogError(" Broadcasts Airstrikes: Disabled.");
            }
            if (Instance.Configuration.Instance.LogAirstrikes)
            {
                System.IO.Directory.CreateDirectory("Plugins/Airstrikes/Logs");
                Logger.LogWarning(" Log Airstrikes: Enabled.");
            }
            else
            {
                Logger.LogError(" Log Airstrikes: Disabled.");
            }
            Logger.LogWarning("\n General Airstrike Options:");
            Logger.LogWarning($" Max Airstrike Distance: {Instance.Configuration.Instance.MaxAirstrikeDistance} meters.");
            Logger.LogWarning($" Min Airstrike Distance: {Instance.Configuration.Instance.MinAirstrikeDistance} meters.");
            Logger.LogWarning($" Airstrike Strike Count: {Instance.Configuration.Instance.StrikeCount}.");
            Logger.LogWarning($" Airstrike Start Delay: {Instance.Configuration.Instance.StartDelay} seconds.");
            Logger.LogWarning($" Airstrike Location Effect: {Instance.Configuration.Instance.AirstrikeLocationEffectID}");
            Logger.LogWarning("\n Specific Airstrike Options:");
            Logger.LogWarning($" Strike Interval Max: {Instance.Configuration.Instance.StrikeDelayMax} seconds.");
            Logger.LogWarning($" Strike Interval Min: {Instance.Configuration.Instance.StrikeDelayMin} seconds.");
            Logger.LogWarning($" Strike Damange Intensity: {Instance.Configuration.Instance.DamageIntensity}.");
            Logger.LogWarning($" Strike Damange Radius: {Instance.Configuration.Instance.DamageRadius} meters.");
            Logger.LogWarning($" Strike Explosion Effect: {Instance.Configuration.Instance.StrikeExplosionEffectID}");
            if (Instance.Configuration.Instance.AutoAirstrikes)
            {
                Logger.LogWarning(" Automatic Airstrikes: Enabled.");
                Instance.StartCoroutine(AutomaticStrike());
            }
            else
            {
                Logger.LogError(" Automatic Airstrikes: Disabled.");
            }
            Logger.LogWarning("\n Successfully loaded Airstrikes, made by Mr.Kwabs!");
        }
Exemplo n.º 3
0
        public void Execute(IRocketPlayer rCaller, params string[] Command)
        {
            UnturnedPlayer uCaller = (UnturnedPlayer)rCaller;

            if (Command.Length == 0) // Players wants own position
            {
                UnturnedChat.Say(uCaller, $"Your Location - X: {uCaller.Position.x} | Y: {uCaller.Position.y} | Z: {uCaller.Position.z}", Color.yellow);
                Logger.Log($"{uCaller.DisplayName}'s Location - X: { uCaller.Player.quests.markerPosition.x} | Y: { uCaller.Player.quests.markerPosition.y} | Z: { uCaller.Player.quests.markerPosition.z}", ConsoleColor.Cyan);
                return;
            }
            else if (Command.Length == 1)   // Players wants waypoint location
            {
                if (Command[0].ToLower() == "wp")
                {
                    if (uCaller.Player.quests.isMarkerPlaced)
                    {
                        Vector3?groundLocation = Airstrikes.GetGround(uCaller.Player.quests.markerPosition);
                        if (groundLocation == null)
                        {
                            UnturnedChat.Say(uCaller, "There has been an Error getting your Marker location, please check the Console.", Color.red);
                            Logger.LogError("[Error] Encountered error whilst trying to get Marker location - returned null. Please contact the plugin author.");
                            return;
                        }
                        UnturnedChat.Say(uCaller, $"Marker Location - X: {groundLocation.Value.x} | Y: {groundLocation.Value.y} | Z: {groundLocation.Value.z}", Color.yellow);
                        Logger.Log($"{uCaller.DisplayName}'s Marker Location - X: {groundLocation.Value.x} | Y: {groundLocation.Value.y} | Z: {groundLocation.Value.z}", ConsoleColor.Cyan);
                        return;
                    }
                    else
                    {
                        UnturnedChat.Say(uCaller, "You need to place a Marker before you use this command!", Color.red);
                        return;
                    }
                }
                else
                {
                    UnturnedChat.Say(uCaller, Syntax, Color.red);
                    return;
                }
            }
            else
            {
                UnturnedChat.Say(uCaller, Syntax, Color.red);
                return;
            }
        }
Exemplo n.º 4
0
 protected override void Unload()
 {
     Instance = null;
     base.Unload();
 }