Added nuclear drill / Broke various things

This commit is contained in:
Anuken
2018-03-31 14:03:52 -04:00
parent c14fb51eb8
commit 8a80e82b5d
15 changed files with 439 additions and 349 deletions
@@ -74,13 +74,15 @@ public class Recipes {
new Recipe(production, ProductionBlocks.reinforcedDrill, stack(Items.iron, 25)),
new Recipe(production, ProductionBlocks.steelDrill, stack(Items.iron, 25)),
new Recipe(production, ProductionBlocks.titaniumDrill, stack(Items.iron, 25)),
new Recipe(production, ProductionBlocks.laserdrill, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
new Recipe(production, ProductionBlocks.nucleardrill, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
new Recipe(production, ProductionBlocks.plasmadrill, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
//new Recipe(production, ProductionBlocks.leaddrill, stack(Items.iron, 25)),
//new Recipe(production, ProductionBlocks.coaldrill, stack(Items.iron, 25), stack(Items.iron, 40)),
//new Recipe(production, ProductionBlocks.titaniumdrill, stack(Items.iron, 50), stack(Items.steel, 50)),
//new Recipe(production, ProductionBlocks.thoriumdrill, stack(Items.iron, 40), stack(Items.steel, 40)),
//new Recipe(production, ProductionBlocks.quartzextractor, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
new Recipe(production, ProductionBlocks.cultivator, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
new Recipe(production, ProductionBlocks.laserdrill, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
new Recipe(production, ProductionBlocks.waterextractor, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
new Recipe(production, ProductionBlocks.oilextractor, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
@@ -164,7 +164,7 @@ public class CraftingBlocks {
output = Items.sand;
health = 80;
craftEffect = Fx.pulverize;
craftTime = 70f;
craftTime = 60f;
updateEffect = Fx.pulverizeSmall;
hasInventory = hasPower = true;
}},
@@ -45,11 +45,15 @@ public class ProductionBlocks {
nucleardrill = new Drill("nucleardrill") {{
drillTime = 170;
size = 3;
powerUse = 0.32f;
powerUse = 0.5f;
drawRim = true;
hasPower = true;
tier = 5;
updateEffect = Fx.pulverizeMedium;
drillEffect = Fx.mineBig;
updateEffect = Fx.pulverizeRed;
updateEffectChance = 0.03f;
drillEffect = Fx.mineHuge;
rotateSpeed = 6f;
warmupSpeed = 0.01f;
}},
plasmadrill = new Drill("plasmadrill") {{
@@ -57,12 +61,15 @@ public class ProductionBlocks {
liquidRequired = true;
drillTime = 110;
size = 4;
powerUse = 0.16f;
powerUse = 0.7f;
hasLiquids = true;
hasPower = true;
tier = 5;
updateEffect = Fx.pulverizeMedium;
drillEffect = Fx.mineBig;
rotateSpeed = 8f;
drawRim = true;
updateEffect = Fx.pulverizeRed;
updateEffectChance = 0.03f;
drillEffect = Fx.mineHuge;
}},
waterextractor = new SolidPump("waterextractor") {{
@@ -0,0 +1,5 @@
package io.anuke.mindustry.graphics;
public class BlockFx {
//TODO
}
@@ -0,0 +1,5 @@
package io.anuke.mindustry.graphics;
public class ExplosionFx {
//TODO
}
@@ -196,6 +196,14 @@ public class Fx{
});
}),
pulverizeRed = new Effect(40, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.ifract()*8f, (x, y)->{
Draw.color(Color.valueOf("ffa480"), stoneGray, e.ifract());
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 2f + 0.5f, 45);
Draw.reset();
});
}),
pulverizeSmall = new Effect(30, e -> {
Angles.randLenVectors(e.id, 3, e.ifract()*5f, (x, y)->{
Draw.color(stoneGray);
@@ -384,6 +392,14 @@ public class Fx{
});
}),
mineHuge = new Effect(40, e -> {
Angles.randLenVectors(e.id, 8, 5f + e.ifract()*10f, (x, y)->{
Draw.color(e.color, Color.LIGHT_GRAY, e.ifract());
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 2f + 0.5f, 45);
Draw.reset();
});
}),
sparkbig = new Effect(11, e -> {
Lines.stroke(1f);
Draw.color(lightRed, Color.GRAY, e.ifract());
@@ -0,0 +1,5 @@
package io.anuke.mindustry.graphics;
public class TurretFx {
//TODO
}
@@ -1,5 +1,6 @@
package io.anuke.mindustry.world.blocks.types.production;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.content.Liquids;
@@ -13,6 +14,7 @@ import io.anuke.mindustry.world.BlockGroup;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.core.Graphics;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Mathf;
@@ -39,6 +41,8 @@ public class Drill extends Block{
protected boolean liquidRequired = false;
/**How many times faster the drill will progress when booster by liquid.*/
protected float liquidBoostIntensity = 1.3f;
/**Speed at which the drill speeds up.*/
protected float warmupSpeed = 0.02f;
/**Effect played when an item is produced. This is colored.*/
protected Effect drillEffect = Fx.mine;
@@ -49,6 +53,10 @@ public class Drill extends Block{
/**Chance the update effect will appear.*/
protected float updateEffectChance = 0.02f;
protected boolean drawRim = false;
protected Color heatColor = Color.valueOf("ff5512");
public Drill(String name) {
super(name);
update = true;
@@ -62,10 +70,24 @@ public class Drill extends Block{
@Override
public void draw(Tile tile) {
float s = 0.3f;
float ts = 0.6f;
DrillEntity entity = tile.entity();
Draw.rect(name, tile.drawx(), tile.drawy());
if(drawRim) {
Graphics.setAdditiveBlending();
Draw.color(heatColor);
Draw.alpha(entity.warmup * ts * (1f-s + Mathf.absin(Timers.time(), 3f, s)));
Draw.rect(name + "-rim", tile.drawx(), tile.drawy());
Draw.color();
Graphics.setNormalBlending();
}
Draw.rect(name + "-rotator", tile.drawx(), tile.drawy(), entity.drillTime * rotateSpeed);
Draw.rect(name + "-top", tile.drawx(), tile.drawy());
if(!isMultiblock() && isValid(tile)) {
@@ -127,13 +149,13 @@ public class Drill extends Block{
speed = liquidBoostIntensity;
}
entity.warmup = Mathf.lerpDelta(entity.warmup, speed, 0.02f);
entity.warmup = Mathf.lerpDelta(entity.warmup, speed, warmupSpeed);
entity.progress += Timers.delta() * multiplier * speed;
if(Mathf.chance(Timers.delta() * updateEffectChance))
Effects.effect(updateEffect, entity.x + Mathf.range(size*2f), entity.y + Mathf.range(size*2f));
}else{
entity.warmup = Mathf.lerpDelta(entity.warmup, 0f, 0.02f);
entity.warmup = Mathf.lerpDelta(entity.warmup, 0f, warmupSpeed);
return;
}