Enforce sector core capacity
This commit is contained in:
@@ -16,6 +16,7 @@ import mindustry.type.Weather.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.*;
|
||||
import mindustry.world.blocks.BuildBlock.*;
|
||||
import mindustry.world.blocks.storage.CoreBlock.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -88,7 +89,7 @@ public class Logic implements ApplicationListener{
|
||||
Events.on(WorldLoadEvent.class, e -> {
|
||||
if(state.isCampaign() && state.rules.sector.getTurnsPassed() > 0){
|
||||
int passed = state.rules.sector.getTurnsPassed();
|
||||
Building core = state.rules.defaultTeam.core();
|
||||
CoreEntity core = state.rules.defaultTeam.core();
|
||||
|
||||
if(state.rules.sector.hasWaves()){
|
||||
SectorDamage.apply(passed);
|
||||
@@ -103,6 +104,8 @@ public class Logic implements ApplicationListener{
|
||||
|
||||
//ensure positive items
|
||||
if(core.items.get(item) < 0) core.items.set(item, 0);
|
||||
//cap the items
|
||||
if(core.items.get(item) > core.storageCapacity) core.items.set(item, core.storageCapacity);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -312,7 +312,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
|
||||
int i = 0;
|
||||
for(Item item : content.items()){
|
||||
int amount = map.get(item);
|
||||
int amount = Math.min(map.get(item), sector.save.meta.secinfo.storageCapacity);
|
||||
if(amount > 0){
|
||||
res.image(item.icon(Cicon.small)).padRight(3);
|
||||
res.add(ui.formatAmount(amount)).color(Color.lightGray);
|
||||
|
||||
Reference in New Issue
Block a user