This commit is contained in:
Anuken
2020-06-23 16:27:32 -04:00
parent ba78eab30a
commit fc8e1d5b6d
12 changed files with 31 additions and 40 deletions

View File

@@ -60,8 +60,6 @@ public class BuilderAI extends AIController{
blocks.removeFirst();
blocks.addLast(block);
}
}else{
//TODO implement AI base building
}
}
}

View File

@@ -169,6 +169,14 @@ public class Weathers implements ContentList{
region = Core.atlas.find("circle-shadow");
}
@Override
public void update(Weatherc state){
for(Unitc unit : Groups.unit){
unit.impulse(force.x * state.intensity(), force.y * state.intensity());
}
}
@Override
public void drawOver(Weatherc state){
rand.setSeed(0);
@@ -179,10 +187,6 @@ public class Weathers implements ContentList{
Draw.tint(color);
float baseAlpha = Draw.getColor().a;
for(Unitc unit : Groups.unit){
unit.impulse(force.x * state.intensity(), force.y * state.intensity());
}
for(int i = 0; i < total; i++){
float scl = rand.random(0.5f, 1f);
float scl2 = rand.random(0.5f, 1f);

View File

@@ -33,13 +33,6 @@ public class Logic implements ApplicationListener{
public Logic(){
Events.on(WaveEvent.class, event -> {
if(state.isCampaign()){
//TODO implement
//state.getSector().updateWave(state.wave);
}
});
Events.on(BlockDestroyEvent.class, event -> {
//blocks that get broken are appended to the team's broken block queue
Tile tile = event.tile;

View File

@@ -114,12 +114,16 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
if(tile == null) return false;
if(tile.collide(this) && type.collides(this, tile) && !tile.dead() && (type.collidesTeam || tile.team() != team())){
boolean remove = false;
if(tile.team() != team()){
tile.collision(this);
remove = tile.collision(this);
}
type.hitTile(this, tile);
remove();
if(remove){
type.hitTile(this, tile);
remove();
}
return true;
}

View File

@@ -1046,8 +1046,12 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
return true;
}
public void collision(Bulletc other){
/** Handle a bullet collision.
* @return whether the bullet should be removed. */
public boolean collision(Bulletc other){
damage(other.damage() * other.type().tileDamageMultiplier);
return true;
}
public void removeFromProximity(){

View File

@@ -37,7 +37,6 @@ public class AIController implements UnitController{
}
protected void targetClosest(){
//TODO optimize!
Teamc newTarget = Units.closestTarget(unit.team(), unit.x(), unit.y(), Math.max(unit.range(), unit.type().range), u -> (unit.type().targetAir && u.isFlying()) || (unit.type().targetGround && !u.isFlying()));
if(newTarget != null){
target = newTarget;

View File

@@ -2,7 +2,6 @@ package mindustry.entities.units;
import mindustry.gen.*;
//TODO rename
public interface UnitController{
void unit(Unitc unit);
Unitc unit();

View File

@@ -335,7 +335,6 @@ public class Mods implements Loadable{
for(Fi file : mod.root.list()){
//ignore special folders like bundles or sprites
if(file.isDirectory() && !specialFolders.contains(file.name())){
//TODO calling child/parent on these files will give you gibberish; create wrapper class.
file.walk(f -> tree.addFile(mod.file.isDirectory() ? f.path().substring(1 + mod.file.path().length()) :
zipFolder ? f.path().substring(parentName.length() + 1) : f.path(), f));
}

View File

@@ -98,7 +98,6 @@ public class PlayerListFragment extends Fragment{
}
};
table.margin(8);
//TODO dead players should have no region
table.add(new Image(user.icon()).setScaling(Scaling.none)).grow();
button.add(table).size(h);

View File

@@ -175,7 +175,6 @@ public class Block extends UnlockableContent{
protected Prov<Tilec> entityType = null; //initialized later
public ObjectMap<Class<?>, Cons2> configurations = new ObjectMap<>();
//TODO move
protected TextureRegion[] generatedIcons;
protected TextureRegion[] variantRegions, editorVariantRegions;
@@ -183,7 +182,6 @@ public class Block extends UnlockableContent{
public @Load("@-team") TextureRegion teamRegion;
public TextureRegion[] teamRegions;
//TODO move
public static TextureRegion[][] cracks;
protected static final Seq<Tile> tempTiles = new Seq<>();
protected static final Seq<Tilec> tempTileEnts = new Seq<>();

View File

@@ -40,23 +40,16 @@ public class DeflectorWall extends Wall{
}
@Override
public void collision(Bulletc bullet){
public boolean collision(Bulletc bullet){
super.collision(bullet);
//TODO fix and test
//doesn't reflect powerful bullets
if(bullet.damage() > maxDamageDeflect) return;
if(bullet.damage() > maxDamageDeflect) return true;
float penX = Math.abs(getX() - bullet.x()), penY = Math.abs(getY() - bullet.y());
//translate bullet back to where it was upon collision
bullet.trns(-bullet.vel().x, -bullet.vel().y);
bullet.hitbox(rect2);
Vec2 position = Geometry.raycastRect(bullet.x() - bullet.vel().x*Time.delta(), bullet.y() - bullet.vel().y*Time.delta(), bullet.x() + bullet.vel().x*Time.delta(), bullet.y() + bullet.vel().y*Time.delta(),
rect.setSize(size * tilesize + rect2.width*2 + rect2.height*2).setCenter(getX(), getY()));
if(position != null){
bullet.set(position.x, position.y);
}
float penX = Math.abs(x - bullet.x()), penY = Math.abs(y - bullet.y());
if(penX > penY){
bullet.vel().x *= -1;
@@ -64,14 +57,13 @@ public class DeflectorWall extends Wall{
bullet.vel().y *= -1;
}
//bullet.updateVelocity();
bullet.owner(this);
bullet.team(team());
bullet.team(team);
bullet.time(bullet.time() + 1f);
//TODO deflect
//bullet.deflect();
hit = 1f;
return false;
}
}
}

View File

@@ -16,11 +16,13 @@ public class SurgeWall extends Wall{
public class SurgeEntity extends TileEntity{
@Override
public void collision(Bulletc bullet){
public boolean collision(Bulletc bullet){
super.collision(bullet);
if(Mathf.chance(lightningChance)){
Lightning.create(team(), Pal.surge, lightningDamage, x, y, bullet.rotation() + 180f, lightningLength);
}
return true;
}
}
}