コード例 #1
0
 async Task <bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
 {
     if (!ActionBlockerSystem.CanInteract(eventArgs.User))
     {
         return(false);
     }
     if (!_cellSlot.InsertCell(eventArgs.Using))
     {
         return(false);
     }
     Dirty();
     return(true);
 }
コード例 #2
0
        private void AddInsertVerb(EntityUid uid, PowerCellSlotComponent component, GetInteractionVerbsEvent args)
        {
            if (args.Using == null ||
                !args.CanAccess ||
                !args.CanInteract ||
                component.HasCell ||
                !args.Using.HasComponent <PowerCellComponent>() ||
                !_actionBlockerSystem.CanDrop(args.User))
            {
                return;
            }

            Verb verb = new();

            verb.Text     = args.Using.Name;
            verb.Category = VerbCategory.Insert;
            verb.Act      = () => component.InsertCell(args.Using);
            args.Verbs.Add(verb);
        }
コード例 #3
0
        private void AddInsertVerb(EntityUid uid, PowerCellSlotComponent component, GetInteractionVerbsEvent args)
        {
            if (args.Using is not {
                Valid : true
            } @using ||
                !args.CanAccess ||
                !args.CanInteract ||
                component.HasCell ||
                !EntityManager.HasComponent <PowerCellComponent>(@using) ||
                !_actionBlockerSystem.CanDrop(args.User))
            {
                return;
            }

            Verb verb = new();

            verb.Text     = EntityManager.GetComponent <MetaDataComponent>(@using).EntityName;
            verb.Category = VerbCategory.Insert;
            verb.Act      = () => component.InsertCell(@using);
            args.Verbs.Add(verb);
        }