This commit is contained in:
Anuken
2022-08-21 20:44:12 -04:00
10 changed files with 44 additions and 8 deletions

View File

@@ -440,7 +440,7 @@ public class Damage{
/** Applies a status effect to all enemy units in a range. */
public static void status(Team team, float x, float y, float radius, StatusEffect effect, float duration, boolean air, boolean ground){
Cons<Unit> cons = entity -> {
if(entity.team == team || !entity.within(x, y, radius) || (entity.isFlying() && !air) || (entity.isGrounded() && !ground)){
if(entity.team == team || !entity.checkTarget(air, ground) || !entity.hittable() || !entity.within(x, y, radius)){
return;
}

View File

@@ -48,7 +48,7 @@ public class EmpBulletType extends BasicBulletType{
if(hitUnits){
Units.nearbyEnemies(b.team, x, y, radius, other -> {
if(other.team != b.team){
if(other.team != b.team && other.hittable()){
var absorber = Damage.findAbsorber(b.team, x, y, other.x, other.y);
if(absorber != null){
return;

View File

@@ -474,7 +474,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
drag = type.drag * (isGrounded() ? (floorOn().dragMultiplier) : 1f) * dragMultiplier * state.rules.dragMultiplier;
//apply knockback based on spawns
if(team != state.rules.waveTeam && state.hasSpawns() && (!net.client() || isLocal())){
if(team != state.rules.waveTeam && state.hasSpawns() && (!net.client() || isLocal()) && hittable()){
float relativeSize = state.rules.dropZoneRadius + hitSize/2f + 1f;
for(Tile spawn : spawner.getSpawns()){
if(within(spawn.worldx(), spawn.worldy(), relativeSize)){

View File

@@ -554,6 +554,7 @@ public class EventType{
}
}
/** Called before a player leaves the game. */
public static class PlayerLeave{
public final Player player;

View File

@@ -487,7 +487,8 @@ public class Administration{
autosaveAmount = new Config("autosaveAmount", "The maximum amount of autosaves. Older ones get replaced.", 10),
autosaveSpacing = new Config("autosaveSpacing", "Spacing between autosaves in seconds.", 60 * 5),
debug = new Config("debug", "Enable debug logging", false, () -> Log.level = debug() ? LogLevel.debug : LogLevel.info),
snapshotInterval = new Config("snapshotInterval", "Client entity snapshot interval in ms.", 200);
snapshotInterval = new Config("snapshotInterval", "Client entity snapshot interval in ms.", 200),
autoPause = new Config("autoPause", "Whether the game should pause when nobody is online.", false);
public final Object defaultValue;
public final String name, key, description;

View File

@@ -93,6 +93,8 @@ public class Weapon implements Cloneable{
public float minWarmup = 0f;
/** lerp speed for shoot warmup, only used for parts */
public float shootWarmupSpeed = 0.1f, smoothReloadSpeed = 0.15f;
/** If true, shoot warmup is linear instead of a curve. */
public boolean linearWarmup = false;
/** random sound pitch range */
public float soundPitchMin = 0.8f, soundPitchMax = 1f;
/** whether shooter rotation is ignored when shooting. */
@@ -253,9 +255,15 @@ public class Weapon implements Cloneable{
float lastReload = mount.reload;
mount.reload = Math.max(mount.reload - Time.delta * unit.reloadMultiplier, 0);
mount.recoil = Mathf.approachDelta(mount.recoil, 0, unit.reloadMultiplier / recoilTime);
mount.warmup = Mathf.lerpDelta(mount.warmup, (can && mount.shoot) || (continuous && mount.bullet != null) ? 1f : 0f, shootWarmupSpeed);
mount.smoothReload = Mathf.lerpDelta(mount.smoothReload, mount.reload / reload, smoothReloadSpeed);
mount.charge = mount.charging && shoot.firstShotDelay > 0 ? Mathf.approachDelta(mount.charge, 1, 1 / shoot.firstShotDelay) : 0;
float warmupTarget = (can && mount.shoot) || (continuous && mount.bullet != null) || mount.charging ? 1f : 0f;
if(linearWarmup){
mount.warmup = Mathf.approachDelta(mount.warmup, warmupTarget, shootWarmupSpeed);
}else{
mount.warmup = Mathf.lerpDelta(mount.warmup, warmupTarget, shootWarmupSpeed);
}
//rotate if applicable
if(rotate && (mount.rotate || mount.shoot) && can){

View File

@@ -26,6 +26,7 @@ public class PayloadAmmoTurret extends Turret{
super(name);
maxAmmo = 3;
acceptsPayload = true;
}
/** Initializes accepted ammo map. Format: [block1, bullet1, block2, bullet2...] */

View File

@@ -343,7 +343,7 @@ public class Turret extends ReloadTurret{
public void updateTile(){
if(!validateTarget()) target = null;
float warmupTarget = isShooting() && canConsume() ? 1f : 0f;
float warmupTarget = (isShooting() && canConsume()) || charging() ? 1f : 0f;
if(linearWarmup){
shootWarmup = Mathf.approachDelta(shootWarmup, warmupTarget, shootWarmupSpeed * (warmupTarget > 0 ? efficiency : 1f));
}else{