bool IEffectBlocker.CanSlip() { if (Owner.TryGetComponent(out InventoryComponent inventoryComponent) && inventoryComponent.TryGetSlotItem(EquipmentSlotDefines.Slots.SHOES, out ItemComponent shoes) ) { return(EffectBlockerSystem.CanSlip(shoes.Owner)); } return(true); }
private bool TrySlip(IEntity entity) { if (!Slippery || ContainerHelpers.IsInContainer(Owner) || _slipped.Contains(entity.Uid) || !entity.TryGetComponent(out SharedStunnableComponent stun) || !entity.TryGetComponent(out ICollidableComponent otherBody) || !Owner.TryGetComponent(out ICollidableComponent body)) { return(false); } if (otherBody.LinearVelocity.Length < RequiredSlipSpeed || stun.KnockedDown) { return(false); } var percentage = otherBody.WorldAABB.IntersectPercentage(body.WorldAABB); if (percentage < IntersectPercentage) { return(false); } if (!EffectBlockerSystem.CanSlip(entity)) { return(false); } if (entity.TryGetComponent(out ICollidableComponent collidable)) { var controller = collidable.EnsureController <SlipController>(); controller.LinearVelocity = collidable.LinearVelocity * LaunchForwardsMultiplier; } stun.Paralyze(5); _slipped.Add(entity.Uid); OnSlip(); return(true); }
private bool TrySlip(SlipperyComponent component, IPhysBody ourBody, IPhysBody otherBody) { if (!component.Slippery || component.Owner.IsInContainer() || component.Slipped.Contains(otherBody.Owner.Uid) || !otherBody.Owner.TryGetComponent(out SharedStunnableComponent? stun)) { return(false); } if (otherBody.LinearVelocity.Length < component.RequiredSlipSpeed || stun.KnockedDown) { return(false); } var percentage = otherBody.GetWorldAABB().IntersectPercentage(ourBody.GetWorldAABB()); if (percentage < component.IntersectPercentage) { return(false); } if (!EffectBlockerSystem.CanSlip(otherBody.Owner)) { return(false); } otherBody.LinearVelocity *= component.LaunchForwardsMultiplier; stun.Paralyze(5); component.Slipped.Add(otherBody.Owner.Uid); component.Dirty(); PlaySound(component); return(true); }
public void CollideWith(IEntity collidedWith) { if (ContainerHelpers.IsInContainer(Owner) || _slipped.Contains(collidedWith.Uid) || !collidedWith.TryGetComponent(out StunnableComponent stun) || !collidedWith.TryGetComponent(out ICollidableComponent otherBody) || !collidedWith.TryGetComponent(out IPhysicsComponent otherPhysics) || !Owner.TryGetComponent(out ICollidableComponent body)) { return; } if (otherPhysics.LinearVelocity.Length < RequiredSlipSpeed || stun.KnockedDown) { return; } var percentage = otherBody.WorldAABB.IntersectPercentage(body.WorldAABB); if (percentage < IntersectPercentage) { return; } if (!EffectBlockerSystem.CanSlip(collidedWith)) { return; } stun.Paralyze(5f); _slipped.Add(collidedWith.Uid); if (!string.IsNullOrEmpty(SlipSound)) { EntitySystem.Get <AudioSystem>().PlayFromEntity(SlipSound, Owner, AudioHelpers.WithVariation(0.2f)); } }
private bool TrySlip(IEntity entity) { if (ContainerHelpers.IsInContainer(Owner) || _slipped.Contains(entity.Uid) || !entity.TryGetComponent(out SharedStunnableComponent stun) || !entity.TryGetComponent(out ICollidableComponent otherBody) || !entity.TryGetComponent(out IPhysicsComponent otherPhysics) || !Owner.TryGetComponent(out ICollidableComponent body)) { return(false); } if (otherPhysics.LinearVelocity.Length < RequiredSlipSpeed || stun.KnockedDown) { return(false); } var percentage = otherBody.WorldAABB.IntersectPercentage(body.WorldAABB); if (percentage < IntersectPercentage) { return(false); } if (!EffectBlockerSystem.CanSlip(entity)) { return(false); } stun.Paralyze(5); _slipped.Add(entity.Uid); OnSlip(); return(true); }