Implemented multiblocks, added nuclear reactor, many internals changed

This commit is contained in:
Anuken
2017-10-24 19:07:27 -04:00
parent 9c0b8c7e54
commit 2447f240fa
27 changed files with 640 additions and 308 deletions

View File

@@ -32,10 +32,25 @@ public class Bullet extends BulletEntity{
int tilex = Mathf.scl2(x, tilesize);
int tiley = Mathf.scl2(y, tilesize);
Tile tile = World.tile(tilex, tiley);
TileEntity targetEntity = null;
if(tile != null && tile.entity != null &&
tile.entity.collide(this) && !tile.entity.dead){
tile.entity.collision(this);
if(tile != null){
if(tile.entity != null && tile.entity.collide(this) && !tile.entity.dead){
targetEntity = tile.entity;
}else{
//make sure to check for linked block collisions
//TODO move this to the block class?
Tile linked = tile.getLinked();
if(linked != null &&
linked.entity != null && linked.entity.collide(this) && !linked.entity.dead){
targetEntity = linked.entity;
}
}
}
if(targetEntity != null){
targetEntity.collision(this);
remove();
type.removed(this);
}

View File

@@ -50,11 +50,14 @@ public class TileEntity extends Entity{
Vars.control.coreDestroyed();
}
tile.setBlock(Blocks.air);
Effects.shake(4f, 4f, this);
Effects.effect("explosion", this);
Block block = tile.block();
Effects.sound("break", this);
block.onDestroyed(tile);
for(Tile other : tile.getLinkedTiles()){
other.setBlock(Blocks.air);
}
tile.setBlock(Blocks.air);
}
public void collision(Bullet other){