mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-04 15:27:19 +07:00
Move damage and knockback to hitEntity
(#5000)
* Move damge and knockback to `hitEntity` * b.damage, not damage
This commit is contained in:
@ -185,8 +185,15 @@ public abstract class BulletType extends Content{
|
||||
}
|
||||
}
|
||||
|
||||
public void hitEntity(Bullet b, Hitboxc other, float initialHealth){
|
||||
public void hitEntity(Bullet b, Hitboxc entity, float initialHealth){
|
||||
if(entity instanceof Healthc h){
|
||||
h.damage(b.damage);
|
||||
}
|
||||
|
||||
if(entity instanceof Unit unit){
|
||||
unit.impulse(Tmp.v3.set(unit).sub(b.x, b.y).nor().scl(knockback * 80f));
|
||||
unit.apply(status, statusDuration);
|
||||
}
|
||||
}
|
||||
|
||||
public void hit(Bullet b){
|
||||
|
@ -71,6 +71,7 @@ public class RailBulletType extends BulletType{
|
||||
@Override
|
||||
public void hitEntity(Bullet b, Hitboxc entity, float initialHealth){
|
||||
handle(b, entity, initialHealth);
|
||||
super.hitEntity(b, entity, initialHealth);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -93,12 +93,6 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
|
||||
|
||||
if(other instanceof Healthc h){
|
||||
health = h.health();
|
||||
h.damage(damage);
|
||||
}
|
||||
|
||||
if(other instanceof Unit unit){
|
||||
unit.impulse(Tmp.v3.set(unit).sub(this.x, this.y).nor().scl(type.knockback * 80f));
|
||||
unit.apply(type.status, type.statusDuration);
|
||||
}
|
||||
|
||||
//must be last.
|
||||
|
Reference in New Issue
Block a user