Fixed controller hit not registering splash damage
This commit is contained in:
@@ -181,7 +181,7 @@ public class CommandAI extends AIController{
|
||||
public void hit(Bullet bullet){
|
||||
if(unit.team.isAI() && bullet.owner instanceof Teamc teamc && teamc.team() != unit.team && attackTarget == null &&
|
||||
//can only counter-attack every few seconds to prevent rapidly changing targets
|
||||
!(teamc instanceof Unit u && !u.checkTarget(unit.type.targetAir, unit.type.targetGround)) && timer.get(timerTarget4, 60f * 12f)){
|
||||
!(teamc instanceof Unit u && !u.checkTarget(unit.type.targetAir, unit.type.targetGround)) && timer.get(timerTarget4, 60f * 10f)){
|
||||
commandTarget(teamc, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,6 +474,7 @@ public class Damage{
|
||||
|
||||
float amount = calculateDamage(scaled ? Math.max(0, entity.dst(x, y) - entity.type.hitSize/2) : entity.dst(x, y), radius, damage);
|
||||
entity.damage(amount);
|
||||
entity.controller().hit(source);
|
||||
//TODO better velocity displacement
|
||||
float dst = vec.set(entity.x - x, entity.y - y).len();
|
||||
entity.vel.add(vec.setLength((1f - dst / radius) * 2f / entity.mass()));
|
||||
|
||||
Reference in New Issue
Block a user