Exemplo n.º 1
0
 public void PlayLockedSound()
 {
     FxManager.PlayFx(CodeLock?.ServerPosition ?? Position, "assets/prefabs/locks/keypad/effects/lock.code.denied.prefab");
 }
Exemplo n.º 2
0
 public void PlayAccessSound()
 {
     FxManager.PlayFx(CodeLock?.ServerPosition ?? Position, "assets/prefabs/locks/keypad/effects/lock.code.unlock.prefab");
 }
Exemplo n.º 3
0
        private void ProcessWorldItems()
        {
            if (Utility.Config.ScanForWorldItems && Recycler.IsOn())
            {
                List <BaseEntity> entities = new List <BaseEntity>();

                Vector3 position = Position + (Recycler.transform.up * 1.5f) + (Recycler.transform.forward * 0.1f) + (Recycler.transform.right * -0.25f);
                float   radius   = 0.3f;

                Vis.Entities(position, radius, entities);
                entities = entities.Where(ent => ent.GetComponent <WorldItem>() != null).ToList();

                if (nextPickup <= Time.time)
                {
                    foreach (var entity in entities)
                    {
                        if (nextPickup > Time.time)
                        {
                            break;
                        }

                        var worldItem = (WorldItem)entity;

                        bool partiallyInserted = false;

                        for (int i = 0; i < outputInventory.capacity - 1; ++i)
                        {
                            var slot = outputInventory.GetSlot(i);
                            if (slot == null)
                            {
                                worldItem.item.MoveToContainer(outputInventory, i);
                                partiallyInserted = true;
                                break;
                            }

                            if (slot.info == worldItem.item.info && slot.skin == worldItem.item.skin && slot.amount < slot.info.stackable)
                            {
                                int available = slot.info.stackable - slot.amount;
                                int toMove    = Math.Min(available, worldItem.item.amount);
                                worldItem.item.amount -= toMove;
                                slot.amount           += toMove;

                                slot.MarkDirty();

                                partiallyInserted = true;

                                if (worldItem.item.amount <= 0)
                                {
                                    worldItem.item.Remove();
                                    worldItem.Kill();
                                    break;
                                }
                            }
                        }

                        if (partiallyInserted)
                        {
                            FxManager.PlayFx(worldItem.ServerPosition, Constants.StackSoundFxPrefab);
                        }
                    }
                }
            }
        }