public ItemContainer(BaseEntity entityOwner, int capacity = 6) { this.UID = BaseNetworkable.TakeUID(); ListContainers[this.UID] = this; this.Capacity = capacity; this.EntityOwner = entityOwner; }
private Item(ItemInformation _info, uint _amount, ulong _skinid) { this.UID = BaseNetworkable.TakeUID(); ListItemsInWorld[this.UID] = this; this.Information = _info; this.SkinID = _skinid; this.Condition = this.Information.MaxCondition; if (_amount <= 0) { this.Amount = 1; } else if (_amount > this.Information.MaxStack) { this.Amount = (uint)this.Information.MaxStack; } else { this.Amount = _amount; } if (this.Information.IsHoldable()) { if (ItemInformation.GetHeldType(_info.HeldType, out Type type) == false) { ConsoleSystem.LogError($"[{nameof(Item)}] Unrealized class for <{_info.Shortname}>"); } this.HeldEntity = (BaseHeldEntity)Framework.Bootstraper.AddType(type); this.HeldEntity.Spawn(this.Information.HeldEntity.PrefabID); this.HeldEntity.SendNetworkUpdate(); this.HeldEntity.ItemOwner = this; this.HeldEntity.Initialization(); } }