Moved unit-related classes, added base flying types

This commit is contained in:
Anuken
2018-04-22 17:40:23 -04:00
parent 5aa995b5ef
commit aa83510fbe
19 changed files with 84 additions and 24 deletions

View File

@@ -0,0 +1,6 @@
package io.anuke.mindustry.ai;
/**Class used for indexing special target blocks for AI.
* TODO implement this class*/
public class BlockIndexer {
}

View File

@@ -114,7 +114,10 @@ public class Recipes {
new Recipe(liquid, LiquidBlocks.pump, stack(Items.steel, 10)),
new Recipe(liquid, LiquidBlocks.fluxpump, stack(Items.steel, 10), stack(Items.densealloy, 5)),
new Recipe(units, UnitBlocks.flierFactory, stack(Items.steel, 10)),
new Recipe(units, UnitBlocks.droneFactory, stack(Items.steel, 10)),
new Recipe(units, UnitBlocks.vtolFactory, stack(Items.steel, 10)),
new Recipe(units, UnitBlocks.droneFactory, stack(Items.steel, 10)),
new Recipe(units, UnitBlocks.droneFactory, stack(Items.steel, 10)),
new Recipe(units, UnitBlocks.walkerFactory, stack(Items.steel, 10)),
new Recipe(units, DebugBlocks.itemSource, stack(Items.steel, 10)).setDebug(),

View File

@@ -1,12 +1,13 @@
package io.anuke.mindustry.content;
import io.anuke.mindustry.entities.units.UnitType;
import io.anuke.mindustry.entities.units.types.Flier;
import io.anuke.mindustry.entities.units.types.Vtol;
import io.anuke.mindustry.entities.units.types.Scout;
public class UnitTypes {
public static final UnitType
drone = new Vtol(),
scout = new Scout(),
flier = new Flier();
vtol = new Vtol();
}

View File

@@ -4,13 +4,22 @@ import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.UnitTypes;
import io.anuke.mindustry.resource.ItemStack;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.types.production.UnitFactory;
import io.anuke.mindustry.world.blocks.types.units.UnitFactory;
public class UnitBlocks {
public static final Block
flierFactory = new UnitFactory("flierfactory"){{
type = UnitTypes.flier;
droneFactory = new UnitFactory("dronefactory"){{
type = UnitTypes.drone;
produceTime = 200;
size = 2;
requirements = new ItemStack[]{
new ItemStack(Items.stone, 5)
};
}},
vtolFactory = new UnitFactory("vtolfactory"){{
type = UnitTypes.vtol;
produceTime = 200;
size = 2;
requirements = new ItemStack[]{

View File

@@ -123,7 +123,7 @@ public class TurretBullets {
hiteffect = BulletFx.hitLancer;
despawneffect = Fx.none;
hitsize = 4;
lifetime = 20f;
lifetime = 16f;
pierce = true;
}
@@ -134,12 +134,15 @@ public class TurretBullets {
@Override
public void draw(Bullet b) {
Lines.lineAngle(b.x, b.y, b.angle(), length);
float f = Mathf.curve(b.fin(), 0f, 0.2f);
float baseLen = length * f;
Lines.lineAngle(b.x, b.y, b.angle(), baseLen);
for(int s = 0; s < 3; s ++) {
Draw.color(colors[s]);
for (int i = 0; i < tscales.length; i++) {
Lines.stroke(7f * b.fout() * (s == 0 ? 1.5f : s == 1 ? 1f : 0.3f) * tscales[i]);
Lines.lineAngle(b.x, b.y, b.angle(), length * lenscales[i]);
Lines.lineAngle(b.x, b.y, b.angle(), baseLen * lenscales[i]);
}
}
Draw.reset();

View File

@@ -0,0 +1,10 @@
package io.anuke.mindustry.entities.units.types;
import io.anuke.mindustry.entities.units.FlyingUnitType;
public class Bomber extends FlyingUnitType {
public Bomber(String name) {
super(name);
}
}

View File

@@ -0,0 +1,10 @@
package io.anuke.mindustry.entities.units.types;
import io.anuke.mindustry.entities.units.FlyingUnitType;
public class Cruiser extends FlyingUnitType {
public Cruiser(String name) {
super(name);
}
}

View File

@@ -0,0 +1,9 @@
package io.anuke.mindustry.entities.units.types;
import io.anuke.mindustry.entities.units.FlyingUnitType;
public class Reaper extends FlyingUnitType {
public Reaper(String name) {
super(name);
}
}

View File

@@ -0,0 +1,10 @@
package io.anuke.mindustry.entities.units.types;
import io.anuke.mindustry.entities.units.FlyingUnitType;
public class RepairDrone extends FlyingUnitType {
public RepairDrone(String name) {
super(name);
}
}

View File

@@ -2,9 +2,9 @@ package io.anuke.mindustry.entities.units.types;
import io.anuke.mindustry.entities.units.FlyingUnitType;
public class Flier extends FlyingUnitType {
public class Vtol extends FlyingUnitType {
public Flier(){
public Vtol(){
super("flier");
}

View File

@@ -7,11 +7,11 @@ import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.StaticBlock;
import io.anuke.mindustry.world.blocks.types.defense.Turret;
import io.anuke.ucore.core.Graphics;
import io.anuke.ucore.core.Settings;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Mathf;
import java.util.Arrays;
import static io.anuke.mindustry.Vars.*;
@@ -230,8 +230,7 @@ public class BlockRenderer{
if((storeX == drawx - halfBlockWidth || storeX == drawx + halfBlockWidth || storeY == drawy - halfBlockHeight || storeY == drawy + halfBlockHeight) &&
((tiley - control.input().getBlockY()) % block.size != 0 || (tilex - control.input().getBlockX()) % block.size != 0)) {
return;
}
else {
}else{
storeX = drawx;
storeY = drawy;
}
@@ -241,14 +240,6 @@ public class BlockRenderer{
Draw.color(Color.WHITE);
Draw.alpha(opacity);
if(block instanceof Turret) {
if (block.isMultiblock()) {
Draw.rect("block-" + block.size + "x" + block.size, drawx, drawy);
} else {
Draw.rect("block", drawx, drawy);
}
}
drawPreview(block, drawx, drawy, rotation, opacity);
Draw.reset();

View File

@@ -0,0 +1,4 @@
package io.anuke.mindustry.world.blocks.types.units;
public class ResupplyPoint {
}

View File

@@ -1,4 +1,4 @@
package io.anuke.mindustry.world.blocks.types.production;
package io.anuke.mindustry.world.blocks.types.units;
import com.badlogic.gdx.graphics.Colors;
import com.badlogic.gdx.graphics.g2d.TextureRegion;

View File

@@ -0,0 +1,4 @@
package io.anuke.mindustry.world.blocks.types.units;
public class UnloadPoint {
}