More block descriptions, improved indicators

This commit is contained in:
Anuken 2017-12-02 14:59:28 -05:00
parent 597c5161e3
commit 9cadb08024
8 changed files with 50 additions and 31 deletions

View File

@ -37,6 +37,7 @@ import io.anuke.ucore.scene.utils.Cursors;
import io.anuke.ucore.util.*;
public class Renderer extends RendererModule{
String[] surfaces = {"shadow", "shield", "pixel", "indicators"};
int targetscale = baseCameraScale;
int chunksize = 32;
Cache[][] floorCache;
@ -45,15 +46,14 @@ public class Renderer extends RendererModule{
public Renderer() {
Core.cameraScale = baseCameraScale;
Graphics.addSurface("pixel", Core.cameraScale);
}
@Override
public void init(){
pixelate = Settings.getBool("pixelate");
Graphics.addSurface("shadow", Settings.getBool("pixelate") ? Core.cameraScale : 1);
Graphics.addSurface("shield", Settings.getBool("pixelate") ? Core.cameraScale : 1);
for(String surface : surfaces){
Graphics.addSurface(surface, Settings.getBool("pixelate") ? Core.cameraScale : 1);
}
}
public void setPixelate(boolean pixelate){
@ -186,8 +186,9 @@ public class Renderer extends RendererModule{
}
void drawEnemyMarkers(){
Graphics.surface("indicators");
Draw.color(Color.RED);
Draw.alpha(0.6f);
//Draw.alpha(0.6f);
for(Enemy enemy : control.enemyGroup.all()){
if(Tmp.r1.setSize(camera.viewportWidth, camera.viewportHeight).setCenter(camera.position.x, camera.position.y).overlaps(enemy.hitbox.getRect(enemy.x, enemy.y))){
@ -199,6 +200,9 @@ public class Renderer extends RendererModule{
Draw.rect("enemyarrow", camera.position.x + Angles.x(), camera.position.y + Angles.y(), angle);
}
Draw.color();
Draw.alpha(0.4f);
Graphics.flushSurface();
Draw.color();
}
void drawShield(){
@ -513,9 +517,9 @@ public class Renderer extends RendererModule{
targetscale = amount;
clampScale();
if(Settings.getBool("pixelate")){
Graphics.getSurface("pixel").setScale(targetscale);
Graphics.getSurface("shadow").setScale(targetscale);
Graphics.getSurface("shield").setScale(targetscale);
for(String surface : surfaces){
Graphics.getSurface(surface).setScale(targetscale);
}
}
}

View File

@ -96,6 +96,7 @@ public class UI extends SceneModule{
Colors.put("craftinfo", Color.LIGHT_GRAY);
Colors.put("missingitems", Color.SCARLET);
Colors.put("health", Color.YELLOW);
Colors.put("healthstats", Color.SCARLET);
Colors.put("interact", Color.ORANGE);
Colors.put("accent", Color.valueOf("f4ba6e"));
}

View File

@ -84,7 +84,7 @@ public class Block{
public void getStats(Array<String> list){
list.add("[gray]size: " + width + "x" + height);
list.add("[health]health: " + health);
list.add("[healthstats]health: " + health);
}
public String name(){

View File

@ -6,7 +6,8 @@ import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
/**Used for multiblocks. Each block that is not the center of the multiblock is a blockpart.
* Think of these as delegates to the actual block; all events are passed to the target block.*/
* Think of these as delegates to the actual block; all events are passed to the target block.
* They are made to share all properties from the linked tile/block.*/
public class BlockPart extends Block implements PowerAcceptor, LiquidAcceptor{
public BlockPart() {
@ -78,10 +79,6 @@ public class BlockPart extends Block implements PowerAcceptor, LiquidAcceptor{
return false;
}
}
private Block linked(Tile tile){
return tile.getLinked().block();
}
@Override
public void setPower(Tile tile, float power){
@ -91,6 +88,9 @@ public class BlockPart extends Block implements PowerAcceptor, LiquidAcceptor{
((PowerAcceptor)block).setPower(tile.getLinked(), power);
}
}
private Block linked(Tile tile){
return tile.getLinked().block();
}
}

View File

@ -1,5 +1,7 @@
package io.anuke.mindustry.world.blocks.types.defense;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.effect.Fx;
@ -9,16 +11,25 @@ import io.anuke.mindustry.world.blocks.types.PowerBlock;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.entities.BulletEntity;
import io.anuke.ucore.util.Strings;
public class ShieldBlock extends PowerBlock{
public float shieldRadius = 40f;
public float powerDrain = 0.005f;
public float powerDrain = 0.006f;
public float powerPerDamage = 0.1f;
public ShieldBlock(String name) {
super(name);
voltage = powerDrain;
}
@Override
public void getStats(Array<String> list){
super.getStats(list);
list.add("[powerinfo]Power Drain/second: " + Strings.toFixed(powerDrain*60, 2));
list.add("[powerinfo]Power Drain/damage taken: " + Strings.toFixed(powerPerDamage, 2));
list.add("[powerinfo]Shield Radius: " + (int)shieldRadius + " units");
}
@Override
public void update(Tile tile){

View File

@ -7,18 +7,28 @@ import io.anuke.mindustry.Vars;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.PowerAcceptor;
import io.anuke.mindustry.world.blocks.types.production.Generator;
import io.anuke.ucore.core.Draw;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.util.Mathf;
public class PowerBooster extends Generator{
public int powerRange = 4;
public PowerBooster(String name) {
super(name);
drawRadius = true;
explosive = false;
hasLasers = false;
}
@Override
public void drawPixelOverlay(Tile tile){
super.drawPixelOverlay(tile);
Draw.color("yellow");
Draw.dashcircle(tile.worldx(), tile.worldy(), powerRange * Vars.tilesize);
Draw.reset();
}
@Override
public void getStats(Array<String> list){
super.getStats(list);

View File

@ -21,10 +21,8 @@ public class Generator extends PowerBlock{
public int laserRange = 6;
public int laserDirections = 4;
public int powerRange = 4;
public float powerSpeed = 0.06f;
public boolean explosive = true;
public boolean drawRadius = false;
public boolean hasLasers = true;
public boolean outputOnly = false;
@ -35,6 +33,12 @@ public class Generator extends PowerBlock{
@Override
public void getStats(Array<String> list){
super.getStats(list);
if(hasLasers){
list.add("[powerinfo]Laser range: " + laserRange + " blocks");
list.add("[powerinfo]Max power transfer/second: " + Strings.toFixed(powerSpeed*2, 2));
}
if(explosive){
list.add("[orange]Highly explosive!");
}
@ -64,17 +68,6 @@ public class Generator extends PowerBlock{
super.onDestroyed(tile);
}
}
@Override
public void drawPixelOverlay(Tile tile){
super.drawPixelOverlay(tile);
if(drawRadius){
Draw.color("yellow");
Draw.dashcircle(tile.worldx(), tile.worldy(), powerRange * Vars.tilesize);
Draw.reset();
}
}
@Override
public void drawOver(Tile tile){

View File

@ -29,7 +29,7 @@ public class NuclearReactor extends LiquidItemPowerGenerator{
protected float coolantPower = 0.007f; //how much heat decreases per coolant unit
protected float smokeThreshold = 0.3f; //threshold at which block starts smoking
protected int explosionRadius = 19;
protected int explosionDamage = 128;
protected int explosionDamage = 135;
protected float flashThreshold = 0.46f;
public NuclearReactor(String name) {