Exemple #1
0
 private Verb CreateVerb(EntityUid uid, SuitSensorComponent component, EntityUid userUid, SuitSensorMode mode)
 {
     return(new Verb()
     {
         Text = GetModeName(mode),
         Disabled = component.Mode == mode,
         Priority = -(int)mode,  // sort them in descending order
         Category = VerbCategory.SetSensor,
         Act = () => SetSensor(uid, mode, userUid, component)
     });
 }
Exemple #2
0
 private void OnMapInit(EntityUid uid, SuitSensorComponent component, MapInitEvent args)
 {
     // generate random mode
     if (component.RandomMode)
     {
         //make the sensor mode favor higher levels, except coords.
         var modesDist = new[]
         {
             SuitSensorMode.SensorOff,
             SuitSensorMode.SensorBinary, SuitSensorMode.SensorBinary,
             SuitSensorMode.SensorVitals, SuitSensorMode.SensorVitals, SuitSensorMode.SensorVitals,
             SuitSensorMode.SensorCords, SuitSensorMode.SensorCords
         };
         component.Mode = _random.Pick(modesDist);
     }
 }
Exemple #3
0
        private void OnVerb(EntityUid uid, SuitSensorComponent component, GetInteractionVerbsEvent args)
        {
            // check if user can change sensor
            if (component.ControlsLocked)
            {
                return;
            }

            // standard interaction checks
            if (!args.CanAccess || !args.CanInteract || !_actionBlockerSystem.CanDrop(args.User))
            {
                return;
            }

            args.Verbs.UnionWith(new[]
            {
                CreateVerb(uid, component, args.User, SuitSensorMode.SensorOff),
                CreateVerb(uid, component, args.User, SuitSensorMode.SensorBinary),
                CreateVerb(uid, component, args.User, SuitSensorMode.SensorVitals),
                CreateVerb(uid, component, args.User, SuitSensorMode.SensorCords)
            });
        }