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

@@ -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);