private void OnSetNetwork(EntityUid uid, SurveillanceCameraComponent component,
                              SurveillanceCameraSetupSetNetwork args)
    {
        if (args.UiKey is not SurveillanceCameraSetupUiKey key ||
            key != SurveillanceCameraSetupUiKey.Camera)
        {
            return;
        }
        if (args.Network < 0 || args.Network >= component.AvailableNetworks.Count)
        {
            return;
        }

        if (!_prototypeManager.TryIndex <DeviceFrequencyPrototype>(component.AvailableNetworks[args.Network],
                                                                   out var frequency))
        {
            return;
        }

        _deviceNetworkSystem.SetReceiveFrequency(uid, frequency.Frequency);
        component.NetworkSet = true;
        UpdateSetupInterface(uid, component);
    }
예제 #2
0
    private void OnSetNetwork(EntityUid uid, SurveillanceCameraRouterComponent component,
                              SurveillanceCameraSetupSetNetwork args)
    {
        if (args.UiKey is not SurveillanceCameraSetupUiKey key ||
            key != SurveillanceCameraSetupUiKey.Router)
        {
            return;
        }
        if (args.Network < 0 || args.Network >= component.AvailableNetworks.Count)
        {
            return;
        }

        if (!_prototypeManager.TryIndex <DeviceFrequencyPrototype>(component.AvailableNetworks[args.Network],
                                                                   out var frequency))
        {
            return;
        }

        component.SubnetFrequencyId = component.AvailableNetworks[args.Network];
        component.SubnetFrequency   = frequency.Frequency;
        component.Active            = true;
        UpdateSetupInterface(uid, component);
    }