private void OnCellSlotUpdated(EntityUid uid, ServerBatteryBarrelComponent component, ContainerModifiedMessage args)
 {
     if (args.Container.ID == component.CellSlot.ID)
     {
         component.UpdateAppearance();
     }
 }
        private void AddInsertCellVerb(EntityUid uid, ServerBatteryBarrelComponent component, GetInteractionVerbsEvent args)
        {
            if (args.Using == null ||
                !args.CanAccess ||
                !args.CanInteract ||
                component.PowerCell != null ||
                !args.Using.HasComponent <BatteryComponent>() ||
                !_actionBlockerSystem.CanDrop(args.User))
            {
                return;
            }

            Verb verb = new();

            verb.Text     = args.Using.Name;
            verb.Category = VerbCategory.Insert;
            verb.Act      = () => component.TryInsertPowerCell(args.Using);
            args.Verbs.Add(verb);
        }
        // TODO VERBS EJECTABLES Standardize eject/insert verbs into a single system?
        // Really, why isn't this just PowerCellSlotComponent?
        private void AddEjectCellVerb(EntityUid uid, ServerBatteryBarrelComponent component, GetAlternativeVerbsEvent args)
        {
            if (args.Hands == null ||
                !args.CanAccess ||
                !args.CanInteract ||
                !component.PowerCellRemovable ||
                component.PowerCell == null ||
                !_actionBlockerSystem.CanPickup(args.User))
            {
                return;
            }

            Verb verb = new();

            verb.Text     = component.PowerCell.Owner.Name;
            verb.Category = VerbCategory.Eject;
            verb.Act      = () => component.TryEjectCell(args.User);
            args.Verbs.Add(verb);
        }
Beispiel #4
0
 private void OnCellSlotUpdated(EntityUid uid, ServerBatteryBarrelComponent component, PowerCellChangedEvent args)
 {
     component.UpdateAppearance();
 }