mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-09 04:09:07 +07:00
Fixed #10259
This commit is contained in:
parent
9c8429deae
commit
e384e4b4e9
Binary file not shown.
@ -163,7 +163,7 @@ public class Sector{
|
||||
}
|
||||
|
||||
public boolean isCaptured(){
|
||||
if(isBeingPlayed()) return !info.waves && !info.attack;
|
||||
if(isBeingPlayed()) return !state.rules.waves && !state.rules.attackMode;
|
||||
return save != null && !info.waves && !info.attack;
|
||||
}
|
||||
|
||||
|
@ -179,8 +179,7 @@ public class ItemModule extends BlockModule{
|
||||
return total > 0;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Item first(){
|
||||
public @Nullable Item first(){
|
||||
for(int i = 0; i < items.length; i++){
|
||||
if(items[i] > 0){
|
||||
return content.item(i);
|
||||
@ -189,8 +188,7 @@ public class ItemModule extends BlockModule{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Item take(){
|
||||
public @Nullable Item take(){
|
||||
for(int i = 0; i < items.length; i++){
|
||||
int index = (i + takeRotation);
|
||||
if(index >= items.length) index -= items.length;
|
||||
@ -204,30 +202,6 @@ public class ItemModule extends BlockModule{
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Begins a speculative take operation. This returns the item that would be returned by #take(), but does not change state. */
|
||||
@Nullable
|
||||
public Item takeIndex(int takeRotation){
|
||||
for(int i = 0; i < items.length; i++){
|
||||
int index = (i + takeRotation);
|
||||
if(index >= items.length) index -= items.length;
|
||||
if(items[index] > 0){
|
||||
return content.item(index);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int nextIndex(int takeRotation){
|
||||
for(int i = 1; i < items.length; i++){
|
||||
int index = (i + takeRotation);
|
||||
if(index >= items.length) index -= items.length;
|
||||
if(items[index] > 0){
|
||||
return (takeRotation + i) % items.length;
|
||||
}
|
||||
}
|
||||
return takeRotation;
|
||||
}
|
||||
|
||||
public int get(int id){
|
||||
return items[id];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user