mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-04 23:38:10 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@ -46,6 +46,8 @@ public class BulletType extends Content implements Cloneable{
|
||||
public boolean pierceBuilding;
|
||||
/** Maximum # of pierced objects. */
|
||||
public int pierceCap = -1;
|
||||
/** Multiplier of damage decreased per health pierced. */
|
||||
public float pierceDamageFactor = 0f;
|
||||
/** If false, this bullet isn't removed after pierceCap is exceeded. Expert usage only. */
|
||||
public boolean removeAfterPierce = true;
|
||||
/** For piercing lasers, setting this to true makes it get absorbed by plastanium walls. */
|
||||
@ -360,6 +362,8 @@ public class BulletType extends Content implements Cloneable{
|
||||
}else if(build.team != b.team && direct){
|
||||
hit(b);
|
||||
}
|
||||
|
||||
handlePierce(b, initialHealth, x, y);
|
||||
}
|
||||
|
||||
public void hitEntity(Bullet b, Hitboxc entity, float health){
|
||||
@ -385,6 +389,19 @@ public class BulletType extends Content implements Cloneable{
|
||||
if(!wasDead && entity instanceof Unit unit && unit.dead){
|
||||
Events.fire(new UnitBulletDestroyEvent(unit, b));
|
||||
}
|
||||
|
||||
handlePierce(b, health, entity.x(), entity.y());
|
||||
}
|
||||
|
||||
public void handlePierce(Bullet b, float initialHealth, float x, float y){
|
||||
float sub = Math.max(initialHealth*pierceDamageFactor, 0);
|
||||
//subtract health from each consecutive pierce
|
||||
b.damage -= Math.min(b.damage, sub);
|
||||
|
||||
if(removeAfterPierce && b.damage <= 0){
|
||||
b.hit = true;
|
||||
b.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public float damageMultiplier(Bullet b){
|
||||
|
@ -13,8 +13,6 @@ public class RailBulletType extends BulletType{
|
||||
|
||||
public Effect pierceEffect = Fx.hitBulletSmall, pointEffect = Fx.none, lineEffect = Fx.none;
|
||||
public Effect endEffect = Fx.none;
|
||||
/** Multiplier of damage decreased per health pierced. */
|
||||
public float pierceDamageFactor = 1f;
|
||||
|
||||
public float length = 100f;
|
||||
|
||||
@ -37,8 +35,9 @@ public class RailBulletType extends BulletType{
|
||||
return length;
|
||||
}
|
||||
|
||||
void handle(Bullet b, float initialHealth, float x, float y){
|
||||
float sub = Math.max(initialHealth*pierceDamageFactor, 0);
|
||||
@Override
|
||||
public void handlePierce(Bullet b, float initialHealth, float x, float y){
|
||||
float sub = Math.max(initialHealth * pierceDamageFactor, 0);
|
||||
|
||||
if(b.damage <= 0){
|
||||
b.fdata = Math.min(b.fdata, b.dst(x, y));
|
||||
@ -93,14 +92,8 @@ public class RailBulletType extends BulletType{
|
||||
return bullet.team != tile.team;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hitEntity(Bullet b, Hitboxc entity, float health){
|
||||
super.hitEntity(b, entity, health);
|
||||
handle(b, health, entity.getX(), entity.getY());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hitTile(Bullet b, Building build, float x, float y, float initialHealth, boolean direct){
|
||||
handle(b, initialHealth, x, y);
|
||||
handlePierce(b, initialHealth, x, y);
|
||||
}
|
||||
}
|
||||
|
@ -367,7 +367,7 @@ public class SettingsMenuDialog extends BaseDialog{
|
||||
|
||||
int[] lastUiScale = {settings.getInt("uiscale", 100)};
|
||||
|
||||
graphics.sliderPref("uiscale", 100, 25, 300, 25, s -> {
|
||||
graphics.sliderPref("uiscale", 100, 5, 300, 5, s -> {
|
||||
//if the user changed their UI scale, but then put it back, don't consider it 'changed'
|
||||
Core.settings.put("uiscalechanged", s != lastUiScale[0]);
|
||||
return s + "%";
|
||||
|
Reference in New Issue
Block a user