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.1")] [Description("Lock your composter")] class Lockcomposter : RustPlugin { void OnServerInitialized() { foreach (var entity in BaseNetworkable.serverEntities.OfType()){ if (entity == null) { continue; } if(isPlayer(entity.OwnerID)){ var composter = entity as Composter; composter.isLockable = true; composter.SendNetworkUpdate(); composter.SendNetworkUpdateImmediate(true); } } } 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(true); 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; } } } } }