private void HandlePullStarted(EntityUid uid, HandsComponent component, PullStartedMessage args) { if (!_virtualItemSystem.TrySpawnVirtualItemInHand(args.Pulled.Owner, uid)) { DebugTools.Assert("Unable to find available hand when starting pulling??"); } }
private void HandlePullStarted(PullStartedMessage message) { // TODO: this isn't directed so things have to be done the bad way if (message.Pulled.Owner.TryGetComponent(out ThrownItemComponent? thrownItem)) { LandComponent(thrownItem); } }
private void HandlePullStarted(PullStartedMessage message) { // TODO: this isn't directed so things have to be done the bad way if (EntityManager.TryGetComponent(message.Pulled.Owner.Uid, out ThrownItemComponent? thrownItemComponent)) { StopThrow(message.Pulled.Owner.Uid, thrownItemComponent); } }
public void ForceRelationship(SharedPullerComponent?puller, SharedPullableComponent?pullable) { if ((puller != null) && (puller.Pulling == pullable)) { // Already done return; } // Start by disconnecting the pullable from whatever it is currently connected to. var pullableOldPullerE = pullable?.Puller; if (pullableOldPullerE != null) { ForceDisconnect(pullableOldPullerE.GetComponent <SharedPullerComponent>(), pullable !); } // Continue with the puller. var pullerOldPullableE = puller?.Pulling; if (pullerOldPullableE != null) { ForceDisconnect(puller !, pullerOldPullableE.GetComponent <SharedPullableComponent>()); } // And now for the actual connection (if any). if ((puller != null) && (pullable != null)) { var pullerPhysics = puller.Owner.GetComponent <PhysicsComponent>(); var pullablePhysics = pullable.Owner.GetComponent <PhysicsComponent>(); // State startup puller.Pulling = pullable.Owner; pullable.Puller = puller.Owner; // Joint startup var union = pullerPhysics.GetWorldAABB().Union(pullablePhysics.GetWorldAABB()); var length = Math.Max(union.Size.X, union.Size.Y) * 0.75f; pullable.PullJoint = _jointSystem.CreateDistanceJoint(pullablePhysics.Owner.Uid, pullerPhysics.Owner.Uid, id: $"pull-joint-{pullablePhysics.Owner.Uid}"); pullable.PullJoint.CollideConnected = false; // This maximum has to be there because if the object is constrained too closely, the clamping goes backwards and asserts. pullable.PullJoint.MaxLength = Math.Max(1.0f, length); pullable.PullJoint.Length = length * 0.75f; pullable.PullJoint.MinLength = 0f; pullable.PullJoint.Stiffness = 1f; // Messaging var message = new PullStartedMessage(pullerPhysics, pullablePhysics); RaiseLocalEvent(puller.Owner.Uid, message, broadcast: false); RaiseLocalEvent(pullable.Owner.Uid, message); // Networking puller.Dirty(); pullable.Dirty(); } }
private void OnPullStarted(PullStartedMessage message) { if (_pullers.TryGetValue(message.Puller.Owner, out var pulled) && pulled.TryGetComponent(out SharedPullableComponent? pulledComponent)) { pulledComponent.TryStopPull(); } SetPuller(message.Puller.Owner, message.Pulled.Owner); }
private void PullerHandlePullStarted( EntityUid uid, SharedPullerComponent component, PullStartedMessage args) { if (args.Puller.Owner != uid) { return; } _alertsSystem.ShowAlert(component.Owner, AlertType.Pulling); RefreshMovementSpeed(component); }
private static void PullerHandlePullStarted( EntityUid uid, SharedPullerComponent component, PullStartedMessage args) { if (args.Puller.Owner.Uid != uid) { return; } if (component.Owner.TryGetComponent(out SharedAlertsComponent? alerts)) { alerts.ShowAlert(AlertType.Pulling); } }
private void HandlePullStarted(EntityUid uid, HandsComponent component, PullStartedMessage args) { if (args.Puller.Owner != uid) { return; } if (TryComp <SharedPullerComponent>(args.Puller.Owner, out var pullerComp) && !pullerComp.NeedsHands) { return; } if (!_virtualItemSystem.TrySpawnVirtualItemInHand(args.Pulled.Owner, uid)) { DebugTools.Assert("Unable to find available hand when starting pulling??"); } }
private void PullerHandlePullStarted( EntityUid uid, SharedPullerComponent component, PullStartedMessage args) { if (args.Puller.Owner != uid) { return; } if (EntityManager.TryGetComponent(component.Owner, out SharedAlertsComponent? alerts)) { alerts.ShowAlert(AlertType.Pulling); } RefreshMovementSpeed(component); }
private void HandlePullStarted(EntityUid uid, HandsComponent component, PullStartedMessage args) { foreach (var handName in component.ActivePriorityEnumerable()) { var hand = component.GetHand(handName); if (!hand.IsEmpty) { continue; } var pos = component.Owner.Transform.Coordinates; var virtualPull = EntityManager.SpawnEntity("HandVirtualPull", pos); var virtualPullComp = virtualPull.GetComponent <HandVirtualPullComponent>(); virtualPullComp.PulledEntity = args.Pulled.Owner.Uid; component.PutEntityIntoHand(hand, virtualPull); return; } DebugTools.Assert("Unable to find available hand when starting pulling??"); }
private void OnPull(EntityUid uid, ArtifactInteractionTriggerComponent component, PullStartedMessage args) { if (!component.PullActivation) { return; } _artifactSystem.TryActivateArtifact(uid, args.Puller.Owner); }
private void OnPullStarted(PullStartedMessage message) { SetPuller(message.Puller.Owner, message.Pulled.Owner); }