Иконка ресурса

FREE HumanHeart : 1.0.1 1.0.1

Нет прав для скачивания
C#:
using Newtonsoft.Json;

namespace Oxide.Plugins
{
    [Info("HumanHeart", "walkinrey", "1.0.1")]
    class HumanHeart : RustPlugin 
    {
        #region Конфигурация
        private Configuration config;
        private class Configuration 
        {
            [JsonProperty("Настройка предмета")] public ItemSetup itemSet = new ItemSetup();
            public class ItemSetup 
            {
                [JsonProperty("Название предмета")] public string itemName = "Человеческое сердце";
                [JsonProperty("Скин ID предмета")] public ulong itemSkin = 2301754945;
                [JsonProperty("Количество")] public int itemCount = 1;
                [JsonProperty("Shortname предмета")] public string itemShortname = "fish.cooked";
            }
        }
        protected override void LoadDefaultConfig() => config = new Configuration();
        protected override void LoadConfig()
        {
            base.LoadConfig(); 
            try 
            {
                config = Config.ReadObject<Configuration>();
            } 
            catch 
            {
                LoadDefaultConfig();
            }
            Config.WriteObject(config);
        }
        #endregion
        #region Переменные
        #endregion
        #region Хуки
        object OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item)
        {
            var ent = dispenser.GetComponent<BaseCombatEntity>();
            if(dispenser.gatherType != ResourceDispenser.GatherType.Flesh) return null;
            NextTick(() =>
            {
                if(ent == null) entity.GiveItem(CreateHeart());
            });
            return null;
        }
        #endregion
        #region Методы
        public Item CreateHeart()
        {
            var heart = ItemManager.CreateByName(config.itemSet.itemShortname);
            heart.name = config.itemSet.itemName;
            heart.skin = config.itemSet.itemSkin;
            heart.amount = config.itemSet.itemCount;
            return heart;
        }
        #endregion
    }
}

Автор
15FPS
Скачиваний
0
Просмотры
1
Первый выпуск
Обновление
Оценка
0.00 звёзд 0 оценок
Сверху