コード例 #1
0
 /// <summary>
 /// Triggers while trying to examine an activator to see if it's used
 /// </summary>
 private void OnCreatorExamine(EntityUid uid, GuardianCreatorComponent component, ExaminedEvent args)
 {
     if (component.Used)
     {
         args.PushMarkup(Loc.GetString("guardian-activator-empty-examine"));
     }
 }
コード例 #2
0
 private void OnCreatorInteract(EntityUid uid, GuardianCreatorComponent component, AfterInteractEvent args)
 {
     if (args.Handled || args.Target == null || !args.CanReach)
     {
         return;
     }
     args.Handled = true;
     UseCreator(args.User, args.Target.Value, component);
 }
コード例 #3
0
 /// <summary>
 /// Adds the guardian host component to the user and spawns the guardian inside said component
 /// </summary>
 private void OnCreatorUse(EntityUid uid, GuardianCreatorComponent component, UseInHandEvent args)
 {
     if (args.Handled)
     {
         return;
     }
     args.Handled = true;
     UseCreator(args.User, args.User, component);
 }
コード例 #4
0
        private void UseCreator(EntityUid user, EntityUid target, GuardianCreatorComponent component)
        {
            if (component.Used)
            {
                _popupSystem.PopupEntity(Loc.GetString("guardian-activator-empty-invalid-creation"), user, Filter.Entities(user));
                return;
            }

            // Can only inject things with the component...
            if (!HasComp <CanHostGuardianComponent>(target))
            {
                _popupSystem.PopupEntity(Loc.GetString("guardian-activator-invalid-target"), user, Filter.Entities(user));
                return;
            }


            // If user is already a host don't duplicate.
            if (HasComp <GuardianHostComponent>(target))
            {
                _popupSystem.PopupEntity(Loc.GetString("guardian-already-present-invalid-creation"), user, Filter.Entities(user));
                return;
            }

            // Can't work without actions
            EntityManager.EnsureComponent <ServerActionsComponent>(target);

            if (component.Injecting)
            {
                return;
            }

            component.Injecting = true;

            _doAfterSystem.DoAfter(new DoAfterEventArgs(user, component.InjectionDelay, target: target)
            {
                BroadcastFinishedEvent  = new GuardianCreatorInjectedEvent(user, target, component),
                BroadcastCancelledEvent = new GuardianCreatorInjectCancelledEvent(target, component),
                BreakOnTargetMove       = true,
                BreakOnUserMove         = true,
            });
        }
コード例 #5
0
 public GuardianCreatorInjectCancelledEvent(EntityUid target, GuardianCreatorComponent component)
 {
     Target    = target;
     Component = component;
 }
コード例 #6
0
 public GuardianCreatorInjectedEvent(EntityUid user, EntityUid target, GuardianCreatorComponent component)
 {
     User      = user;
     Target    = target;
     Component = component;
 }