Compass Spawn issue

Discussion in 'Empire Help & Support' started by Paul2924, Feb 17, 2016.

  1. I don't know if I am doing something wrong, or if there is a bug in the Compass system.

    When I am in Wasteland NE and try to set my compass to the NE safe zone, I use /compass spawn. The instructions for compass on the wiki says that this should set it to the closest safe zone, but instead it always sets it to the main spawn area (I think the center safe zone?). I can easily tell this because if I set the compass by hand with /compass set x y, then it points to the correct safe zone.

    Please excuse me if I have misunderstood how compass works, or if this is the wrong place to post this question.

    So far, in he short time I've been on Empire, the players have been great help on the forum. Thanks for that past help and any assistance with this question.

    Regards,
    Paul
    (aka Dwelfman)
  2. There is some form of bug in wastelands calculations, going to try to track it down tonight.
  3. Another thing worth noting, whenever I die in the wastelands it always spawns me in the center outpost, even if I was closer to a different one.
  4. Thats the same bug. It's calculations for closest are different than the Frontiers. It tried to be 'smarter' in a faster code kind of way, and somethings off in my math.

    https://gist.github.com/aikar/d1b632fb6ff16d9e439f
  5. I haven't worked through it completely yet, but it seems like using DISTANCE=2000 causes you to end up at the non-center Outposts only if they are beyond 2000 blocks out in any direction. I think using DISTANCE=1000 (halfway between Center and outlying Outposts) might be the value you need to use.

    Edit: I'm seeing more than just this. I know you're probably trying to avoid it but you might be better off with a bunch of conditionals. Putting different values into your formula, is giving me more than 9 results. I'm sure you don't need help but:

    Code:
    public static int DISTANCE=1000;
    
    if (blockX>DISTANCE) {    // Eastern third of map
        if (blockZ>DISTANCE)    return WastelandOutpost.SOUTH_EAST;
        if (blockZ<-DISTANCE)    return WastelandOutpost.NORTH_EAST;
        return WastelandOutpost.EAST;
    }
    
    if (blockX<-DISTANCE) {    // Western third of map
        if (blockZ>DISTANCE)    return WastelandOutpost.SOUTH_WEST;
        if (blockZ<-DISTANCE)    return WastelandOutpost.NORTH_WEST;
        return WastelandOutpost.WEST;
    }
    
    // Middle of map
    if (blockZ>DISTANCE)    return WastelandOutpost.SOUTH;
    if (blockZ<-DISTANCE)    return WastelandOutpost.NORTH;
    return WastelandOutpost.CENTER;
    
    
  6. I think it's got something to do with the default being the center outpost.
  7. There has to be a default. If none of the case's are met, then the player isn't teleported at all.
    Pab10S likes this.
  8. I'm aware of this. I'm saying "change the default and see what happens."
  9. that would still give incorrect results :p
    Pab10S likes this.
  10. Yes, but it would help narrow down the issue.
  11. there was 2 issues.
    1) needed to round instead of floor. so that 0.9999 doesn't go down to 0
    2) loss of precision with DISTANCE being int

    so new working code is
    final int x = (int) Math.round(loc.getBlockX() / (double) DISTANCE);
    final int z = (int) Math.round(loc.getBlockZ() / (double) DISTANCE);
    ShelLuser likes this.
  12. Unless you changed some of the other code you posted earlier wouldn't you end up in the Center Outpost for values where |X|>3000 or |Z|>3000?

    For example x=3500,z=3500.
    x=Round(3500/2000)=Round(1.75)=2
    z=Round(3500/2000)=Round(1.75)=2
    val=(1000 * 2) + 2 = 2002
    ShelLuser likes this.
  13. good catch... revisiting
    ShelLuser likes this.
  14. bleh its slower than the other code but it gets the job done so whatever :p

    public static WastelandOutpost getCurrentRegion(Location loc) {
    World world = loc.getWorld();
    WastelandOutpost nearest = WastelandOutpost.CENTER;
    double dist = loc.distance(WastelandOutpost.CENTER.getLocation(world));
    for (WastelandOutpost outpost : WastelandOutpost.values()) {
    double curDist = loc.distance(outpost.getLocation(world));
    if (curDist < dist) {
    dist = curDist;
    nearest = outpost;
    }
    }
    return nearest;
    }
    ShelLuser likes this.
  15. Will you be making it so that the compass could operate in the nether Aikar?
  16. Sorry, late reaction...

    Most likely not. Chickeneer already thought about it and came to conclude that for this to work you'd also need client modifications. So even if you set the compass target then things will work (/loc for example shows you the target and your distance to it) but unfortunately the compass simply doesn't show it.