Fixed controller hit not registering splash damage

This commit is contained in:
Anuken
2022-09-26 19:17:18 -04:00
parent 159f335f64
commit b993f150fb
2 changed files with 2 additions and 1 deletions

View File

@@ -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);
}
}

View File

@@ -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()));