1
0
Fork 0
A320-family/Models/Instruments/Lower-ECAM/Lower-ECAM.nas

48 lines
1.4 KiB
Text
Raw Normal View History

2019-10-14 16:48:35 +00:00
# A3XX Lower ECAM Canvas
2021-07-05 21:17:20 +00:00
# Copyright (c) 2021 Josh Davidson (Octal450) and Jonathan Redpath
2019-10-14 16:48:35 +00:00
2021-07-05 21:17:20 +00:00
var SystemDisplayPageRecipient =
{
2021-07-06 13:00:27 +00:00
new: func(_ident)
2021-07-05 21:17:20 +00:00
{
var SDRecipient = emesary.Recipient.new(_ident);
2021-07-06 13:00:27 +00:00
SDRecipient.MainScreen = canvas_lowerECAM_base;
SDRecipient.Page = nil;
2021-07-05 21:17:20 +00:00
SDRecipient.Receive = func(notification)
{
2021-07-05 21:17:20 +00:00
if (notification.NotificationType == "FrameNotification")
{
2021-07-06 13:00:27 +00:00
if (SDRecipient.Page == nil) {
SDRecipient.Page = SystemDisplayPageRecipient.pageList.apu;
2021-07-05 21:17:20 +00:00
}
if (math.mod(notifications.frameNotification.FrameCount,2) == 0) {
2021-07-06 13:00:27 +00:00
SDRecipient.Page.update(notification);
2021-07-05 21:17:20 +00:00
}
return emesary.Transmitter.ReceiptStatus_OK;
}
2021-07-05 21:17:20 +00:00
return emesary.Transmitter.ReceiptStatus_NotProcessed;
2019-10-14 16:48:35 +00:00
};
2021-07-05 21:17:20 +00:00
return SDRecipient;
2019-10-14 16:48:35 +00:00
},
2021-07-06 13:00:27 +00:00
pageList: {
apu: canvas_lowerECAMPageApu.new("Aircraft/A320-family/Models/Instruments/Lower-ECAM/res/apu.svg"),
2021-07-06 13:00:27 +00:00
},
2019-10-14 16:48:35 +00:00
};
2021-07-06 13:00:27 +00:00
var A320SD = SystemDisplayPageRecipient.new("A320 SD");
emesary.GlobalTransmitter.Register(A320SD);
2021-07-05 21:17:20 +00:00
var input = {
2021-07-06 11:37:18 +00:00
gForce: "/accelerations/pilot-gdamped",
gForceDisplay: "/ECAM/Lower/g-force-display",
hour: "/sim/time/utc/hour",
minute: "/sim/time/utc/minute",
2021-07-05 21:17:20 +00:00
};
2019-10-14 16:48:35 +00:00
2021-07-05 21:17:20 +00:00
foreach (var name; keys(input)) {
2021-07-06 13:00:27 +00:00
emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("A320 System Display", name, input[name]));
2019-10-14 16:48:35 +00:00
}
setlistener("/systems/electrical/bus/ac-2", func() {
2021-07-06 13:00:27 +00:00
A320SD.MainScreen.powerTransient();
2021-07-05 21:17:20 +00:00
}, 0, 0);