#(sudura) Random point in Polygon *ALWAYS* picking the very far West?

1 messages · Page 1 of 1 (latest)

ivory fern
#

Seems to be pretty random North to South but it is literally always on the very far west side.

    type: command
    name: suduraearth
    description: Teleport to a random spot in a continent
    usage: /suduraearth <&lt>continent<&gt>
    aliases:
    - suduraglobe
    - sudurartp
    permission: sudura.user.util.earth
    tab completions:
        1: asia|north-america|south-america|europe|australia|antarctica|africa
    script:
    - if !<server.flag[continents].keys.contains[<context.args.get[1]>]>:
        - narrate "<&c>Not a valid continent. Try again!"
        - stop
    - define tpLocation <server.flag[continents].get[<context.args.get[1]>].spawnable_blocks.random>
    - while !<[tpLocation].light.sky.is_more_than_or_equal_to[13]>:
        - define tpLocation <server.flag[continents].get[<context.args.get[1]>].spawnable_blocks.random>
    - teleport <player> <[tpLocation]>```

Narrated polygon (Europe) - Newlined each vertex: 
```polygon@earth,64.0,128.0,
-992.0,-5392.0,
-560.0,-6048.0,
2400.0,-7248.0,
5472.0,-6992.0,
5392.0,-4880.0,
5056.0,-4240.0,
3472.0,-4640.0,
2816.0,-4208.0,
1664.0,-4080.0,
816.0,-4464.0,
-560.0,-3792.0,
-960.0,-3936.0,
-880.0,-4384.0'```

In literally 25+ attempts I'm ending up in Ireland; a miniscule part of the polygon majority of the time; and the rest south of that (still on the far west side but random up/down)
cyan fernBOT
stone sedgeBOT
#

(sudura) Random point in Polygon ALWAYS picking the very far West?

stone sedgeBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.
You can block this bot if you don't want to see these messages, I won't mind.
<@&525394568410038282>

ivory fern
#

Guy spamming it right now over and over; always Ireland

#

have i completely fucked the polygon or smth?

#

This is Europe polygon demonstrated on GIMP; I added vertexes clockwise from Ireland (all continents have this bug so i'm using europe as example)

#

was gonna do the triangles; figured this would work ok but slow; very wrong

#

Coords definitely correct too (you can see the vague trend in the polygon narration)

celest forge
#

You're getting spawnable_blocks from a flag, I'm assuming that's an AreaObject?

ivory fern
#

yup PolygonTag

#

server_flag[continents] is a map of polygons to names

celest forge
#

The wize of that actual list is likely massive, and Denizen as per default configuration limits how many entries will be added to a list from a tag

#

Cause the alternative is likely a OOM

ivory fern
#

yeah it is definitely way too many 😎

#

i guess it generates a certain way that caused this

#

lines left to right

celest forge
#

Yep, gunna want a more sane way of handling it

ivory fern
#

see the problem is i could not figure out how i get the "top y" value so i just expanded polygon min & max y

#

(extremely poor way to handle it)

celest forge
#

More, smaller area objects

ivory fern
#

so now its an insanely huge 3d polygon instead of a "reasonable" 2d one

#

u know how i could instead find any location and compare the top block in y instead of the location it finds

#

that was the idea but i couldnt find it so got lazy n now have this obscenely slow, very bad way

celest forge
#

!t locationtag.highest

gusty pivotBOT
celest forge
#

This?

ivory fern
#

exactly

#

yes

#

thanks

celest forge
#

Np

ivory fern
#

lemme unfuck it and try again

#

appreciate it

celest forge
#

Good luck!