Respawn key

This commit is contained in:
Anuken
2020-05-24 22:27:14 -04:00
parent e8869c07fe
commit 0e59a22cbe
26 changed files with 105 additions and 16 deletions

View File

@@ -133,7 +133,7 @@ public class Bullets implements ContentList{
frontColor = Pal.bulletYellow;
}};
glassFrag = new BasicBulletType(3f, 6, "bullet"){{
glassFrag = new BasicBulletType(3f, 5, "bullet"){{
bulletWidth = 5f;
bulletHeight = 12f;
bulletShrink = 1f;
@@ -174,10 +174,10 @@ public class Bullets implements ContentList{
bulletWidth = 6f;
bulletHeight = 8f;
hitEffect = Fx.flakExplosion;
splashDamage = 30f;
splashDamageRadius = 26f;
splashDamage = 20f;
splashDamageRadius = 20f;
fragBullet = glassFrag;
fragBullets = 6;
fragBullets = 5;
}};
flakPlastic = new FlakBulletType(4f, 6){{
@@ -192,16 +192,18 @@ public class Bullets implements ContentList{
}};
flakExplosive = new FlakBulletType(4f, 5){{
//default bullet type, no changes
shootEffect = Fx.shootBig;
ammoMultiplier = 4f;
splashDamage = 15f;
splashDamageRadius = 34f;
status = StatusEffects.blasted;
statusDuration = 60f;
}};
flakSurge = new FlakBulletType(4f, 7){{
splashDamage = 33f;
flakSurge = new FlakBulletType(4.5f, 13){{
splashDamage = 40f;
splashDamageRadius = 40f;
lightining = 2;
lightningLength = 12;
shootEffect = Fx.shootBig;

View File

@@ -1,16 +1,19 @@
package mindustry.entities.comp;
import arc.util.ArcAnnotate.*;
import arc.struct.*;
import mindustry.annotations.Annotations.*;
import mindustry.world.blocks.payloads.*;
/** An entity that holds a payload. */
@Component
abstract class PayloadComp{
//TODO multiple payloads?
@Nullable Payload payload;
Array<Payload> payloads = new Array<>();
boolean hasPayload(){
return payload != null;
return payloads.size > 0;
}
void addPayload(Payload load){
payloads.add(load);
}
}

View File

@@ -10,8 +10,9 @@ public enum Binding implements KeyBind{
move_x(new Axis(KeyCode.a, KeyCode.d), "general"),
move_y(new Axis(KeyCode.s, KeyCode.w)),
mouse_move(KeyCode.mouseBack),
boost(KeyCode.shiftLeft), //TODO rename
control(KeyCode.shiftLeft),
boost(KeyCode.shiftLeft),
control(KeyCode.controlLeft),
respawn(KeyCode.v),
select(KeyCode.mouseLeft),
deselect(KeyCode.mouseRight),
break_block(KeyCode.mouseRight),

View File

@@ -64,7 +64,7 @@ public class DesktopInput extends InputHandler{
});
group.fill(t -> {
t.visible(() -> lastSchematic != null && !selectRequests.isEmpty());
t.visible(() -> Core.settings.getBool("hints") && lastSchematic != null && !selectRequests.isEmpty());
t.bottom();
t.table(Styles.black6, b -> {
b.defaults().left();
@@ -77,6 +77,15 @@ public class DesktopInput extends InputHandler{
});
}).margin(6f);
});
group.fill(t -> {
t.visible(() -> Core.settings.getBool("hints") && !player.dead() && !player.unit().spawnedByCore());
t.bottom();
t.table(Styles.black6, b -> {
b.defaults().left();
b.label(() -> Core.bundle.format("respawn", Core.keybinds.get(Binding.respawn).key.toString())).style(Styles.outlineLabel);
}).margin(6f);
});
}
@Override
@@ -197,6 +206,11 @@ public class DesktopInput extends InputHandler{
}
}
if(Core.input.keyDown(Binding.respawn) && !player.dead() && !player.unit().spawnedByCore()){
Call.onUnitClear(player);
controlledType = null;
}
//TODO this is for debugging, remove later
if(Core.input.keyTap(KeyCode.g) && !player.dead() && player.unit() instanceof Commanderc){
Commanderc commander = (Commanderc)player.unit();
@@ -565,10 +579,11 @@ public class DesktopInput extends InputHandler{
float speed = unit.type().speed * Mathf.lerp(1f, unit.type().canBoost ? unit.type().boostMultiplier : 1f, unit.elevation()) * strafePenalty;
float xa = Core.input.axis(Binding.move_x);
float ya = Core.input.axis(Binding.move_y);
boolean boosted = (!unit.type().flying && unit.isFlying());
movement.set(xa, ya).nor().scl(speed);
float mouseAngle = Angles.mouseAngle(unit.x(), unit.y());
boolean aimCursor = omni && isShooting && unit.type().hasWeapons() && unit.type().faceTarget;
boolean aimCursor = omni && isShooting && unit.type().hasWeapons() && unit.type().faceTarget && !boosted;
if(aimCursor){
unit.lookAt(mouseAngle);
@@ -588,7 +603,7 @@ public class DesktopInput extends InputHandler{
}
unit.aim(unit.type().faceTarget ? Core.input.mouseWorld() : Tmp.v1.trns(unit.rotation(), Core.input.mouseWorld().dst(unit)).add(unit.x(), unit.y()));
unit.controlWeapons(true, isShooting && !(!unit.type().flying && unit.isFlying()));
unit.controlWeapons(true, isShooting && !boosted);
isBoosting = Core.input.keyDown(Binding.boost) && !movement.isZero();
player.boosting(isBoosting);

View File

@@ -184,6 +184,16 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
}
}
@Remote(targets = Loc.both, called = Loc.server, forward = true)
public static void onUnitClear(Playerc player){
//no free core teleports?
if(!player.dead() && player.unit().spawnedByCore()) return;
Fx.spawn.at(player);
player.clearUnit();
player.deathTimer(60f); //for instant respawn
}
public Eachable<BuildRequest> allRequests(){
return cons -> {
for(BuildRequest request : player.builder().requests()) cons.get(request);