This commit is contained in:
Anuken
2020-10-30 10:36:07 -04:00
parent 968d94904a
commit 14869041b8
6 changed files with 22 additions and 11 deletions

View File

@@ -1328,7 +1328,7 @@ public class Blocks implements ContentList{
//region storage
coreShard = new CoreBlock("core-shard"){{
requirements(Category.effect, BuildVisibility.debugOnly, with(Items.copper, 2000, Items.lead, 1000));
requirements(Category.effect, BuildVisibility.editorOnly, with(Items.copper, 2000, Items.lead, 1000));
alwaysUnlocked = true;
unitType = UnitTypes.alpha;

View File

@@ -8,7 +8,7 @@ import mindustry.content.*;
import mindustry.entities.*;
import mindustry.gen.*;
public class MovementLightningAbility extends Ability{
public class MoveLightningAbility extends Ability{
//Lightning damage
public float damage = 35f;
//Chance of firing every tick. Set >= 1 to always fire lightning every tick at max speed.
@@ -17,15 +17,15 @@ public class MovementLightningAbility extends Ability{
public int length = 12;
//Speeds for when to start lightninging and when to stop getting faster
public float minSpeed = 0.8f, maxSpeed = 1.2f;
//Lightning Color
//Lightning color
public Color color = Color.valueOf("a9d8ff");
public Effect shootEffect = Fx.sparkShoot;
public Sound shootSound = Sounds.spark;
MovementLightningAbility(){}
MoveLightningAbility(){}
public MovementLightningAbility(float damage, int length, float chance, float minSpeed, float maxSpeed, Color color){
public MoveLightningAbility(float damage, int length, float chance, float minSpeed, float maxSpeed, Color color){
this.damage = damage;
this.length = length;
this.chance = chance;
@@ -37,10 +37,10 @@ public class MovementLightningAbility extends Ability{
@Override
public void update(Unit unit){
float scl = Mathf.clamp((unit.vel().len() - minSpeed) / (maxSpeed - minSpeed));
if(Mathf.chance(Time.delta * (chance * scl))){
if(Mathf.chance(Time.delta * chance * scl)){
shootEffect.at(unit.x, unit.y, unit.rotation, color);
Lightning.create(unit.team, color, damage, unit.x + unit.vel().x, unit.y + unit.vel().y, unit.rotation, length);
shootSound.at(unit.x, unit.y);
Lightning.create(unit.team, color, damage, unit.x + unit.vel.x, unit.y + unit.vel.y, unit.rotation, length);
shootSound.at(unit);
}
}
}

View File

@@ -141,7 +141,7 @@ public class BlockInventoryFragment extends Fragment{
Boolp canPick = () -> player.unit().acceptsItem(item) && !state.isPaused() && player.within(tile, itemTransferRange);
HandCursorListener l = new HandCursorListener();
l.setEnabled(canPick);
l.enabled = canPick;
Element image = itemImage(item.icon(Cicon.xlarge), () -> {
if(tile == null || !tile.isValid()){

View File

@@ -714,7 +714,17 @@ public class HudFragment extends Fragment{
t.margin(0);
t.add(new SideBar(() -> player.unit().healthf(), () -> true, true)).width(bw).growY().padRight(pad);
t.image(() -> player.icon()).scaling(Scaling.bounded).grow().maxWidth(54f);
t.image(() -> player.icon()).scaling(Scaling.bounded).grow().maxWidth(54f).with(i -> {
if(mobile){
//on mobile, cause a respawn on tap
i.clicked(() -> {
if(!player.unit().spawnedByCore && !player.dead()){
Call.unitClear(player);
control.input.controlledType = null;
}
});
}
});
t.add(new SideBar(() -> player.dead() ? 0f : player.displayAmmo() ? player.unit().ammof() : player.unit().healthf(), () -> !player.displayAmmo(), false)).width(bw).growY().padLeft(pad).update(b -> {
b.color.set(player.displayAmmo() ? player.dead() || player.unit() instanceof BlockUnitc ? Pal.ammo : player.unit().type.ammoType.color : Pal.health);
});

View File

@@ -7,6 +7,7 @@ public enum BuildVisibility{
hidden(() -> false),
shown(() -> true),
debugOnly(() -> false),
editorOnly(() -> false),
sandboxOnly(() -> Vars.state == null || Vars.state.rules.infiniteResources),
campaignOnly(() -> Vars.state == null || Vars.state.isCampaign()),
lightingOnly(() -> Vars.state == null || Vars.state.rules.lighting || Vars.state.isCampaign()),