Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ configure(
dependencies {
library 'com.github.JnCrMx:discord-game-sdk4j:v0.5.5'

library 'com.fasterxml.jackson.core:jackson-core:2.20.0'
library 'com.fasterxml.jackson.core:jackson-annotations:2.20'
library 'com.fasterxml.jackson.core:jackson-databind:2.20'
library 'com.fasterxml.jackson.core:jackson-core:2.8.8'
library 'com.fasterxml.jackson.core:jackson-annotations:2.8.8'
library 'com.fasterxml.jackson.core:jackson-databind:2.8.8'

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public class Player {
public String lastTiming = "None";
public boolean sprinting = false;
public BoundingBox3D boundingBox = null;

public String sidestep = "None";
public boolean wadStart = false;

@InfoString.Getter
public static LandingBlock getLatestLB() {
Expand All @@ -66,7 +67,7 @@ public static LandingBlock getLatestLB() {
public static List<String> compressedInputHistory() {
return getInputHistory().stream()
.reduce(new ArrayList<Tuple<Integer, TimingInput>>(), (l, t) -> {
if (l.size() == 0) {
if (l.isEmpty()) {
l.add(new Tuple<>(1, t));
return l;
}
Expand Down Expand Up @@ -272,6 +273,7 @@ public Player buildAndSave() {
return this;
}

//Blip
lastBlip = prev.lastBlip;
if (onGround && !prev.onGround && pos.getY() == prev.pos.getY() && !prev.jumpTick) {
if (lastBlip == null) lastBlip = new Blip(1, pos);
Expand All @@ -280,6 +282,24 @@ public Player buildAndSave() {
if (lastBlip != null) lastBlip = new Blip(0, lastBlip.lastChainedBlips, lastBlip.pos);
}

//Sidestep
sidestep = prev.sidestep;
wadStart = prev.wadStart;
if (jumpTick) {
if (prev.keyInput.isMovingSideways() && keyInput.isMovingSideways() && prev.keyInput.hasSwappedDirection(keyInput)) {
sidestep = "WDWA";
} else if (prev.keyInput.isMovingSideways() && !keyInput.isMovingSideways()) {
sidestep = "None";
wadStart = true;
} else {
sidestep = "None";
wadStart = false;
}
} else if (wadStart && keyInput.isMovingSideways()) {
sidestep = airtime == 1 ? "WAD" : "WAD " + airtime + "t";
wadStart = false;
}

Player.updateDisplayInstance();
return this;
}
Expand Down Expand Up @@ -366,6 +386,11 @@ public Player setLastPos(Vector3D lastPos) {
return this;
}

@InfoString.Getter
public String getSidestep() {
return sidestep;
}

@InfoString.DataClass
public static class Blip implements FormatDecimals {
@InfoString.Field
Expand Down Expand Up @@ -484,5 +509,9 @@ public Vector2D getMovementVector() {
public boolean isMovingSideways() {
return left ^ right;
}

public boolean hasSwappedDirection(KeyInput other) {
return (this.left && other.right) || (this.right && other.left);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ public static void registerSerializer() {
module.addDeserializer(Color.class, new ColorDeserializer());

mapper.registerModule(module);
mapper.activateDefaultTyping(
mapper.getPolymorphicTypeValidator(),
mapper.enableDefaultTyping(
ObjectMapper.DefaultTyping.OBJECT_AND_NON_CONCRETE,
JsonTypeInfo.As.PROPERTY
);
Expand Down