Skip to content

Commit

Permalink
Make plugin disabled by default, with an option to enable it
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dseomn committed Jun 20, 2022
1 parent 33e27f4 commit d99e279
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion pathfinding-workarounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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',
Expand Down

0 comments on commit d99e279

Please sign in to comment.