Fixed unit assembler overlap
This commit is contained in:
@@ -1453,7 +1453,7 @@ public class UnitTypes{
|
|||||||
engineSize = 7.8f;
|
engineSize = 7.8f;
|
||||||
rotateShooting = false;
|
rotateShooting = false;
|
||||||
hitSize = 66f;
|
hitSize = 66f;
|
||||||
payloadCapacity = (5.3f * 5.3f) * tilePayload;
|
payloadCapacity = (5.5f * 5.5f) * tilePayload;
|
||||||
buildSpeed = 4f;
|
buildSpeed = 4f;
|
||||||
drawShields = false;
|
drawShields = false;
|
||||||
commandLimit = 6;
|
commandLimit = 6;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import mindustry.annotations.Annotations.*;
|
|||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
import mindustry.entities.units.*;
|
import mindustry.entities.units.*;
|
||||||
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
@@ -46,20 +47,35 @@ public class UnitAssembler extends PayloadBlock{
|
|||||||
flags = EnumSet.of(BlockFlag.unitAssembler);
|
flags = EnumSet.of(BlockFlag.unitAssembler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Rect getRect(Rect rect, float x, float y, int rotation){
|
||||||
|
rect.setCentered(x, y, areaSize * tilesize);
|
||||||
|
float len = tilesize * (areaSize + size)/2f;
|
||||||
|
|
||||||
|
rect.x += Geometry.d4x(rotation) * len;
|
||||||
|
rect.y += Geometry.d4y(rotation) * len;
|
||||||
|
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawPlace(int x, int y, int rotation, boolean valid){
|
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||||
super.drawPlace(x, y, rotation, valid);
|
super.drawPlace(x, y, rotation, valid);
|
||||||
|
|
||||||
x *= tilesize;
|
x *= tilesize;
|
||||||
y *= tilesize;
|
y *= tilesize;
|
||||||
|
x += offset;
|
||||||
|
y += offset;
|
||||||
|
|
||||||
Tmp.r1.setCentered(x, y, areaSize * tilesize);
|
Rect rect = getRect(Tmp.r1, x, y, rotation);
|
||||||
float len = tilesize * (areaSize + size)/2f;
|
|
||||||
|
|
||||||
Tmp.r1.x += Geometry.d4x(rotation) * len;
|
Drawf.dashRect(valid ? Pal.accent : Pal.remove, rect);
|
||||||
Tmp.r1.y += Geometry.d4y(rotation) * len;
|
}
|
||||||
|
|
||||||
Drawf.dashRect(valid ? Pal.accent : Pal.remove, Tmp.r1);
|
@Override
|
||||||
|
public boolean canPlaceOn(Tile tile, Team team, int rotation){
|
||||||
|
//overlapping construction areas not allowed.
|
||||||
|
Rect rect = getRect(Tmp.r1, tile.worldx() + offset, tile.worldy() + offset, rotation).grow(0.1f);
|
||||||
|
return !indexer.getFlagged(team, BlockFlag.unitAssembler).contains(b -> getRect(Tmp.r2, b.x, b.y, b.rotation).overlaps(rect));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user