Skip to content

Commit

Permalink
Fuel-based Smelter: Pyroclast Forge
Browse files Browse the repository at this point in the history
I said I was gonna use it, and I did.

Rejected PRs are opportunities.
  • Loading branch information
MEEPofFaith committed Aug 20, 2021
1 parent 80a24a1 commit 57958dc
Show file tree
Hide file tree
Showing 12 changed files with 184 additions and 145 deletions.
38 changes: 23 additions & 15 deletions assets/bundles/bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,15 @@ liquid.prog-mats-magma.details = This is unobtainable, and it's only purpose is

block.prog-mats-mindron-collider.name = Collider
block.prog-mats-mindron-collider.description = Accelerates titanium and thorium particles at each other to fuse fusium. Requires tons of power.
block.prog-mats-forge.name = Pyroclast Forge
block.prog-mats-forge.description = Smelts massive batches of sand, lead, and coal into silicon and metaglass, using pyratite as an additional fuel source. Less fuel is used in hot locations.
block.prog-mats-shell-press.name = Casing Roller
block.prog-mats-shell-press.description = Alloys metals into casings used in missile construction.\nThe item ui looks weird when there's multiple on the map. I cannot fix this, as it's an issue with MultiLib and not my mod.
block.prog-mats-missile-factory.name = Missile Assembler
block.prog-mats-missile-factory.description = Assembles missiles into missile casings.\nThe item ui looks weird when there's multiple on the map. I cannot fix this, as it's an issue with MultiLib and not my mod.
block.prog-mats-sentry-builder.name = Sentry Assembler
block.prog-mats-sentry-builder.description = Assembles sentry units and packs them into boxes.\nThe item ui looks weird when there's multiple on the map. I cannot fix this, as it's an issue with MultiLib and not my mod.

# Power

block.prog-mats-rainbow-power-node.name = Rainbow Power Node
block.prog-mats-rainbow-power-node.description = Better than the average power node. Also is rainbowy.\nSandbox only.
block.prog-mats-rainbow-power-node.details = SPREAD THE GAY POWER!
block.prog-mats-rainbow-power-source.name = Rainbow Power Source
block.prog-mats-rainbow-power-source.description = Better than the average power source. Also is rainbowy.\nSandbox only.
block.prog-mats-rainbow-power-source.details = CREATE THE GAY POWER!
block.prog-mats-rainbow-power-boost.name = Rainbow Power Boost Source
block.prog-mats-rainbow-power-boost.description = Like the rainbower power source, but anything attached that can be overdriven gets boosted.\nSandbox only.
block.prog-mats-rainbow-power-boost.details = AMPLIFY WITH THE GAY POWER!


# Turret

## Eruptor
Expand Down Expand Up @@ -184,8 +173,7 @@ block.prog-mats-storm.description = Zaps numerous random targets in range.
# Distribution

block.prog-mats-floating-conveyor.name = Hydroconveyor
block.prog-mats-floating-conveyor.description = Transports items forward. It's placable on deep liquids, but will be slower if done so.
block.prog-mats-floating-conveyor.details = Don't ask why deep liquids make it slower, I'm not sure why either.
block.prog-mats-floating-conveyor.description = Transports items forward. Faster than standard conveyors, but slower than titanium conveyors. Placable in deep liquids.
block.prog-mats-burst-driver.name = Burst Driver
block.prog-mats-burst-driver.description = Long-range item transport structure. Fires massive long bursts of items to other burst drivers.\nSingular items are lighter than a large amount bunched together, so it's range and speed are faster than mass drivers.

Expand All @@ -211,6 +199,16 @@ block.prog-mats-everything-gun.details = Ilya helped me with the increase damage
block.prog-mats-sand-driver.name = Sand Driver
block.prog-mats-sand-driver.description = Long-range item generation structure. Fires massive long bursts of items to other burst drivers.\nMagically creates and fires random items.\nSandbox only.

block.prog-mats-rainbow-power-node.name = Rainbow Power Node
block.prog-mats-rainbow-power-node.description = Better than the average power node. Also is rainbowy.\nSandbox only.
block.prog-mats-rainbow-power-node.details = SPREAD THE GAY POWER!
block.prog-mats-rainbow-power-source.name = Rainbow Power Source
block.prog-mats-rainbow-power-source.description = Better than the average power source. Also is rainbowy.\nSandbox only.
block.prog-mats-rainbow-power-source.details = CREATE THE GAY POWER!
block.prog-mats-rainbow-power-boost.name = Rainbow Power Boost Source
block.prog-mats-rainbow-power-boost.description = Like the rainbower power source, but anything attached that can be overdriven gets boosted.\nSandbox only.
block.prog-mats-rainbow-power-boost.details = AMPLIFY WITH THE GAY POWER!

block.prog-mats-sandbox-wall.name = Sandbox Wall
block.prog-mats-sandbox-wall.description = Protects structures from enemy projectiles. Functionalities of Surge, Phase, and Plastanium walls can be toggled.\nSandbox only.\n[gray]Note: Plastanium wall toggle does not work, it's not possible with current game code.
block.prog-mats-sandbox-wall-large.name = Large Sandbox Wall
Expand Down Expand Up @@ -283,6 +281,10 @@ bar.pm-shoot-duration = Duration: {0}%
bar.pm-lifetime = Lifetime: {0}%
bar.pm-flare-limit = Flares: {0}/{1}

bar.pm-fuel = Fuel: {0}
bar.pm-fuel-unneeded = Not required
bar.pm-fuel-use = Fuel per craft: {0}

stat.pm-sentry-lifetime = [lightgray]([stat]{0}[lightgray] second lifetime)

stat.pm-land-speed = On land:
Expand All @@ -295,6 +297,12 @@ stat.pm-static-power = {0} power units/second per link

stat.pm-multi-recipe = [accent]Recipe {0}:

pm-fuel.input [stat]{0}[lightgray] fuel added per item
pm-fuel.use = [stat]{0}[lightgray] fuel used per craft
pm-fuel.capacity = [stat]{0}[lightgray] fuel capacity
### The extra space is deliberate
pm-fuel.affinity = [stat]Affinities:

bullet.pm-sword-speed = [stat]{0}[lightgray] speed

bullet.pm-crit-chance = [stat]{0}%[lightgray] crit chance
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 44 additions & 5 deletions src/progressed/content/PMBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import mindustry.world.blocks.defense.turrets.*;
import mindustry.world.blocks.units.*;
import mindustry.world.consumers.*;
import mindustry.world.draw.*;
import mindustry.world.meta.*;
import progressed.graphics.*;
import progressed.ui.*;
Expand Down Expand Up @@ -77,7 +78,7 @@ public class PMBlocks implements ContentList{
// Region Crafting

//Crafters
mindronCollider, shellPress, missileFactory, sentryBuilder,
mindronCollider, forge, shellPress, missileFactory, sentryBuilder,

// endregion
// Region Effect
Expand Down Expand Up @@ -907,10 +908,8 @@ public void load(){
PMItems.fusium, 3
));
health = 15;
speed = 0.08f;
deepSpeed = 0.06f;
displayedSpeed = 11f;
deepDisplayedSpeed = 8.4f;
speed = 0.06f;
displayedSpeed = 8.4f;
buildCostMultiplier = 0.25f;
researchCostMultiplier = 300f;
}};
Expand Down Expand Up @@ -954,6 +953,46 @@ public void load(){
outputItem = new ItemStack(PMItems.fusium, 2);
}};

forge = new FuelCrafter("forge"){{
requirements(Category.crafting, with(
Items.titanium, 300,
Items.metaglass, 120,
Items.plastanium, 50,
Items.silicon, 180,
Items.surgeAlloy, 70,
PMItems.fusium, 100
));
size = 5;
itemCapacity = 32;
craftTime = 75f;
hasPower = true;
hasLiquids = false;
craftEffect = PMFx.superSmeltsmoke;
ambientSound = Sounds.smelter;
ambientSoundVolume = 1f; //Big flame louder sound

DrawSmelter d = new DrawSmelter(Color.valueOf("ffef99"));
d.flameRadius = 11f;
d.flameRadiusIn = 7f;
drawer = d;

fuelItem = Items.pyratite;
fuelPerItem = 3;
fuelPerCraft = 12;
fuelCapacity = 48;
fuelUseReduction = 0.45f;
consumes.items(with(
Items.lead, 4,
Items.sand, 10,
Items.coal, 6
));
consumes.power(9f);
outputItems = with(
Items.silicon, 16,
Items.metaglass, 8
);
}};

shellPress = new PayloadCrafter("shell-press"){{
requirements(Category.units, with(
Items.copper, 75,
Expand Down
5 changes: 5 additions & 0 deletions src/progressed/content/PMTechTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ public void load(){
node(mindronCollider);
});

vanillaNode(siliconCrucible, () -> {
//Forge
node(forge);
});

// Effect
vanillaNode(shockMine, () -> {
//Static link
Expand Down
22 changes: 8 additions & 14 deletions src/progressed/graphics/PMFx.java
Original file line number Diff line number Diff line change
Expand Up @@ -357,21 +357,8 @@ public class PMFx{
Drawf.tri(e.x + x, e.y + y, e.fslope() * 3f + 1, e.fslope() * 3f + 1, Mathf.angle(x, y));
});
}),

teleportEffect = new Effect(60f, e -> {
color(e.color, e.fout());

float[] data = (float[])e.data;

stroke(data[0] * e.fout());
line(e.x, e.y, data[1], data[2]);
Fill.circle(e.x, e.y, data[0] * 1.5f);
Fill.circle(data[1], data[2], data[0] * 1.5f);

reset();
}),

PMChainLightning = new Effect(10f, 500f, e -> {
fakeLightning = new Effect(10f, 500f, e -> {
if(!(e.data instanceof LightningData d)) return;
float tx = d.pos.getX(), ty = d.pos.getY(), dst = Mathf.dst(e.x, e.y, tx, ty);
Tmp.v1.set(d.pos).sub(e.x, e.y).nor();
Expand Down Expand Up @@ -506,6 +493,13 @@ public class PMFx{
Lines.lineAngle(e.x + x, e.y + y, ang, e.fslope() * 5f);
});
}).layer(32.5f),

superSmeltsmoke = new Effect(15, e -> {
randLenVectors(e.id, 14, 6f + e.fin() * 18f, (x, y) -> {
color(Color.white, e.color, e.fin());
Fill.square(e.x + x, e.y + y, 0.5f + e.fout() * 3f, 45);
});
}),

swordStab = new Effect(24f, e -> {
color(e.color, Color.violet, e.fin());
Expand Down
106 changes: 79 additions & 27 deletions src/progressed/ui/PMStatValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import mindustry.ctype.*;
import mindustry.entities.bullet.*;
import mindustry.gen.*;
import mindustry.maps.*;
import mindustry.type.*;
import mindustry.ui.*;
import mindustry.world.blocks.defense.turrets.*;
Expand All @@ -20,6 +21,7 @@
import progressed.entities.bullet.*;
import progressed.entities.bullet.InjectorBulletType.*;
import progressed.entities.units.*;
import progressed.util.*;
import progressed.world.blocks.crafting.*;
import progressed.world.blocks.payloads.*;

Expand Down Expand Up @@ -195,37 +197,87 @@ public static <T extends UnlockableContent> StatValue ammo(ObjectMap<T, BulletTy
};
}

public static StatValue fuelEfficiency(Floor floor, float multiplier){
return table -> table.stack(
new Image(floor.uiIcon).setScaling(Scaling.fit),
new Table(t -> t.top().right().add((multiplier < 0 ? "[accent]" : "[scarlet]+") + PMUtls.stringsFixed(multiplier * 100)).style(Styles.outlineLabel))
);
}

public static StatValue fuel(FuelCrafter crafter){
return table -> {
table.row();

table.image(crafter.fuelItem.fullIcon).size(3 * 8).padRight(4).right().top();
table.add(crafter.fuelItem.localizedName).padRight(10).left().top();

table.table(t -> {
t.left().defaults().padRight(3).left();

t.add(Core.bundle.format("fuel.fc-input", crafter.fuelPerItem));

sep(t, Core.bundle.format("fuel.fc-use", crafter.fuelPerCraft));

sep(t, Core.bundle.format("fuel.fc-capacity", crafter.fuelCapacity));

if(crafter.attribute != null){
sep(t, Core.bundle.get("fuel.fc-affinity"));
t.row();
t.table(at -> {
Attribute attr = crafter.attribute;

at.left().defaults().padRight(3).left();
for(var block : Vars.content.blocks()
.select(block -> block instanceof Floor f && f.attributes.get(attr) != 0 && !(f.isLiquid && !crafter.floating))
.<Floor>as().with(s -> s.sort(f -> f.attributes.get(attr)))){
floorStat(at, crafter, attr, block);
t.table(ct -> {
for(ItemStack stack : crafter.consumes.getItem().items){
ct.add(new ItemDisplay(stack.item, stack.amount, crafter.craftTime, true)).padRight(5);
}
}).left().get().background(Tex.underline);

t.row();

t.table(ft -> {
ft.image(crafter.fuelItem.fullIcon).size(3 * 8).padRight(4).right().top();
ft.add(crafter.fuelItem.localizedName).padRight(10).left().top();

ft.table(st -> {
st.clearChildren();
st.left().defaults().padRight(3).left();

st.add(Core.bundle.format("pm-fuel.input", crafter.fuelPerItem));

sep(st, Core.bundle.format("pm-fuel.use", crafter.fuelPerCraft));

sep(st, Core.bundle.format("pm-fuel.capacity", crafter.fuelCapacity));

if(crafter.attribute != null){
st.row();
st.table(at -> {
Runnable[] rebuild = {null};
Map[] lastMap = {null};

rebuild[0] = () -> {
at.clearChildren();
at.left();

at.add("@pm-fuel.affinity");

if(state.isGame()){
var blocks = Vars.content.blocks()
.select(block -> block instanceof Floor f && indexer.isBlockPresent(block) && f.attributes.get(crafter.attribute) != 0 && !(f.isLiquid && !crafter.floating))
.<Floor>as().with(s -> s.sort(f -> f.attributes.get(crafter.attribute)));

if(blocks.any()){
int i = 0;
for(var block: blocks){
fuelEfficiency(block, block.attributes.get(crafter.attribute) * crafter.fuelUseReduction / -100f).display(at);
if(++i % 5 == 0){
at.row();
}
}
}else{
at.add("@none.inmap");
}
}else{
at.add("@stat.showinmap");
}
};

rebuild[0].run();

//rebuild when map changes.
at.update(() -> {
Map current = state.isGame() ? state.map : null;

if(current != lastMap[0]){
rebuild[0].run();
lastMap[0] = current;
}
});
});
}
}).padTop(0).left().get().background(null);
}
}).padTop(-9).left().get().background(Tex.underline);
}).padTop(-9).left().get().background(Tex.underline);
}).left();
});
};
}

Expand Down
Loading

0 comments on commit 57958dc

Please sign in to comment.