Added turret damage / Removed changelog dialog

This commit is contained in:
Anuken
2019-07-05 14:01:54 -04:00
parent d2bb3800e3
commit 174caef7ca
17 changed files with 862 additions and 984 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -381,6 +381,7 @@ blocks.booster = Booster
block.unknown = [LIGHT_GRAY]???
blocks.powercapacity = Power Capacity
blocks.powershot = Power/Shot
blocks.damage = Damage
blocks.targetsair = Targets Air
blocks.targetsground = Targets Ground
blocks.itemsmoved = Move Speed

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 788 KiB

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

After

Width:  |  Height:  |  Size: 253 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 233 KiB

After

Width:  |  Height:  |  Size: 276 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -57,7 +57,6 @@ public class UI implements ApplicationListener{
public BansDialog bans;
public AdminsDialog admins;
public TraceDialog traces;
public ChangelogDialog changelog;
public DatabaseDialog database;
public ContentInfoDialog content;
public DeployDialog deploy;
@ -172,7 +171,6 @@ public class UI implements ApplicationListener{
settings = new SettingsMenuDialog();
host = new HostDialog();
paused = new PausedDialog();
changelog = new ChangelogDialog();
about = new AboutDialog();
bans = new BansDialog();
admins = new AdminsDialog();

View File

@ -1,54 +0,0 @@
package io.anuke.mindustry.io;
import io.anuke.arc.Core;
import io.anuke.arc.collection.Array;
import io.anuke.arc.function.Consumer;
import io.anuke.arc.util.serialization.JsonReader;
import io.anuke.arc.util.serialization.JsonValue;
import static io.anuke.mindustry.Vars.releasesURL;
public class Changelogs{
public static void getChangelog(Consumer<Array<VersionInfo>> success, Consumer<Throwable> fail){
Core.net.httpGet(releasesURL, result -> {
JsonReader reader = new JsonReader();
JsonValue value = reader.parse(result.getResultAsString()).child;
Array<VersionInfo> out = new Array<>();
while(value != null){
String name = value.getString("name");
String description = value.getString("body").replace("\r", "");
int id = value.getInt("id");
int build = Integer.parseInt(value.getString("tag_name").substring(1));
out.add(new VersionInfo(name, description, id, build, value.getString("published_at")));
value = value.next;
}
success.accept(out);
}, fail);
}
public static class VersionInfo{
public final String name, description, date;
public final int id, build;
public VersionInfo(String name, String description, int id, int build, String date){
this.name = name;
this.description = description;
this.id = id;
this.build = build;
this.date = date;
}
@Override
public String toString(){
return "VersionInfo{" +
"name='" + name + '\'' +
", description='" + description + '\'' +
", id=" + id +
", build=" + build +
'}';
}
}
}

View File

@ -69,7 +69,7 @@ public class Item extends UnlockableContent implements Comparable<Item>{
@Override
public TextureRegion getContentIcon(){
return icon(Icon.xxlarge);
return icon(Icon.large);
}
@Override

View File

@ -10,13 +10,14 @@ public class Links{
private static void createLinks(){
links = new LinkEntry[]{
new LinkEntry("discord", "https://discord.gg/mindustry", Color.valueOf("7289da")),
new LinkEntry("changelog", "https://github.com/Anuken/Mindustry/releases", Pal.accent.cpy()),
new LinkEntry("trello", "https://trello.com/b/aE2tcUwF", Color.valueOf("026aa7")),
new LinkEntry("wiki", "https://mindustrygame.github.io/wiki/", Color.valueOf("0f142f")),
new LinkEntry("itch.io", "https://anuke.itch.io/mindustry", Color.valueOf("fa5c5c")),
new LinkEntry("google-play", "https://play.google.com/store/apps/details?id=io.anuke.mindustry", Color.valueOf("689f38")),
new LinkEntry("github", "https://github.com/Anuken/Mindustry/", Color.valueOf("24292e")),
new LinkEntry("dev-builds", "https://jenkins.hellomouse.net/job/mindustry/", Color.valueOf("fafbfc")),
new LinkEntry("changelog", "https://github.com/Anuken/Mindustry/releases", Pal.accent.cpy())
new LinkEntry("dev-builds", "https://jenkins.hellomouse.net/job/mindustry/", Color.valueOf("fafbfc"))
};
}

View File

@ -1,89 +0,0 @@
package io.anuke.mindustry.ui.dialogs;
import io.anuke.arc.Core;
import io.anuke.arc.collection.Array;
import io.anuke.arc.scene.ui.ScrollPane;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.util.Log;
import io.anuke.arc.util.OS;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.game.Version;
import io.anuke.mindustry.io.Changelogs;
import io.anuke.mindustry.io.Changelogs.VersionInfo;
import static io.anuke.mindustry.Vars.ios;
public class ChangelogDialog extends FloatingDialog{
private final float vw = 600;
private Array<VersionInfo> versions;
public ChangelogDialog(){
super("$changelog.title");
addCloseButton();
cont.add("$changelog.loading");
shown(() -> {
if(!ios && !OS.isMac){
Changelogs.getChangelog(result -> {
versions = result;
Core.app.post(this::setup);
}, t -> {
Log.err(t);
Core.app.post(this::setup);
});
}
});
}
void setup(){
Table table = new Table();
ScrollPane pane = new ScrollPane(table);
cont.clear();
cont.add(pane).grow();
if(versions == null){
table.add("$changelog.error");
if(Vars.android){
table.row();
table.add("$changelog.error.android").padTop(8);
}
if(ios){
table.row();
table.add("$changelog.error.ios").padTop(8);
}
}else{
for(VersionInfo info : versions){
String desc = info.description;
desc = desc.replace("Android", "Mobile");
Table in = new Table("underline");
in.top().left().margin(10);
in.add("[accent]" + info.name + "[LIGHT_GRAY] | " + info.date);
if(info.build == Version.build){
in.row();
in.add("$changelog.current");
}else if(info == versions.first()){
in.row();
in.add("$changelog.latest");
}
in.row();
in.labelWrap("[lightgray]" + desc).width(vw - 20).padTop(12);
table.add(in).width(vw).pad(8).row();
}
int lastid = Core.settings.getInt("lastBuild");
if(lastid != 0 && versions.peek().build > lastid){
Core.settings.put("lastBuild", versions.peek().build);
Core.settings.save();
show();
}
}
}
}

View File

@ -2,9 +2,12 @@ package io.anuke.mindustry.ui.dialogs;
import io.anuke.arc.Core;
import io.anuke.arc.collection.Array;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.scene.event.ClickListener;
import io.anuke.arc.scene.event.HandCursorListener;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.game.Content;
@ -46,16 +49,20 @@ public class DatabaseDialog extends FloatingDialog{
list.left();
int maxWidth = Core.graphics.isPortrait() ? 7 : 13;
float size = Vars.iconsize;
int count = 0;
for(int i = 0; i < array.size; i++){
UnlockableContent unlock = (UnlockableContent)array.get(i);
Image image = unlocked(unlock) ? new Image(unlock.getContentIcon()) : new Image("icon-locked");
Image image = unlocked(unlock) ? new Image(unlock.getContentIcon()) : new Image("icon-locked", Pal.gray);
image.addListener(new HandCursorListener());
list.add(image).size(size).pad(3);
list.add(image).size(unlocked(unlock) ? 8*4 : Vars.iconsize).pad(3);
ClickListener listener = new ClickListener();
image.addListener(listener);
if(!Vars.mobile){
image.update(() -> image.getColor().lerp(!listener.isOver() ? Color.LIGHT_GRAY : Color.WHITE, 0.4f * Time.delta()));
}
if(unlocked(unlock)){
image.clicked(() -> Vars.ui.content.show(unlock));

View File

@ -301,7 +301,7 @@ public class Block extends BlockStorage{
@Override
public TextureRegion getContentIcon(){
return icon(Icon.large);
return icon(Icon.medium);
}
@Override

View File

@ -11,6 +11,7 @@ import io.anuke.mindustry.type.Liquid;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.consumers.*;
import io.anuke.mindustry.world.meta.BlockStat;
import io.anuke.mindustry.world.meta.StatUnit;
import static io.anuke.mindustry.Vars.tilesize;
@ -30,6 +31,9 @@ public class LaserTurret extends PowerTurret{
super.setStats();
stats.remove(BlockStat.boostEffect);
stats.remove(BlockStat.damage);
//damages every 5 ticks, at least in meltdown's case
stats.add(BlockStat.damage, shootType.damage * 60f / 5f, StatUnit.perSecond);
}
@Override

View File

@ -2,6 +2,8 @@ package io.anuke.mindustry.world.blocks.defense.turrets;
import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.meta.BlockStat;
import io.anuke.mindustry.world.meta.StatUnit;
public abstract class PowerTurret extends CooledTurret{
protected BulletType shootType;
@ -12,6 +14,13 @@ public abstract class PowerTurret extends CooledTurret{
hasPower = true;
}
@Override
public void setStats(){
super.setStats();
stats.add(BlockStat.damage, shootType.damage, StatUnit.none);
}
@Override
public void init(){
consumes.powerCond(powerUse, entity -> ((TurretEntity)entity).target != null);

View File

@ -39,6 +39,7 @@ public enum BlockStat{
powerShot(StatCategory.shooting),
targetsAir(StatCategory.shooting),
targetsGround(StatCategory.shooting),
damage(StatCategory.shooting),
ammo(StatCategory.shooting),
booster(StatCategory.optional),