diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 6198519882..f13309ec45 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -1005,7 +1005,6 @@ block.dark-metal.name = Dark Metal block.basalt.name = Basalt block.hotrock.name = Hot Rock block.magmarock.name = Magma Rock -block.cliffs.name = Cliffs block.copper-wall.name = Copper Wall block.copper-wall-large.name = Large Copper Wall block.titanium-wall.name = Titanium Wall diff --git a/core/assets/shaders/mud.frag b/core/assets/shaders/mud.frag index ffcd60a44d..30ddd1b0e1 100644 --- a/core/assets/shaders/mud.frag +++ b/core/assets/shaders/mud.frag @@ -15,7 +15,7 @@ void main(){ vec2 c = v_texCoords.xy; vec2 coords = vec2(c.x * u_resolution.x + u_campos.x, c.y * u_resolution.y + u_campos.y); - float btime = u_time / 7000000.0; + float btime = u_time / 700000.0; float noise = sin((texture2D(u_noise, (coords) / NSCALE + vec2(btime) * vec2(-0.9, 0.8)).r + texture2D(u_noise, (coords) / NSCALE + vec2(abs(sin(btime)) * 1.1) * vec2(-0.8, -1.0)).r) / 2.0); vec4 color = texture2D(u_texture, c); diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index c84bfccfca..ba4a2059fb 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -801,7 +801,7 @@ public class Blocks implements ContentList{ }}; door = new Door("door"){{ - requirements(Category.defense, with(Items.graphite, 6, Items.silicon, 4)); + requirements(Category.defense, with(Items.titanium, 6, Items.silicon, 4)); health = 100 * wallHealthMultiplier; }}; diff --git a/core/src/mindustry/content/TechTree.java b/core/src/mindustry/content/TechTree.java index 0afcf554e8..2abe1ce799 100644 --- a/core/src/mindustry/content/TechTree.java +++ b/core/src/mindustry/content/TechTree.java @@ -1,18 +1,15 @@ package mindustry.content; import arc.*; -import arc.math.*; import arc.struct.*; import arc.util.ArcAnnotate.*; -import mindustry.core.*; import mindustry.ctype.*; import mindustry.game.Objectives.*; import mindustry.type.*; -import mindustry.world.*; import static mindustry.content.Blocks.*; -import static mindustry.content.SectorPresets.*; import static mindustry.content.SectorPresets.craters; +import static mindustry.content.SectorPresets.*; import static mindustry.content.UnitTypes.*; import static mindustry.type.ItemStack.*; @@ -422,7 +419,11 @@ public class TechTree implements ContentList{ node(risso, () -> { node(minke, () -> { node(bryde, () -> { + node(sei, () -> { + node(omura, () -> { + }); + }); }); }); }); @@ -529,22 +530,7 @@ public class TechTree implements ContentList{ } public static TechNode node(UnlockableContent content, Runnable children){ - ItemStack[] requirements; - - if(content instanceof Block){ - Block block = (Block)content; - - requirements = new ItemStack[block.requirements.length]; - for(int i = 0; i < requirements.length; i++){ - int quantity = 40 + Mathf.round(Mathf.pow(block.requirements[i].amount, 1.25f) * 20, 10); - - requirements[i] = new ItemStack(block.requirements[i].item, UI.roundAmount(quantity)); - } - }else{ - requirements = ItemStack.empty; - } - - return node(content, requirements, children); + return node(content, content.researchRequirements(), children); } public static TechNode node(UnlockableContent content, ItemStack[] requirements, Runnable children){ diff --git a/core/src/mindustry/ctype/UnlockableContent.java b/core/src/mindustry/ctype/UnlockableContent.java index 65e168c54a..ee1739eb9d 100644 --- a/core/src/mindustry/ctype/UnlockableContent.java +++ b/core/src/mindustry/ctype/UnlockableContent.java @@ -8,6 +8,7 @@ import arc.util.ArcAnnotate.*; import mindustry.annotations.Annotations.*; import mindustry.game.EventType.*; import mindustry.graphics.*; +import mindustry.type.*; import mindustry.ui.*; import static mindustry.Vars.*; @@ -43,6 +44,11 @@ public abstract class UnlockableContent extends MappableContent{ } + /** @return items needed to research this content */ + public ItemStack[] researchRequirements(){ + return ItemStack.empty; + } + public String emoji(){ return Fonts.getUnicodeStr(name); } diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 92abb2ee47..c670f3ecd6 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -15,6 +15,7 @@ import arc.util.ArcAnnotate.*; import mindustry.ai.types.*; import mindustry.annotations.Annotations.*; import mindustry.content.*; +import mindustry.core.*; import mindustry.ctype.*; import mindustry.entities.*; import mindustry.entities.abilities.*; @@ -28,6 +29,7 @@ import mindustry.world.*; import mindustry.world.blocks.environment.*; import mindustry.world.blocks.payloads.*; import mindustry.world.blocks.units.*; +import mindustry.world.consumers.*; import static mindustry.Vars.*; @@ -299,6 +301,34 @@ public class UnitType extends UnlockableContent{ } } + @Override + public ItemStack[] researchRequirements(){ + ItemStack[] stacks = null; + + //calculate costs based on reconstructors or factories found + Block rec = content.blocks().find(b -> b instanceof Reconstructor && Structs.contains(((Reconstructor)b).upgrades, u -> u[1] == this)); + + if(rec != null && rec.consumes.has(ConsumeType.item) && rec.consumes.get(ConsumeType.item) instanceof ConsumeItems){ + stacks = ((ConsumeItems)rec.consumes.get(ConsumeType.item)).items; + }else{ + UnitFactory factory = (UnitFactory)content.blocks().find(u -> u instanceof UnitFactory && Structs.contains(((UnitFactory)u).plans, p -> p.unit == this)); + if(factory != null){ + stacks = Structs.find(factory.plans, p -> p.unit == this).requirements; + } + } + + if(stacks != null){ + ItemStack[] out = new ItemStack[stacks.length]; + for(int i = 0; i < out.length; i++){ + out[i] = new ItemStack(stacks[i].item, UI.roundAmount((int)(Math.pow(stacks[i].amount, 1.1) * 50))); + } + + return out; + } + + return super.researchRequirements(); + } + @Override public ContentType getContentType(){ return ContentType.unit; diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 01b700ddc9..94fc221305 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -15,6 +15,7 @@ import arc.util.*; import arc.util.ArcAnnotate.*; import arc.util.pooling.*; import mindustry.annotations.Annotations.*; +import mindustry.core.*; import mindustry.ctype.*; import mindustry.entities.*; import mindustry.entities.units.*; @@ -615,6 +616,18 @@ public class Block extends UnlockableContent{ } } + @Override + public ItemStack[] researchRequirements(){ + ItemStack[] out = new ItemStack[requirements.length]; + for(int i = 0; i < out.length; i++){ + int quantity = 40 + Mathf.round(Mathf.pow(requirements[i].amount, 1.25f) * 20, 10); + + out[i] = new ItemStack(requirements[i].item, UI.roundAmount(quantity)); + } + + return out; + } + @Override public void getDependencies(Cons cons){ //just requires items