void IActivate.Activate(ActivateEventArgs eventArgs) { if (Morgue != null && !Morgue.Deleted && Morgue.TryGetComponent <MorgueEntityStorageComponent>(out var comp)) { comp.Activate(new ActivateEventArgs(eventArgs.User, Morgue)); } }
/// <summary> /// Called when you click the owner entity with an empty hand. Opens the UI client-side if possible. /// </summary> /// <param name="args">Data relevant to the event such as the actor which triggered it.</param> void IActivate.Activate(ActivateEventArgs args) { if (!args.User.TryGetComponent(out IActorComponent actor)) { return; } if (!args.User.TryGetComponent(out IHandsComponent hands)) { _notifyManager.PopupMessage(Owner.Transform.GridPosition, args.User, _localizationManager.GetString("You have no hands.")); return; } if (!Powered) { return; } var activeHandEntity = hands.GetActiveHand?.Owner; if (activeHandEntity == null) { _userInterface.Open(actor.playerSession); } }
public override Outcome Execute(float frameTime) { if (!_target.TryGetContainer(out var container)) { return(Outcome.Success); } if (!_owner.InRangeUnobstructed(container, popup: true)) { return(Outcome.Failed); } if (!IoCManager.Resolve <IEntityManager>().TryGetComponent(container.Owner, out EntityStorageComponent? storageComponent) || storageComponent.IsWeldedShut) { return(Outcome.Failed); } if (!storageComponent.Open) { var activateArgs = new ActivateEventArgs(_owner, _target); storageComponent.Activate(activateArgs); } var blackboard = UtilityAiHelpers.GetBlackboard(_owner); blackboard?.GetState <LastOpenedStorageState>().SetValue(container.Owner); return(Outcome.Success); }
void IActivate.Activate(ActivateEventArgs eventArgs) { if (!eventArgs.User.TryGetComponent(out IActorComponent? actor)) { return; } if (!eventArgs.User.TryGetComponent(out HumanoidAppearanceComponent? looks)) { Owner.PopupMessage(eventArgs.User, Loc.GetString("You can't have any hair!")); return; } UserInterface?.Toggle(actor.playerSession); var appearance = looks.Appearance; var msg = new MagicMirrorInitialDataMessage( appearance.HairColor, appearance.FacialHairColor, appearance.HairStyleId, appearance.FacialHairStyleId, appearance.EyeColor, looks.CategoriesHair, looks.CategoriesFacialHair, looks.CanColorHair, looks.CanColorFacialHair); UserInterface?.SendMessage(msg, actor.playerSession); }
void IActivate.Activate(ActivateEventArgs eventArgs) { if (eventArgs.InRangeUnobstructed() && EntitySystem.Get <ActionBlockerSystem>().CanInteract(eventArgs.User)) { Toggle(); } }
private void InteractionActivate(IEntity user, IEntity used) { var activateMsg = new ActivateInWorldMessage(user, used); RaiseLocalEvent(activateMsg); if (activateMsg.Handled) { return; } if (!used.TryGetComponent(out IActivate activateComp)) { return; } // all activates should only fire when in range / unbostructed var activateEventArgs = new ActivateEventArgs { User = user, Target = used }; if (activateEventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true)) { activateComp.Activate(activateEventArgs); } }
private void InteractionActivate(IEntity user, IEntity used) { if (!_actionBlockerSystem.CanInteract(user) || !_actionBlockerSystem.CanUse(user)) { return; } // all activates should only fire when in range / unobstructed if (!InRangeUnobstructed(user, used, ignoreInsideBlocker: true, popup: true)) { return; } var activateMsg = new ActivateInWorldEvent(user, used); RaiseLocalEvent(used.Uid, activateMsg); if (activateMsg.Handled) { return; } if (!used.TryGetComponent(out IActivate? activateComp)) { return; } var activateEventArgs = new ActivateEventArgs(user, used); activateComp.Activate(activateEventArgs); }
public override Outcome Execute(float frameTime) { if (!ContainerHelpers.TryGetContainer(_target, out var container)) { return(Outcome.Success); } if (!InteractionChecks.InRangeUnobstructed(_owner, container.Owner.Transform.MapPosition, ignoredEnt: container.Owner)) { return(Outcome.Failed); } if (!container.Owner.TryGetComponent(out EntityStorageComponent storageComponent) || storageComponent.IsWeldedShut) { return(Outcome.Failed); } if (!storageComponent.Open) { var activateArgs = new ActivateEventArgs { User = _owner, Target = _target }; storageComponent.Activate(activateArgs); } var blackboard = UtilityAiHelpers.GetBlackboard(_owner); blackboard?.GetState <LastOpenedStorageState>().SetValue(container.Owner); return(Outcome.Success); }
void IActivate.Activate(ActivateEventArgs eventArgs) { if (!eventArgs.User.TryGetComponent(out IActorComponent? actor)) { return; } if (!Powered) { return; } if (!ActionBlockerSystem.CanInteract(actor.playerSession.AttachedEntity)) { return; } _game ??= new SpaceVillainGame(this); if (_wiresComponent?.IsPanelOpen == true) { _wiresComponent.OpenInterface(actor.playerSession); } else { UserInterface?.Toggle(actor.playerSession); } }
void IActivate.Activate(ActivateEventArgs eventArgs) { SpriteComponent?sprite; if (!EntitySystem.Get <SharedPullingSystem>().TryGetPulled(eventArgs.User, out var victim)) { if (_meatParts == 0) { return; } _meatParts--; if (!string.IsNullOrEmpty(_meatPrototype)) { Owner.EntityManager.SpawnEntity(_meatPrototype, Owner.Transform.Coordinates); } if (_meatParts != 0) { eventArgs.User.PopupMessage(_meatSource1p); } else { if (Owner.TryGetComponent(out sprite)) { sprite.LayerSetState(0, "spike"); } eventArgs.User.PopupMessage(_meatSource0); } return; } if (_meatParts > 0) { Owner.PopupMessage(eventArgs.User, Loc.GetString("The spike already has something on it, finish collecting its meat first!")); return; } if (!victim.TryGetComponent <ButcherableComponent>(out var food)) { Owner.PopupMessage(eventArgs.User, Loc.GetString("{0:theName} can't be butchered on the spike.", victim)); return; } _meatPrototype = food.MeatPrototype; _meatParts = 5; _meatSource1p = Loc.GetString("You remove some meat from {0:theName}.", victim); _meatSource0 = Loc.GetString("You remove the last piece of meat from {0:theName}!", victim); if (Owner.TryGetComponent(out sprite)) { sprite.LayerSetState(0, "spikebloody"); } Owner.PopupMessageEveryone(Loc.GetString("{0:theName} has forced {1:theName} onto the spike, killing them instantly!", eventArgs.User, victim)); victim.Delete(); }
public void Activate(ActivateEventArgs args) { if (!args.User.TryGetComponent(out IActorComponent actor)) { return; } _userInterface.Open(actor.playerSession); }
public void Activate(ActivateEventArgs eventArgs) { if (!eventArgs.User.TryGetComponent(out IActorComponent? actor)) { return; } OpenInterface(actor.playerSession); }
void IActivate.Activate(ActivateEventArgs eventArgs) { if (!eventArgs.User.TryGetComponent(out IActorComponent actor) || !Powered) { return; } UpdateUserInterface(); _userInterface.Open(actor.playerSession); }
void IActivate.Activate(ActivateEventArgs eventArgs) { if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor)) { return; } UserInterface?.Open(actor.PlayerSession); }
void IActivate.Activate(ActivateEventArgs eventArgs) { var entMan = IoCManager.Resolve <IEntityManager>(); if (Morgue != default && !entMan.Deleted(Morgue) && entMan.TryGetComponent <MorgueEntityStorageComponent?>(Morgue, out var comp)) { comp.Activate(new ActivateEventArgs(eventArgs.User, Morgue)); } }
void IActivate.Activate(ActivateEventArgs eventArgs) { if (_entities.TryGetComponent(eventArgs.User, out ActorComponent? actor)) { ToggleInterface(actor.PlayerSession); return; } return; }
void IActivate.Activate(ActivateEventArgs eventArgs) { if (!eventArgs.User.TryGetComponent(out IActorComponent actor)) { return; } _interface.Open(actor.playerSession); UpdatePDAAppearance(); }
void IActivate.Activate(ActivateEventArgs eventArgs) { if (!eventArgs.User.TryGetComponent(out IActorComponent? actor)) { return; } UserInterface?.Open(actor.playerSession); }
void IActivate.Activate(ActivateEventArgs eventArgs) { if (!eventArgs.User.TryGetComponent(out IActorComponent actor) || !_powered) { return; } _uiDirty = true; _userInterface.Open(actor.playerSession); }
void IActivate.Activate(ActivateEventArgs eventArgs) { if (!IoCManager.Resolve <IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor)) { return; } OpenUserInterface(actor.PlayerSession); }
void IActivate.Activate(ActivateEventArgs eventArgs) { if (!_entities.TryGetComponent(eventArgs.User, out ActorComponent? actor) || !Powered) { return; } _uiDirty = true; UserInterface?.Toggle(actor.PlayerSession); }
void IActivate.Activate(ActivateEventArgs eventArgs) { if (!eventArgs.User.TryGetComponent(out ActorComponent? actor)) { return; } UserInterface?.Toggle(actor.PlayerSession); UpdatePDAAppearance(); }
public void DeleteMagazine(ActivateEventArgs args) { if (ammoCount > 0) { var player = interactable.selectingInteractor.GetComponentInParent <PlayerCtrl>(); player.ammoCount += ammoCount; player.SetText(ammoCount, 1); } Destroy(gameObject); }
void IActivate.Activate(ActivateEventArgs eventArgs) { if (!eventArgs.User.TryGetComponent(out IActorComponent? actor)) { return; } if (Owner.TryGetComponent <WiresComponent>(out var wires) && wires.IsPanelOpen) { wires.OpenInterface(actor.playerSession); }
void IActivate.Activate(ActivateEventArgs eventArgs) { if (_state == DoorState.Open) { Close(); } else if (_state == DoorState.Closed) { Open(); } }
public void AddAmmo(ActivateEventArgs args) { if (interactable.isSelected) { var player = args.interactable.selectingInteractor.GetComponentInParent <PlayerCtrl>(); player.ammoCount += ammo; player.SetText(ammo, 1); player.audioSource.PlayOneShot(player.ammoSFX); Destroy(gameObject); } }
void IActivate.Activate(ActivateEventArgs eventArgs) { if (Open) { CloseStorage(); } else { OpenStorage(); } }
void IActivate.Activate(ActivateEventArgs eventArgs) { if (!eventArgs.User.TryGetComponent(out IActorComponent actor)) { return; } if (actor.playerSession.AttachedEntity.TryGetComponent(out BodyManagerComponent attempt)) { _userInterface.SetState(PrepareBodyScannerInterfaceState(attempt.Template, attempt.PartDictionary)); } _userInterface.Open(actor.playerSession); }
protected override void BeginAction(ActivateEventArgs args) { base.BeginAction(args); Controller = args.interactor.GetComponent <XRController>(); Controller.inputDevice.IsPressed(InputHelpers.Button.Trigger, out _isPressed); //If i want the button press to be registered when it's almost pressed in, have to continuously check //for IsPressed instead of (how it seems) being checked once on BeginAction. Default threshold 0.1f if (_isPressed) { Weapon.PullTrigger(); } }
private void Navigate(object sender, ActivateEventArgs e) { object uri = ((ContentControl) sender).Tag; if (uri == null) return; Messenger.Default.Send( new NavigationMessage() { NavigateTo = new Uri(uri.ToString(), UriKind.Relative)} ); }
void IActivate.Activate(ActivateEventArgs eventArgs) { if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor)) { return; } _mode = PaperAction.Read; UpdateUserInterface(); UserInterface?.Toggle(actor.PlayerSession); return; }