Mech balance / Re-added map screenshot

This commit is contained in:
Anuken
2019-03-30 00:17:29 -04:00
parent db3aae1388
commit b419a96d69
8 changed files with 88 additions and 23 deletions

View File

@@ -35,6 +35,7 @@ public class Mechs implements ContentList{
mass = 1.2f;
speed = 0.5f;
boostSpeed = 0.85f;
buildPower = 1.2f;
engineColor = Color.valueOf("ffd37f");
health = 300f;
@@ -47,6 +48,11 @@ public class Mechs implements ContentList{
}};
}
@Override
public void updateAlt(Player player){
player.healBy(Time.delta() * 0.4f);
}
@Override
public boolean alwaysUnlocked(){
return true;
@@ -63,6 +69,7 @@ public class Mechs implements ContentList{
itemCapacity = 15;
mass = 0.9f;
health = 250f;
buildPower = 0.9f;
weaponOffsetX = -1;
weaponOffsetY = -1;
engineColor = Color.valueOf("d3ddff");
@@ -110,6 +117,7 @@ public class Mechs implements ContentList{
boostSpeed = 0.8f;
canHeal = true;
health = 200f;
buildPower = 1.6f;
engineColor = Pal.heal;
weapon = new Weapon("heal-blaster"){{
@@ -161,6 +169,7 @@ public class Mechs implements ContentList{
weaponOffsetY = 0;
engineColor = Color.valueOf("feb380");
health = 300f;
buildPower = 1.5f;
weapon = new Weapon("swarmer"){{
length = 1.5f;
recoil = 4f;
@@ -227,6 +236,7 @@ public class Mechs implements ContentList{
weaponOffsetY = -1;
engineColor = Pal.lightTrail;
cellTrnsY = 1f;
buildPower = 1.1f;
weapon = new Weapon("blaster"){{
length = 1.5f;
reload = 20f;
@@ -315,6 +325,7 @@ public class Mechs implements ContentList{
itemCapacity = 30;
engineColor = Color.valueOf("84f491");
cellTrnsY = 1f;
buildPower = 2f;
weapon = new Weapon("bomber"){{
length = 0f;
width = 2f;
@@ -346,6 +357,7 @@ public class Mechs implements ContentList{
itemCapacity = 60;
engineColor = Color.valueOf("feb380");
cellTrnsY = 1f;
buildPower = 1.2f;
weapon = new Weapon("bomber"){{
length = 1.5f;

View File

@@ -8,6 +8,7 @@ import io.anuke.arc.graphics.GL20;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.TextureAtlas;
import io.anuke.arc.input.KeyCode;
import io.anuke.arc.scene.ui.TextField;
import io.anuke.arc.util.BufferUtils;
import io.anuke.arc.util.Interval;
import io.anuke.arc.util.Strings;
@@ -301,6 +302,10 @@ public class Control implements ApplicationListener{
}
}
if(!mobile && Core.input.keyTap(Binding.screenshot) && !(scene.getKeyboardFocus() instanceof TextField) && !ui.chatfrag.chatOpen()){
renderer.takeMapScreenshot();
}
}else{
if(!state.isPaused()){
Time.update();

View File

@@ -2,10 +2,13 @@ package io.anuke.mindustry.core;
import io.anuke.arc.ApplicationListener;
import io.anuke.arc.Core;
import io.anuke.arc.files.FileHandle;
import io.anuke.arc.function.Consumer;
import io.anuke.arc.function.Predicate;
import io.anuke.arc.graphics.Camera;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.Pixmap;
import io.anuke.arc.graphics.PixmapIO;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.graphics.g2d.SpriteBatch;
@@ -13,6 +16,8 @@ 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;
import io.anuke.arc.util.BufferUtils;
import io.anuke.arc.util.ScreenUtils;
import io.anuke.arc.util.Time;
import io.anuke.arc.util.Tmp;
import io.anuke.arc.util.pooling.Pools;
@@ -296,10 +301,6 @@ public class Renderer implements ApplicationListener{
EntityDraw.drawWith(group, toDraw, drawer);
}
public float cameraScale(){
return camerascale;
}
public void scaleCamera(float amount){
targetscale += amount;
clampScale();
@@ -310,4 +311,47 @@ public class Renderer implements ApplicationListener{
targetscale = Mathf.clamp(targetscale, s * 1.5f, Math.round(s * 6));
}
public void takeMapScreenshot(){
drawGroundShadows();
int w = world.width()*tilesize, h = world.height()*tilesize;
boolean isWater = settings.getBool("animatedwater");
settings.put("animatedwater", false);
FrameBuffer buffer = new FrameBuffer(w, h);
float vpW = camera.width, vpH = camera.height, px = camera.position.x, py = camera.position.y;
disableUI = true;
camera.width = w;
camera.height = h;
camera.position.x = w/2f + tilesize/2f;
camera.position.y = h/2f + tilesize/2f;
Draw.flush();
buffer.begin();
draw();
Draw.flush();
buffer.end();
disableUI = false;
camera.width = vpW;
camera.height = vpH;
camera.position.set(px, py);
buffer.begin();
byte[] lines = ScreenUtils.getFrameBufferPixels(0, 0, w, h, true);
for(int i = 0; i < lines.length; i+= 4){
lines[i + 3] = (byte)255;
}
buffer.end();
Pixmap fullPixmap = new Pixmap(w, h, Pixmap.Format.RGBA8888);
BufferUtils.copy(lines, 0, fullPixmap.getPixels(), lines.length);
FileHandle file = screenshotDirectory.child("screenshot-" + Time.millis() + ".png");
PixmapIO.writePNG(file, fullPixmap);
fullPixmap.dispose();
ui.showInfoFade(Core.bundle.format("screenshot", file.toString()));
buffer.dispose();
settings.put("animatedwater", isWater);
}
}

View File

@@ -25,6 +25,7 @@ public enum Binding implements KeyBind{
menu(Core.app.getType() == ApplicationType.Android ? KeyCode.BACK : KeyCode.ESCAPE),
pause(KeyCode.SPACE),
toggle_menus(KeyCode.C),
screenshot(KeyCode.P),
player_list(KeyCode.TAB, "multiplayer"),
chat(KeyCode.ENTER),
chat_history_prev(KeyCode.UP),

View File

@@ -134,6 +134,7 @@ public class ContentDisplay{
title.addImage(mech.getContentIcon()).size(8 * 6);
title.add("[accent]" + mech.localizedName()).padLeft(5);
});
table.left().defaults().left();
table.row();
@@ -159,13 +160,17 @@ public class ContentDisplay{
table.add(Core.bundle.format("mech.ability", Core.bundle.get("mech." + mech.name + ".ability")));
table.row();
}
table.add(Core.bundle.format("mech.buildspeed", (int)(mech.buildPower * 100f)));
table.row();
table.add(Core.bundle.format("mech.health", (int)mech.health));
table.row();
table.add(Core.bundle.format("mech.itemcapacity", mech.itemCapacity));
table.row();
if(mech.drillPower > 0){
table.add(Core.bundle.format("mech.minespeed", (int) (mech.mineSpeed * 10)));
table.add(Core.bundle.format("mech.minespeed", (int)(mech.mineSpeed * 100f)));
table.row();
table.add(Core.bundle.format("mech.minepower", mech.drillPower));
table.row();

View File

@@ -163,7 +163,7 @@ public class Block extends BlockStorage{
if(tile == null || tile.entity == null || tile.entity.power == null) return out;
for(Tile other : tile.entity.proximity()){
if(other.entity.power != null && !(consumesPower && other.block().consumesPower && !outputsPower && !other.block().outputsPower)
if(other != null && other.entity != null && other.entity.power != null && !(consumesPower && other.block().consumesPower && !outputsPower && !other.block().outputsPower)
&& !tile.entity.power.links.contains(other.pos())){
out.add(other);
}