Skip to content

Commit

Permalink
Merge pull request #498 from HHS81/Issue_497_FGCameraCompat
Browse files Browse the repository at this point in the history
Add FGCamera compatibility
  • Loading branch information
hbeni authored Jan 9, 2023
2 parents 712ebb2 + b1cf4c9 commit 84f9420
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Nasal/c182s.nas
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,25 @@ setlistener("/sim/signals/fdm-initialized", func {

# Alias standard crashed property
setlistener("/engines/engine/crashed", func(n) {setprop("/sim/crashed", n.getBoolValue());});


#
# FGCamera compatibility (https://wiki.flightgear.org/FGCamera#Aircraft_integration_API)
# - Open the door on the C182S/T when getting out or in:
#
if (addons.isAddonLoaded("a.marius.FGCamera")) {
fgcamera.walker.getOutCallback = func {
fgcamera.walker.getOutTime = getprop("/sim/model/door-positions/DoorL/opened") == 0 ? 2 : 0;
c182s.DoorL.open();
};

fgcamera.walker.getInCallback = func {
view.setViewByIndex(110); # so we stay outside (under the hood we are already switched one frame into the pilot seat, which we must roll back)
fgcamera.walker.getInTime = getprop("/sim/model/door-positions/DoorL/opened") == 0 ? 2 : 0;
#c182s.DoorL.close();
};
print("C182 FGCamera integration loaded");
}

});

Expand Down

0 comments on commit 84f9420

Please sign in to comment.