Projectile clipping, PassDoor fix (#176)

* Numbered packet sizes.
Corrected sound packet length to 6 from 5.
Corrected sound packet in server.
Teleport sound now plays correctly.
Corrected modern teleport animation playthrough.
Removed redundant teleport delay.

* Changed sendSound packet size back to 5 and removed type attribute to maintain compatibility with Parabot.

* After running around an object to attack the player will no longer wait a number of ticks to start attacking again.
Fixed an issue where walkTo being called from CycleEvents would not execute correctly.
Player will no longer face a killed npc after it respawns.
Added projectile clipping.
Added a new algorithm for player->player/npc following that accounts for projectile clipping.
This commit is contained in:
mikeysasse
2019-11-11 14:20:02 -06:00
committed by Daniel Ginovker
parent a4e4b89d99
commit c827d46ca0
66 changed files with 1293 additions and 480 deletions
+20 -4
View File
@@ -19,6 +19,10 @@ public class Misc {
return (int) Math.random() * range;
}
public static double distance(int x1, int y1, int x2, int y2 ) {
return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
}
public static boolean goodDistance(int objectX, int objectY, int playerX, int playerY, int distance) {
return objectX - playerX <= distance && objectX - playerX >= -distance && objectY - playerY <= distance && objectY - playerY >= -distance;
}
@@ -255,6 +259,20 @@ public class Misc {
'&', '*', '\\', '\'', '@', '#', '+', '=', '\243', '$', '%', '"',
'[', ']' };
public static int[] delta(int x1, int y1, int x2, int y2) {
return new int[] {x2 - x1, y2 - y1};
}
public static int directionFromDelta(int x, int y) {
for (int a = 0; a < directionDeltaX.length; a++) {
if (directionDeltaX[a] == x && directionDeltaY[a] == y) {
return xlateDirectionToClient[a];
}
}
throw new IllegalArgumentException(String.format("Cannot find direction %d %d", x, y));
}
public static int direction(int srcX, int srcY, int x, int y) {
double dx = (double) x - srcX, dy = (double) y - srcY;
double angle = Math.atan(dy / dx);
@@ -273,10 +291,8 @@ public class Misc {
*/
}
public static byte directionDeltaX[] = new byte[] { 0, 1, 1, 1, 0, -1, -1,
-1 };
public static byte directionDeltaY[] = new byte[] { 1, 1, 0, -1, -1, -1, 0,
1 };
public static byte directionDeltaX[] = new byte[] { 0, 1, 1, 1, 0, -1, -1, -1 };
public static byte directionDeltaY[] = new byte[] { 1, 1, 0, -1, -1, -1, 0, 1 };
public static byte xlateDirectionToClient[] = new byte[] { 1, 2, 4, 7, 6,
5, 3, 0 };