JogoShugh / SpaceMiner

SpaceMiner
http://spaceminer.azurewebsites.net
Other
4 stars 4 forks source link

D: When updating a world, the starttasks should not be duplicated #101

Closed JogoShugh closed 8 years ago

JogoShugh commented 8 years ago

The start() function is currently concatenating tasks on each execution. It should just zero-length the array each time instead to prevent insane behaviors.

JogoShugh commented 8 years ago

This is a really bizarre one, but I think I have it partially solved.

The first part had to do with too many gameUpdated.changed() dependencies getting fired, triggering multiple executes of start tasks and thus competing instructions.

The next part will be to make start, if called twice in the actual code, result in a no-op.

JogoShugh commented 8 years ago

I have modified the build page so that Update world is now Update & preview world and it opens in a popup window instead of inside the page. This avoids a lot of issues with synchronization. It also makes it easier to see the world and the code side-by-side.

This is a world that does some basic operations and scripted navigation upon start:

Note that teleport is weird because it is zero-based while the rest start at 1, so I'll fix that soon...

let worldName = 'Testing autoPilot with mine';

start(
    mine(width(4)),
    mine(at(4, 2), width(4)),
    mine(at(8, 4), width(4)),
    land,
    navigate(
        right(3), down(1), right(3), 
        teleport(7, 3), right(2)
    )
);