Short circuit unnecessary repetition

This commit is contained in:
David Rowe 2018-09-29 16:00:44 +12:00
parent 9dfbaa9201
commit 7560a2a923

View file

@ -802,7 +802,15 @@ Script.include("/~/system/libraries/controllers.js");
Picks.disablePick(_this.teleportHandCollisionPick);
};
this.teleportState = "";
this.setTeleportState = function (mode, visibleState, invisibleState) {
var teleportState = mode + visibleState + invisibleState;
if (teleportState === this.teleportState) {
return;
}
this.teleportState = teleportState;
var visible = visibleState === "teleport";
if (visible) {
Selection.enableListHighlight(this.teleporterSelectionName, this.TELEPORTER_SELECTION_STYLE);