private void HandleDirChange(ICommonSession?session, Direction dir, ushort subTick, bool state) { if (!TryGetAttachedComponent <IMoverComponent>(session, out var moverComp)) { return; } var owner = session?.AttachedEntity; if (owner != null && session != null) { EntityManager.EventBus.RaiseLocalEvent(owner.Value, new RelayMoveInputEvent(session)); // For stuff like "Moving out of locker" or the likes if (owner.Value.IsInContainer() && (!EntityManager.TryGetComponent(owner.Value, out MobStateComponent? mobState) || mobState.IsAlive())) { var relayMoveEvent = new RelayMovementEntityEvent(owner.Value); EntityManager.EventBus.RaiseLocalEvent(EntityManager.GetComponent <TransformComponent>(owner.Value).ParentUid, relayMoveEvent); } } moverComp.SetVelocityDirection(dir, subTick, state); }
private static void HandleDirChange(ICommonSession?session, Direction dir, ushort subTick, bool state) { if (!TryGetAttachedComponent <IMoverComponent>(session, out var moverComp)) { return; } var owner = session?.AttachedEntity; if (owner != null && session != null) { foreach (var comp in owner.GetAllComponents <IRelayMoveInput>()) { comp.MoveInputPressed(session); } // For stuff like "Moving out of locker" or the likes if (owner.IsInContainer() && (!owner.TryGetComponent(out IMobStateComponent? mobState) || mobState.IsAlive())) { var relayEntityMoveMessage = new RelayMovementEntityMessage(owner); owner.Transform.Parent !.Owner.SendMessage(owner.Transform, relayEntityMoveMessage); var relayMoveEvent = new RelayMovementEntityEvent(owner); owner.EntityManager.EventBus.RaiseLocalEvent(owner.Transform.ParentUid, relayMoveEvent); } } moverComp.SetVelocityDirection(dir, subTick, state); }
private void HandleDirChange(ICommonSession?session, Direction dir, ushort subTick, bool state) { if (!TryComp <IMoverComponent>(session?.AttachedEntity, out var moverComp)) { return; } var owner = session?.AttachedEntity; if (owner != null && session != null) { EntityManager.EventBus.RaiseLocalEvent(owner.Value, new RelayMoveInputEvent(session), true); // For stuff like "Moving out of locker" or the likes if (owner.Value.IsInContainer() && (!EntityManager.TryGetComponent(owner.Value, out MobStateComponent? mobState) || mobState.IsAlive())) { var relayMoveEvent = new RelayMovementEntityEvent(owner.Value); EntityManager.EventBus.RaiseLocalEvent(EntityManager.GetComponent <TransformComponent>(owner.Value).ParentUid, relayMoveEvent, true); } // Pass the rider's inputs to the vehicle (the rider itself is on the ignored list in C.S/MoverController.cs) if (TryComp <RiderComponent>(owner.Value, out var rider) && rider.Vehicle != null && rider.Vehicle.HasKey) { if (TryComp <IMoverComponent>(rider.Vehicle.Owner, out var vehicleMover)) { vehicleMover.SetVelocityDirection(dir, subTick, state); } } } moverComp.SetVelocityDirection(dir, subTick, state); }
private void OnRelayMovement(EntityUid uid, DisposalTubeComponent component, RelayMovementEntityEvent args) { if (_gameTiming.CurTime < component.LastClang + DisposalTubeComponent.ClangDelay) { return; } component.LastClang = _gameTiming.CurTime; SoundSystem.Play(component.ClangSound.GetSound(), Filter.Pvs(uid), uid); }
private void OnRelayMovement(EntityUid uid, ResistLockerComponent component, RelayMovementEntityEvent args) { if (component.IsResisting) { return; } if (!TryComp(uid, out EntityStorageComponent? storageComponent)) { return; } if (TryComp <LockComponent>(uid, out var lockComponent) && lockComponent.Locked || storageComponent.IsWeldedShut) { AttemptResist(args.Entity, uid, storageComponent, component); } }
private void OnRelayMovement(EntityUid uid, MedicalScannerComponent scannerComponent, RelayMovementEntityEvent args) { if (!_blocker.CanInteract(args.Entity, scannerComponent.Owner)) { return; } EjectBody(uid, scannerComponent); }
private void OnRelayMovement(EntityUid uid, MedicalScannerComponent component, RelayMovementEntityEvent args) { if (_blocker.CanInteract(args.Entity)) { if (_gameTiming.CurTime < component.LastInternalOpenAttempt + MedicalScannerComponent.InternalOpenAttemptDelay) { return; } component.LastInternalOpenAttempt = _gameTiming.CurTime; component.EjectBody(); } }
private void OnRelayMovement(EntityUid uid, EntityStorageComponent component, RelayMovementEntityEvent args) { if (!EntityManager.HasComponent <HandsComponent>(args.Entity)) { return; } if (_gameTiming.CurTime < component.LastInternalOpenAttempt + EntityStorageComponent.InternalOpenAttemptDelay) { return; } component.LastInternalOpenAttempt = _gameTiming.CurTime; component.TryOpenStorage(args.Entity); }