Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features

 Conflicts:
	core/src/mindustry/type/UnitType.java
This commit is contained in:
Anuken
2021-10-01 09:41:33 -04:00
20 changed files with 236 additions and 58 deletions

View File

@@ -30,6 +30,8 @@ public class Effect{
public float lifetime = 50f;
/** Clip size. */
public float clip;
/** Time delay before the effect starts */
public float startDelay;
/** Amount added to rotation */
public float baseRotation;
/** If true, parent unit is data are followed. */
@@ -58,6 +60,11 @@ public class Effect{
all.add(this);
}
public Effect startDelay(float d){
startDelay = d;
return this;
}
public void init(){}
public Effect followParent(boolean follow){
@@ -168,21 +175,29 @@ public class Effect{
effect.init();
}
EffectState entity = EffectState.create();
entity.effect = effect;
entity.rotation = effect.baseRotation + rotation;
entity.data = data;
entity.lifetime = effect.lifetime;
entity.set(x, y);
entity.color.set(color);
if(effect.followParent && data instanceof Posc p){
entity.parent = p;
entity.rotWithParent = effect.rotWithParent;
if(effect.startDelay <= 0f){
inst(effect, x, y, rotation, color, data);
}else{
Time.runTask(effect.startDelay, () -> inst(effect, x, y, rotation, color, data));
}
entity.add();
}
}
private static void inst(Effect effect, float x, float y, float rotation, Color color, Object data){
EffectState entity = EffectState.create();
entity.effect = effect;
entity.rotation = effect.baseRotation + rotation;
entity.data = data;
entity.lifetime = effect.lifetime;
entity.set(x, y);
entity.color.set(color);
if(effect.followParent && data instanceof Posc p){
entity.parent = p;
entity.rotWithParent = effect.rotWithParent;
}
entity.add();
}
public static void decal(TextureRegion region, float x, float y, float rotation){
decal(region, x, y, rotation, 3600f, Pal.rubble);
}

View File

@@ -49,6 +49,8 @@ public class BulletType extends Content implements Cloneable{
public Effect despawnEffect = Fx.hitBulletSmall;
/** Effect created when shooting. */
public Effect shootEffect = Fx.shootSmall;
/** Effect created when charging completes; only usable in single-shot weapons with a firstShotDelay / shotDelay. */
public Effect chargeShootEffect = Fx.none;
/** Extra smoke effect created when shooting. */
public Effect smokeEffect = Fx.shootSmallSmoke;
/** Sound made when hitting something or getting removed.*/

View File

@@ -12,6 +12,8 @@ public class WeaponMount{
public float reload;
/** rotation relative to the unit this mount is on */
public float rotation;
/** weapon recoil */
public float recoil;
/** destination rotation; do not modify! */
public float targetRotation;
/** current heat, 0 to 1*/