Merge remote-tracking branch 'upstream/master' into unit-stats

This commit is contained in:
Leonwang4234
2020-11-11 16:49:29 -08:00
197 changed files with 911 additions and 592 deletions

View File

@@ -102,7 +102,7 @@ public class MusicControl{
}
/** Plays a random track.*/
protected void playRandom(){
public void playRandom(){
if(isDark()){
playOnce(darkMusic.random(lastRandomPlayed));
}else{

View File

@@ -1246,7 +1246,7 @@ public class Blocks implements ContentList{
powerProduction = 130f;
itemDuration = 140f;
ambientSound = Sounds.pulse;
ambientSoundVolume = 0.2f;
ambientSoundVolume = 0.07f;
consumes.power(25f);
consumes.item(Items.blastCompound);

View File

@@ -10,7 +10,7 @@ public class SectorPresets implements ContentList{
groundZero,
craters, frozenForest, ruinousShores, stainedMountains, tarFields, fungalPass,
saltFlats, overgrowth,
desolateRift, nuclearComplex;
impact0078, desolateRift, nuclearComplex;
@Override
public void load(){
@@ -55,17 +55,22 @@ public class SectorPresets implements ContentList{
}};
tarFields = new SectorPreset("tarFields", serpulo, 23){{
captureWave = 50;
captureWave = 40;
difficulty = 5;
}};
impact0078 = new SectorPreset("impact0078", serpulo, 227){{
captureWave = 45;
difficulty = 7;
}};
desolateRift = new SectorPreset("desolateRift", serpulo, 123){{
captureWave = 40;
captureWave = 30;
difficulty = 8;
}};
nuclearComplex = new SectorPreset("nuclearComplex", serpulo, 130){{
captureWave = 60;
captureWave = 50;
difficulty = 7;
}};
}

View File

@@ -151,7 +151,7 @@ public class StatusEffects implements ContentList{
boss = new StatusEffect("boss"){{
color = Pal.health;
permanent = true;
damageMultiplier = 1.5f;
damageMultiplier = 1.3f;
healthMultiplier = 1.5f;
}};

View File

@@ -479,19 +479,25 @@ public class TechTree implements ContentList{
new Research(kiln),
new Research(mechanicalPump)
), () -> {
node(tarFields, Seq.with(
new SectorComplete(ruinousShores),
new Research(coalCentrifuge),
new Research(conduit),
new Research(wave)
), () -> {
node(desolateRift, Seq.with(
//TODO change positions?
node(impact0078, Seq.with(
new SectorComplete(tarFields),
new Research(thermalGenerator),
new Research(thoriumReactor)
new Research(Items.thorium),
new Research(overdriveProjector)
), () -> {
node(desolateRift, Seq.with(
new SectorComplete(impact0078),
new Research(thermalGenerator),
new Research(thoriumReactor)
), () -> {
});
});
});

View File

@@ -12,7 +12,6 @@ import arc.util.*;
import mindustry.audio.*;
import mindustry.content.*;
import mindustry.core.GameState.*;
import mindustry.ctype.*;
import mindustry.entities.*;
import mindustry.game.EventType.*;
import mindustry.game.*;
@@ -406,6 +405,10 @@ public class Control implements ApplicationListener, Loadable{
}
}
for(Music music : assets.getAll(Music.class, new Seq<>())){
music.stop();
}
content.dispose();
net.dispose();
Musics.dispose();

View File

@@ -8,7 +8,7 @@ import arc.util.*;
import mindustry.ui.dialogs.*;
public class MapResizeDialog extends BaseDialog{
private static final int minSize = 50, maxSize = 500, increment = 50;
public static int minSize = 50, maxSize = 500, increment = 50;
int width, height;
public MapResizeDialog(MapEditor editor, Intc2 cons){

View File

@@ -34,9 +34,7 @@ abstract class FireComp implements Timedc, Posc, Firec, Syncc{
Fx.fireSmoke.at(x + Mathf.range(4f), y + Mathf.range(4f));
}
if(Mathf.chance(0.001 * Time.delta)){
Sounds.fire.at(this);
}
loops.play(Sounds.fire, this, 0.07f);
time = Mathf.clamp(time + Time.delta, 0, lifetime());

View File

@@ -69,8 +69,9 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
}
public float speed(){
float strafePenalty = isGrounded() || !isPlayer() ? 1f : Mathf.lerp(1f, type.strafePenalty, Angles.angleDist(vel().angle(), rotation) / 180f);
//limit speed to minimum formation speed to preserve formation
return isCommanding() ? minFormationSpeed * 0.98f : type.speed;
return (isCommanding() ? minFormationSpeed * 0.98f : type.speed) * strafePenalty;
}
/** @return speed with boost multipliers factored in. */

View File

@@ -334,6 +334,9 @@ public class Saves{
}
public void delete(){
if(SaveIO.backupFileFor(file).exists()){
SaveIO.backupFileFor(file).delete();
}
file.delete();
saves.remove(this, true);
if(this == current){

View File

@@ -133,6 +133,7 @@ public class Schematics implements Loadable{
try{
write(newSchematic, target.file);
}catch(Exception e){
Log.err("Failed to overwrite schematic '@' (@)", newSchematic.name(), target.file);
Log.err(e);
ui.showException(e);
}
@@ -153,6 +154,7 @@ public class Schematics implements Loadable{
return s;
}catch(Throwable e){
Log.err("Failed to read schematic from file '@'", file);
Log.err(e);
}
return null;
@@ -188,6 +190,7 @@ public class Schematics implements Loadable{
try{
return getBuffer(schematic).getTexture();
}catch(Throwable t){
Log.err("Failed to get preview for schematic '@' (@)", schematic.name(), schematic.file);
Log.err(t);
errored.add(schematic);
return errorTexture;

View File

@@ -150,8 +150,11 @@ public class Universe{
//increment seconds passed for this sector by the time that just passed with this turn
if(!sector.isBeingPlayed()){
//increment time
sector.info.secondsPassed += turnDuration/60f;
//increment time if attacked
if(sector.isAttacked()){
sector.info.secondsPassed += turnDuration/60f;
}
int wavesPassed = (int)(sector.info.secondsPassed*60f / sector.info.waveSpacing);
boolean attacked = sector.info.waves;
@@ -206,7 +209,7 @@ public class Universe{
if(!sector.isAttacked() && turn > invasionGracePeriod){
//invasion chance depends on # of nearby bases
if(Mathf.chance(baseInvasionChance * sector.near().count(Sector::hasEnemyBase))){
int waveMax = Math.max(sector.info.winWave, state.wave) + Mathf.random(2, 5) * 5;
int waveMax = Math.max(sector.info.winWave, sector.isBeingPlayed() ? state.wave : sector.info.wave + sector.info.wavesPassed) + Mathf.random(2, 5) * 5;
//assign invasion-related things
if(sector.isBeingPlayed()){

View File

@@ -316,7 +316,7 @@ public class Waves{
}});
i += next + 1;
if(curTier < 3 || rand.chance(0.05)){
if(curTier < 3 || (rand.chance(0.05) && difficulty > 0.8)){
curTier ++;
}

View File

@@ -51,7 +51,7 @@ public class Drawf{
}
private static boolean allowLight(Team team){
return team == Team.derelict || team == Vars.player.team() || state.rules.enemyLights;
return renderer != null && (team == Team.derelict || team == Vars.player.team() || state.rules.enemyLights);
}
public static void selected(Building tile, Color color){

View File

@@ -98,5 +98,11 @@ public class Pal{
plasticSmoke = Color.valueOf("f1e479"),
adminChat = Color.valueOf("ff4000");
adminChat = Color.valueOf("ff4000"),
logicBlocks = Color.valueOf("d4816b"),
logicControl = Color.valueOf("6bb2b2"),
logicOperations = Color.valueOf("877bad"),
logicIo = Color.valueOf("a08a8a"),
logicUnits = Color.valueOf("c7b59d");
}

View File

@@ -99,7 +99,7 @@ public class PlanetRenderer implements Disposable{
Gl.enable(Gl.blend);
irenderer.renderProjections();
irenderer.renderProjections(planet);
Gl.disable(Gl.cullFace);
Gl.disable(Gl.depthTest);
@@ -177,17 +177,23 @@ public class PlanetRenderer implements Disposable{
}
public void drawArc(Planet planet, Vec3 a, Vec3 b){
drawArc(planet, a, b, Pal.accent, Color.clear, 1f);
}
public void drawArc(Planet planet, Vec3 a, Vec3 b, Color from, Color to, float length){
drawArc(planet, a, b, from, to, length, 80f, 25);
}
public void drawArc(Planet planet, Vec3 a, Vec3 b, Color from, Color to, float length, float timeScale, int pointCount){
Vec3 avg = Tmp.v31.set(b).add(a).scl(0.5f);
avg.setLength(planet.radius*2f);
avg.setLength(planet.radius*(1f+length));
points.clear();
points.addAll(Tmp.v33.set(b).setLength(outlineRad), Tmp.v31, Tmp.v34.set(a).setLength(outlineRad));
Tmp.bz3.set(points);
float points = 25;
for(int i = 0; i < points + 1; i++){
float f = i / points;
Tmp.c1.set(Pal.accent).lerp(Color.clear, (f+Time.globalTime()/80f)%1f);
for(int i = 0; i < pointCount + 1; i++){
float f = i / (float)pointCount;
Tmp.c1.set(from).lerp(to, (f+Time.globalTime()/timeScale)%1f);
batch.color(Tmp.c1);
batch.vertex(Tmp.bz3.valueAt(Tmp.v32, f));
@@ -312,6 +318,6 @@ public class PlanetRenderer implements Disposable{
public interface PlanetInterfaceRenderer{
void renderSectors(Planet planet);
void renderProjections();
void renderProjections(Planet planet);
}
}

View File

@@ -183,7 +183,7 @@ public class DesktopInput extends InputHandler{
boolean panCam = false;
float camSpeed = (!Core.input.keyDown(Binding.boost) ? panSpeed : panBoostSpeed) * Time.delta;
if(input.keyDown(Binding.pan)){
if(input.keyDown(Binding.pan) && !scene.hasField() && !scene.hasDialog()){
panCam = true;
panning = true;
}
@@ -193,7 +193,7 @@ public class DesktopInput extends InputHandler{
}
//TODO awful UI state checking code
if(((player.dead() || state.isPaused()) && !ui.chatfrag.shown()) && (!scene.hasField() && !scene.hasDialog())){
if(((player.dead() || state.isPaused()) && !ui.chatfrag.shown()) && !scene.hasField() && !scene.hasDialog()){
if(input.keyDown(Binding.mouse_move)){
panCam = true;
}
@@ -602,9 +602,7 @@ public class DesktopInput extends InputHandler{
boolean omni = unit.type.omniMovement;
boolean ground = unit.isGrounded();
float strafePenalty = ground ? 1f : Mathf.lerp(1f, unit.type.strafePenalty, Angles.angleDist(unit.vel().angle(), unit.rotation()) / 180f);
float speed = unit.realSpeed() * strafePenalty;
float speed = unit.realSpeed();
float xa = Core.input.axis(Binding.move_x);
float ya = Core.input.axis(Binding.move_y);
boolean boosted = (unit instanceof Mechc && unit.isFlying());

View File

@@ -854,9 +854,8 @@ public class MobileInput extends InputHandler implements GestureListener{
targetPos.set(Core.camera.position);
float attractDst = 15f;
float strafePenalty = legs ? 1f : Mathf.lerp(1f, type.strafePenalty, Angles.angleDist(unit.vel.angle(), unit.rotation) / 180f);
float speed = unit.realSpeed() * strafePenalty;
float speed = unit.realSpeed();
float range = unit.hasWeapons() ? unit.range() : 0f;
float bulletSpeed = unit.hasWeapons() ? type.weapons.first().bullet.speed : 0f;
float mouseAngle = unit.angleTo(unit.aimX(), unit.aimY());

View File

@@ -268,7 +268,7 @@ public class LCanvas extends Table{
st.elem = this;
background(Tex.whitePane);
setColor(st.category().color);
setColor(st.color());
margin(0f);
touchable = Touchable.enabled;

View File

@@ -1,17 +0,0 @@
package mindustry.logic;
import arc.graphics.*;
public enum LCategory{
blocks(Color.valueOf("d4816b")),
control(Color.valueOf("6bb2b2")),
operations(Color.valueOf("877bad")),
io(Color.valueOf("a08a8a")),
units(Color.valueOf("c7b59d"));
public final Color color;
LCategory(Color color){
this.color = color;
}
}

View File

@@ -2,6 +2,7 @@ package mindustry.logic;
import arc.*;
import arc.func.*;
import arc.graphics.*;
import arc.math.*;
import arc.scene.*;
import arc.scene.actions.*;
@@ -21,7 +22,7 @@ public abstract class LStatement{
public transient @Nullable StatementElem elem;
public abstract void build(Table table);
public abstract LCategory category();
public abstract Color color();
public abstract LInstruction build(LAssembler builder);
public LStatement copy(){

View File

@@ -8,6 +8,7 @@ import arc.scene.ui.layout.*;
import mindustry.*;
import mindustry.annotations.Annotations.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.logic.LCanvas.*;
import mindustry.logic.LExecutor.*;
import mindustry.type.*;
@@ -29,8 +30,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.control;
public Color color(){
return Pal.logicControl;
}
@Override
@@ -47,8 +48,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.operations;
public Color color(){
return Pal.logicOperations;
}
@Override
@@ -79,8 +80,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.io;
public Color color(){
return Pal.logicIo;
}
@Override
@@ -111,8 +112,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.io;
public Color color(){
return Pal.logicIo;
}
@Override
@@ -233,8 +234,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.io;
public Color color(){
return Pal.logicIo;
}
@Override
@@ -258,8 +259,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.io;
public Color color(){
return Pal.logicIo;
}
}
@@ -274,8 +275,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.blocks;
public Color color(){
return Pal.logicBlocks;
}
@Override
@@ -295,8 +296,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.blocks;
public Color color(){
return Pal.logicBlocks;
}
@Override
@@ -319,8 +320,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.blocks;
public Color color(){
return Pal.logicBlocks;
}
@Override
@@ -372,8 +373,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.blocks;
public Color color(){
return Pal.logicBlocks;
}
@Override
@@ -443,8 +444,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.blocks;
public Color color(){
return Pal.logicBlocks;
}
@Override
@@ -546,8 +547,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.blocks;
public Color color(){
return Pal.logicBlocks;
}
@Override
@@ -571,8 +572,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.operations;
public Color color(){
return Pal.logicOperations;
}
@Override
@@ -629,8 +630,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.operations;
public Color color(){
return Pal.logicOperations;
}
}
@@ -647,8 +648,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.control;
public Color color(){
return Pal.logicControl;
}
}
@@ -712,8 +713,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.control;
public Color color(){
return Pal.logicControl;
}
}
@@ -750,8 +751,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.units;
public Color color(){
return Pal.logicUnits;
}
@Override
@@ -803,8 +804,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.units;
public Color color(){
return Pal.logicUnits;
}
@Override
@@ -823,8 +824,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.units;
public Color color(){
return Pal.logicUnits;
}
@Override
@@ -932,8 +933,8 @@ public class LStatements{
}
@Override
public LCategory category(){
return LCategory.units;
public Color color(){
return Pal.logicUnits;
}
@Override

View File

@@ -65,7 +65,7 @@ public class LogicDialog extends BaseDialog{
if(example instanceof InvalidStatement || example.hidden()) continue;
TextButtonStyle style = new TextButtonStyle(Styles.cleart);
style.fontColor = example.category().color;
style.fontColor = example.color();
style.font = Fonts.outline;
t.button(example.name(), style, () -> {

View File

@@ -92,7 +92,7 @@ public class ContentParser{
if(Vars.headless) return new MockSound();
String name = "sounds/" + data.asString();
String path = Vars.tree.get(name + ".ogg").exists() && !Vars.ios ? name + ".ogg" : name + ".mp3";
String path = Vars.tree.get(name + ".ogg").exists() ? name + ".ogg" : name + ".mp3";
if(Core.assets.contains(path, Sound.class)) return Core.assets.get(path, Sound.class);
ModLoadingSound sound = new ModLoadingSound();

View File

@@ -2,6 +2,7 @@ package mindustry.mod;
import arc.audio.*;
import arc.mock.*;
import arc.util.*;
public class ModLoadingMusic implements Music{
public Music music = new MockMusic();
@@ -71,6 +72,11 @@ public class ModLoadingMusic implements Music{
music.setCompletionListener(listener);
}
@Override
public void setFilter(int index, @Nullable AudioFilter filter){
music.setFilter(index, filter);
}
@Override
public boolean isDisposed(){
return music.isDisposed();

View File

@@ -3,6 +3,7 @@ package mindustry.mod;
import arc.audio.*;
import arc.math.geom.*;
import arc.mock.*;
import arc.util.*;
public class ModLoadingSound implements Sound{
public Sound sound = new MockSound();
@@ -77,16 +78,6 @@ public class ModLoadingSound implements Sound{
sound.stop();
}
@Override
public void pause(){
sound.pause();
}
@Override
public void resume(){
sound.resume();
}
@Override
public void dispose(){
sound.dispose();
@@ -131,4 +122,19 @@ public class ModLoadingSound implements Sound{
public boolean isDisposed(){
return sound.isDisposed();
}
@Override
public int play(float volume, float pitch, float pan, boolean loop){
return sound.play(volume, pitch, pan, loop);
}
@Override
public void setFilter(int index, @Nullable AudioFilter filter){
sound.setFilter(index, filter);
}
@Override
public boolean isPlaying(int soundId){
return sound.isPlaying(soundId);
}
}

View File

@@ -90,7 +90,7 @@ public class Scripts implements Disposable{
if(Vars.headless) return new MockSound();
String name = "sounds/" + soundName;
String path = Vars.tree.get(name + ".ogg").exists() && !Vars.ios ? name + ".ogg" : name + ".mp3";
String path = Vars.tree.get(name + ".ogg").exists() ? name + ".ogg" : name + ".mp3";
if(Core.assets.contains(path, Sound.class)) return Core.assets.get(path, Sound.class);
ModLoadingSound sound = new ModLoadingSound();
@@ -105,7 +105,7 @@ public class Scripts implements Disposable{
if(Vars.headless) return new MockMusic();
String name = "music/" + soundName;
String path = Vars.tree.get(name + ".ogg").exists() && !Vars.ios ? name + ".ogg" : name + ".mp3";
String path = Vars.tree.get(name + ".ogg").exists() ? name + ".ogg" : name + ".mp3";
if(Core.assets.contains(path, Music.class)) return Core.assets.get(path, Music.class);
ModLoadingMusic sound = new ModLoadingMusic();

View File

@@ -45,7 +45,7 @@ public class BeControl{
}, updateInterval, updateInterval);
}
if(System.getProperties().contains("becopy")){
if(System.getProperties().containsKey("becopy")){
try{
Fi dest = Fi.get(System.getProperty("becopy"));
Fi self = Fi.get(BeControl.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());

View File

@@ -153,24 +153,21 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
public void renderSectors(Planet planet){
//draw all sector stuff
if(!debugSelect){
if(!debugSelect && selectAlpha > 0.01f){
for(Sector sec : planet.sectors){
if(canSelect(sec) || sec.unlocked()){
if(selectAlpha > 0.01f){
if(canSelect(sec) || sec.unlocked()){
Color color =
sec.hasBase() ? Tmp.c2.set(Team.sharded.color).lerp(Team.crux.color, sec.hasEnemyBase() ? 0.5f : 0f) :
sec.preset != null ? Team.derelict.color :
sec.hasEnemyBase() ? Team.crux.color :
null;
Color color =
sec.hasBase() ? Team.sharded.color :
sec.preset != null ? Team.derelict.color :
sec.hasEnemyBase() ? Team.crux.color :
null;
if(color != null){
planets.drawSelection(sec, Tmp.c1.set(color).mul(0.8f).a(selectAlpha), 0.026f, -0.001f);
}
}else{
planets.fill(sec, Tmp.c1.set(shadowColor).mul(1, 1, 1, selectAlpha), -0.001f);
if(color != null){
planets.drawSelection(sec, Tmp.c1.set(color).mul(0.8f).a(selectAlpha), 0.026f, -0.001f);
}
}else{
planets.fill(sec, Tmp.c1.set(shadowColor).mul(1, 1, 1, selectAlpha), -0.001f);
}
}
}
@@ -202,20 +199,39 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
}
}
/*
//TODO render arcs
if(selected != null && selected.preset != null){
for(Objective o : selected.preset.requirements){
if(o instanceof SectorObjective){
SectorPreset preset = ((SectorObjective)o).preset;
planets.drawArc(planet, selected.tile.v, preset.sector.tile.v);
if(selectAlpha > 0.001f){
for(Sector sec : planet.sectors){
if(sec.hasBase()){
for(Sector enemy : sec.near()){
if(enemy.hasEnemyBase()){
planets.drawArc(planet, enemy.tile.v, sec.tile.v, Team.crux.color.write(Tmp.c2).a(selectAlpha), Color.clear, 0.24f, 110f, 25);
}
}
}
}
}*/
}
}
@Override
public void renderProjections(){
public void renderProjections(Planet planet){
for(Sector sec : planet.sectors){
if(sec != hovered){
var icon = (sec.isAttacked() ? Icon.warning : !sec.hasBase() && sec.preset != null && sec.preset.unlocked() ? Icon.terrain : null);
var color = sec.preset != null && !sec.hasBase() ? Team.derelict.color : Team.sharded.color;
if(icon != null){
planets.drawPlane(sec, () -> {
Draw.color(color, selectAlpha);
Draw.rect(icon.getRegion(), 0, 0);
});
}
}
}
Draw.reset();
if(hovered != null){
planets.drawPlane(hovered, () -> {
Draw.color(hovered.isAttacked() ? Pal.remove : Color.white, Pal.accent, Mathf.absin(5f, 1f));
@@ -229,6 +245,8 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
Draw.reset();
});
}
Draw.reset();
}
void setup(){
@@ -391,6 +409,12 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
(plus ? "+" : "") + (toCapture < 0 ? "" : "/" + toCapture) + " waves");
stable.row();
}
}else if(sector.hasBase() && sector.near().contains(Sector::hasEnemyBase)){
stable.add("[scarlet]Vulnerable");
stable.row();
}else if(!sector.hasBase() && sector.hasEnemyBase()){
stable.add("[scarlet]Enemy Base");
stable.row();
}
if(sector.save != null && sector.info.resources.any()){

View File

@@ -146,6 +146,12 @@ public class SettingsMenuDialog extends SettingsDialog{
}
}
}
for(var slot : control.saves.getSaveSlots().copy()){
if(slot.isSector()){
slot.delete();
}
}
});
}).marginLeft(4);

View File

@@ -177,7 +177,7 @@ public class ItemTurret extends Turret{
totalAmmo += a;
//only add ammo if this is a valid ammo type
if(ammoTypes.containsKey(item)){
if(item != null && ammoTypes.containsKey(item)){
ammo.add(new ItemEntry(item, a));
}
}

View File

@@ -26,6 +26,7 @@ public class LiquidTurret extends Turret{
acceptCoolant = false;
hasLiquids = true;
loopSound = Sounds.spray;
shootSound = Sounds.none;
}
/** Initializes accepted ammo map. Format: [liquid1, bullet1, liquid2, bullet2...] */
@@ -75,7 +76,7 @@ public class LiquidTurret extends Turret{
@Override
public boolean shouldActiveSound(){
return target != null && hasAmmo();
return wasShooting;
}
@Override

View File

@@ -136,6 +136,7 @@ public abstract class Turret extends ReloadTurret{
public @Nullable Posc target;
public Vec2 targetPos = new Vec2();
public BlockUnitc unit = Nulls.blockUnit;
public boolean wasShooting;
@Override
public void created(){
@@ -176,11 +177,15 @@ public abstract class Turret extends ReloadTurret{
case rotation -> rotation;
case shootX -> World.conv(targetPos.x);
case shootY -> World.conv(targetPos.y);
case shooting -> (isControlled() ? unit.isShooting() : logicControlled() ? logicShooting : validateTarget()) ? 1 : 0;
case shooting -> isShooting() ? 1 : 0;
default -> super.sense(sensor);
};
}
public boolean isShooting(){
return (isControlled() ? unit.isShooting() : logicControlled() ? logicShooting : target != null);
}
@Override
public Unit unit(){
return (Unit)unit;
@@ -228,6 +233,8 @@ public abstract class Turret extends ReloadTurret{
public void updateTile(){
if(!validateTarget()) target = null;
wasShooting = false;
recoil = Mathf.lerpDelta(recoil, 0f, restitution);
heat = Mathf.lerpDelta(heat, 0f, cooldown);
@@ -269,6 +276,7 @@ public abstract class Turret extends ReloadTurret{
}
if(Angles.angleDist(rotation, targetRot) < shootCone && canShoot){
wasShooting = true;
updateShooting();
}
}

View File

@@ -42,7 +42,7 @@ public class Conveyor extends Block implements Autotiler{
conveyorPlacement = true;
ambientSound = Sounds.conveyor;
ambientSoundVolume = 0.0015f;
ambientSoundVolume = 0.0022f;
unloadable = false;
noUpdateDisabled = false;
}

View File

@@ -153,7 +153,7 @@ public class PowerNode extends PowerBlock{
float fract = 1f - satisfaction;
Draw.color(laserColor1, laserColor2, fract * 0.86f + Mathf.absin(3f, 0.1f));
Draw.alpha(renderer.laserOpacity);
Draw.alpha(renderer == null ? 0.5f : renderer.laserOpacity);
}
protected void drawLaser(Team team, float x1, float y1, float x2, float y2, int size1, int size2){
@@ -226,7 +226,7 @@ public class PowerNode extends PowerBlock{
if(otherReq == null || otherReq.block == null) return;
drawLaser(player.team(), req.drawx(), req.drawy(), otherReq.drawx(), otherReq.drawy(), size, otherReq.block.size);
drawLaser(player == null ? Team.sharded : player.team(), req.drawx(), req.drawy(), otherReq.drawx(), otherReq.drawy(), size, otherReq.block.size);
}
Draw.color();
}

View File

@@ -67,7 +67,7 @@ public class Drill extends Block{
liquidCapacity = 5f;
hasItems = true;
ambientSound = Sounds.drill;
ambientSoundVolume = 0.016f;
ambientSoundVolume = 0.015f;
}
@Override

View File

@@ -210,7 +210,7 @@ public class CoreBlock extends StorageBlock{
super.onDestroyed();
//add a spawn to the map for future reference - waves should be disabled, so it shouldn't matter
if(state.isCampaign() && team == state.rules.waveTeam){
if(state.isCampaign() && team == state.rules.waveTeam && team.cores().size <= 1){
//do not recache
tile.setOverlayQuiet(Blocks.spawn);