This commit is contained in:
Anuken
2019-06-08 10:41:22 -04:00
parent 10bd1d1969
commit e6499f7e5a
6 changed files with 22 additions and 10 deletions

View File

@@ -547,7 +547,7 @@ public class Bullets implements ContentList{
@Override
public void update(Bullet b){
if(b.timer.get(1, 5f)){
Damage.collideLine(b, b.getTeam(), hitEffect, b.x, b.y, b.rot(), length);
Damage.collideLine(b, b.getTeam(), hitEffect, b.x, b.y, b.rot(), length, true);
}
Effects.shake(1f, 1f, b.x, b.y);
}

View File

@@ -190,6 +190,7 @@ public class NetClient implements ApplicationListener{
public static void onWorldDataBegin(){
Entities.clear();
netClient.removed.clear();
logic.reset();
ui.chatfrag.clearMessages();
Net.setClientLoaded(false);

View File

@@ -3,8 +3,7 @@ package io.anuke.mindustry.entities;
import io.anuke.annotations.Annotations.Struct;
import io.anuke.arc.collection.GridBits;
import io.anuke.arc.collection.IntQueue;
import io.anuke.arc.function.Consumer;
import io.anuke.arc.function.Predicate;
import io.anuke.arc.function.*;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.*;
@@ -78,18 +77,31 @@ public class Damage{
}
}
public static void collideLine(Bullet hitter, Team team, Effect effect, float x, float y, float angle, float length){
collideLine(hitter, team, effect, x, y, angle, length, false);
}
/**
* Damages entities in a line.
* Only enemies of the specified team are damaged.
*/
public static void collideLine(Bullet hitter, Team team, Effect effect, float x, float y, float angle, float length){
public static void collideLine(Bullet hitter, Team team, Effect effect, float x, float y, float angle, float length, boolean large){
tr.trns(angle, length);
world.raycastEachWorld(x, y, x + tr.x, y + tr.y, (cx, cy) -> {
IntPositionConsumer collider = (cx, cy) -> {
Tile tile = world.ltile(cx, cy);
if(tile != null && tile.entity != null && tile.getTeamID() != team.ordinal() && tile.entity.collide(hitter)){
tile.entity.collision(hitter);
hitter.getBulletType().hit(hitter, tile.worldx(), tile.worldy());
}
};
world.raycastEachWorld(x, y, x + tr.x, y + tr.y, (cx, cy) -> {
collider.accept(cx, cy);
if(large){
for(Point2 p : Geometry.d4){
collider.accept(cx + p.x, cy + p.y);
}
}
return false;
});

View File

@@ -56,8 +56,8 @@ public class Predict{
*/
public static Vector2 intercept(TargetTrait src, TargetTrait dst, float v){
return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(),
dst.getTargetVelocityX() - src.getTargetVelocityX(),
dst.getTargetVelocityY() - src.getTargetVelocityY(), v);
dst.getTargetVelocityX() - src.getTargetVelocityX()/2f,
dst.getTargetVelocityY() - src.getTargetVelocityY()/2f, v);
}
private static Vector2 quad(float a, float b, float c){

View File

@@ -4,8 +4,7 @@ import io.anuke.arc.Core;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.entities.Entities;
import io.anuke.mindustry.entities.type.Player;
import io.anuke.mindustry.game.Rules;
import io.anuke.mindustry.game.Version;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.io.JsonIO;
import io.anuke.mindustry.io.SaveIO;
import io.anuke.mindustry.maps.Map;

View File

@@ -83,7 +83,7 @@ public class MechPad extends Block{
protected static boolean checkValidTap(Tile tile, Player player){
MechFactoryEntity entity = tile.entity();
return Math.abs(player.x - tile.drawx()) <= tile.block().size * tilesize &&
return !player.isDead() && Math.abs(player.x - tile.drawx()) <= tile.block().size * tilesize &&
Math.abs(player.y - tile.drawy()) <= tile.block().size * tilesize && entity.cons.valid() && entity.player == null;
}