mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-22 04:28:27 +07:00
Generator explosion system cleanup
This commit is contained in:
parent
fa1a5971cf
commit
e28d7b8d8d
@ -39,8 +39,8 @@ public class BaseRegistry{
|
|||||||
|
|
||||||
//load ore types and corresponding items
|
//load ore types and corresponding items
|
||||||
for(Block block : content.blocks()){
|
for(Block block : content.blocks()){
|
||||||
if(block instanceof OreBlock && block.asFloor().itemDrop != null){
|
if(block instanceof OreBlock ore && ore.itemDrop != null && !ore.wallOre && !ores.containsKey(ore.itemDrop)){
|
||||||
ores.put(block.asFloor().itemDrop, (OreBlock)block);
|
ores.put(ore.itemDrop, ore);
|
||||||
}else if(block.isFloor() && block.asFloor().itemDrop != null && !oreFloors.containsKey(block.asFloor().itemDrop)){
|
}else if(block.isFloor() && block.asFloor().itemDrop != null && !oreFloors.containsKey(block.asFloor().itemDrop)){
|
||||||
oreFloors.put(block.asFloor().itemDrop, block.asFloor());
|
oreFloors.put(block.asFloor().itemDrop, block.asFloor());
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ public class Blocks{
|
|||||||
cliffCrusher, plasmaBore, largePlasmaBore, impactDrill, eruptionDrill,
|
cliffCrusher, plasmaBore, largePlasmaBore, impactDrill, eruptionDrill,
|
||||||
|
|
||||||
//storage
|
//storage
|
||||||
coreShard, coreFoundation, /*TODO core foundation is a bad name, rename to fragment */ coreNucleus, vault, container, unloader,
|
coreShard, coreFoundation, coreNucleus, vault, container, unloader,
|
||||||
//storage - erekir
|
//storage - erekir
|
||||||
coreBastion, coreCitadel, coreAcropolis, reinforcedContainer, reinforcedVault,
|
coreBastion, coreCitadel, coreAcropolis, reinforcedContainer, reinforcedVault,
|
||||||
|
|
||||||
@ -162,7 +162,6 @@ public class Blocks{
|
|||||||
worldProcessor, worldCell,
|
worldProcessor, worldCell,
|
||||||
|
|
||||||
//campaign
|
//campaign
|
||||||
//TODO launch pad on erekir, 5x5, uses nuclear(?) fuel
|
|
||||||
launchPad, interplanetaryAccelerator
|
launchPad, interplanetaryAccelerator
|
||||||
|
|
||||||
;
|
;
|
||||||
@ -1161,7 +1160,6 @@ public class Blocks{
|
|||||||
consumePower(6f);
|
consumePower(6f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
//TODO better name
|
|
||||||
electrolyzer = new GenericCrafter("electrolyzer"){{
|
electrolyzer = new GenericCrafter("electrolyzer"){{
|
||||||
requirements(Category.crafting, with(Items.silicon, 50, Items.graphite, 40, Items.beryllium, 130, Items.tungsten, 80));
|
requirements(Category.crafting, with(Items.silicon, 50, Items.graphite, 40, Items.beryllium, 130, Items.tungsten, 80));
|
||||||
size = 3;
|
size = 3;
|
||||||
@ -1222,7 +1220,6 @@ public class Blocks{
|
|||||||
|
|
||||||
heatRequirement = 6f;
|
heatRequirement = 6f;
|
||||||
|
|
||||||
//TODO continuous output
|
|
||||||
outputLiquid = new LiquidStack(Liquids.nitrogen, 4f / 60f);
|
outputLiquid = new LiquidStack(Liquids.nitrogen, 4f / 60f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@ -1380,10 +1377,9 @@ public class Blocks{
|
|||||||
}});
|
}});
|
||||||
|
|
||||||
consumeItem(Items.silicon, 3);
|
consumeItem(Items.silicon, 3);
|
||||||
//TODO must consume from 2 pumps, 1, or 1.5?
|
|
||||||
//TODO consume hydrogen/ozone?
|
//TODO consume hydrogen/ozone?
|
||||||
consumeLiquid(Liquids.slag, 40f / 60f);
|
consumeLiquid(Liquids.slag, 40f / 60f);
|
||||||
consumePower(2f); //TODO necessary?
|
consumePower(2f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
cyanogenSynthesizer = new HeatCrafter("cyanogen-synthesizer"){{
|
cyanogenSynthesizer = new HeatCrafter("cyanogen-synthesizer"){{
|
||||||
@ -1415,7 +1411,6 @@ public class Blocks{
|
|||||||
consumePower(2f);
|
consumePower(2f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
//TODO bad name, and there's no use for phase yet...
|
|
||||||
phaseSynthesizer = new HeatCrafter("phase-synthesizer"){{
|
phaseSynthesizer = new HeatCrafter("phase-synthesizer"){{
|
||||||
requirements(Category.crafting, with(Items.carbide, 90, Items.silicon, 100, Items.thorium, 100, Items.tungsten, 200));
|
requirements(Category.crafting, with(Items.carbide, 90, Items.silicon, 100, Items.thorium, 100, Items.tungsten, 200));
|
||||||
|
|
||||||
@ -1512,7 +1507,6 @@ public class Blocks{
|
|||||||
envDisabled |= Env.scorching;
|
envDisabled |= Env.scorching;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
//TODO all these should be hidden from view completely
|
|
||||||
thoriumWall = new Wall("thorium-wall"){{
|
thoriumWall = new Wall("thorium-wall"){{
|
||||||
requirements(Category.defense, with(Items.thorium, 6));
|
requirements(Category.defense, with(Items.thorium, 6));
|
||||||
health = 200 * wallHealthMultiplier;
|
health = 200 * wallHealthMultiplier;
|
||||||
@ -2492,7 +2486,6 @@ public class Blocks{
|
|||||||
color = Pal.slagOrange;
|
color = Pal.slagOrange;
|
||||||
}});
|
}});
|
||||||
|
|
||||||
//TODO ratios, extra requirements?
|
|
||||||
consumeLiquids(LiquidStack.with(Liquids.slag, 20f / 60f, Liquids.arkycite, 30f / 60f));
|
consumeLiquids(LiquidStack.with(Liquids.slag, 20f / 60f, Liquids.arkycite, 30f / 60f));
|
||||||
size = 3;
|
size = 3;
|
||||||
|
|
||||||
@ -2509,7 +2502,7 @@ public class Blocks{
|
|||||||
//TODO still very much WIP, stats are bad
|
//TODO still very much WIP, stats are bad
|
||||||
fluxReactor = new VariableReactor("flux-reactor"){{
|
fluxReactor = new VariableReactor("flux-reactor"){{
|
||||||
requirements(Category.power, with(Items.graphite, 300, Items.carbide, 200, Items.oxide, 100, Items.silicon, 600, Items.surgeAlloy, 300));
|
requirements(Category.power, with(Items.graphite, 300, Items.carbide, 200, Items.oxide, 100, Items.silicon, 600, Items.surgeAlloy, 300));
|
||||||
powerProduction = 140f;
|
powerProduction = 120f;
|
||||||
maxHeat = 150f;
|
maxHeat = 150f;
|
||||||
|
|
||||||
consumeLiquid(Liquids.cyanogen, 9f / 60f);
|
consumeLiquid(Liquids.cyanogen, 9f / 60f);
|
||||||
|
@ -52,6 +52,7 @@ public class Liquids{
|
|||||||
capPuddles = false;
|
capPuddles = false;
|
||||||
hidden = true;
|
hidden = true;
|
||||||
spreadTarget = Liquids.water;
|
spreadTarget = Liquids.water;
|
||||||
|
moveThroughBlocks = true;
|
||||||
|
|
||||||
colorFrom = Color.valueOf("e8803f");
|
colorFrom = Color.valueOf("e8803f");
|
||||||
colorTo = Color.valueOf("8c1225");
|
colorTo = Color.valueOf("8c1225");
|
||||||
|
@ -61,7 +61,7 @@ abstract class PuddleComp implements Posc, Puddlec, Drawc{
|
|||||||
int targets = 0;
|
int targets = 0;
|
||||||
for(Point2 point : Geometry.d4){
|
for(Point2 point : Geometry.d4){
|
||||||
Tile other = world.tile(tile.x + point.x, tile.y + point.y);
|
Tile other = world.tile(tile.x + point.x, tile.y + point.y);
|
||||||
if(other != null && other.block() == Blocks.air){
|
if(other != null && (other.block() == Blocks.air || liquid.moveThroughBlocks)){
|
||||||
targets ++;
|
targets ++;
|
||||||
Puddles.deposit(other, tile, liquid, deposited, false);
|
Puddles.deposit(other, tile, liquid, deposited, false);
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,8 @@ public class Liquid extends UnlockableContent implements Senseable{
|
|||||||
public float explosiveness;
|
public float explosiveness;
|
||||||
/** if false, this liquid cannot be a coolant */
|
/** if false, this liquid cannot be a coolant */
|
||||||
public boolean coolant = true;
|
public boolean coolant = true;
|
||||||
|
/** if true, this liquid can move through blocks as a puddle. */
|
||||||
|
public boolean moveThroughBlocks = false;
|
||||||
/** The associated status effect. */
|
/** The associated status effect. */
|
||||||
public StatusEffect effect = StatusEffects.none;
|
public StatusEffect effect = StatusEffects.none;
|
||||||
/** Effect shown in puddles. */
|
/** Effect shown in puddles. */
|
||||||
|
@ -21,6 +21,8 @@ public class ConsumeGenerator extends PowerGenerator{
|
|||||||
public float generateEffectRange = 3f;
|
public float generateEffectRange = 3f;
|
||||||
|
|
||||||
public @Nullable LiquidStack outputLiquid;
|
public @Nullable LiquidStack outputLiquid;
|
||||||
|
/** If true, this block explodes when outputLiquid exceeds capacity. */
|
||||||
|
public boolean explodeOnFull = false;
|
||||||
|
|
||||||
public @Nullable ConsumeItemFilter filterItem;
|
public @Nullable ConsumeItemFilter filterItem;
|
||||||
public @Nullable ConsumeLiquidFilter filterLiquid;
|
public @Nullable ConsumeLiquidFilter filterLiquid;
|
||||||
@ -48,6 +50,10 @@ public class ConsumeGenerator extends PowerGenerator{
|
|||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(explodeOnFull && outputLiquid != null && explosionPuddleLiquid == null){
|
||||||
|
explosionPuddleLiquid = outputLiquid.liquid;
|
||||||
|
}
|
||||||
|
|
||||||
//TODO hardcoded
|
//TODO hardcoded
|
||||||
emitLight = true;
|
emitLight = true;
|
||||||
lightRadius = 65f * size;
|
lightRadius = 65f * size;
|
||||||
@ -106,6 +112,10 @@ public class ConsumeGenerator extends PowerGenerator{
|
|||||||
float added = Math.min(productionEfficiency * delta() * outputLiquid.amount, liquidCapacity - liquids.get(outputLiquid.liquid));
|
float added = Math.min(productionEfficiency * delta() * outputLiquid.amount, liquidCapacity - liquids.get(outputLiquid.liquid));
|
||||||
liquids.add(outputLiquid.liquid, added);
|
liquids.add(outputLiquid.liquid, added);
|
||||||
dumpLiquid(outputLiquid.liquid);
|
dumpLiquid(outputLiquid.liquid);
|
||||||
|
|
||||||
|
if(explodeOnFull && liquids.get(outputLiquid.liquid) >= liquidCapacity - 0.0001f){
|
||||||
|
kill();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//generation time always goes down, but only at the end so consumeTriggerValid doesn't assume fake items
|
//generation time always goes down, but only at the end so consumeTriggerValid doesn't assume fake items
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
package mindustry.world.blocks.power;
|
package mindustry.world.blocks.power;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.audio.*;
|
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.util.io.*;
|
import arc.util.io.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.entities.*;
|
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
@ -16,17 +14,10 @@ import mindustry.ui.*;
|
|||||||
import mindustry.world.draw.*;
|
import mindustry.world.draw.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
|
||||||
|
|
||||||
public class ImpactReactor extends PowerGenerator{
|
public class ImpactReactor extends PowerGenerator{
|
||||||
public final int timerUse = timers++;
|
public final int timerUse = timers++;
|
||||||
|
|
||||||
public float warmupSpeed = 0.001f;
|
public float warmupSpeed = 0.001f;
|
||||||
public float itemDuration = 60f;
|
public float itemDuration = 60f;
|
||||||
public int explosionRadius = 23;
|
|
||||||
public int explosionDamage = 1900;
|
|
||||||
public Effect explodeEffect = Fx.impactReactorExplosion;
|
|
||||||
public Sound explodeSound = Sounds.explosionbig;
|
|
||||||
|
|
||||||
public ImpactReactor(String name){
|
public ImpactReactor(String name){
|
||||||
super(name);
|
super(name);
|
||||||
@ -41,6 +32,12 @@ public class ImpactReactor extends PowerGenerator{
|
|||||||
envEnabled = Env.any;
|
envEnabled = Env.any;
|
||||||
|
|
||||||
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawPlasma(), new DrawDefault());
|
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawPlasma(), new DrawDefault());
|
||||||
|
|
||||||
|
explosionShake = 6f;
|
||||||
|
explosionShakeDuration = 16f;
|
||||||
|
explosionDamage = 1900 * 4;
|
||||||
|
explodeEffect = Fx.impactReactorExplosion;
|
||||||
|
explodeSound = Sounds.explosionbig;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -114,16 +111,10 @@ public class ImpactReactor extends PowerGenerator{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyed(){
|
public void createExplosion(){
|
||||||
super.onDestroyed();
|
if(warmup >= 0.3f){
|
||||||
|
super.createExplosion();
|
||||||
if(warmup < 0.3f || !state.rules.reactorExplosions) return;
|
}
|
||||||
|
|
||||||
Damage.damage(x, y, explosionRadius * tilesize, explosionDamage * 4);
|
|
||||||
|
|
||||||
Effect.shake(6f, 16f, x, y);
|
|
||||||
explodeEffect.at(this);
|
|
||||||
explodeSound.at(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package mindustry.world.blocks.power;
|
package mindustry.world.blocks.power;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.audio.*;
|
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
@ -10,7 +9,6 @@ import arc.util.*;
|
|||||||
import arc.util.io.*;
|
import arc.util.io.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.entities.*;
|
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
@ -27,8 +25,6 @@ public class NuclearReactor extends PowerGenerator{
|
|||||||
public Color lightColor = Color.valueOf("7f19ea");
|
public Color lightColor = Color.valueOf("7f19ea");
|
||||||
public Color coolColor = new Color(1, 1, 1, 0f);
|
public Color coolColor = new Color(1, 1, 1, 0f);
|
||||||
public Color hotColor = Color.valueOf("ff9575a3");
|
public Color hotColor = Color.valueOf("ff9575a3");
|
||||||
public Effect explodeEffect = Fx.reactorExplosion;
|
|
||||||
public Sound explodeSound = Sounds.explosionbig;
|
|
||||||
/** ticks to consume 1 fuel */
|
/** ticks to consume 1 fuel */
|
||||||
public float itemDuration = 120;
|
public float itemDuration = 120;
|
||||||
/** heating per frame * fullness */
|
/** heating per frame * fullness */
|
||||||
@ -37,8 +33,7 @@ public class NuclearReactor extends PowerGenerator{
|
|||||||
public float smokeThreshold = 0.3f;
|
public float smokeThreshold = 0.3f;
|
||||||
/** heat threshold at which lights start flashing */
|
/** heat threshold at which lights start flashing */
|
||||||
public float flashThreshold = 0.46f;
|
public float flashThreshold = 0.46f;
|
||||||
public int explosionRadius = 19;
|
|
||||||
public int explosionDamage = 1250;
|
|
||||||
/** heat removed per unit of coolant */
|
/** heat removed per unit of coolant */
|
||||||
public float coolantPower = 0.5f;
|
public float coolantPower = 0.5f;
|
||||||
public float smoothLight;
|
public float smoothLight;
|
||||||
@ -58,6 +53,15 @@ public class NuclearReactor extends PowerGenerator{
|
|||||||
flags = EnumSet.of(BlockFlag.reactor, BlockFlag.generator);
|
flags = EnumSet.of(BlockFlag.reactor, BlockFlag.generator);
|
||||||
schematicPriority = -5;
|
schematicPriority = -5;
|
||||||
envEnabled = Env.any;
|
envEnabled = Env.any;
|
||||||
|
|
||||||
|
explosionShake = 6f;
|
||||||
|
explosionShakeDuration = 16f;
|
||||||
|
|
||||||
|
explosionRadius = 19;
|
||||||
|
explosionDamage = 1250 * 4;
|
||||||
|
|
||||||
|
explodeEffect = Fx.reactorExplosion;
|
||||||
|
explodeSound = Sounds.explosionbig;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -124,19 +128,10 @@ public class NuclearReactor extends PowerGenerator{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyed(){
|
public void createExplosion(){
|
||||||
super.onDestroyed();
|
if(items.get(fuelItem) >= 5 && heat >= 0.5f){
|
||||||
|
super.createExplosion();
|
||||||
int fuel = items.get(fuelItem);
|
}
|
||||||
|
|
||||||
if((fuel < 5 && heat < 0.5f) || !state.rules.reactorExplosions) return;
|
|
||||||
|
|
||||||
Effect.shake(6f, 16f, x, y);
|
|
||||||
// * ((float)fuel / itemCapacity) to scale based on fullness
|
|
||||||
Damage.damage(x, y, explosionRadius * tilesize, explosionDamage * 4);
|
|
||||||
|
|
||||||
explodeEffect.at(this);
|
|
||||||
explodeSound.at(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,24 +1,43 @@
|
|||||||
package mindustry.world.blocks.power;
|
package mindustry.world.blocks.power;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
|
import arc.audio.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.util.io.*;
|
import arc.util.io.*;
|
||||||
|
import mindustry.content.*;
|
||||||
|
import mindustry.entities.*;
|
||||||
import mindustry.entities.units.*;
|
import mindustry.entities.units.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
|
import mindustry.type.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
|
import mindustry.world.*;
|
||||||
import mindustry.world.draw.*;
|
import mindustry.world.draw.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class PowerGenerator extends PowerDistributor{
|
public class PowerGenerator extends PowerDistributor{
|
||||||
/** The amount of power produced per tick in case of an efficiency of 1.0, which represents 100%. */
|
/** The amount of power produced per tick in case of an efficiency of 1.0, which represents 100%. */
|
||||||
public float powerProduction;
|
public float powerProduction;
|
||||||
public Stat generationType = Stat.basePowerGeneration;
|
public Stat generationType = Stat.basePowerGeneration;
|
||||||
public DrawBlock drawer = new DrawDefault();
|
public DrawBlock drawer = new DrawDefault();
|
||||||
|
|
||||||
|
public int explosionRadius = 12;
|
||||||
|
public int explosionDamage = 0;
|
||||||
|
public Effect explodeEffect = Fx.none;
|
||||||
|
public Sound explodeSound = Sounds.none;
|
||||||
|
|
||||||
|
public int explosionPuddles = 10;
|
||||||
|
public float explosionPuddleRange = tilesize * 2f;
|
||||||
|
public float explosionPuddleAmount = 100f;
|
||||||
|
public @Nullable Liquid explosionPuddleLiquid;
|
||||||
|
|
||||||
|
public float explosionShake = 0f, explosionShakeDuration = 6f;
|
||||||
|
|
||||||
public PowerGenerator(String name){
|
public PowerGenerator(String name){
|
||||||
super(name);
|
super(name);
|
||||||
sync = true;
|
sync = true;
|
||||||
@ -81,6 +100,36 @@ public class PowerGenerator extends PowerDistributor{
|
|||||||
return productionEfficiency;
|
return productionEfficiency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyed(){
|
||||||
|
super.onDestroyed();
|
||||||
|
|
||||||
|
if(state.rules.reactorExplosions){
|
||||||
|
createExplosion();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createExplosion(){
|
||||||
|
if(explosionDamage > 0){
|
||||||
|
Damage.damage(x, y, explosionRadius * tilesize, explosionDamage);
|
||||||
|
}
|
||||||
|
|
||||||
|
explodeEffect.at(this);
|
||||||
|
explodeSound.at(this);
|
||||||
|
|
||||||
|
if(explosionPuddleLiquid != null){
|
||||||
|
for(int i = 0; i < explosionPuddles; i++){
|
||||||
|
Tmp.v1.trns(Mathf.random(360f), Mathf.random(explosionPuddleRange));
|
||||||
|
Tile tile = world.tileWorld(x + Tmp.v1.x, y + Tmp.v1.y);
|
||||||
|
Puddles.deposit(tile, explosionPuddleLiquid, explosionPuddleAmount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(explosionShake > 0){
|
||||||
|
Effect.shake(explosionShake, explosionShakeDuration, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLight(){
|
public void drawLight(){
|
||||||
super.drawLight();
|
super.drawLight();
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package mindustry.world.blocks.power;
|
package mindustry.world.blocks.power;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.audio.*;
|
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
@ -13,9 +12,7 @@ import mindustry.entities.*;
|
|||||||
import mindustry.entities.effect.*;
|
import mindustry.entities.effect.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.type.*;
|
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.world.*;
|
|
||||||
import mindustry.world.blocks.heat.*;
|
import mindustry.world.blocks.heat.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
@ -32,22 +29,23 @@ public class VariableReactor extends PowerGenerator{
|
|||||||
public float flashThreshold = 0.01f, flashAlpha = 0.4f, flashSpeed = 7f;
|
public float flashThreshold = 0.01f, flashAlpha = 0.4f, flashSpeed = 7f;
|
||||||
public Color flashColor1 = Color.red, flashColor2 = Color.valueOf("89e8b6");
|
public Color flashColor1 = Color.red, flashColor2 = Color.valueOf("89e8b6");
|
||||||
|
|
||||||
public int explosionRadius = 12;
|
|
||||||
public int explosionDamage = 1000;
|
|
||||||
public Effect explodeEffect = new MultiEffect(Fx.bigShockwave, new WrapEffect(Fx.titanSmoke, Color.valueOf("e3ae6f")));
|
|
||||||
public Sound explodeSound = Sounds.explosionbig;
|
|
||||||
|
|
||||||
public int puddles = 70;
|
|
||||||
public float puddleRange = tilesize * 6f;
|
|
||||||
public Liquid puddleLiquid = Liquids.slag;
|
|
||||||
public float puddleAmount = 100f;
|
|
||||||
|
|
||||||
public @Load("@-lights") TextureRegion lightsRegion;
|
public @Load("@-lights") TextureRegion lightsRegion;
|
||||||
|
|
||||||
public VariableReactor(String name){
|
public VariableReactor(String name){
|
||||||
super(name);
|
super(name);
|
||||||
powerProduction = 20f;
|
powerProduction = 20f;
|
||||||
rebuildable = false;
|
rebuildable = false;
|
||||||
|
|
||||||
|
|
||||||
|
explosionRadius = 12;
|
||||||
|
explosionDamage = 1000;
|
||||||
|
explodeEffect = new MultiEffect(Fx.bigShockwave, new WrapEffect(Fx.titanSmoke, Color.valueOf("e3ae6f")));
|
||||||
|
explodeSound = Sounds.explosionbig;
|
||||||
|
|
||||||
|
explosionPuddles = 70;
|
||||||
|
explosionPuddleRange = tilesize * 6f;
|
||||||
|
explosionPuddleLiquid = Liquids.slag;
|
||||||
|
explosionPuddleAmount = 100f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -86,24 +84,6 @@ public class VariableReactor extends PowerGenerator{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroyed(){
|
|
||||||
super.onDestroyed();
|
|
||||||
|
|
||||||
if(!state.rules.reactorExplosions) return;
|
|
||||||
|
|
||||||
Damage.damage(x, y, explosionRadius * tilesize, explosionDamage);
|
|
||||||
|
|
||||||
explodeEffect.at(this);
|
|
||||||
explodeSound.at(this);
|
|
||||||
|
|
||||||
for(int i = 0; i < puddles; i++){
|
|
||||||
Tmp.v1.trns(Mathf.random(360f), Mathf.random(puddleRange));
|
|
||||||
Tile tile = world.tileWorld(x + Tmp.v1.x, y + Tmp.v1.y);
|
|
||||||
Puddles.deposit(tile, puddleLiquid, puddleAmount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
super.draw();
|
super.draw();
|
||||||
|
Loading…
Reference in New Issue
Block a user