Gradle update / Block inventory improved / Crash fixes
This commit is contained in:
@@ -392,32 +392,34 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
|
||||
/**Draw all current build requests. Does not draw the beam effect, only the positions.*/
|
||||
public void drawBuildRequests(){
|
||||
for (BuildRequest request : getPlaceQueue()) {
|
||||
synchronized (getPlaceQueue()) {
|
||||
for (BuildRequest request : getPlaceQueue()) {
|
||||
|
||||
if(request.remove){
|
||||
Block block = world.tile(request.x, request.y).target().block();
|
||||
if (request.remove) {
|
||||
Block block = world.tile(request.x, request.y).target().block();
|
||||
|
||||
//draw removal request
|
||||
Draw.color(Palette.remove);
|
||||
//draw removal request
|
||||
Draw.color(Palette.remove);
|
||||
|
||||
Lines.stroke((1f-request.progress));
|
||||
Lines.stroke((1f - request.progress));
|
||||
|
||||
Lines.poly(request.x * tilesize + block.offset(),
|
||||
request.y * tilesize + block.offset(),
|
||||
4, block.size * tilesize /2f, 45 + 15);
|
||||
}else{
|
||||
//draw place request
|
||||
Draw.color(Palette.accent);
|
||||
Lines.poly(request.x * tilesize + block.offset(),
|
||||
request.y * tilesize + block.offset(),
|
||||
4, block.size * tilesize / 2f, 45 + 15);
|
||||
} else {
|
||||
//draw place request
|
||||
Draw.color(Palette.accent);
|
||||
|
||||
Lines.stroke((1f-request.progress));
|
||||
Lines.stroke((1f - request.progress));
|
||||
|
||||
Lines.poly(request.x * tilesize + request.recipe.result.offset(),
|
||||
request.y * tilesize + request.recipe.result.offset(),
|
||||
4, request.recipe.result.size * tilesize /2f, 45 + 15);
|
||||
Lines.poly(request.x * tilesize + request.recipe.result.offset(),
|
||||
request.y * tilesize + request.recipe.result.offset(),
|
||||
4, request.recipe.result.size * tilesize / 2f, 45 + 15);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Draw.reset();
|
||||
Draw.reset();
|
||||
}
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
@@ -65,11 +65,13 @@ public interface BuilderTrait {
|
||||
/**If a place request matching this signature is present, it is removed.
|
||||
* Otherwise, a new place request is added to the queue.*/
|
||||
default void replaceBuilding(int x, int y, int rotation, Recipe recipe){
|
||||
for(BuildRequest request : getPlaceQueue()){
|
||||
if(request.x == x && request.y == y){
|
||||
clearBuilding();
|
||||
addBuildRequest(request);
|
||||
return;
|
||||
synchronized (getPlaceQueue()) {
|
||||
for (BuildRequest request : getPlaceQueue()) {
|
||||
if (request.x == x && request.y == y) {
|
||||
clearBuilding();
|
||||
addBuildRequest(request);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,14 +87,16 @@ public interface BuilderTrait {
|
||||
}
|
||||
}
|
||||
|
||||
/**Add another build requests to the tail of the queue.*/
|
||||
/**Add another build requests to the tail of the queue, if it doesn't exist there yet.*/
|
||||
default void addBuildRequest(BuildRequest place){
|
||||
for(BuildRequest request : getPlaceQueue()){
|
||||
if(request.x == place.x && request.y == place.y){
|
||||
return;
|
||||
synchronized (getPlaceQueue()) {
|
||||
for (BuildRequest request : getPlaceQueue()) {
|
||||
if (request.x == place.x && request.y == place.y) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
getPlaceQueue().addLast(place);
|
||||
}
|
||||
getPlaceQueue().addLast(place);
|
||||
}
|
||||
|
||||
/**Return the build requests currently active, or the one at the top of the queue.
|
||||
|
||||
Reference in New Issue
Block a user