Costs for unit research
This commit is contained in:
@@ -1005,7 +1005,6 @@ block.dark-metal.name = Dark Metal
|
|||||||
block.basalt.name = Basalt
|
block.basalt.name = Basalt
|
||||||
block.hotrock.name = Hot Rock
|
block.hotrock.name = Hot Rock
|
||||||
block.magmarock.name = Magma Rock
|
block.magmarock.name = Magma Rock
|
||||||
block.cliffs.name = Cliffs
|
|
||||||
block.copper-wall.name = Copper Wall
|
block.copper-wall.name = Copper Wall
|
||||||
block.copper-wall-large.name = Large Copper Wall
|
block.copper-wall-large.name = Large Copper Wall
|
||||||
block.titanium-wall.name = Titanium Wall
|
block.titanium-wall.name = Titanium Wall
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ void main(){
|
|||||||
vec2 c = v_texCoords.xy;
|
vec2 c = v_texCoords.xy;
|
||||||
vec2 coords = vec2(c.x * u_resolution.x + u_campos.x, c.y * u_resolution.y + u_campos.y);
|
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);
|
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);
|
vec4 color = texture2D(u_texture, c);
|
||||||
|
|
||||||
|
|||||||
@@ -801,7 +801,7 @@ public class Blocks implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
door = new Door("door"){{
|
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;
|
health = 100 * wallHealthMultiplier;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,15 @@
|
|||||||
package mindustry.content;
|
package mindustry.content;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.math.*;
|
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
import mindustry.core.*;
|
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.game.Objectives.*;
|
import mindustry.game.Objectives.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.world.*;
|
|
||||||
|
|
||||||
import static mindustry.content.Blocks.*;
|
import static mindustry.content.Blocks.*;
|
||||||
import static mindustry.content.SectorPresets.*;
|
|
||||||
import static mindustry.content.SectorPresets.craters;
|
import static mindustry.content.SectorPresets.craters;
|
||||||
|
import static mindustry.content.SectorPresets.*;
|
||||||
import static mindustry.content.UnitTypes.*;
|
import static mindustry.content.UnitTypes.*;
|
||||||
import static mindustry.type.ItemStack.*;
|
import static mindustry.type.ItemStack.*;
|
||||||
|
|
||||||
@@ -422,12 +419,16 @@ public class TechTree implements ContentList{
|
|||||||
node(risso, () -> {
|
node(risso, () -> {
|
||||||
node(minke, () -> {
|
node(minke, () -> {
|
||||||
node(bryde, () -> {
|
node(bryde, () -> {
|
||||||
|
node(sei, () -> {
|
||||||
|
node(omura, () -> {
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
node(additiveReconstructor, () -> {
|
node(additiveReconstructor, () -> {
|
||||||
node(multiplicativeReconstructor, () -> {
|
node(multiplicativeReconstructor, () -> {
|
||||||
@@ -529,22 +530,7 @@ public class TechTree implements ContentList{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static TechNode node(UnlockableContent content, Runnable children){
|
public static TechNode node(UnlockableContent content, Runnable children){
|
||||||
ItemStack[] requirements;
|
return node(content, content.researchRequirements(), children);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TechNode node(UnlockableContent content, ItemStack[] requirements, Runnable children){
|
public static TechNode node(UnlockableContent content, ItemStack[] requirements, Runnable children){
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import arc.util.ArcAnnotate.*;
|
|||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
|
import mindustry.type.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
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(){
|
public String emoji(){
|
||||||
return Fonts.getUnicodeStr(name);
|
return Fonts.getUnicodeStr(name);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import arc.util.ArcAnnotate.*;
|
|||||||
import mindustry.ai.types.*;
|
import mindustry.ai.types.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
|
import mindustry.core.*;
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
import mindustry.entities.abilities.*;
|
import mindustry.entities.abilities.*;
|
||||||
@@ -28,6 +29,7 @@ import mindustry.world.*;
|
|||||||
import mindustry.world.blocks.environment.*;
|
import mindustry.world.blocks.environment.*;
|
||||||
import mindustry.world.blocks.payloads.*;
|
import mindustry.world.blocks.payloads.*;
|
||||||
import mindustry.world.blocks.units.*;
|
import mindustry.world.blocks.units.*;
|
||||||
|
import mindustry.world.consumers.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
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
|
@Override
|
||||||
public ContentType getContentType(){
|
public ContentType getContentType(){
|
||||||
return ContentType.unit;
|
return ContentType.unit;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import arc.util.*;
|
|||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
import arc.util.pooling.*;
|
import arc.util.pooling.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
|
import mindustry.core.*;
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
import mindustry.entities.units.*;
|
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
|
@Override
|
||||||
public void getDependencies(Cons<UnlockableContent> cons){
|
public void getDependencies(Cons<UnlockableContent> cons){
|
||||||
//just requires items
|
//just requires items
|
||||||
|
|||||||
Reference in New Issue
Block a user