public virtual async void Lock(EntityControllerBase entity) { if (Locked == null || entity == null || Locked.ID != entity.ID) { bool wasAttacking = AttackAssembly.AttackRunning; if (wasAttacking) { AttackAssembly.Stop(); ICommand positionFixCommand = new AbortDirectionLockCommand(ID); EntitesInRange(x => x.Send(positionFixCommand)); } } if (entity == null) { Locked = null; Send(PacketBuilder.DeselectionCommand()); } else if (entity.ID != ID) { if (entity is PlayerController playerController && playerController.SpecialItemsAssembly.IsNotTargetable) { return; } Locked = entity; SendLockVisual(entity); } }
protected void SendLockVisual(EntityControllerBase entity) { if (entity.AttackTraceAssembly.CurrentMainAttacker == -1) { Send(PacketBuilder.SelectCommand(entity)); } else { Send( PacketBuilder.SelectCommand(entity), PacketBuilder.MainAttackerChangedCommand(entity, entity.AttackTraceAssembly.CurrentMainAttacker) ); } }
public abstract void EntityAddedToMap(EntityControllerBase entity);