Skip to content

Commit

Permalink
Fix view switch compatibility on 2020.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ShFsn committed Jan 15, 2023
1 parent 12b3a60 commit 1735a98
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Nasal/view.nas
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ var ver_calc = func () {
if ( version_req != 1 ) return 0;
else return 1;
}
var sim_next = ver_calc(); # Check if there's an availability to change view using number-raw

var forceView = func{
if( modview_active ) return; # Deny view modification if ~ pressed (sub view active)
Expand All @@ -68,17 +69,16 @@ var forceView = func{
if( n == 1 ) setprop("tu154/mod-views/copilot-view", 1);
else setprop("tu154/mod-views/copilot-view", 0);

var offset = getprop("tu154/mod-views/view-offset") + ver_calc();
if( n > 0 ) n = n + offset;
setprop("sim/current-view/view-number", n);
if( n > 0 ) n = sim_next == 1 ? n + 100 : n + getprop("tu154/mod-views/view-offset");
if (sim_next) setprop("sim/current-view/view-number-raw", n);
else setprop("sim/current-view/view-number", n);
#gui.popupTip(views[n].getNode("name").getValue());
};

var modView = func{
var n = getprop("sim/current-view/view-number");
var offset = getprop("tu154/mod-views/view-offset");
var n = getprop("sim/current-view/view-number-raw");
if( n == nil ) n = 0;
if( n > 0 ) n = n - offset - ver_calc();
if( n > 0 ) n = n - 100;
if( n < 0 ) return;
var mode = arg[0];
if( mode == nil ) mode = 0;
Expand Down

0 comments on commit 1735a98

Please sign in to comment.