Example #1
0
        private void CreateRecycler(BasePlayer p)
        {
            Recycler r = GameManager.server.CreateEntity(Recycle.RecyclePrefab, p.transform.position + Vector3.up * 4000) as Recycler;

            r.recycleEfficiency = this.Data.Settings.RefundRatio;
            r.enableSaving      = false;
            r.SetFlag(BaseEntity.Flags.Locked, true);
            r.UpdateNetworkGroup();
            r.Spawn();
            if (!r.isSpawned)
            {
                return;
            }
            r.gameObject.layer = 0;
            r.SendNetworkUpdateImmediate(true);
            this.Subscribe(nameof(CanNetworkTo));
            this.OpenContainer(p, r);
            this.Recyclers.Add(r.net.ID, new EntityAndPlayer {
                Entity = r, Player = p
            });
        }