Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Resolved Custom Web issues

Joined
Sep 30, 2015
Messages
86
EDIT: Included a debug script at the bottom.

I've started creating my own Web for my API, and I cannot get it to work correctly. I'm currently trying to simply get Lodestones working.

2ND EDIT: Everything works perfectly if you switch vertex.addDirectedEdge(v, 25); to v.addDirectedEdge(vertext, 25);

Before:
Code:
    public void addLodestoneVertices() {
        for (Lodestone lodestone : Lodestone.values()) {
            LodestoneVertex vertex = new LodestoneVertex(lodestone);
            Coordinate c = lodestone.getPosition().derive(0, -1);
            WebVertex v = webCustom.getVertexNearestTo(c);
            if (v != null) {
                double dist = Distance.between(c, v.getPosition());
                if (dist < 3) {
                    vertex.addDirectedEdge(v, 25);
                    webCustom.addVertices(vertex);
                    debug("Added: " + lodestone);
                    debug(v.distanceTo(vertex));
                }
            }
        }
    }

After:
Code:
    public void addLodestoneVertices() {
        for (Lodestone lodestone : Lodestone.values()) {
            LodestoneVertex vertex = new LodestoneVertex(lodestone);
            Coordinate c = lodestone.getPosition().derive(0, -1);
            WebVertex v = webCustom.getVertexNearestTo(c);
            if (v != null) {
                double dist = Distance.between(c, v.getPosition());
                if (dist < 3) {
                    v.addDirectedEdge(vertex, 25);
                    webCustom.addVertices(vertex);
                    debug("Added: " + lodestone);
                    debug(v.distanceTo(vertex));
                }
            }
        }
    }

It appears to be using the lodestones like it should now, thanks @Aidden
 

Attachments

  • webCustomDebug.zip
    133.3 KB · Views: 6
Last edited:
Joined
Oct 24, 2015
Messages
7
Well I can't see anything wrong with the code , it's probably just an issue with the current web system.
Maybe an admin could respond and verify?..
 
Author of MaxiBots
Joined
Dec 3, 2013
Messages
6,876
Resolved. The edge was in the wrong direction. v.addDirectedEdge(vertex, 25) fixed the issue.
 
Top