File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -51,10 +51,26 @@ eventManager.on("getWaitingQueue", function lowerVolume() {
5151eventManager . on ( "PlayingGame" , function bindHotkeys ( ) {
5252 // Binds to Space, Middle Click
5353 hotkeys . push ( new Hotkey ( "End turn" ) . bindKey ( 32 ) . bindClick ( 2 ) . run ( ( e ) => {
54- if ( ! $ ( e . target ) . is ( "#endTurnBtn" ) && userTurn && userTurn === userId ) endTurn ( ) ;
54+ if ( ! $ ( e . target ) . is ( "#endTurnBtn" ) && userTurn === userId ) endTurn ( ) ;
5555 } ) ) ;
5656} ) ;
5757
58+ eventManager . on ( 'PlayingGame' , function fixEndTurn ( ) {
59+ const button = $ ( '#endTurnBtn' ) ;
60+ const oEndTurn = endTurn ;
61+ let endedTurn = false ;
62+ endTurn = function restrictedEndTurn ( ) {
63+ if ( endedTurn || button . prop ( 'disabled' ) ) return ;
64+ endedTurn = true ;
65+ oEndTurn ( ) ;
66+ } ;
67+
68+ eventManager . on ( 'getTurnStart' , function turnStarted ( ) {
69+ if ( userTurn !== userId ) return ;
70+ endedTurn = false ;
71+ } ) ;
72+ } ) ;
73+
5874eventManager . on ( "GameStart" , function battleLogger ( ) {
5975 const ignoreEvents = Object . keys ( {
6076 getConnectedFirst : '' ,
You can’t perform that action at this time.
0 commit comments