From d99e279b87054155fba557e3eb73da94aebfb21b Mon Sep 17 00:00:00 2001 From: David Mandelberg Date: Mon, 20 Jun 2022 16:50:31 -0400 Subject: [PATCH] Make plugin disabled by default, with an option to enable it Any workarounds for pathfinding issues are just that, workarounds. They obscure potentially real issues in a park, like disconnected paths. I still find this plugin useful in specific cases where pathfinding is working really poorly for a lot of guests, but in general I don't think it makes sense for this plugin to be enabled by default for all parks. --- pathfinding-workarounds.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/pathfinding-workarounds.js b/pathfinding-workarounds.js index 69a2531..1648cac 100644 --- a/pathfinding-workarounds.js +++ b/pathfinding-workarounds.js @@ -14,7 +14,15 @@ * limitations under the License. */ +const PLUGIN_NAME = 'Pathfinding Workarounds'; + +var enabled = false; + function helpLostGuests() { + if (!enabled) { + return; + } + var guestsRemoved = 0; map.getAllEntities('guest').forEach(function(guest) { if (!guest.isInPark || !guest.isLost) { @@ -35,12 +43,36 @@ function helpLostGuests() { console.log('Removed ' + guestsRemoved + ' lost guests.'); } +function showSettings() { + ui.openWindow({ + classification: PLUGIN_NAME, + width: 220, + height: 40, + title: PLUGIN_NAME, + widgets: [ + { + type: 'checkbox', + x: 10, + y: 20, + width: 200, + height: 10, + text: 'Enable pathfinding workarounds', + isChecked: enabled, + onChange: function(isChecked) { enabled = isChecked; }, + }, + ], + }); +} + function main() { context.subscribe('interval.day', helpLostGuests); + if (typeof ui !== 'undefined') { + ui.registerMenuItem(PLUGIN_NAME, showSettings); + } } registerPlugin({ - name: 'Pathfinding Workarounds', + name: PLUGIN_NAME, version: '0', authors: ['David Mandelberg'], type: 'remote',