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

FREE HumanHeart : 1.0.0 1.0.0

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

namespace Oxide.Plugins
{
    [Info("HumanHeart", "walkinrey", "1.0.0")]
    class HumanHeart : RustPlugin 
    {
        #region Конфигурация
        Configuration config;
        class Configuration 
        {
            [JsonProperty("Настройка предмета")] public ItemSetup itemSet = new ItemSetup();
        }
        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 SaveConfig() => Config.WriteObject(config);
        protected override void LoadConfig()
        {
            base.LoadConfig(); 
            try 
            {
                config = Config.ReadObject<Configuration>();
            } 
            catch 
            {
                LoadDefaultConfig();
            }
            NextTick(SaveConfig);
        }
        protected override void LoadDefaultConfig() => config = new Configuration();
        #endregion
        #region Переменные
        List<ResourceDispenser> bodiesCollected = new List<ResourceDispenser>();
        #endregion
        #region Хуки
        object OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item)
        {
            if(dispenser.gatherType == ResourceDispenser.GatherType.Flesh)
            {
                if(bodiesCollected.Contains(dispenser)) {if(dispenser.containedItems.Count < 2) bodiesCollected.Remove(dispenser);}
                else {bodiesCollected.Add(dispenser); entity.GiveItem(CreateHeart(), BaseEntity.GiveItemReason.PickedUp);}
            }
            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 оценок

Другие ресурсы пользователя 15FPS

Сверху