Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features
This commit is contained in:
@@ -465,8 +465,8 @@ public class Damage{
|
||||
for(int dx = -trad; dx <= trad; dx++){
|
||||
for(int dy = -trad; dy <= trad; dy++){
|
||||
Tile tile = world.tile(Math.round(x / tilesize) + dx, Math.round(y / tilesize) + dy);
|
||||
if(tile != null && tile.build != null && (team == null ||team.isEnemy(tile.team())) && Mathf.dst(dx, dy) <= trad){
|
||||
tile.build.damage(damage);
|
||||
if(tile != null && tile.build != null && (team == null ||team.isEnemy(tile.team())) && dx*dx + dy*dy <= trad){
|
||||
tile.build.damage(team, damage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@ import mindustry.entities.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
public class RailBulletType extends BulletType{
|
||||
//for calculating the furthest point
|
||||
static float furthest = 0;
|
||||
|
||||
public Effect pierceEffect = Fx.hitBulletSmall, updateEffect = Fx.none;
|
||||
/** Multiplier of damage decreased per health pierced. */
|
||||
public float pierceDamageFactor = 1f;
|
||||
@@ -47,6 +50,11 @@ public class RailBulletType extends BulletType{
|
||||
|
||||
//subtract health from each consecutive pierce
|
||||
b.damage -= Math.min(b.damage, sub);
|
||||
|
||||
//bullet was stopped, decrease furthest distance
|
||||
if(b.damage <= 0f){
|
||||
furthest = Math.min(furthest, b.dst(pos));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -54,8 +62,9 @@ public class RailBulletType extends BulletType{
|
||||
super.init(b);
|
||||
|
||||
b.fdata = length;
|
||||
furthest = length;
|
||||
Damage.collideLine(b, b.team, b.type.hitEffect, b.x, b.y, b.rotation(), length, false, false);
|
||||
float resultLen = b.fdata;
|
||||
float resultLen = furthest;
|
||||
|
||||
Vec2 nor = Tmp.v1.trns(b.rotation(), 1f).nor();
|
||||
for(float i = 0; i <= resultLen; i += updateEffectSeg){
|
||||
|
||||
@@ -133,8 +133,9 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
|
||||
int x = x0f, dx = Math.abs(x1 - x), sx = x < x1 ? 1 : -1;
|
||||
int y = y0f, dy = Math.abs(y1 - y), sy = y < y1 ? 1 : -1;
|
||||
int e2, err = dx - dy;
|
||||
int ww = world.width(), wh = world.height();
|
||||
|
||||
while(true){
|
||||
while(x >= 0 && y >= 0 && x < ww && y < wh){
|
||||
Building build = world.build(x, y);
|
||||
if(build != null && isAdded() && build.collide(self()) && type.testCollision(self(), build)
|
||||
&& !build.dead() && (type.collidesTeam || build.team != team) && !(type.pierceBuilding && hasCollided(build.id))){
|
||||
|
||||
Reference in New Issue
Block a user