diff --git a/CHANGELOG.md b/CHANGELOG.md index 20958a3..0ea6d0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 12.4.2 +* Fixed confirm dialogs broken by Atom update. +* If you get an error when you try to Get Lua Scripts you need to update Atom. + ## 12.4.1 * Fixed goto line number not working with included files. * Fixed snippet parameter order for onObjectDrop and onObjectPickUp. diff --git a/lib/tabletopsimulator-lua.coffee b/lib/tabletopsimulator-lua.coffee index d80fae9..7b3a0ea 100644 --- a/lib/tabletopsimulator-lua.coffee +++ b/lib/tabletopsimulator-lua.coffee @@ -1214,13 +1214,13 @@ module.exports = TabletopsimulatorLua = if atom.config.get('tabletopsimulator-lua.loadSave.communicationMode') == 'disable' return # Confirm just in case they misclicked Save & Play - remote.dialog.showMessageBox(remote.getCurrentWindow(), { + promise = remote.dialog.showMessageBox(remote.getCurrentWindow(), { type: 'info', normalizeAccessKeys: true, message: 'Get Lua Scripts from game?' detailedMessage: 'This will erase any changes that you have made in Atom since the last Save & Play.' buttons: ['Get Scripts', 'Cancel'] - }).then((event) -> + }).then (event) => if event.response == 0 #destroyTTSEditors() #deleteCachedFiles() @@ -1228,8 +1228,9 @@ module.exports = TabletopsimulatorLua = log LOG_MSG, "Get Lua Scripts: Sending request to TTS..." #if not TabletopsimulatorLua.if_connected TabletopsimulatorLua.startConnection() - TabletopsimulatorLua.connection.wri - ) + TabletopsimulatorLua.connection.write '{ messageID: ' + ATOM_MSG_GET_SCRIPTS + ' }' + log LOG_MSG, "Sent." + # hack needed because atom 1.19 makes save() async blocking_save: (editor) => @@ -1298,11 +1299,8 @@ module.exports = TabletopsimulatorLua = @blocking_save(editor).then (buffer) => log LOG_MSG, buffer.getPath() savedFiles += 1 - if savedFiles == openFiles + if savedFiles == openFiles # Only process the files once we've saved them all. log LOG_MSG, "All done!" - # This is a horrible hack I feel - we see how many editors are open, then - # run this block after each save, but only do the below code if the - # number of files we have saved is the number of files open. Urgh. # Read all files into JSON object @luaObjects = {} diff --git a/package.json b/package.json index 4e36d45..31ae175 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tabletopsimulator-lua", "main": "./lib/tabletopsimulator-lua", - "version": "12.4.1", + "version": "12.4.2", "description": "Official plugin for Tabletop Simulator's Lua Scripting.", "keywords": [ "tabletop",