Surge uses / Fixes, optimizations / Turret implementation base

This commit is contained in:
Anuken
2018-08-27 23:50:23 -04:00
parent 9b57550f3d
commit 802e7b12d0
42 changed files with 875 additions and 720 deletions
@@ -14,7 +14,7 @@ import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Edges;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.Wall;
import io.anuke.mindustry.world.blocks.defense.Wall;
import io.anuke.mindustry.world.consumers.Consume;
import io.anuke.mindustry.world.modules.ConsumeModule;
import io.anuke.mindustry.world.modules.InventoryModule;
@@ -108,6 +108,10 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
return data;
}
public void setData(Object data){
this.data = data;
}
@Override
public float getDamage(){
if(owner instanceof Unit){
@@ -0,0 +1,41 @@
package io.anuke.mindustry.entities.bullet;
import com.badlogic.gdx.math.Rectangle;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.entities.Units;
import io.anuke.ucore.core.Timers;
public abstract class FlakBulletType extends BasicBulletType{
protected static Rectangle rect = new Rectangle();
protected float explodeRange = 30f;
public FlakBulletType(float speed, float damage){
super(speed, damage, "shell");
splashDamage = 15f;
splashDamageRadius = 34f;
hiteffect = BulletFx.flakExplosionBig;
bulletWidth = 8f;
bulletHeight = 10f;
}
@Override
public void update(Bullet b){
super.update(b);
if(b.getData() instanceof Integer) return;
if(b.timer.get(2, 6)){
Units.getNearbyEnemies(b.getTeam(), rect.setSize(explodeRange*2f).setCenter(b.x, b.y), unit -> {
if(b.getData() instanceof Float) return;
if(unit.distanceTo(b) < explodeRange){
b.setData(0);
Timers.run(5f, () -> {
if(b.getData() instanceof Integer){
b.time(b.lifetime());
}
});
}
});
}
}
}
@@ -56,6 +56,7 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncT
Call.createLighting(lastSeed++, team, effect, color, damage, x, y, targetAngle, length);
}
/**Do not invoke!*/
@Remote(called = Loc.server)
public static void createLighting(int seed, Team team, Effect effect, Color color, float damage, float x, float y, float targetAngle, int length){
Lightning l = Pooling.obtain(Lightning.class);
@@ -251,6 +251,7 @@ public abstract class GroundUnit extends BaseUnit{
if(enemy == null) return;
Tile tile = world.tileWorld(x, y);
if(tile == null) return;
Tile targetTile = world.pathfinder().getTargetTile(enemy, tile);
TileEntity core = getClosestCore();