private void UpdateAttachedHoppers(bool lbInput)
    {
        int index1 = 0;

        this.mnTotalHoppers            = 0;
        this.mnNumAttachedValidHoppers = 0;
        for (int index2 = 0; index2 < 6; ++index2)
        {
            this.maAttachedHoppers[index2] = (StorageMachineInterface)null;
            long x = this.mnX;
            long y = this.mnY;
            long z = this.mnZ;
            if (index2 == 0)
            {
                --x;
            }
            if (index2 == 1)
            {
                ++x;
            }
            if (index2 == 2)
            {
                --y;
            }
            if (index2 == 3)
            {
                ++y;
            }
            if (index2 == 4)
            {
                --z;
            }
            if (index2 == 5)
            {
                ++z;
            }
            Segment segment = this.AttemptGetSegment(x, y, z);
            if (segment != null)
            {
                StorageMachineInterface machineInterface = segment.SearchEntity(x, y, z) as StorageMachineInterface;
                if (machineInterface != null)
                {
                    ++this.mnTotalHoppers;
                    eHopperPermissions permissions = machineInterface.GetPermissions();
                    if (permissions != eHopperPermissions.Locked && (lbInput || permissions != eHopperPermissions.AddOnly) && ((!lbInput || permissions != eHopperPermissions.RemoveOnly) && (!lbInput || !machineInterface.IsFull())) && (lbInput || !machineInterface.IsEmpty()))
                    {
                        this.maAttachedHoppers[index1] = machineInterface;
                        ++index1;
                    }
                }
            }
        }
        this.mnNumAttachedValidHoppers = index1;
    }
 private void UpdateAttachedHoppers()
 {
     for (int index2 = 0; index2 < 6; ++index2)
     {
         long x = this.mnX;
         long y = this.mnY;
         long z = this.mnZ;
         if (index2 == 0)
         {
             --x;
         }
         if (index2 == 1)
         {
             ++x;
         }
         if (index2 == 2)
         {
             --y;
         }
         if (index2 == 3)
         {
             ++y;
         }
         if (index2 == 4)
         {
             --z;
         }
         if (index2 == 5)
         {
             ++z;
         }
         Segment segment = this.AttemptGetSegment(x, y, z);
         if (segment != null)
         {
             StorageMachineInterface machineInterface = segment.SearchEntity(x, y, z) as StorageMachineInterface;
             if (machineInterface != null)
             {
                 eHopperPermissions permissions = machineInterface.GetPermissions();
                 if (permissions != eHopperPermissions.Locked && permissions != eHopperPermissions.AddOnly && permissions != eHopperPermissions.RemoveOnly)
                 {
                     this.hopper = machineInterface;
                 }
             }
         }
     }
 }
    public static bool SetPermissions(Player player, ExtraStorageHoppers hopper, eHopperPermissions permissions)
    {
        if (hopper.mPermissions != permissions)
        {
            hopper.mPermissions = permissions;
        }
        if (!WorldScript.mbIsServer)
        {
            switch (permissions)
            {
            case eHopperPermissions.AddAndRemove:
                NetworkManager.instance.SendInterfaceCommand("ExtraStorageHopperWindowNew", "SetAddRemove", null, null, hopper, 0f);
                break;

            case eHopperPermissions.RemoveOnly:
                NetworkManager.instance.SendInterfaceCommand("ExtraStorageHopperWindowNew", "SetRemoveOnly", null, null, hopper, 0f);
                break;

            case eHopperPermissions.AddOnly:
                NetworkManager.instance.SendInterfaceCommand("ExtraStorageHopperWindowNew", "SetAddOnly", null, null, hopper, 0f);
                break;

            case eHopperPermissions.Locked:
                NetworkManager.instance.SendInterfaceCommand("ExtraStorageHopperWindowNew", "SetLocked", null, null, hopper, 0f);
                break;

            default:
                NetworkManager.instance.SendInterfaceCommand("ExtraStorageHopperWindowNew", "SetAddRemove", null, null, hopper, 0f);
                break;
            }
        }
        //AudioHUDManager.instance.HUDIn();
        //AudioSpeechManager.instance.UpdateStorageHopper(hopper.mPermissions);
        hopper.MarkDirtyDelayed();
        typeof(ExtraStorageHoppers).GetField("mbForceTextUpdate", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(hopper, true);
        typeof(ExtraStorageHoppers).GetField("mbForceHoloUpdate", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(hopper, true);
        hopper.RequestImmediateNetworkUpdate();
        FloatingCombatTextQueue floatingCombatTextQueue = FloatingCombatTextManager.instance.QueueText(hopper.mnX, hopper.mnY + 1L, hopper.mnZ, 1f, hopper.mPermissions.ToString(), Color.green, 1.5f, 64f);

        ExtraStorageHopperWindowNew.dirty = true;
        if (floatingCombatTextQueue != null)
        {
            floatingCombatTextQueue.mrStartRadiusRand = 0.25f;
        }
        return(true);
    }