This commit is contained in:
Anuken
2020-10-18 09:08:47 -04:00
parent 521d44714d
commit c1c41a19c8
16 changed files with 30 additions and 30 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ public class Build{
Core.app.post(() -> Events.fire(new BlockBuildBeginEvent(tile, team, true)));
}
/** Places a BuildBlock at this location. */
/** Places a ConstructBlock at this location. */
@Remote(called = Loc.server)
public static void beginPlace(Block result, Team team, int x, int y, int rotation){
if(!validPlace(result, team, x, y, rotation)){
+1 -1
View File
@@ -21,7 +21,7 @@ public class CachedTile extends Tile{
}
@Override
protected void changeEntity(Team team, Prov<Building> entityprov, int rotation){
protected void changeBuild(Team team, Prov<Building> entityprov, int rotation){
build = null;
Block block = block();
+7 -7
View File
@@ -45,7 +45,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
this.block = wall;
//update entity and create it if needed
changeEntity(Team.derelict, wall::newBuilding, 0);
changeBuild(Team.derelict, wall::newBuilding, 0);
changed();
}
@@ -186,7 +186,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
this.block = type;
preChanged();
changeEntity(team, entityprov, (byte)Mathf.mod(rotation, 4));
changeBuild(team, entityprov, (byte)Mathf.mod(rotation, 4));
if(build != null){
build.team(team);
@@ -430,15 +430,15 @@ public class Tile implements Position, QuadTreeObject, Displayable{
getHitbox(rect);
}
public Tile getNearby(Point2 relative){
public Tile nearby(Point2 relative){
return world.tile(x + relative.x, y + relative.y);
}
public Tile getNearby(int dx, int dy){
public Tile nearby(int dx, int dy){
return world.tile(x + dx, y + dy);
}
public Tile getNearby(int rotation){
public Tile nearby(int rotation){
if(rotation == 0) return world.tile(x + 1, y);
if(rotation == 1) return world.tile(x, y + 1);
if(rotation == 2) return world.tile(x - 1, y);
@@ -446,7 +446,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
return null;
}
public Building getNearbyEntity(int rotation){
public Building nearbyBuild(int rotation){
if(rotation == 0) return world.build(x + 1, y);
if(rotation == 1) return world.build(x, y + 1);
if(rotation == 2) return world.build(x - 1, y);
@@ -503,7 +503,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
}
}
protected void changeEntity(Team team, Prov<Building> entityprov, int rotation){
protected void changeBuild(Team team, Prov<Building> entityprov, int rotation){
if(build != null){
int size = build.block.size;
build.remove();
@@ -133,7 +133,7 @@ public interface Autotiler{
for(int i = 0; i < 4; i++){
int realDir = Mathf.mod(rotation - i, 4);
if(blends(tile, rotation, directional, i, world) && (tile != null && tile.getNearbyEntity(realDir) != null && !tile.getNearbyEntity(realDir).block.squareSprite)){
if(blends(tile, rotation, directional, i, world) && (tile != null && tile.nearbyBuild(realDir) != null && !tile.nearbyBuild(realDir).block.squareSprite)){
blendresult[4] |= (1 << i);
}
}
@@ -194,7 +194,7 @@ public interface Autotiler{
// TODO docs -- use for direction?
default boolean blends(Tile tile, int rotation, int direction){
Building other = tile.getNearbyEntity(Mathf.mod(rotation - direction, 4));
Building other = tile.nearbyBuild(Mathf.mod(rotation - direction, 4));
return other != null && other.team == tile.team() && blends(tile, rotation, other.tileX(), other.tileY(), other.rotation, other.block);
}
@@ -42,7 +42,7 @@ public class ConstructBlock extends Block{
consBlocks[size - 1] = this;
}
/** Returns a BuildBlock by size. */
/** Returns a ConstructBlock by size. */
public static ConstructBlock get(int size){
if(size > maxSize) throw new IllegalArgumentException("No. Don't place ConstructBlock of size greater than " + maxSize);
return consBlocks[size - 1];
@@ -202,7 +202,7 @@ public class ItemBridge extends Block{
for(int i = 1; i <= range; i++){
for(int j = 0; j < 4; j++){
Tile other = tile.getNearby(Geometry.d4[j].x * i, Geometry.d4[j].y * i);
Tile other = tile.nearby(Geometry.d4[j].x * i, Geometry.d4[j].y * i);
if(linkValid(tile, other)){
boolean linked = other.pos() == link;
@@ -87,7 +87,7 @@ public class PayloadConveyor extends Block{
}
int ntrns = 1 + size/2;
Tile next = tile.getNearby(Geometry.d4(rotation).x * ntrns, Geometry.d4(rotation).y * ntrns);
Tile next = tile.nearby(Geometry.d4(rotation).x * ntrns, Geometry.d4(rotation).y * ntrns);
blocked = (next != null && next.solid() && !next.block().outputsPayload) || (this.next != null && (this.next.rotation + 2)%4 == rotation);
}
@@ -183,7 +183,7 @@ public class Floor extends Block{
for(int i = 0; i < 8; i++){
Point2 point = Geometry.d8[i];
Tile other = tile.getNearby(point);
Tile other = tile.nearby(point);
if(other != null && other.floor().cacheLayer == layer && other.floor().edges() != null){
if(!blended.getAndSet(other.floor().id)){
blenders.add(other.floor());
@@ -200,7 +200,7 @@ public class Floor extends Block{
for(int i = 0; i < 8; i++){
Point2 point = Geometry.d8[i];
Tile other = tile.getNearby(point);
Tile other = tile.nearby(point);
if(other != null && doEdge(other.floor()) && other.floor().cacheLayer == cacheLayer && other.floor().edges() != null){
if(!blended.getAndSet(other.floor().id)){
blenders.add(other.floor());
@@ -217,7 +217,7 @@ public class Floor extends Block{
for(Block block : blenders){
for(int i = 0; i < 8; i++){
Point2 point = Geometry.d8[i];
Tile other = tile.getNearby(point);
Tile other = tile.nearby(point);
if(other != null && other.floor() == block){
TextureRegion region = edge((Floor)block, 1 - point.x, 1 - point.y);
Draw.rect(region, tile.worldx(), tile.worldy());
@@ -229,7 +229,7 @@ public class Floor extends Block{
//'new' style of edges with shadows instead of colors, not used currently
protected void drawEdgesFlat(Tile tile, boolean sameLayer){
for(int i = 0; i < 4; i++){
Tile other = tile.getNearby(i);
Tile other = tile.nearby(i);
if(other != null && doEdge(other.floor())){
Color color = other.floor().mapColor;
Draw.color(color.r, color.g, color.b, 1f);
@@ -21,7 +21,7 @@ public class StaticTree extends StaticWall{
float oy = 0;
for(int i = 0; i < 4; i++){
if(tile.getNearby(i) != null && tile.getNearby(i).block() instanceof StaticWall){
if(tile.nearby(i) != null && tile.nearby(i).block() instanceof StaticWall){
if(i == 0){
r.setWidth(r.width - crop);