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

FREE Lockcomposter : 1.0.2 1.0.2

Нет прав для скачивания
C#:
using System;
using UnityEngine;
using System.Collections.Generic;
using Oxide.Core;
using Oxide.Core.Plugins;
using Convert = System.Convert;
using System.Linq;
using Oxide.Game.Rust.Cui;
using Rust;

namespace Oxide.Plugins
{
    [Info("Lock composter", "Julio Juajez", "1.0.2")]
    [Description("Lock your composter")]
    class Lockcomposter : RustPlugin
    {

        void OnServerInitialized()
        {
            foreach (var entity in BaseNetworkable.serverEntities.OfType<Composter>()){
                if (entity == null) { continue; }
                if(isPlayer(entity.OwnerID)){
                    var composter = entity as Composter;
                    composter.isLockable = true;
                    composter.SendNetworkUpdate();
                    composter.SendNetworkUpdateImmediate();
                }
            }
        }

        static bool isPlayer(ulong id) => id > 76560000000000000L;

        private void OnEntitySpawned(BaseNetworkable entity)
        {
            if (entity is Composter)
            {
                var composter = entity as Composter;

                composter.isLockable = true;
                composter.SendNetworkUpdateImmediate();
                return;
            }

            var par = (entity as BaseLock)?.GetParentEntity() as Composter;

            if (par != null)
            {
                switch (par.PrefabName)
                {
                    case "assets/prefabs/deployable/composter/composter.prefab":
                        entity.transform.localPosition = new Vector3(0f, 1.3f, 0.6f);
                        entity.transform.localRotation = Quaternion.Euler(0, 90, 0);
                        break;
                }
            }
        }
    }
 }

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