Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken
2023-03-09 05:25:41 -05:00
47 changed files with 1050 additions and 963 deletions

View File

@@ -193,7 +193,7 @@ public class Control implements ApplicationListener, Loadable{
if(!settings.getBool("skipcoreanimation") && !state.rules.pvp){
coreDelay = coreLandDuration;
//delay player respawn so animation can play.
player.deathTimer = -80f;
player.deathTimer = Player.deathDelay - coreLandDuration;
//TODO this sounds pretty bad due to conflict
if(settings.getInt("musicvol") > 0){
Musics.land.stop();

View File

@@ -93,13 +93,13 @@ public class ForceFieldAbility extends Ability{
checkRadius(unit);
if(unit.shield > 0){
Draw.z(Layer.shields);
Draw.color(unit.team.color, Color.white, Mathf.clamp(alpha));
if(Vars.renderer.animateShields){
Draw.z(Layer.shields + 0.001f * alpha);
Fill.poly(unit.x, unit.y, sides, realRad, rotation);
}else{
Draw.z(Layer.shields);
Lines.stroke(1.5f);
Draw.alpha(0.09f);
Fill.poly(unit.x, unit.y, sides, radius, rotation);

View File

@@ -177,6 +177,8 @@ public class BulletType extends Content implements Cloneable{
public float intervalSpread = 0f;
/** Angle offset for interval bullets. */
public float intervalAngle = 0f;
/** Use a negative value to disable interval bullet delay. */
public float intervalDelay = -1f;
/** Color used for hit/despawn effects. */
public Color hitColor = Color.white;
@@ -557,7 +559,7 @@ public class BulletType extends Content implements Cloneable{
}
public void updateBulletInterval(Bullet b){
if(intervalBullet != null && b.timer.get(2, bulletInterval)){
if(intervalBullet != null && b.time >= intervalDelay && b.timer.get(2, bulletInterval)){
float ang = b.rotation();
for(int i = 0; i < intervalBullets; i++){
intervalBullet.create(b, b.x, b.y, ang + Mathf.range(intervalRandomSpread) + intervalAngle + ((i - (intervalBullets - 1f)/2f) * intervalSpread));

View File

@@ -79,7 +79,11 @@ public class ContentParser{
put(Interp.class, (type, data) -> field(Interp.class, data));
put(Blending.class, (type, data) -> field(Blending.class, data));
put(CacheLayer.class, (type, data) -> field(CacheLayer.class, data));
put(Attribute.class, (type, data) -> Attribute.get(data.asString()));
put(Attribute.class, (type, data) -> {
String attr = data.asString();
if(Attribute.exists(attr)) return Attribute.get(attr);
return Attribute.add(attr);
});
put(BuildVisibility.class, (type, data) -> field(BuildVisibility.class, data));
put(Schematic.class, (type, data) -> {
Object result = fieldOpt(Loadouts.class, data);

View File

@@ -30,6 +30,8 @@ public class ForceProjector extends Block{
public float phaseRadiusBoost = 80f;
public float phaseShieldBoost = 400f;
public float radius = 101.7f;
public int sides = 6;
public float shieldRotation = 0f;
public float shieldHealth = 700f;
public float cooldownNormal = 1.75f;
public float cooldownLiquid = 1.5f;
@@ -46,7 +48,7 @@ public class ForceProjector extends Block{
protected static ForceBuild paramEntity;
protected static Effect paramEffect;
protected static final Cons<Bullet> shieldConsumer = bullet -> {
if(bullet.team != paramEntity.team && bullet.type.absorbable && Intersector.isInsideHexagon(paramEntity.x, paramEntity.y, paramEntity.realRadius() * 2f, bullet.x, bullet.y)){
if(bullet.team != paramEntity.team && bullet.type.absorbable && Intersector.isInRegularPolygon(((ForceProjector)(paramEntity.block)).sides, paramEntity.x, paramEntity.y, paramEntity.realRadius() * 2f, ((ForceProjector)(paramEntity.block)).shieldRotation, bullet.x, bullet.y)){
bullet.absorb();
paramEffect.at(bullet);
paramEntity.hit = 1f;
@@ -109,10 +111,10 @@ public class ForceProjector extends Block{
Draw.color(Pal.gray);
Lines.stroke(3f);
Lines.poly(x * tilesize + offset, y * tilesize + offset, 6, radius);
Lines.poly(x * tilesize + offset, y * tilesize + offset, sides, radius, shieldRotation);
Draw.color(player.team().color);
Lines.stroke(1f);
Lines.poly(x * tilesize + offset, y * tilesize + offset, 6, radius);
Lines.poly(x * tilesize + offset, y * tilesize + offset, sides, radius, shieldRotation);
Draw.color();
}
@@ -241,18 +243,18 @@ public class ForceProjector extends Block{
if(!broken){
float radius = realRadius();
Draw.z(Layer.shields);
Draw.color(team.color, Color.white, Mathf.clamp(hit));
if(renderer.animateShields){
Fill.poly(x, y, 6, radius);
Draw.z(Layer.shields + 0.001f * hit);
Fill.poly(x, y, sides, radius, shieldRotation);
}else{
Draw.z(Layer.shields);
Lines.stroke(1.5f);
Draw.alpha(0.09f + Mathf.clamp(0.08f * hit));
Fill.poly(x, y, 6, radius);
Fill.poly(x, y, sides, radius, shieldRotation);
Draw.alpha(1f);
Lines.poly(x, y, 6, radius);
Lines.poly(x, y, sides, radius, shieldRotation);
Draw.reset();
}
}

View File

@@ -42,6 +42,9 @@ public class BeamDrill extends Block{
/** How many times faster the drill will progress when boosted by an optional consumer. */
public float optionalBoostIntensity = 2.5f;
/** Multipliers of drill speed for each item. Defaults to 1. */
public ObjectFloatMap<Item> drillMultipliers = new ObjectFloatMap<>();
public Color sparkColor = Color.valueOf("fd9e81"), glowColor = Color.white;
public float glowIntensity = 0.2f, pulseIntensity = 0.07f;
public float glowScl = 3f;
@@ -161,7 +164,7 @@ public class BeamDrill extends Block{
}
if(item != null){
float width = drawPlaceText(Core.bundle.formatFloat("bar.drillspeed", 60f / drillTime * count, 2), x, y, valid);
float width = drawPlaceText(Core.bundle.formatFloat("bar.drillspeed", 60f / getDrillTime(item) * count, 2), x, y, valid);
if(!multiple){
float dx = x * tilesize + offset - width/2f - 4f, dy = y * tilesize + offset + size * tilesize / 2f + 5, s = iconSmall / 4f;
Draw.mixcol(Color.darkGray, 1f);
@@ -194,6 +197,10 @@ public class BeamDrill extends Block{
return false;
}
public float getDrillTime(Item item){
return drillTime / drillMultipliers.get(item, 1f);
}
public class BeamDrillBuild extends Building{
public Tile[] facing = new Tile[size];
public Point2[] lasers = new Point2[size];
@@ -227,6 +234,7 @@ public class BeamDrill extends Block{
updateFacing();
float multiplier = Mathf.lerp(1f, optionalBoostIntensity, optionalEfficiency);
float drillTime = getDrillTime(lastItem);
boostWarmup = Mathf.lerpDelta(boostWarmup, optionalEfficiency, 0.1f);
lastDrillSpeed = (facingAmount * multiplier * timeScale) / drillTime;

View File

@@ -31,9 +31,6 @@ public class BurstDrill extends Drill{
public Sound drillSound = Sounds.drillImpact;
public float drillSoundVolume = 0.6f, drillSoundPitchRand = 0.1f;
/** Multipliers of drill speed for each item. Defaults to 1. */
public ObjectFloatMap<Item> drillMultipliers = new ObjectFloatMap<>();
public BurstDrill(String name){
super(name);

View File

@@ -59,6 +59,9 @@ public class Drill extends Block{
/** Chance the update effect will appear. */
public float updateEffectChance = 0.02f;
/** Multipliers of drill speed for each item. Defaults to 1. */
public ObjectFloatMap<Item> drillMultipliers = new ObjectFloatMap<>();
public boolean drawRim = false;
public boolean drawSpinSprite = true;
public Color heatColor = Color.valueOf("ff5512");
@@ -160,7 +163,7 @@ public class Drill extends Block{
}
public float getDrillTime(Item item){
return drillTime + hardnessDrillMultiplier * item.hardness;
return (drillTime + hardnessDrillMultiplier * item.hardness) / drillMultipliers.get(item, 1f);
}
@Override

View File

@@ -395,7 +395,7 @@ public class CoreBlock extends StorageBlock{
if(renderer.getLandTime() >= 1f){
tile.getLinkedTiles(t -> {
if(Mathf.chance(0.4f)){
Fx.coreLandDust.at(t.worldx(), t.worldy(), angleTo(t) + Mathf.range(30f), Tmp.c1.set(t.floor().mapColor).mul(1.5f + Mathf.range(0.15f)));
Fx.coreLandDust.at(t.worldx(), t.worldy(), angleTo(t.worldx(), t.worldy()) + Mathf.range(30f), Tmp.c1.set(t.floor().mapColor).mul(1.5f + Mathf.range(0.15f)));
}
});

View File

@@ -47,6 +47,11 @@ public class Attribute{
return map.getThrow(name, () -> new IllegalArgumentException("Unknown Attribute type: " + name));
}
/** @return Whether an attribute exists. */
public static boolean exists(String name){
return map.containsKey(name);
}
/** Automatically registers this attribute for use. Do not call after mod init. */
public static Attribute add(String name){
Attribute a = new Attribute(all.length, name);

View File

@@ -339,7 +339,7 @@ public class StatValues{
}
table.table(bt -> {
bt.left().defaults().padRight(3).left();
bt.left().top().defaults().padRight(3).left();
if(type.damage > 0 && (type.collides || type.splashDamage <= 0)){
if(type.continuousDamage() > 0){
@@ -407,11 +407,40 @@ public class StatValues{
sep(bt, (type.status.minfo.mod == null ? type.status.emoji() : "") + "[stat]" + type.status.localizedName + (type.status.reactive ? "" : "[lightgray] ~ [stat]" + ((int)(type.statusDuration / 60f)) + "[lightgray] " + Core.bundle.get("unit.seconds")));
}
if(type.fragBullet != null){
sep(bt, Core.bundle.format("bullet.frags", type.fragBullets));
if(type.intervalBullet != null){
bt.row();
ammo(ObjectMap.of(t, type.fragBullet), indent + 1, false).display(bt);
Table ic = new Table();
ammo(ObjectMap.of(t, type.intervalBullet), indent + 1, false).display(ic);
Collapser coll = new Collapser(ic, true);
coll.setDuration(0.1f);
bt.table(it -> {
it.left().defaults().left();
it.add(Core.bundle.format("bullet.interval", Strings.autoFixed(type.intervalBullets / type.bulletInterval * 60, 2)));
it.button(Icon.downOpen, Styles.emptyi, () -> coll.toggle(false)).update(i -> i.getStyle().imageUp = (!coll.isCollapsed() ? Icon.upOpen : Icon.downOpen)).size(8).padLeft(16f).expandX();
});
bt.row();
bt.add(coll);
}
if(type.fragBullet != null){
bt.row();
Table fc = new Table();
ammo(ObjectMap.of(t, type.fragBullet), indent + 1, false).display(fc);
Collapser coll = new Collapser(fc, true);
coll.setDuration(0.1f);
bt.table(ft -> {
ft.left().defaults().left();
ft.add(Core.bundle.format("bullet.frags", type.fragBullets));
ft.button(Icon.downOpen, Styles.emptyi, () -> coll.toggle(false)).update(i -> i.getStyle().imageUp = (!coll.isCollapsed() ? Icon.upOpen : Icon.downOpen)).size(8).padLeft(16f).expandX();
});
bt.row();
bt.add(coll);
}
}).padTop(compact ? 0 : -9).padLeft(indent * 8).left().get().background(compact ? null : Tex.underline);