Fixes wave being an item turret for some reason

This commit is contained in:
Anuken
2020-05-30 09:06:39 -04:00
parent 9e7a97b780
commit 8d0486d425
4 changed files with 20 additions and 17 deletions
+1 -1
View File
@@ -1416,7 +1416,7 @@ public class Blocks implements ContentList{
shootSound = Sounds.artillery; shootSound = Sounds.artillery;
}}; }};
wave = new ItemTurret("wave"){{ wave = new LiquidTurret("wave"){{
requirements(Category.turret, ItemStack.with(Items.metaglass, 45, Items.lead, 75)); requirements(Category.turret, ItemStack.with(Items.metaglass, 45, Items.lead, 75));
ammo( ammo(
Liquids.water, Bullets.waterShot, Liquids.water, Bullets.waterShot,
+15 -12
View File
@@ -221,25 +221,28 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
return tile.absoluteRelativeTo(cx, cy); return tile.absoluteRelativeTo(cx, cy);
} }
public @Nullable Tile frontLarge(){ /** Multiblock front. */
int trns = block.size/2 + 1;
return tile.getNearby(Geometry.d4(rotation()).x * trns, Geometry.d4(rotation()).y * trns);
}
public @Nullable Tilec front(){ public @Nullable Tilec front(){
return nearby((rotation() + 4) % 4); int trns = block.size/2 + 1;
} return nearby(Geometry.d4(rotation()).x * trns, Geometry.d4(rotation()).y * trns);
public @Nullable Tilec right(){
return nearby((rotation() + 3) % 4);
} }
/** Multiblock back. */
public @Nullable Tilec back(){ public @Nullable Tilec back(){
return nearby((rotation() + 2) % 4); int trns = block.size/2 + 1;
return nearby(Geometry.d4(rotation() + 2).x * trns, Geometry.d4(rotation() + 2).y * trns);
} }
/** Multiblock left. */
public @Nullable Tilec left(){ public @Nullable Tilec left(){
return nearby((rotation() + 1) % 4); int trns = block.size/2 + 1;
return nearby(Geometry.d4(rotation() + 1).x * trns, Geometry.d4(rotation() + 1).y * trns);
}
/** Multiblock right. */
public @Nullable Tilec right(){
int trns = block.size/2 + 1;
return nearby(Geometry.d4(rotation() + 3).x * trns, Geometry.d4(rotation() + 3).y * trns);
} }
public int pos(){ public int pos(){
@@ -344,7 +344,7 @@ public abstract class Turret extends Block{
tr.trns(rotation, size * tilesize / 2f, Mathf.range(xRand)); tr.trns(rotation, size * tilesize / 2f, Mathf.range(xRand));
for(int i = 0; i < shots; i++){ for(int i = 0; i < shots; i++){
bullet(type, rotation + Mathf.range(inaccuracy + type.inaccuracy) + (i - shots / 2f) * spread); bullet(type, rotation + Mathf.range(inaccuracy + type.inaccuracy) + (i - (int)(shots / 2f)) * spread);
} }
} }
@@ -79,12 +79,12 @@ public class PayloadAcceptor extends Block{
if(payVector.len() >= size * tilesize/2f){ if(payVector.len() >= size * tilesize/2f){
payVector.clamp(-size * tilesize / 2f, size * tilesize / 2f, -size * tilesize / 2f, size * tilesize / 2f); payVector.clamp(-size * tilesize / 2f, size * tilesize / 2f, -size * tilesize / 2f, size * tilesize / 2f);
Tile front = frontLarge(); Tilec front = front();
if(front != null && front.entity != null && front.block().outputsPayload){ if(front != null && front.block().outputsPayload){
if(movePayload(payload)){ if(movePayload(payload)){
payload = null; payload = null;
} }
}else if(front != null && !front.solid()){ }else if(front != null && !front.tile().solid()){
dumpPayload(); dumpPayload();
} }
} }