diff --git a/core/assets/contributors b/core/assets/contributors index 0b6b9cbed0..b1f5c46fb1 100644 --- a/core/assets/contributors +++ b/core/assets/contributors @@ -187,3 +187,4 @@ Iniquit DSFdsfWxp Someone's Shadow buj +MCxzfwq/m1cxzfw3q diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 620c2354ee..000b9d02f3 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -94,16 +94,18 @@ public class Blocks{ //sandbox powerSource, powerVoid, itemSource, itemVoid, liquidSource, liquidVoid, payloadSource, payloadVoid, illuminator, heatSource, - //defense + //walls copperWall, copperWallLarge, titaniumWall, titaniumWallLarge, plastaniumWall, plastaniumWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge, phaseWall, phaseWallLarge, surgeWall, surgeWallLarge, + scrapWall, scrapWallLarge, scrapWallHuge, scrapWallGigantic, thruster, //ok, these names are getting ridiculous, but at least I don't have humongous walls yet + //walls - erekir berylliumWall, berylliumWallLarge, tungstenWall, tungstenWallLarge, blastDoor, reinforcedSurgeWall, reinforcedSurgeWallLarge, carbideWall, carbideWallLarge, shieldedWall, + //defense mender, mendProjector, overdriveProjector, overdriveDome, forceProjector, shockMine, - scrapWall, scrapWallLarge, scrapWallHuge, scrapWallGigantic, thruster, //ok, these names are getting ridiculous, but at least I don't have humongous walls yet //defense - erekir radar, diff --git a/core/src/mindustry/mod/ContentParser.java b/core/src/mindustry/mod/ContentParser.java index dd93a8a1df..ccdf1cdc40 100644 --- a/core/src/mindustry/mod/ContentParser.java +++ b/core/src/mindustry/mod/ContentParser.java @@ -516,12 +516,43 @@ public class ContentParser{ } } case "powerBuffered" -> block.consumePowerBuffered(child.asFloat()); + case "itemsBoost" -> block.consume( + child.isArray()? new ConsumeItems(parser.readValue(ItemStack[].class, child)) : + child.isString() ? new ConsumeItems(new ItemStack[]{parser.readValue(ItemStack.class, child)}) : + parser.readValue(ConsumeItems.class, child)).boost(); + case "liquidsBoost" -> block.consume( + child.isArray() ? new ConsumeLiquids(parser.readValue(LiquidStack[].class, child)) : + parser.readValue(ConsumeLiquids.class, child)).boost(); default -> throw new IllegalArgumentException("Unknown consumption type: '" + child.name + "' for block '" + block.name + "'."); } } value.remove("consumes"); } + public void readBlockCanInputItems(Block block, JsonValue value){ + boolean[] booleans = block.itemFilter; + for(JsonValue child : value){ + switch(child.name){ + case "add" -> { + for (Item it : parser.readValue(Item[].class, child)) { + if (!booleans[it.id]) { + block.itemFilter[it.id] = true; + } + } + } + case "remove" -> { + for (Item it : parser.readValue(Item[].class, child)) { + if(booleans[it.id]){ + block.itemFilter[it.id] = false; + } + } + } + default -> throw new IllegalArgumentException("Unknown consumption type: '" + child.name + "' for block '" + block.name + "'."); + } + } + value.remove("canInputItems"); + } + private ObjectMap> parsers = ObjectMap.of( ContentType.block, (TypeParser)(mod, name, value) -> { readBundle(ContentType.block, name, value); @@ -547,6 +578,11 @@ public class ContentParser{ value.remove("consumes"); } + if(value.has("canInputItems") && value.get("canInputItems").isObject()){ + readBlockCanInputItems(block, value.get("canInputItems")); + value.remove("canInputItems"); + } + readFields(block, value, true); if(block.size > maxBlockSize){ diff --git a/core/src/mindustry/world/blocks/production/Drill.java b/core/src/mindustry/world/blocks/production/Drill.java index aa69e11714..47695bd003 100644 --- a/core/src/mindustry/world/blocks/production/Drill.java +++ b/core/src/mindustry/world/blocks/production/Drill.java @@ -7,6 +7,7 @@ import arc.math.*; import arc.struct.*; import arc.util.*; import arc.util.io.*; +import mindustry.Vars; import mindustry.annotations.Annotations.*; import mindustry.content.*; import mindustry.entities.*;