Esempio n. 1
0
        private void AddInsertVerb(EntityUid uid, ReagentDispenserComponent component, GetInteractionVerbsEvent args)
        {
            if (args.Using == null ||
                !args.CanAccess ||
                !args.CanInteract ||
                component.HasBeaker ||
                !args.Using.HasComponent <FitsInDispenserComponent>() ||
                !_actionBlockerSystem.CanDrop(args.User))
            {
                return;
            }

            if (!args.Using.HasComponent <FitsInDispenserComponent>() ||
                !_solutionContainerSystem.TryGetSolution(args.Using.Uid, "beaker", out _))
            {
                return;
            }

            Verb verb = new();

            verb.Act = () =>
            {
                component.BeakerContainer.Insert(args.Using);
                component.UpdateUserInterface();
            };
            verb.Category = VerbCategory.Insert;
            verb.Text     = args.Using.Name;
            args.Verbs.Add(verb);
        }
 private void OnEmagged(EntityUid uid, ReagentDispenserComponent comp, GotEmaggedEvent args)
 {
     if (!comp.AlreadyEmagged)
     {
         comp.AddFromPrototype(comp.EmagPackPrototypeId);
         comp.AlreadyEmagged = true;
         args.Handled        = true;
     }
 }
Esempio n. 3
0
        // TODO VERBS EJECTABLES Standardize eject/insert verbs into a single system? Maybe using something like the
        // system mentioned in #4538? The code here is basically identical to the stuff in ChemDispenserSystem.
        private void AddEjectVerb(EntityUid uid, ReagentDispenserComponent component, GetAlternativeVerbsEvent args)
        {
            if (args.Hands == null ||
                !args.CanAccess ||
                !args.CanInteract ||
                !component.HasBeaker ||
                !_actionBlockerSystem.CanPickup(args.User))
            {
                return;
            }

            Verb verb = new();

            verb.Act = () =>
            {
                component.TryEject(args.User);
                component.UpdateUserInterface();
            };
            verb.Category = VerbCategory.Eject;
            verb.Text     = component.BeakerContainer.ContainedEntity !.Name;

            args.Verbs.Add(verb);
        }
Esempio n. 4
0
 private void OnSolutionChange(EntityUid uid, ReagentDispenserComponent component, SolutionChangedEvent args)
 {
     component.UpdateUserInterface();
 }
Esempio n. 5
0
 private static void OnReagentDispenserPower(EntityUid uid, ReagentDispenserComponent component, PowerChangedEvent args)
 {
     component.OnPowerChanged();
 }