#(daxz_) floodfill algorithm

20 messages · Page 1 of 1 (latest)

red hatch
#
claimInventory:
    type: inventory
    inventory: chest
    debug: false
    gui: true
    size: 54
    title: Your Claim
    definitions:
        p: claimPane
    procedural items:
        - define core <player.flag[claims.openedCore]>
        - define coreSlot 23

        - define listy <list>

        - foreach <[core].flag[claims.areas]> as:area:
            - define slot
        - repeat 25:
            - define listy:->:claimLockedSlot
        - determine <[listy]>
    slots:
    - [p] [p] [] [] [] [] [] [p] [p]
    - [p] [p] [] [] [] [] [] [p] [p]
    - [p] [p] [] [] [x] [] [] [p] [p]
    - [p] [p] [] [] [] [] [] [p] [p]
    - [p] [p] [] [] [] [] [] [p] [p]
    - [p] [p] [p] [p] [p] [p] [p] [p] [claimSettings]

hi there, i want to make a claim system where you can buy slots of chunks. im trying to floodfill algorithm from the center "x" and adding coords to the chunk to check if the chunk is claimed or not via a flag. any ideas how to start?

past wagonBOT
#

(daxz_) floodfill algorithm

past wagonBOT
#

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.

red hatch
#

actually cant i like slope this LOL

#

hmm no that wont work, i need to get the chunk first

red hatch
#
        - define core <player.flag[claims.openedCore]>
        - define coreSlot 23

        - define listy <list>

        - define startChunk <[core].chunk.add[2,-2]>
        - repeat 5 from:0:
            - define rowChunk <[startChunk].add[-<[value]>,0]>
            - repeat 5 from:0:
                - define chunk <[rowChunk].add[0,<[value]>]>
                - narrate <[chunk].x>,<[chunk].z>
                - if <[chunk].has_flag[claims]>:
                    - define listy:->:claimUnlockedSlot
                - else:
                    - define listy:->:claimLockedSlot
#

heres the code

vale night
# red hatch hmm

So you're trying to have the stone display as something else if the chunk it represents is claimed?

quick cipher
#

i dont get why you're calculating the player's claims on the fly instead of saving them

#

or is this code to find the chunks relative to the gui slots' placements?

red hatch
#

and my next problem is knowing how to translate the item form into chink form again

#

so i know which chunk the player clicks on to "buy"

vale night
#

Well, you could calculate it based on it's position in the GUI, but since you already create the items and add them to the list there, why not just flag them with the chunk they represent?

red hatch
#

oh wait yeah

jagged briarBOT
#
Thread Closing Reminder

Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.

If not yet resolved, please reply below to tell us what you still need.

(Note that if there is no reply for a few days, this thread will eventually close itself.)

#

@red hatch