mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-07 00:38:26 +07:00
Fixed #10344
This commit is contained in:
@ -733,15 +733,14 @@ public class CoreBlock extends StorageBlock{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRemoved(){
|
public void onRemoved(){
|
||||||
int total = proximity.count(e -> e.items != null && e.items == items);
|
int totalCapacity = proximity.sum(e -> e.items != null && e.items == items ? e.block.itemCapacity : 0);
|
||||||
float fract = 1f / total / state.teams.cores(team).size;
|
|
||||||
|
|
||||||
proximity.each(e -> owns(e) && e.items == items && owns(e), t -> {
|
proximity.each(e -> owns(e) && e.items == items && owns(e), t -> {
|
||||||
StorageBuild ent = (StorageBuild)t;
|
StorageBuild ent = (StorageBuild)t;
|
||||||
ent.linkedCore = null;
|
ent.linkedCore = null;
|
||||||
ent.items = new ItemModule();
|
ent.items = new ItemModule();
|
||||||
for(Item item : content.items()){
|
for(Item item : content.items()){
|
||||||
ent.items.set(item, (int)(fract * items.get(item)));
|
ent.items.set(item, (int)Math.min(ent.block.itemCapacity, items.get(item) * (float)ent.block.itemCapacity / totalCapacity));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user