mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-03-29 18:20:39 -07:00
Enforce sector core capacity
This commit is contained in:
parent
0d6657a1e8
commit
fb032eb763
2 changed files with 5 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue