mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-13 11:29:48 +07:00
Multipress sprite / Shields re-added
This commit is contained in:
parent
203612853b
commit
f5028a4937
BIN
core/assets-raw/sprites/blocks/production/multi-press.png
Normal file
BIN
core/assets-raw/sprites/blocks/production/multi-press.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 507 B After Width: | Height: | Size: 509 B |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
@ -317,7 +317,7 @@ public class Blocks implements ContentList{
|
||||
craftEffect = Fx.pulverizeMedium;
|
||||
output = Items.graphite;
|
||||
craftTime = 30f;
|
||||
size = 2;
|
||||
size = 3;
|
||||
hasItems = true;
|
||||
hasLiquids = true;
|
||||
hasPower = true;
|
||||
@ -811,7 +811,7 @@ public class Blocks implements ContentList{
|
||||
requirements(Category.power, ItemStack.with(Items.titanium, 15, Items.lead, 20, Items.silicon, 30, Items.surgealloy, 10));
|
||||
size = 2;
|
||||
maxNodes = 2;
|
||||
laserRange = 40f;
|
||||
laserRange = 30f;
|
||||
}};
|
||||
|
||||
battery = new Battery("battery"){{
|
||||
@ -884,9 +884,13 @@ public class Blocks implements ContentList{
|
||||
consumes.liquid(Liquids.cryofluid, maxLiquidUse);
|
||||
}};
|
||||
|
||||
fusionReactor = new FusionReactor("fusion-reactor"){{
|
||||
fusionReactor = new ImpactGenerator("fusion-reactor"){{
|
||||
requirements(Category.power, ItemStack.with(Items.lead, 800, Items.silicon, 600, Items.graphite, 600, Items.thorium, 200, Items.surgealloy, 400, Items.metaglass, 200));
|
||||
size = 4;
|
||||
health = 600;
|
||||
health = 900;
|
||||
powerProduction = 70f;
|
||||
//consumes.power(20f);
|
||||
consumes.liquid(Liquids.water, 0.5f);
|
||||
}};
|
||||
|
||||
//endregion power
|
||||
|
@ -2,12 +2,6 @@ package io.anuke.mindustry.core;
|
||||
|
||||
import io.anuke.arc.ApplicationListener;
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.mindustry.entities.Effects;
|
||||
import io.anuke.mindustry.entities.EntityDraw;
|
||||
import io.anuke.mindustry.entities.EntityGroup;
|
||||
import io.anuke.mindustry.entities.impl.EffectEntity;
|
||||
import io.anuke.mindustry.entities.traits.DrawTrait;
|
||||
import io.anuke.mindustry.entities.traits.Entity;
|
||||
import io.anuke.arc.function.Consumer;
|
||||
import io.anuke.arc.function.Predicate;
|
||||
import io.anuke.arc.graphics.Camera;
|
||||
@ -15,6 +9,7 @@ import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.graphics.g2d.Lines;
|
||||
import io.anuke.arc.graphics.g2d.SpriteBatch;
|
||||
import io.anuke.arc.graphics.glutils.FrameBuffer;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.arc.math.geom.Rectangle;
|
||||
import io.anuke.arc.math.geom.Vector2;
|
||||
@ -23,15 +18,22 @@ import io.anuke.arc.util.Time;
|
||||
import io.anuke.arc.util.pooling.Pools;
|
||||
import io.anuke.mindustry.content.Fx;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.Effects;
|
||||
import io.anuke.mindustry.entities.EntityDraw;
|
||||
import io.anuke.mindustry.entities.EntityGroup;
|
||||
import io.anuke.mindustry.entities.effect.GroundEffectEntity;
|
||||
import io.anuke.mindustry.entities.effect.GroundEffectEntity.GroundEffect;
|
||||
import io.anuke.mindustry.entities.impl.EffectEntity;
|
||||
import io.anuke.mindustry.entities.traits.BelowLiquidTrait;
|
||||
import io.anuke.mindustry.entities.traits.DrawTrait;
|
||||
import io.anuke.mindustry.entities.traits.Entity;
|
||||
import io.anuke.mindustry.entities.type.BaseUnit;
|
||||
import io.anuke.mindustry.entities.type.Player;
|
||||
import io.anuke.mindustry.entities.type.TileEntity;
|
||||
import io.anuke.mindustry.entities.type.Unit;
|
||||
import io.anuke.mindustry.entities.effect.GroundEffectEntity;
|
||||
import io.anuke.mindustry.entities.effect.GroundEffectEntity.GroundEffect;
|
||||
import io.anuke.mindustry.entities.traits.BelowLiquidTrait;
|
||||
import io.anuke.mindustry.entities.type.BaseUnit;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.graphics.*;
|
||||
import io.anuke.mindustry.world.blocks.defense.ForceProjector.ShieldEntity;
|
||||
|
||||
import static io.anuke.arc.Core.*;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
@ -41,6 +43,7 @@ public class Renderer implements ApplicationListener{
|
||||
public final MinimapRenderer minimap = new MinimapRenderer();
|
||||
public final OverlayRenderer overlays = new OverlayRenderer();
|
||||
|
||||
private FrameBuffer shieldBuffer = new FrameBuffer(2, 2);
|
||||
private Color clearColor;
|
||||
private float targetscale = io.anuke.arc.scene.ui.layout.Unit.dp.scl(4);
|
||||
private float camerascale = targetscale;
|
||||
@ -198,16 +201,25 @@ public class Renderer implements ApplicationListener{
|
||||
drawAndInterpolate(playerGroup, p -> true, Player::drawBuildRequests);
|
||||
|
||||
//TODO shield
|
||||
/*
|
||||
if(shieldGroup.size() > 0){
|
||||
Graphics.beginShaders(Shaders.shield);
|
||||
|
||||
if(EntityDraw.countInBounds(shieldGroup) > 0){
|
||||
if(graphics.getWidth() >= 2 && graphics.getHeight() >= 2 && (shieldBuffer.getWidth() != graphics.getWidth() || shieldBuffer.getHeight() != graphics.getHeight())){
|
||||
shieldBuffer.resize(graphics.getWidth(), graphics.getHeight());
|
||||
}
|
||||
|
||||
Draw.flush();
|
||||
shieldBuffer.begin();
|
||||
graphics.clear(Color.CLEAR);
|
||||
EntityDraw.draw(shieldGroup);
|
||||
EntityDraw.drawWith(shieldGroup, shield -> true, shield -> ((ShieldEntity)shield).drawOver());
|
||||
Draw.flush();
|
||||
shieldBuffer.end();
|
||||
Draw.shader(Shaders.shield);
|
||||
Draw.color(Palette.accent);
|
||||
Graphics.endShaders();
|
||||
Draw.rect(Draw.wrap(shieldBuffer.getTexture()), camera.position.x, camera.position.y, camera.width, -camera.height);
|
||||
Draw.color();
|
||||
Draw.shader();
|
||||
}
|
||||
*/
|
||||
|
||||
overlays.drawTop();
|
||||
|
||||
|
@ -11,11 +11,18 @@ public class EntityDraw{
|
||||
private static final Rectangle viewport = new Rectangle();
|
||||
private static final Rectangle rect = new Rectangle();
|
||||
private static boolean clip = true;
|
||||
private static int count = 0;
|
||||
|
||||
public static void setClip(boolean clip){
|
||||
EntityDraw.clip = clip;
|
||||
}
|
||||
|
||||
public static int countInBounds(EntityGroup<?> group){
|
||||
count = 0;
|
||||
drawWith(group, e -> true, e -> count++);
|
||||
return count;
|
||||
}
|
||||
|
||||
public static void draw(){
|
||||
draw(Entities.defaultGroup());
|
||||
}
|
||||
|
@ -500,13 +500,8 @@ public class Block extends BlockStorage{
|
||||
bars.row();
|
||||
}
|
||||
|
||||
if(entity.power != null && consumes.has(ConsumePower.class) && consumes.get(ConsumePower.class).isBuffered){
|
||||
bars.add(new Bar("blocks.power", Palette.power, () -> entity.power.satisfaction)).growX();
|
||||
bars.row();
|
||||
}
|
||||
|
||||
if(entity.power != null && consumes.has(ConsumePower.class) && !consumes.get(ConsumePower.class).isBuffered){
|
||||
bars.add(new Bar("blocks.power.satisfaction", Palette.power, () -> entity.power.satisfaction)).growX();
|
||||
if(entity.power != null && consumes.has(ConsumePower.class)){
|
||||
bars.add(new Bar(consumes.get(ConsumePower.class).isBuffered ? "blocks.power" : "blocks.power.satisfaction", Palette.power, () -> entity.power.satisfaction)).growX();
|
||||
bars.row();
|
||||
}
|
||||
}
|
||||
|
@ -28,22 +28,20 @@ public class FusionReactor extends PowerGenerator{
|
||||
powerProduction = 2.0f;
|
||||
liquidCapacity = 30f;
|
||||
hasItems = true;
|
||||
outputsPower = consumesPower = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
FusionReactorEntity entity = tile.entity();
|
||||
|
||||
float increaseOrDecrease = 1.0f;
|
||||
if(entity.cons.valid()){
|
||||
entity.warmup = Mathf.lerpDelta(entity.warmup, 1f, warmupSpeed);
|
||||
}else{
|
||||
entity.warmup = Mathf.lerpDelta(entity.warmup, 0f, 0.01f);
|
||||
increaseOrDecrease = -1.0f;
|
||||
}
|
||||
|
||||
float efficiencyAdded = Mathf.pow(entity.warmup, 4f) * Time.delta();
|
||||
entity.productionEfficiency = Mathf.clamp(entity.productionEfficiency + efficiencyAdded * increaseOrDecrease);
|
||||
entity.productionEfficiency = Mathf.pow(entity.warmup, 5f);
|
||||
|
||||
super.update(tile);
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
package io.anuke.mindustry.world.blocks.power;
|
||||
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
|
||||
public class ImpactGenerator extends TurbineGenerator{
|
||||
|
||||
public ImpactGenerator(String name){
|
||||
super(name);
|
||||
minItemEfficiency = 0.5f;
|
||||
minLiquidEfficiency = 0.5f;
|
||||
randomlyExplode = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getItemEfficiency(Item item){
|
||||
return item.explosiveness;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getLiquidEfficiency(Liquid liquid){
|
||||
return liquid.explosiveness;
|
||||
}
|
||||
}
|
@ -36,6 +36,7 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
||||
protected Effects.Effect explodeEffect = Fx.generatespark;
|
||||
protected Color heatColor = Color.valueOf("ff9b59");
|
||||
protected TextureRegion topRegion;
|
||||
protected boolean randomlyExplode = false;
|
||||
|
||||
public ItemLiquidGenerator(boolean hasItems, boolean hasLiquids, String name){
|
||||
super(name);
|
||||
@ -107,9 +108,9 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
||||
if(entity.generateTime > 0f){
|
||||
entity.generateTime -= Math.min(1f / itemDuration * entity.delta(), entity.generateTime);
|
||||
|
||||
if(Mathf.chance(entity.delta() * 0.06 * Mathf.clamp(entity.explosiveness - 0.5f))){
|
||||
if(randomlyExplode && Mathf.chance(entity.delta() * 0.06 * Mathf.clamp(entity.explosiveness - 0.5f))){
|
||||
//this block is run last so that in the event of a block destruction, no code relies on the block type
|
||||
entity.damage(Mathf.random(8f));
|
||||
entity.damage(Mathf.random(11f));
|
||||
Effects.effect(explodeEffect, tile.worldx() + Mathf.range(size * tilesize / 2f), tile.worldy() + Mathf.range(size * tilesize / 2f));
|
||||
}
|
||||
}else{
|
||||
|
@ -198,8 +198,7 @@ public class PowerNode extends PowerBlock{
|
||||
|
||||
for(int i = 0; i < entity.power.links.size; i++){
|
||||
Tile link = world.tile(entity.power.links.get(i));
|
||||
if(linkValid(tile, link) && (!(link.block() instanceof PowerNode)
|
||||
|| ((tile.block().size > link.block().size) || (tile.block().size == link.block().size && tile.pos() < link.pos())))){
|
||||
if(linkValid(tile, link)){
|
||||
drawLaser(tile, link);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user