Пример #1
0
        void LootCommand(BasePlayer player, string command, string[] args)
        {
            if (GuardAgainst(() => State.NoBoss(), player, Text.Error_Loot_NoBoss) ||
                GuardAgainst(() => State.IsNotBoss(player), player, Text.Error_Loot_NotBoss, State.BossName))
            {
                return;
            }

            RaycastHit       hit;
            StorageContainer targetBox = null;

            if (Physics.Raycast(player.eyes.HeadRay(), out hit, 10f))
            {
                targetBox = hit.GetEntity().GetComponent <StorageContainer>();
            }

            if (targetBox != null && targetBox.GetType() == typeof(BoxStorage))
            {
                State.LootContainer = targetBox;
                PrintToChat(player, Text.Success_Looting);
                return;
            }

            if (targetBox != null && targetBox.GetType() == typeof(StorageContainer))
            {
                State.LootContainer = targetBox;
                PrintToChat(player, Text.Success_Looting);
            }
            else
            {
                PrintToChat(player, "Stand close to, and look directly at, the storage box you want your taxes paying into.");
            }
        }