Removed item core restrictions

This commit is contained in:
Anuken 2020-06-29 19:32:15 -04:00
parent 810a59f146
commit df4278a646
11 changed files with 10 additions and 38 deletions

View File

@ -830,7 +830,6 @@ liquid.water.name = Water
liquid.slag.name = Slag
liquid.oil.name = Oil
liquid.cryofluid.name = Cryofluid
item.corestorable = [lightgray]Storable in Core: {0}
item.explosiveness = [lightgray]Explosiveness: {0}%
item.flammability = [lightgray]Flammability: {0}%
item.radioactivity = [lightgray]Radioactivity: {0}%

View File

@ -1,9 +1,8 @@
package mindustry.content;
import arc.graphics.Color;
import mindustry.ctype.ContentList;
import mindustry.type.Item;
import mindustry.type.ItemType;
import arc.graphics.*;
import mindustry.ctype.*;
import mindustry.type.*;
public class Items implements ContentList{
public static Item scrap, copper, lead, graphite, coal, titanium, thorium, silicon, plastanium, phasefabric, surgealloy,
@ -12,26 +11,22 @@ public class Items implements ContentList{
@Override
public void load(){
copper = new Item("copper", Color.valueOf("d99d73")){{
type = ItemType.material;
hardness = 1;
cost = 0.5f;
alwaysUnlocked = true;
}};
lead = new Item("lead", Color.valueOf("8c7fa9")){{
type = ItemType.material;
hardness = 1;
cost = 0.7f;
alwaysUnlocked = true;
}};
metaglass = new Item("metaglass", Color.valueOf("ebeef5")){{
type = ItemType.material;
cost = 1.5f;
}};
graphite = new Item("graphite", Color.valueOf("b2c6d2")){{
type = ItemType.material;
cost = 1f;
}};
@ -46,13 +41,11 @@ public class Items implements ContentList{
}};
titanium = new Item("titanium", Color.valueOf("8da1e3")){{
type = ItemType.material;
hardness = 3;
cost = 1f;
}};
thorium = new Item("thorium", Color.valueOf("f9a3c7")){{
type = ItemType.material;
explosiveness = 0.2f;
hardness = 4;
radioactivity = 1f;
@ -64,25 +57,21 @@ public class Items implements ContentList{
}};
silicon = new Item("silicon", Color.valueOf("53565c")){{
type = ItemType.material;
cost = 0.8f;
}};
plastanium = new Item("plastanium", Color.valueOf("cbd97f")){{
type = ItemType.material;
flammability = 0.1f;
explosiveness = 0.2f;
cost = 1.3f;
}};
phasefabric = new Item("phase-fabric", Color.valueOf("f4ba6e")){{
type = ItemType.material;
cost = 1.3f;
radioactivity = 0.6f;
}};
surgealloy = new Item("surge-alloy", Color.valueOf("f3e979")){{
type = ItemType.material;
}};
sporePod = new Item("spore-pod", Color.valueOf("7457ce")){{

View File

@ -39,7 +39,7 @@ public class Stats{
//weigh used fractions
float frac = 0f;
Seq<Item> obtainable = Seq.select(zone.data.resources, i -> i instanceof Item && ((Item)i).type == ItemType.material).as();
Seq<Item> obtainable = Seq.select(zone.data.resources, i -> i instanceof Item).as();
for(Item item : obtainable){
frac += Mathf.clamp((float)itemsDelivered.get(item, 0) / capacity) / (float)obtainable.size;
}

View File

@ -12,8 +12,6 @@ import static mindustry.Vars.content;
public class Item extends UnlockableContent{
public final Color color;
/** type of the item; used for tabs and core acceptance. default value is {@link ItemType#resource}. */
public ItemType type = ItemType.resource;
/** how explosive this item is. */
public float explosiveness = 0f;
/** flammability above 0.3 makes this eleigible for item burners. */

View File

@ -1,8 +0,0 @@
package mindustry.type;
public enum ItemType{
/** Not used for anything besides crafting inside blocks. */
resource,
/** Can be used for constructing blocks. Only materials are accepted into the core. */
material
}

View File

@ -84,9 +84,6 @@ public class ContentDisplay{
table.left().defaults().fillX();
table.add(Core.bundle.format("item.corestorable", item.type == ItemType.material ? Core.bundle.format("yes") : Core.bundle.format("no")));
table.row();
table.add(Core.bundle.format("item.explosiveness", (int)(item.explosiveness * 100)));
table.row();
table.add(Core.bundle.format("item.flammability", (int)(item.flammability * 100)));

View File

@ -30,7 +30,7 @@ public class ItemsDisplay extends Table{
t.marginRight(30f);
t.left();
for(Item item : content.items()){
if(item.type == ItemType.material && item.unlocked()){
if(item.unlocked()){
t.label(() -> format(item)).left();
t.image(item.icon(Cicon.small)).size(8 * 3).padLeft(4).padRight(4);
t.add(item.localizedName).color(Color.lightGray).left();

View File

@ -106,8 +106,7 @@ public class LoadoutDialog extends BaseDialog{
private void reseed(){
this.stacks = originalStacks.map(ItemStack::copy);
this.stacks.addAll(content.items().select(i -> i.type == ItemType.material &&
!stacks.contains(stack -> stack.item == i)).map(i -> new ItemStack(i, 0)));
this.stacks.addAll(content.items().select(i -> !stacks.contains(stack -> stack.item == i)).map(i -> new ItemStack(i, 0)));
this.stacks.sort(Structs.comparingInt(s -> s.item.id));
}

View File

@ -76,7 +76,7 @@ public class CoreBlock extends StorageBlock{
new Bar(
() -> Core.bundle.format("bar.capacity", ui.formatAmount(e.storageCapacity)),
() -> Pal.items,
() -> e.items().total() / ((float)e.storageCapacity * content.items().count(i -> i.type == ItemType.material))
() -> e.items().total() / ((float)e.storageCapacity * content.items().size)
));
bars.add("units", e ->
@ -154,7 +154,7 @@ public class CoreBlock extends StorageBlock{
@Override
public int getMaximumAccepted(Item item){
return item.type == ItemType.material ? storageCapacity : 0;
return storageCapacity;
}
@Override

View File

@ -64,7 +64,7 @@ public class SStats implements SteamUserStatsCallback{
}
for(Building entity : player.team().cores()){
if(!content.items().contains(i -> i.type == ItemType.material && entity.items.get(i) < entity.block().itemCapacity)){
if(!content.items().contains(i -> entity.items.get(i) < entity.block().itemCapacity)){
fillCoreAllCampaign.complete();
break;
}

View File

@ -418,9 +418,7 @@ public class ServerControl implements ApplicationListener{
}
for(Item item : content.items()){
if(item.type == ItemType.material){
state.teams.cores(team).first().items().set(item, state.teams.cores(team).first().block().itemCapacity);
}
state.teams.cores(team).first().items().set(item, state.teams.cores(team).first().block().itemCapacity);
}
info("Core filled.");