Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features
Conflicts: core/src/mindustry/content/UnitTypes.java
This commit is contained in:
@@ -89,7 +89,7 @@ public class BaseAI{
|
||||
calculating = false;
|
||||
}
|
||||
}else{
|
||||
var field = pathfinder.getField(state.rules.waveTeam, Pathfinder.costGround, Pathfinder.fieldCore);
|
||||
var field = pathfinder.getField(data.team, Pathfinder.costGround, Pathfinder.fieldCore);
|
||||
|
||||
if(field.weights != null){
|
||||
int[][] weights = field.weights;
|
||||
@@ -120,7 +120,7 @@ public class BaseAI{
|
||||
}
|
||||
|
||||
//found the end.
|
||||
if(calcTile.build instanceof CoreBuild b && b.team == state.rules.defaultTeam){
|
||||
if(calcTile.build instanceof CoreBuild b && b.team != data.team){
|
||||
//clean up calculations and flush results
|
||||
calculating = false;
|
||||
calcCount = 0;
|
||||
|
||||
@@ -1342,12 +1342,14 @@ public class Blocks implements ContentList{
|
||||
battery = new Battery("battery"){{
|
||||
requirements(Category.power, with(Items.copper, 5, Items.lead, 20));
|
||||
consumes.powerBuffered(4000f);
|
||||
baseExplosiveness = 1f;
|
||||
}};
|
||||
|
||||
batteryLarge = new Battery("battery-large"){{
|
||||
requirements(Category.power, with(Items.titanium, 20, Items.lead, 40, Items.silicon, 20));
|
||||
size = 3;
|
||||
consumes.powerBuffered(50000f);
|
||||
baseExplosiveness = 5f;
|
||||
}};
|
||||
|
||||
combustionGenerator = new BurnerGenerator("combustion-generator"){{
|
||||
@@ -2091,7 +2093,7 @@ public class Blocks implements ContentList{
|
||||
requirements(Category.units, with(Items.copper, 50, Items.lead, 120, Items.silicon, 80));
|
||||
plans = Seq.with(
|
||||
new UnitPlan(UnitTypes.dagger, 60f * 15, with(Items.silicon, 10, Items.lead, 10)),
|
||||
new UnitPlan(UnitTypes.crawler, 60f * 12, with(Items.silicon, 10, Items.coal, 20)),
|
||||
new UnitPlan(UnitTypes.crawler, 60f * 10, with(Items.silicon, 8, Items.coal, 10)),
|
||||
new UnitPlan(UnitTypes.nova, 60f * 40, with(Items.silicon, 30, Items.lead, 20, Items.titanium, 20))
|
||||
);
|
||||
size = 3;
|
||||
|
||||
@@ -158,7 +158,7 @@ public class UnitTypes implements ContentList{
|
||||
}};
|
||||
|
||||
scepter = new UnitType("scepter"){{
|
||||
speed = 0.35f;
|
||||
speed = 0.36f;
|
||||
hitSize = 22f;
|
||||
rotateSpeed = 2.1f;
|
||||
health = 9000;
|
||||
@@ -186,7 +186,7 @@ public class UnitTypes implements ContentList{
|
||||
inaccuracy = 3f;
|
||||
shotDelay = 4f;
|
||||
|
||||
bullet = new BasicBulletType(7f, 45){{
|
||||
bullet = new BasicBulletType(7f, 50){{
|
||||
width = 11f;
|
||||
height = 20f;
|
||||
lifetime = 25f;
|
||||
@@ -195,7 +195,7 @@ public class UnitTypes implements ContentList{
|
||||
lightningLength = 6;
|
||||
lightningColor = Pal.surge;
|
||||
//standard bullet damage is far too much for lightning
|
||||
lightningDamage = 19;
|
||||
lightningDamage = 20;
|
||||
}};
|
||||
}},
|
||||
|
||||
@@ -244,7 +244,7 @@ public class UnitTypes implements ContentList{
|
||||
ejectEffect = Fx.casing4;
|
||||
shootSound = Sounds.bang;
|
||||
|
||||
bullet = new BasicBulletType(13f, 65){{
|
||||
bullet = new BasicBulletType(13f, 70){{
|
||||
pierce = true;
|
||||
pierceCap = 10;
|
||||
width = 14f;
|
||||
@@ -419,7 +419,7 @@ public class UnitTypes implements ContentList{
|
||||
vela = new UnitType("vela"){{
|
||||
hitSize = 24f;
|
||||
|
||||
rotateSpeed = 1.7f;
|
||||
rotateSpeed = 1.8f;
|
||||
mechFrontSway = 1f;
|
||||
buildSpeed = 3f;
|
||||
|
||||
@@ -429,7 +429,7 @@ public class UnitTypes implements ContentList{
|
||||
drownTimeMultiplier = 4f;
|
||||
|
||||
speed = 0.44f;
|
||||
boostMultiplier = 2.2f;
|
||||
boostMultiplier = 2.4f;
|
||||
engineOffset = 12f;
|
||||
engineSize = 6f;
|
||||
lowAltitude = true;
|
||||
@@ -442,6 +442,7 @@ public class UnitTypes implements ContentList{
|
||||
immunities = ObjectSet.with(StatusEffects.burning);
|
||||
|
||||
commandLimit = 8;
|
||||
singleTarget = true;
|
||||
|
||||
weapons.add(new Weapon("vela-weapon"){{
|
||||
mirror = false;
|
||||
@@ -485,6 +486,18 @@ public class UnitTypes implements ContentList{
|
||||
shootStatus = StatusEffects.slow;
|
||||
shootStatusDuration = bullet.lifetime + firstShotDelay;
|
||||
}});
|
||||
|
||||
weapons.add(new RepairBeamWeapon("repair-beam-weapon-center-large"){{
|
||||
x = 44 / 4f;
|
||||
y = -30f / 4f;
|
||||
shootY = 6f;
|
||||
beamWidth = 0.8f;
|
||||
repairSpeed = 1.4f;
|
||||
|
||||
bullet = new BulletType(){{
|
||||
maxRange = 120f;
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
|
||||
corvus = new UnitType("corvus"){{
|
||||
@@ -1059,7 +1072,7 @@ public class UnitTypes implements ContentList{
|
||||
rotateSpeed = 1.9f;
|
||||
flying = true;
|
||||
lowAltitude = true;
|
||||
health = 7000;
|
||||
health = 7200;
|
||||
armor = 9f;
|
||||
engineOffset = 21;
|
||||
engineSize = 5.3f;
|
||||
@@ -1067,13 +1080,13 @@ public class UnitTypes implements ContentList{
|
||||
targetFlags = new BlockFlag[]{BlockFlag.generator, BlockFlag.core, null};
|
||||
ammoType = new ItemAmmoType(Items.thorium);
|
||||
|
||||
BulletType missiles = new MissileBulletType(2.7f, 14){{
|
||||
BulletType missiles = new MissileBulletType(2.7f, 18){{
|
||||
width = 8f;
|
||||
height = 8f;
|
||||
shrinkY = 0f;
|
||||
drag = -0.01f;
|
||||
splashDamageRadius = 20f;
|
||||
splashDamage = 34f;
|
||||
splashDamage = 37f;
|
||||
ammoMultiplier = 4f;
|
||||
lifetime = 50f;
|
||||
hitEffect = Fx.blastExplosion;
|
||||
@@ -1128,13 +1141,13 @@ public class UnitTypes implements ContentList{
|
||||
}};
|
||||
|
||||
eclipse = new UnitType("eclipse"){{
|
||||
speed = 0.52f;
|
||||
speed = 0.54f;
|
||||
accel = 0.04f;
|
||||
drag = 0.04f;
|
||||
rotateSpeed = 1f;
|
||||
flying = true;
|
||||
lowAltitude = true;
|
||||
health = 21000;
|
||||
health = 22000;
|
||||
engineOffset = 38;
|
||||
engineSize = 7.3f;
|
||||
hitSize = 58f;
|
||||
@@ -1143,10 +1156,10 @@ public class UnitTypes implements ContentList{
|
||||
targetFlags = new BlockFlag[]{BlockFlag.reactor, BlockFlag.battery, BlockFlag.core, null};
|
||||
ammoType = new ItemAmmoType(Items.thorium);
|
||||
|
||||
BulletType fragBullet = new FlakBulletType(4f, 5){{
|
||||
BulletType fragBullet = new FlakBulletType(4f, 15){{
|
||||
shootEffect = Fx.shootBig;
|
||||
ammoMultiplier = 4f;
|
||||
splashDamage = 60f;
|
||||
splashDamage = 65f;
|
||||
splashDamageRadius = 25f;
|
||||
collidesGround = true;
|
||||
lifetime = 47f;
|
||||
@@ -1169,7 +1182,7 @@ public class UnitTypes implements ContentList{
|
||||
rotate = true;
|
||||
|
||||
bullet = new LaserBulletType(){{
|
||||
damage = 110f;
|
||||
damage = 115f;
|
||||
sideAngle = 20f;
|
||||
sideWidth = 1.5f;
|
||||
sideLength = 80f;
|
||||
@@ -1338,7 +1351,7 @@ public class UnitTypes implements ContentList{
|
||||
quad = new UnitType("quad"){{
|
||||
armor = 8f;
|
||||
health = 6000;
|
||||
speed = 1.3f;
|
||||
speed = 1.2f;
|
||||
rotateSpeed = 2f;
|
||||
accel = 0.05f;
|
||||
drag = 0.017f;
|
||||
@@ -1447,7 +1460,7 @@ public class UnitTypes implements ContentList{
|
||||
armor = 2f;
|
||||
|
||||
weapons.add(new Weapon("mount-weapon"){{
|
||||
reload = 12f;
|
||||
reload = 13f;
|
||||
x = 4f;
|
||||
shootY = 4f;
|
||||
y = 1.5f;
|
||||
@@ -1458,7 +1471,7 @@ public class UnitTypes implements ContentList{
|
||||
|
||||
weapons.add(new Weapon("missiles-mount"){{
|
||||
mirror = false;
|
||||
reload = 23f;
|
||||
reload = 25f;
|
||||
x = 0f;
|
||||
y = -5f;
|
||||
rotate = true;
|
||||
@@ -1570,15 +1583,14 @@ public class UnitTypes implements ContentList{
|
||||
ejectEffect = Fx.casing3;
|
||||
shootSound = Sounds.artillery;
|
||||
|
||||
bullet = new ArtilleryBulletType(3.2f, 12){{
|
||||
bullet = new ArtilleryBulletType(3.2f, 15){{
|
||||
trailMult = 0.8f;
|
||||
hitEffect = Fx.massiveExplosion;
|
||||
knockback = 1.5f;
|
||||
lifetime = 80f;
|
||||
lifetime = 84f;
|
||||
height = 15.5f;
|
||||
width = 15f;
|
||||
collidesTiles = false;
|
||||
ammoMultiplier = 4f;
|
||||
splashDamageRadius = 40f;
|
||||
splashDamage = 70f;
|
||||
backColor = Pal.missileYellowBack;
|
||||
|
||||
@@ -164,14 +164,14 @@ public class NetClient implements ApplicationListener{
|
||||
public static void sound(Sound sound, float volume, float pitch, float pan){
|
||||
if(sound == null) return;
|
||||
|
||||
sound.play(volume * Core.settings.getInt("sfxvol") / 100f, pitch, pan);
|
||||
sound.play(Mathf.clamp(volume, 0, 4f) * Core.settings.getInt("sfxvol") / 100f, pitch, pan);
|
||||
}
|
||||
|
||||
@Remote(variants = Variant.both, unreliable = true)
|
||||
public static void soundAt(Sound sound, float x, float y, float volume, float pitch){
|
||||
if(sound == null) return;
|
||||
|
||||
sound.at(x, y, pitch, volume);
|
||||
sound.at(x, y, pitch, Mathf.clamp(volume, 0, 4f));
|
||||
}
|
||||
|
||||
@Remote(variants = Variant.both, unreliable = true)
|
||||
|
||||
@@ -896,7 +896,7 @@ public class NetServer implements ApplicationListener{
|
||||
}
|
||||
|
||||
String fixName(String name){
|
||||
name = name.trim();
|
||||
name = name.trim().replace("\n", "").replace("\t", "");
|
||||
if(name.equals("[") || name.equals("]")){
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mindustry.editor;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.math.*;
|
||||
import arc.scene.event.*;
|
||||
import arc.scene.ui.*;
|
||||
@@ -14,6 +15,7 @@ import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.io.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.ui.dialogs.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
@@ -22,6 +24,7 @@ import static mindustry.game.SpawnGroup.*;
|
||||
public class WaveInfoDialog extends BaseDialog{
|
||||
private int displayed = 20;
|
||||
Seq<SpawnGroup> groups = new Seq<>();
|
||||
private SpawnGroup expandedGroup;
|
||||
|
||||
private Table table;
|
||||
private int start = 0;
|
||||
@@ -67,6 +70,12 @@ public class WaveInfoDialog extends BaseDialog{
|
||||
buildGroups();
|
||||
dialog.hide();
|
||||
}));
|
||||
dialog.cont.row();
|
||||
dialog.cont.button("@clear", () -> ui.showConfirm("@confirm", "@settings.clear.confirm", () -> {
|
||||
groups.clear();
|
||||
buildGroups();
|
||||
dialog.hide();
|
||||
}));
|
||||
dialog.show();
|
||||
}).size(270f, 64f);
|
||||
|
||||
@@ -132,7 +141,10 @@ public class WaveInfoDialog extends BaseDialog{
|
||||
main.row();
|
||||
main.button("@add", () -> {
|
||||
if(groups == null) groups = new Seq<>();
|
||||
groups.add(new SpawnGroup(lastType));
|
||||
SpawnGroup newGroup = new SpawnGroup(lastType);
|
||||
groups.add(newGroup);
|
||||
expandedGroup = newGroup;
|
||||
showUpdate(newGroup);
|
||||
buildGroups();
|
||||
}).growX().height(70f);
|
||||
}), new Label("@waves.none"){{
|
||||
@@ -153,6 +165,7 @@ public class WaveInfoDialog extends BaseDialog{
|
||||
table.margin(10f);
|
||||
|
||||
if(groups != null){
|
||||
groups.sort(g -> g.begin);
|
||||
|
||||
for(SpawnGroup group : groups){
|
||||
table.table(Tex.button, t -> {
|
||||
@@ -164,92 +177,100 @@ public class WaveInfoDialog extends BaseDialog{
|
||||
|
||||
b.add().growX();
|
||||
|
||||
b.button(Icon.cancel, () -> {
|
||||
b.label(() -> (group.begin + 1) + "").color(Color.lightGray).minWidth(45f).labelAlign(Align.left).left();
|
||||
|
||||
b.button(Icon.unitsSmall, Styles.emptyi, () -> showUpdate(group)).pad(-6).size(46f);
|
||||
b.button(Icon.cancel, Styles.emptyi, () -> {
|
||||
groups.remove(group);
|
||||
table.getCell(t).pad(0f);
|
||||
t.remove();
|
||||
updateWaves();
|
||||
}).pad(-6).size(46f).padRight(-12f);
|
||||
}, () -> showUpdate(group)).height(46f).pad(-6f).padBottom(0f).row();
|
||||
}, () -> {
|
||||
expandedGroup = expandedGroup == group ? null : group;
|
||||
buildGroups();
|
||||
}).height(46f).pad(-6f).padBottom(0f).row();
|
||||
|
||||
t.table(spawns -> {
|
||||
spawns.field("" + (group.begin + 1), TextFieldFilter.digitsOnly, text -> {
|
||||
if(Strings.canParsePositiveInt(text)){
|
||||
group.begin = Strings.parseInt(text) - 1;
|
||||
updateWaves();
|
||||
}
|
||||
}).width(100f);
|
||||
spawns.add("@waves.to").padLeft(4).padRight(4);
|
||||
spawns.field(group.end == never ? "" : (group.end + 1) + "", TextFieldFilter.digitsOnly, text -> {
|
||||
if(Strings.canParsePositiveInt(text)){
|
||||
group.end = Strings.parseInt(text) - 1;
|
||||
updateWaves();
|
||||
}else if(text.isEmpty()){
|
||||
group.end = never;
|
||||
updateWaves();
|
||||
}
|
||||
}).width(100f).get().setMessageText("∞");
|
||||
}).row();
|
||||
if(expandedGroup == group){
|
||||
t.table(spawns -> {
|
||||
spawns.field("" + (group.begin + 1), TextFieldFilter.digitsOnly, text -> {
|
||||
if(Strings.canParsePositiveInt(text)){
|
||||
group.begin = Strings.parseInt(text) - 1;
|
||||
updateWaves();
|
||||
}
|
||||
}).width(100f);
|
||||
spawns.add("@waves.to").padLeft(4).padRight(4);
|
||||
spawns.field(group.end == never ? "" : (group.end + 1) + "", TextFieldFilter.digitsOnly, text -> {
|
||||
if(Strings.canParsePositiveInt(text)){
|
||||
group.end = Strings.parseInt(text) - 1;
|
||||
updateWaves();
|
||||
}else if(text.isEmpty()){
|
||||
group.end = never;
|
||||
updateWaves();
|
||||
}
|
||||
}).width(100f).get().setMessageText("∞");
|
||||
}).row();
|
||||
|
||||
t.table(p -> {
|
||||
p.add("@waves.every").padRight(4);
|
||||
p.field(group.spacing + "", TextFieldFilter.digitsOnly, text -> {
|
||||
if(Strings.canParsePositiveInt(text) && Strings.parseInt(text) > 0){
|
||||
group.spacing = Strings.parseInt(text);
|
||||
updateWaves();
|
||||
}
|
||||
}).width(100f);
|
||||
p.add("@waves.waves").padLeft(4);
|
||||
}).row();
|
||||
t.table(p -> {
|
||||
p.add("@waves.every").padRight(4);
|
||||
p.field(group.spacing + "", TextFieldFilter.digitsOnly, text -> {
|
||||
if(Strings.canParsePositiveInt(text) && Strings.parseInt(text) > 0){
|
||||
group.spacing = Strings.parseInt(text);
|
||||
updateWaves();
|
||||
}
|
||||
}).width(100f);
|
||||
p.add("@waves.waves").padLeft(4);
|
||||
}).row();
|
||||
|
||||
t.table(a -> {
|
||||
a.field(group.unitAmount + "", TextFieldFilter.digitsOnly, text -> {
|
||||
if(Strings.canParsePositiveInt(text)){
|
||||
group.unitAmount = Strings.parseInt(text);
|
||||
updateWaves();
|
||||
}
|
||||
}).width(80f);
|
||||
t.table(a -> {
|
||||
a.field(group.unitAmount + "", TextFieldFilter.digitsOnly, text -> {
|
||||
if(Strings.canParsePositiveInt(text)){
|
||||
group.unitAmount = Strings.parseInt(text);
|
||||
updateWaves();
|
||||
}
|
||||
}).width(80f);
|
||||
|
||||
a.add(" + ");
|
||||
a.field(Strings.fixed(Math.max((Mathf.zero(group.unitScaling) ? 0 : 1f / group.unitScaling), 0), 2), TextFieldFilter.floatsOnly, text -> {
|
||||
if(Strings.canParsePositiveFloat(text)){
|
||||
group.unitScaling = 1f / Strings.parseFloat(text);
|
||||
updateWaves();
|
||||
}
|
||||
}).width(80f);
|
||||
a.add("@waves.perspawn").padLeft(4);
|
||||
}).row();
|
||||
a.add(" + ");
|
||||
a.field(Strings.fixed(Math.max((Mathf.zero(group.unitScaling) ? 0 : 1f / group.unitScaling), 0), 2), TextFieldFilter.floatsOnly, text -> {
|
||||
if(Strings.canParsePositiveFloat(text)){
|
||||
group.unitScaling = 1f / Strings.parseFloat(text);
|
||||
updateWaves();
|
||||
}
|
||||
}).width(80f);
|
||||
a.add("@waves.perspawn").padLeft(4);
|
||||
}).row();
|
||||
|
||||
t.table(a -> {
|
||||
a.field(group.max + "", TextFieldFilter.digitsOnly, text -> {
|
||||
if(Strings.canParsePositiveInt(text)){
|
||||
group.max = Strings.parseInt(text);
|
||||
updateWaves();
|
||||
}
|
||||
}).width(80f);
|
||||
t.table(a -> {
|
||||
a.field(group.max + "", TextFieldFilter.digitsOnly, text -> {
|
||||
if(Strings.canParsePositiveInt(text)){
|
||||
group.max = Strings.parseInt(text);
|
||||
updateWaves();
|
||||
}
|
||||
}).width(80f);
|
||||
|
||||
a.add("@waves.max").padLeft(5);
|
||||
}).row();
|
||||
a.add("@waves.max").padLeft(5);
|
||||
}).row();
|
||||
|
||||
t.table(a -> {
|
||||
a.field((int)group.shields + "", TextFieldFilter.digitsOnly, text -> {
|
||||
if(Strings.canParsePositiveInt(text)){
|
||||
group.shields = Strings.parseInt(text);
|
||||
updateWaves();
|
||||
}
|
||||
}).width(80f);
|
||||
t.table(a -> {
|
||||
a.field((int)group.shields + "", TextFieldFilter.digitsOnly, text -> {
|
||||
if(Strings.canParsePositiveInt(text)){
|
||||
group.shields = Strings.parseInt(text);
|
||||
updateWaves();
|
||||
}
|
||||
}).width(80f);
|
||||
|
||||
a.add(" + ");
|
||||
a.field((int)group.shieldScaling + "", TextFieldFilter.digitsOnly, text -> {
|
||||
if(Strings.canParsePositiveInt(text)){
|
||||
group.shieldScaling = Strings.parseInt(text);
|
||||
updateWaves();
|
||||
}
|
||||
}).width(80f);
|
||||
a.add("@waves.shields").padLeft(4);
|
||||
}).row();
|
||||
a.add(" + ");
|
||||
a.field((int)group.shieldScaling + "", TextFieldFilter.digitsOnly, text -> {
|
||||
if(Strings.canParsePositiveInt(text)){
|
||||
group.shieldScaling = Strings.parseInt(text);
|
||||
updateWaves();
|
||||
}
|
||||
}).width(80f);
|
||||
a.add("@waves.shields").padLeft(4);
|
||||
}).row();
|
||||
|
||||
t.check("@waves.guardian", b -> group.effect = (b ? StatusEffects.boss : null)).padTop(4).update(b -> b.setChecked(group.effect == StatusEffects.boss)).padBottom(8f);
|
||||
t.check("@waves.guardian", b -> group.effect = (b ? StatusEffects.boss : null)).padTop(4).update(b -> b.setChecked(group.effect == StatusEffects.boss)).padBottom(8f);
|
||||
}
|
||||
}).width(340f).pad(8);
|
||||
|
||||
table.row();
|
||||
@@ -281,6 +302,7 @@ public class WaveInfoDialog extends BaseDialog{
|
||||
if(++i % 3 == 0) p.row();
|
||||
}
|
||||
});
|
||||
dialog.addCloseButton();
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ public class Damage{
|
||||
public static void dynamicExplosion(float x, float y, float flammability, float explosiveness, float power, float radius, boolean damage, boolean fire, @Nullable Team ignoreTeam, Effect explosionFx){
|
||||
if(damage){
|
||||
for(int i = 0; i < Mathf.clamp(power / 700, 0, 8); i++){
|
||||
int length = 5 + Mathf.clamp((int)(power / 500), 1, 20);
|
||||
Time.run(i * 0.8f + Mathf.random(4f), () -> Lightning.create(Team.derelict, Pal.power, 3, x, y, Mathf.random(360f), length + Mathf.range(2)));
|
||||
int length = 5 + Mathf.clamp((int)(Mathf.pow(power, 0.98f) / 500), 1, 18);
|
||||
Time.run(i * 0.8f + Mathf.random(4f), () -> Lightning.create(Team.derelict, Pal.power, 3 + Mathf.pow(power, 0.35f), x, y, Mathf.random(360f), length + Mathf.range(2)));
|
||||
}
|
||||
|
||||
if(fire){
|
||||
|
||||
@@ -4,14 +4,19 @@ import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.util.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.graphics.*;
|
||||
|
||||
/** The most essential effect class. Can create particles in various shapes. */
|
||||
public class ParticleEffect extends Effect{
|
||||
private static final Rand rand = new Rand();
|
||||
private static final Vec2 rv = new Vec2();
|
||||
|
||||
public Color colorFrom = Color.white.cpy(), colorTo = Color.white.cpy();
|
||||
public int particles = 6;
|
||||
public boolean randLength = true;
|
||||
public float cone = 180f, length = 20f, baseLength = 0f;
|
||||
/** Particle size/length/radius interpolation. */
|
||||
public Interp interp = Interp.linear;
|
||||
@@ -57,15 +62,25 @@ public class ParticleEffect extends Effect{
|
||||
Lines.stroke(interp.apply(strokeFrom, strokeTo, rawfin));
|
||||
float len = interp.apply(lenFrom, lenTo, rawfin);
|
||||
|
||||
Angles.randLenVectors(e.id, particles, length * fin + baseLength, e.rotation, cone, (x, y) -> {
|
||||
rand.setSeed(e.id);
|
||||
for(int i = 0; i < particles; i++){
|
||||
float l = length * fin + baseLength;
|
||||
rv.trns(e.rotation + rand.range(cone), !randLength ? l : rand.random(l));
|
||||
float x = rv.x, y = rv.y;
|
||||
|
||||
Lines.lineAngle(ox + x, oy + y, Mathf.angle(x, y), len);
|
||||
Drawf.light(ox + x, oy + y, len * lightScl, lightColor, lightOpacity* Draw.getColor().a);
|
||||
});
|
||||
Drawf.light(ox + x, oy + y, len * lightScl, lightColor, lightOpacity * Draw.getColor().a);
|
||||
}
|
||||
}else{
|
||||
Angles.randLenVectors(e.id, particles, length * fin + baseLength, e.rotation, cone, (x, y) -> {
|
||||
rand.setSeed(e.id);
|
||||
for(int i = 0; i < particles; i++){
|
||||
float l = length * fin + baseLength;
|
||||
rv.trns(e.rotation + rand.range(cone), !randLength ? l : rand.random(l));
|
||||
float x = rv.x, y = rv.y;
|
||||
|
||||
Draw.rect(tex, ox + x, oy + y, rad, rad, e.rotation + offset + e.time * spin);
|
||||
Drawf.light(ox + x, oy + y, rad * lightScl, lightColor, lightOpacity * Draw.getColor().a);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package mindustry.ui.dialogs;
|
||||
|
||||
import arc.*;
|
||||
import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
@@ -58,7 +60,6 @@ public class ContentInfoDialog extends BaseDialog{
|
||||
|
||||
if(map.size == 0) continue;
|
||||
|
||||
//TODO check
|
||||
if(stats.useCategories){
|
||||
table.add("@category." + cat.name()).color(Pal.accent).fillX();
|
||||
table.row();
|
||||
@@ -80,7 +81,7 @@ public class ContentInfoDialog extends BaseDialog{
|
||||
}
|
||||
|
||||
if(content.details != null){
|
||||
table.add("[gray]" + content.details).pad(6).padTop(20).width(400f).wrap().fillX();
|
||||
table.add("[gray]" + (content.unlocked() ? content.details : Iconc.lock + " " + Core.bundle.get("unlock.incampaign"))).pad(6).padTop(20).width(400f).wrap().fillX();
|
||||
table.row();
|
||||
}
|
||||
|
||||
|
||||
@@ -176,7 +176,8 @@ public class ChatFragment extends Table{
|
||||
String message = chatfield.getText().trim();
|
||||
clearChatInput();
|
||||
|
||||
if(message.isEmpty()) return;
|
||||
//avoid sending prefix-empty messages
|
||||
if(message.isEmpty() || (message.startsWith(mode.prefix) && message.substring(mode.prefix.length()).isEmpty())) return;
|
||||
|
||||
history.insert(1, message);
|
||||
|
||||
|
||||
@@ -163,12 +163,14 @@ public class MenuFragment extends Fragment{
|
||||
new Buttoni("@customgame", Icon.terrain, () -> checkPlay(ui.custom::show)),
|
||||
new Buttoni("@loadgame", Icon.download, () -> checkPlay(ui.load::show))
|
||||
),
|
||||
new Buttoni("@database.button", Icon.menu,
|
||||
new Buttoni("@schematics", Icon.paste, ui.schematics::show),
|
||||
new Buttoni("@database", Icon.book, ui.database::show),
|
||||
new Buttoni("@about.button", Icon.info, ui.about::show)
|
||||
),
|
||||
new Buttoni("@editor", Icon.terrain, () -> checkPlay(ui.maps::show)), steam ? new Buttoni("@workshop", Icon.steam, platform::openWorkshop) : null,
|
||||
new Buttoni("@mods", Icon.book, ui.mods::show),
|
||||
//not enough space for this button
|
||||
//new Buttoni("@schematics", Icon.paste, ui.schematics::show),
|
||||
new Buttoni("@settings", Icon.settings, ui.settings::show),
|
||||
new Buttoni("@about.button", Icon.info, ui.about::show),
|
||||
new Buttoni("@quit", Icon.exit, Core.app::exit)
|
||||
);
|
||||
|
||||
|
||||
@@ -192,8 +192,10 @@ public class PlacementFragment extends Fragment{
|
||||
}
|
||||
|
||||
if(Core.input.keyTap(Binding.block_info)){
|
||||
Block displayBlock = menuHoverBlock != null ? menuHoverBlock : input.block;
|
||||
if(displayBlock != null){
|
||||
var build = world.buildWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
|
||||
Block hovering = build == null ? null : build instanceof ConstructBuild c ? c.current : build.block;
|
||||
Block displayBlock = menuHoverBlock != null ? menuHoverBlock : input.block != null ? input.block : hovering;
|
||||
if(displayBlock != null && displayBlock.unlockedNow()){
|
||||
ui.content.show(displayBlock);
|
||||
Events.fire(new BlockInfoEvent());
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ public class Block extends UnlockableContent{
|
||||
stats.add(Stat.health, health, StatUnit.none);
|
||||
}
|
||||
|
||||
if(canBeBuilt()){
|
||||
if(canBeBuilt() && requirements.length > 0){
|
||||
stats.add(Stat.buildTime, buildCost / 60, StatUnit.seconds);
|
||||
stats.add(Stat.buildCost, StatValues.items(false, requirements));
|
||||
}
|
||||
|
||||
@@ -63,20 +63,20 @@ public class OverdriveProjector extends Block{
|
||||
stats.timePeriod = useTime;
|
||||
super.setStats();
|
||||
|
||||
stats.add(Stat.speedIncrease, (int)(100f * speedBoost), StatUnit.percent);
|
||||
stats.add(Stat.speedIncrease, "+" + (int)(speedBoost * 100f - 100) + "%");
|
||||
stats.add(Stat.range, range / tilesize, StatUnit.blocks);
|
||||
stats.add(Stat.productionTime, useTime / 60f, StatUnit.seconds);
|
||||
|
||||
if(hasBoost){
|
||||
stats.add(Stat.boostEffect, phaseRangeBoost / tilesize, StatUnit.blocks);
|
||||
stats.add(Stat.boostEffect, (int)((speedBoost + speedBoostPhase) * 100f), StatUnit.percent);
|
||||
stats.add(Stat.boostEffect, (range + phaseRangeBoost) / tilesize, StatUnit.blocks);
|
||||
stats.add(Stat.boostEffect, "+" + (int)((speedBoost + speedBoostPhase) * 100f - 100) + "%");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
bars.add("boost", (OverdriveBuild entity) -> new Bar(() -> Core.bundle.format("bar.boost", (int)(entity.realBoost() * 100)), () -> Pal.accent, () -> entity.realBoost() / (hasBoost ? speedBoost + speedBoostPhase : speedBoost)));
|
||||
bars.add("boost", (OverdriveBuild entity) -> new Bar(() -> Core.bundle.format("bar.boost", Math.max((int)(entity.realBoost() * 100 - 100), 0)), () -> Pal.accent, () -> entity.realBoost() / (hasBoost ? speedBoost + speedBoostPhase : speedBoost)));
|
||||
}
|
||||
|
||||
public class OverdriveBuild extends Building implements Ranged{
|
||||
|
||||
@@ -1,19 +1,12 @@
|
||||
package mindustry.world.blocks.production;
|
||||
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
public class Fracker extends SolidPump{
|
||||
public float itemUseTime = 100f;
|
||||
|
||||
public @Load("@-liquid") TextureRegion liquidRegion;
|
||||
public @Load("@-rotator") TextureRegion rotatorRegion;
|
||||
public @Load("@-top") TextureRegion topRegion;
|
||||
|
||||
public Fracker(String name){
|
||||
super(name);
|
||||
hasItems = true;
|
||||
@@ -30,33 +23,9 @@ public class Fracker extends SolidPump{
|
||||
stats.add(Stat.productionTime, itemUseTime / 60f, StatUnit.seconds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean outputsItems(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] icons(){
|
||||
return new TextureRegion[]{region, rotatorRegion, topRegion};
|
||||
}
|
||||
|
||||
public class FrackerBuild extends SolidPumpBuild{
|
||||
public float accumulator;
|
||||
|
||||
@Override
|
||||
public void drawCracks(){}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
Draw.rect(region, x, y);
|
||||
super.drawCracks();
|
||||
|
||||
Drawf.liquid(liquidRegion, x, y, liquids.get(result) / liquidCapacity, result.color);
|
||||
|
||||
Drawf.spinSprite(rotatorRegion, x, y, pumpTime);
|
||||
Draw.rect(topRegion, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
if(consValid()){
|
||||
@@ -73,10 +42,5 @@ public class Fracker extends SolidPump{
|
||||
dumpLiquid(result);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float typeLiquid(){
|
||||
return liquids.get(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,11 @@ public class SolidPump extends Pump{
|
||||
return sum > 0.00001f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean outputsItems(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canPump(Tile tile){
|
||||
return tile != null && !tile.floor().isLiquid;
|
||||
@@ -87,10 +92,16 @@ public class SolidPump extends Pump{
|
||||
public float validTiles;
|
||||
public float lastPump;
|
||||
|
||||
|
||||
@Override
|
||||
public void drawCracks(){}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
Draw.rect(region, x, y);
|
||||
Drawf.liquid(liquidRegion, x, y, liquids.total() / liquidCapacity, liquids.current().color);
|
||||
super.drawCracks();
|
||||
|
||||
Drawf.liquid(liquidRegion, x, y, liquids.get(result) / liquidCapacity, result.color);
|
||||
Drawf.spinSprite(rotatorRegion, x, y, pumpTime * rotateSpeed);
|
||||
Draw.rect(topRegion, x, y);
|
||||
}
|
||||
@@ -135,7 +146,7 @@ public class SolidPump extends Pump{
|
||||
}
|
||||
|
||||
public float typeLiquid(){
|
||||
return liquids.total();
|
||||
return liquids.get(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user