mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-06 07:30:35 +07:00
canWithdraw()
+ changes to displayable()
(#6902)
* `shouldDiplay()` + `canWithdraw()` * Better implementation of `displayable()`
This commit is contained in:
parent
968651d9ed
commit
5cc314672f
@ -613,6 +613,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
Fx.unitDrop.at(unit);
|
Fx.unitDrop.at(unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canWithdraw(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean canUnload(){
|
public boolean canUnload(){
|
||||||
return block.unloadable;
|
return block.unloadable;
|
||||||
}
|
}
|
||||||
@ -1342,11 +1346,6 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
public ItemModule flowItems(){
|
public ItemModule flowItems(){
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean displayable(){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void display(Table table){
|
public void display(Table table){
|
||||||
//display the block stuff
|
//display the block stuff
|
||||||
|
@ -4,5 +4,9 @@ import arc.scene.ui.layout.*;
|
|||||||
|
|
||||||
/** An interface for things that can be displayed when hovered over. */
|
/** An interface for things that can be displayed when hovered over. */
|
||||||
public interface Displayable{
|
public interface Displayable{
|
||||||
|
default boolean displayable(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void display(Table table);
|
void display(Table table);
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,8 @@ public class BlockInventoryFragment{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void takeItem(int requested){
|
private void takeItem(int requested){
|
||||||
|
if(!build.canWithdraw()) return;
|
||||||
|
|
||||||
//take everything
|
//take everything
|
||||||
int amount = Math.min(requested, player.unit().maxAccepted(lastItem));
|
int amount = Math.min(requested, player.unit().maxAccepted(lastItem));
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ public class PlacementFragment{
|
|||||||
if(Core.scene.hasMouse() || topTable.hit(v.x, v.y, false) != null) return null;
|
if(Core.scene.hasMouse() || topTable.hit(v.x, v.y, false) != null) return null;
|
||||||
|
|
||||||
//check for a unit
|
//check for a unit
|
||||||
Unit unit = Units.closestOverlap(player.team(), Core.input.mouseWorldX(), Core.input.mouseWorldY(), 5f, u -> !u.isLocal());
|
Unit unit = Units.closestOverlap(player.team(), Core.input.mouseWorldX(), Core.input.mouseWorldY(), 5f, u -> !u.isLocal() && u.displayable());
|
||||||
//if cursor has a unit, display it
|
//if cursor has a unit, display it
|
||||||
if(unit != null) return unit;
|
if(unit != null) return unit;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user