int whoAttacked = readD();
log.finer("AUTOATTACK STARTED by+"+whoAttacked);
//face at target
EntityManager em = Singleton.get().getEntityManager();
PositioningComponent pcpos = (PositioningComponent) em.getComponent(whoAttacked, PositioningComponent.class);
TargetComponent tc = (TargetComponent) em.getComponent(whoAttacked, TargetComponent.class);
PositioningComponent npcpos = null;
if(tc!=null && tc.hasTarget()) {
log.finer("AUTOATTACK STARTED by+"+whoAttacked+" target comp :"+tc.getCurrentTarget());
npcpos = (PositioningComponent) em.getComponent(tc.getCurrentTarget(), PositioningComponent.class);
if(pcpos != null && npcpos != null){
pcpos.targetHeading = PositioningSystem.getHeading(pcpos.position, npcpos.position);
System.out.println("AutoAttackStart: Set heading for "+whoAttacked+" to "+pcpos.targetHeading+" looking at "+tc.getCurrentTarget());
}
}
//start default attack animation
Singleton.get().getAnimSystem().callAction(CallActions.DefaultAttack, whoAttacked);
}