Fully implemented mass driver
This commit is contained in:
@@ -45,34 +45,22 @@ public interface BuilderTrait extends Entity{
|
||||
float placeDistance = 150f;
|
||||
float mineDistance = 70f;
|
||||
|
||||
/**
|
||||
* Returns the queue for storing build requests.
|
||||
*/
|
||||
/**Returns the queue for storing build requests.*/
|
||||
Queue<BuildRequest> getPlaceQueue();
|
||||
|
||||
/**
|
||||
* Returns the tile this builder is currently mining.
|
||||
*/
|
||||
/**Returns the tile this builder is currently mining.*/
|
||||
Tile getMineTile();
|
||||
|
||||
/**
|
||||
* Sets the tile this builder is currently mining.
|
||||
*/
|
||||
/**Sets the tile this builder is currently mining.*/
|
||||
void setMineTile(Tile tile);
|
||||
|
||||
/**
|
||||
* Returns the minining speed of this miner. 1 = standard, 0.5 = half speed, 2 = double speed, etc.
|
||||
*/
|
||||
/**Returns the minining speed of this miner. 1 = standard, 0.5 = half speed, 2 = double speed, etc.*/
|
||||
float getMinePower();
|
||||
|
||||
/**
|
||||
* Build power, can be any float. 1 = builds recipes in normal time, 0 = doesn't build at all.
|
||||
*/
|
||||
/**Build power, can be any float. 1 = builds recipes in normal time, 0 = doesn't build at all.*/
|
||||
float getBuildPower(Tile tile);
|
||||
|
||||
/**
|
||||
* Whether this type of builder can begin creating new blocks.
|
||||
*/
|
||||
/**Whether this type of builder can begin creating new blocks.*/
|
||||
default boolean canCreateBlocks(){
|
||||
return true;
|
||||
}
|
||||
@@ -120,9 +108,7 @@ public interface BuilderTrait extends Entity{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this builder's place queue contains items.
|
||||
*/
|
||||
/**Return whether this builder's place queue contains items.*/
|
||||
default boolean isBuilding(){
|
||||
return getPlaceQueue().size != 0;
|
||||
}
|
||||
@@ -145,16 +131,12 @@ public interface BuilderTrait extends Entity{
|
||||
addBuildRequest(new BuildRequest(x, y, rotation, recipe));
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the placement queue.
|
||||
*/
|
||||
/**Clears the placement queue.*/
|
||||
default void clearBuilding(){
|
||||
getPlaceQueue().clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add another build requests to the tail of the queue, if it doesn't exist there yet.
|
||||
*/
|
||||
/**Add another build requests to the tail of the queue, if it doesn't exist there yet.*/
|
||||
default void addBuildRequest(BuildRequest place){
|
||||
synchronized(getPlaceQueue()){
|
||||
for(BuildRequest request : getPlaceQueue()){
|
||||
@@ -233,9 +215,7 @@ public interface BuilderTrait extends Entity{
|
||||
current.progress = entity.progress();
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not call directly.
|
||||
*/
|
||||
/**Do not call directly.*/
|
||||
default void updateMining(Unit unit){
|
||||
Tile tile = getMineTile();
|
||||
|
||||
@@ -261,9 +241,7 @@ public interface BuilderTrait extends Entity{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw placement effects for an entity. This includes mining
|
||||
*/
|
||||
/**Draw placement effects for an entity. This includes mining*/
|
||||
default void drawBuilding(Unit unit){
|
||||
BuildRequest request;
|
||||
|
||||
@@ -320,9 +298,7 @@ public interface BuilderTrait extends Entity{
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal use only.
|
||||
*/
|
||||
/**Internal use only.*/
|
||||
default void drawMining(Unit unit){
|
||||
Tile tile = getMineTile();
|
||||
|
||||
@@ -349,9 +325,7 @@ public interface BuilderTrait extends Entity{
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for storing build requests. Can be either a place or remove request.
|
||||
*/
|
||||
/**Class for storing build requests. Can be either a place or remove request.*/
|
||||
class BuildRequest{
|
||||
public final int x, y, rotation;
|
||||
public final Recipe recipe;
|
||||
@@ -359,9 +333,7 @@ public interface BuilderTrait extends Entity{
|
||||
|
||||
public float progress;
|
||||
|
||||
/**
|
||||
* This creates a build request.
|
||||
*/
|
||||
/**This creates a build request.*/
|
||||
public BuildRequest(int x, int y, int rotation, Recipe recipe){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
@@ -370,9 +342,7 @@ public interface BuilderTrait extends Entity{
|
||||
this.remove = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This creates a remove request.
|
||||
*/
|
||||
/**This creates a remove request.*/
|
||||
public BuildRequest(int x, int y){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
Reference in New Issue
Block a user