Bat ponies and pegasi can now dash forwards while flying by quickly tapping their primary ability

This commit is contained in:
Sollace 2022-09-26 21:13:58 +02:00
parent 7b60248514
commit 5d21c691b4
12 changed files with 54 additions and 15 deletions

View file

@ -10,6 +10,7 @@ public interface USounds {
SoundEvent ENTITY_PLAYER_BATPONY_SCREECH = register("entity.player.batpony.screech"); SoundEvent ENTITY_PLAYER_BATPONY_SCREECH = register("entity.player.batpony.screech");
SoundEvent ENTITY_PLAYER_REBOUND = register("entity.player.rebound"); SoundEvent ENTITY_PLAYER_REBOUND = register("entity.player.rebound");
SoundEvent ENTITY_PLAYER_PEGASUS_WINGSFLAP = register("entity.player.pegasus.wingsflap"); SoundEvent ENTITY_PLAYER_PEGASUS_WINGSFLAP = register("entity.player.pegasus.wingsflap");
SoundEvent ENTITY_PLAYER_PEGASUS_DASH = register("entity.player.pegasus.dash");
SoundEvent ENTITY_PLAYER_PEGASUS_MOLT = register("entity.player.pegasus.molt"); SoundEvent ENTITY_PLAYER_PEGASUS_MOLT = register("entity.player.pegasus.molt");
SoundEvent ENTITY_PLAYER_CHANGELING_BUZZ = register("entity.player.changeling.buzz"); SoundEvent ENTITY_PLAYER_CHANGELING_BUZZ = register("entity.player.changeling.buzz");
SoundEvent ENTITY_PLAYER_CHANGELING_TRANSFORM = register("entity.player.changeling.transform"); SoundEvent ENTITY_PLAYER_CHANGELING_TRANSFORM = register("entity.player.changeling.transform");

View file

@ -18,7 +18,7 @@ public class CarryAbility implements Ability<Hit> {
@Override @Override
public int getWarmupTime(Pony player) { public int getWarmupTime(Pony player) {
return 0; return 5;
} }
@Override @Override
@ -52,6 +52,17 @@ public class CarryAbility implements Ability<Hit> {
return Hit.SERIALIZER; return Hit.SERIALIZER;
} }
@Override
public boolean onQuickAction(Pony player, ActivationType type) {
if (type == ActivationType.TAP && player.getPhysics().isFlying()) {
player.getPhysics().dashForward((float)player.getReferenceWorld().random.nextTriangular(1, 0.3F));
return true;
}
return false;
}
@Override @Override
public void apply(Pony iplayer, Hit data) { public void apply(Pony iplayer, Hit data) {
PlayerEntity player = iplayer.getMaster(); PlayerEntity player = iplayer.getMaster();

View file

@ -57,6 +57,17 @@ public class PegasusRainboomAbility implements Ability<Hit> {
return player.getMagicalReserves().getMana().getMax() * 0.9F; return player.getMagicalReserves().getMana().getMax() * 0.9F;
} }
@Override
public boolean onQuickAction(Pony player, ActivationType type) {
if (type == ActivationType.TAP && player.getPhysics().isFlying()) {
player.getPhysics().dashForward((float)player.getReferenceWorld().random.nextTriangular(1, 0.3F));
return true;
}
return false;
}
@Override @Override
public void apply(Pony player, Hit data) { public void apply(Pony player, Hit data) {

View file

@ -587,6 +587,17 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
isFlyingSurvival = entity.getAbilities().flying; isFlyingSurvival = entity.getAbilities().flying;
} }
public void dashForward(float speed) {
if (pony.isClient()) {
return;
}
Vec3d orientation = entity.getRotationVec(1).multiply(speed);
entity.addVelocity(orientation.x, orientation.y, orientation.z);
pony.updateVelocity();
pony.playSound(USounds.ENTITY_PLAYER_PEGASUS_DASH, 1);
}
@Override @Override
public void toNBT(NbtCompound compound) { public void toNBT(NbtCompound compound) {
super.toNBT(compound); super.toNBT(compound);

View file

@ -482,6 +482,7 @@
"death.attack.kick.attacker": "%2$s kicked %1$s really hard", "death.attack.kick.attacker": "%2$s kicked %1$s really hard",
"unicopia.subtitle.flap_wings": "Wing flaps", "unicopia.subtitle.flap_wings": "Wing flaps",
"unicopia.subtitle.dash": "Pony Dashes",
"unicopia.subtitle.wind_rush": "Wind gusts", "unicopia.subtitle.wind_rush": "Wind gusts",
"unicopia.subtitle.insects": "Insects Scurrying", "unicopia.subtitle.insects": "Insects Scurrying",
"unicopia.subtitle.changeling_buzz": "Drone buzzing", "unicopia.subtitle.changeling_buzz": "Drone buzzing",

View file

@ -3,11 +3,23 @@
"category": "player", "category": "player",
"subtitle": "unicopia.subtitle.flap_wings", "subtitle": "unicopia.subtitle.flap_wings",
"sounds": [ "sounds": [
"unicopia:wing/wing0", "unicopia:wing/wing0",
"unicopia:wing/wing1", "unicopia:wing/wing1",
"unicopia:wing/wing2", "unicopia:wing/wing2",
"unicopia:wing/wing3" "unicopia:wing/wing3"
] ]
},
"entity.player.pegasus.dash": {
"category": "player",
"subtitle": "unicopia.subtitle.dash",
"sounds": [
"unicopia:woosh/woosh0",
"unicopia:woosh/woosh1",
"unicopia:woosh/woosh2",
"unicopia:woosh/woosh3",
"unicopia:woosh/woosh4",
"unicopia:woosh/woosh5"
]
}, },
"item.magic.aura": { "item.magic.aura": {
"category": "player", "category": "player",
@ -92,15 +104,7 @@
{ "name": "unicopia:record/funk", "stream": true, "attenuation_distance": 21120} { "name": "unicopia:record/funk", "stream": true, "attenuation_distance": 21120}
] ]
}, },
"entity.player.changeling.transform": {
"entity.player.changeling.transform": {
"sounds": [ "sounds": [
{ {
"name": "entity.ravager.ambient", "name": "entity.ravager.ambient",