Magic

Magic

190k Downloads

Sand regen issue

martdamp opened this issue ยท 3 comments

commented

Hey Nathan,

While playing around we found a problem. When using moves to displace sand and then use another move to displace sand before the other move does it undo, then the sand blocks will fall and when the second move undo's there will be holes. I created a test moves and could reproduce it everytime, the move in question:

earth_test:
    icon: sand
    actions:
        cast:
        -   class: CheckBlock
            allowed: sand
            actions:
            -   class: Cylinder
                radius: 2
                actions:
                -   class: Brush
                    brush: erase
                    actions:
                    -   class: ModifyBlock
            -   class: Delay
            -   class: Cylinder
                radius: 3
                actions:
                -   class: Brush
                    brush: erase
                    actions:
                    -   class: ModifyBlock
            -   class: Delay
            -   class: Cylinder
                radius: 4
                actions:
                -   class: Brush
                    brush: erase
                    actions:
                    -   class: ModifyBlock
    parameters:
        target: block
        destructible: sand
        falling: true
        delay: 50
        undo: 4000

We also made a video to show you this problem: https://youtu.be/ElS5-w1lfs4
I would think other gravity blocks will have the same issue.

martdamp

commented

Hm, I see, yeah that's a tricky one. Looks like when the first cast undoes, it restores sand that is now floating because of the blocks the second cast removed. So that sand falls, but since the first cast is done it's not tracking that falling sand anymore.

Need to think about this... having a hard time seeing how to cover it in a general case. I guess ideally the second cast would recognize that some blocks had fallen into its space, and then restore those blocks when it's done. I'll see how doable that is.

commented

I think I have this fixed in this commit, most recent dev build:

1519c25

Can you please let me know if you see any more issues?

The basic idea is to check for spells that have modified the area a falling blocks spawns in or lands in. I also had to check one block down, which seems to cover all the cases even with very large radius (using your test spell)

commented

Thanks for the quick response and fix.
Everything seems to work just fine here.