This commit is contained in:
Anuken
2024-10-11 11:12:30 -04:00
parent 9c8429deae
commit e384e4b4e9
3 changed files with 3 additions and 29 deletions

View File

@@ -163,7 +163,7 @@ public class Sector{
} }
public boolean isCaptured(){ 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; return save != null && !info.waves && !info.attack;
} }

View File

@@ -179,8 +179,7 @@ public class ItemModule extends BlockModule{
return total > 0; return total > 0;
} }
@Nullable public @Nullable Item first(){
public Item first(){
for(int i = 0; i < items.length; i++){ for(int i = 0; i < items.length; i++){
if(items[i] > 0){ if(items[i] > 0){
return content.item(i); return content.item(i);
@@ -189,8 +188,7 @@ public class ItemModule extends BlockModule{
return null; return null;
} }
@Nullable public @Nullable Item take(){
public Item take(){
for(int i = 0; i < items.length; i++){ for(int i = 0; i < items.length; i++){
int index = (i + takeRotation); int index = (i + takeRotation);
if(index >= items.length) index -= items.length; if(index >= items.length) index -= items.length;
@@ -204,30 +202,6 @@ public class ItemModule extends BlockModule{
return null; 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){ public int get(int id){
return items[id]; return items[id];
} }