Closed michaeljb closed 10 years ago
Didn't realize GS.getGameClient() was a thing earlier, so GS.whenGameClientReady() could be simpler:
// in utils.js
GS.whenGameClientReady = function (callback) {
mtgRoom.conn.bind('gameServerHello', function (msg) {
callback(GS.getGameClient());
});
};
No, your implementation is better than the existing getGameClient(). Not only is it more elegant, but it's probably less likely to fail if, say, Goko hasn't yet populated whatever variables mtgRoom.getCurrentTable() needs. Something along those lines appears to be causing the error that theblankman observed.
OK, whenGameClientReady uses my implementation in the commit I just added: 31079870d33b2a2df77a2e00fd4be8dd40247679
Since it depends on the gameServerHello message I'm not sure the other calls can be swapped out but I'll look into it tonight
Verified that auto-stack option works correctly. Verified that the game client gets correctly passed to the callback method.
There's a small conflict with #214, but it's easy to resolve.
I'm wondering whether getGameClient() should even continue to exist. It's dangerous, and it's hard to imagine why you would want the current game client just this once. Adding a listener for every new gameClient with whenGameClientReady() seems like it would always be the better solution.
You've confused my github algorithms by embedding #227 in here. Maybe I will just wait for you to fix the minor issues with both before doing the merge. I promise to get to them faster than I did this last time around.
You've confused my github algorithms by embedding #227 in here. Maybe I will just wait for you to fix the minor issues with both before doing the merge. I promise to get to them faster than I did this last time around.
I'm having trouble with both giving 'assemble' the 'title' argument and getting a setup where I don't have to enter my private key passphrase every time the task runs (kind of defeats the automation of it all), so #227 is a bit held up. I can cherry-pick the relevant commits here and submit a new pull request.
Resubmitted in #232 without the grunt stuff since I don't have that working yet.
This branch is based off my
grunt
branch rather thanbeta
, so #227 should be merged before this pull request (after which this pull request should just be one commit, 130ceae4fc368d42810b83dc6aa96c07950e580c). I did this mainly so I could easily develop withgrunt watch:chrome
.See also #217.
I imagine that getting access to the active game client instance will be something other modules want, so that should probably be split out of
alwaysStack.js
into something more generic and reusable inutils.js
. I'm not completely sure what the best thing to do for this would be, but I had something like this in mind: