コード例 #1
0
        private static async void DestroyRubbleByNameAndSendResult(string rubbleName, User user)
        {
            var result = await Task.Run(() => DestroyRubbleByName(rubbleName));

            if (result < 0)
            {
                OutputMessage = new Eco.Shared.Localization.LocString("That is not a valid rubble type.");
                //ChatManager.ServerMessageToAll(OutputMessage, false, DefaultChatTags.Notifications);
                ChatManager.ServerMessageToPlayer(OutputMessage, user);
            }
            else
            {
                OutputMessage = new Eco.Shared.Localization.LocString("Destroyed " + result + " rubble");
                ChatManager.ServerMessageToPlayer(OutputMessage, user);
            }
        }
コード例 #2
0
        public static void ClearRubbleType(User user, string rubbleName = "")
        {
            if (rubbleName.Length == 0)
            {
                OutputMessage = new Eco.Shared.Localization.LocString("You need to specify an item type");
                ChatManager.ServerMessageToPlayer(OutputMessage, user);
                return;
            }

            try
            {
                DestroyRubbleByNameAndSendResult(rubbleName, user);
            }
            catch (MethodInvocationException ex)
            {
                OutputMessage = new Eco.Shared.Localization.LocString("Error occured: " + ex.Message);
                ChatManager.ServerMessageToPlayer(OutputMessage, user);
            }
        }
コード例 #3
0
        private static int DestroyFallenTrees()
        {
            IEnumerable <TreeEntity> trees = NetObjectManager.GetObjectsOfType <TreeEntity>();
            int count = 0;

            trees.Where((tree) => tree.Fallen).ForEach((tree) =>
            {
                count++;
                //Occasionally a tree may not have a PlantPack - this is a bug in Eco.
                if (tree.PlantPack == null)
                {
                    OutputMessage = new Eco.Shared.Localization.LocString("Warning: Unable to clear a fallen tree it has no PlantPack.Report this to a developer");
                    ChatManager.ServerMessageToAll(OutputMessage, false, DefaultChatTags.Notifications);
                    //LocString = Localizer.Do("Warning: Unable to clear a fallen tree, it has no PlantPack. Report this to a developer.");
                    //ChatManager.ServerMessageToAll(message);
                }
                tree.Destroy();
            });
            return(count);
        }