as350a.ac
Aircraft/AS350/Sounds/mp-sound.xml
var livery_update = aircraft.livery_update.new("Aircraft/AS350/Models/liveries", 30);
var self = cmdarg();
var aliases = [];
for (var i = 0; i < 6; i += 1) {
var door = self.getNode("sim/model/bo105/doors/door[" ~ i ~ "]/position-norm", 1);
var generic = self.getNode("sim/multiplay/generic/float[" ~ i ~ "]", 1);
door.alias(generic);
append(aliases, door);
}
aircraft.data.add(
"instrumentation/kma20/test",
"instrumentation/kma20/auto",
"instrumentation/kma20/com1",
"instrumentation/kma20/com2",
"instrumentation/kma20/nav1",
"instrumentation/kma20/nav2",
"instrumentation/kma20/adf",
"instrumentation/kma20/dme",
"instrumentation/kma20/mkr",
"instrumentation/kma20/sens",
"instrumentation/kma20/knob"
);
#if you're just using the pack, change the values according to the MP bindings in the -set.xml file
#you don't need to delete the entries if the path is nil - it gets skipped automatically and the MP path is just ignored
var mirrorValues = [
mpVar.new(mpPath~"sim/multiplay/generic/int[7]", mpPath~"sim/crashed"),
mpVar.new(mpPath~"sim/multiplay/generic/int[0]", navSwitch),
mpVar.new(mpPath~"sim/multiplay/generic/int[1]", beaconSwitch),
mpVar.new(mpPath~"sim/multiplay/generic/int[1]", strobeSwitch),
mpVar.new(mpPath~"sim/multiplay/generic/int[2]", landingSwitch),
mpVar.new(mpPath~"sim/multiplay/generic/int[3]", taxiSwitch),
mpVar.new(mpPath~"sim/multiplay/generic/int[3]", probeSwitch),
mpVar.new(mpPath~"sim/multiplay/generic/int[0]", whiteSwitch),
mpVar.new(mpPath~"sim/multiplay/generic/int[8]", searchSwitch),
];
#loop at the default MP transfer frequency (10Hz)
var mirrorTimer = maketimer(0.1, func {
foreach(var mir; mirrorValues) {
mir.check();
}
});
mirrorTimer.start();
#### NAV LIGHTS ####
#class for a periodic fade in/out animation - for flashing, use rather standard aircraft.light.new(), as in Beacon and Strobe section
var lightCycle = {
#constructor
new: func(propSwitch, propOut) {
m = { parents: [lightCycle] };
props.globals.initNode(propOut, 0, "DOUBLE");
props.globals.initNode(propSwitch, 1, "BOOL");
m.fadeIn = 0.4 + rand()*0.05-0.025; #fade in time
m.fadeOut = 0.4 + rand()*0.05-0.025; #fade out time
m.stayOn = 1.5 + rand()*0.05-0.025; #stable on period
m.stayOff = 1 + rand()*0.05-0.025; #stable off period
m.turnOff = 0.12; #fade out time when turned off
m.phase = 0; #phase to be run on next timer call: 0 -> fade in, 1 -> stay on, 2 -> fade out, 3 -> stay off
m.cycleTimer = maketimer(0.1, func {
if(getprop(propSwitch)) {
if(m.phase == 0) {
interpolate(propOut, 1, m.fadeIn);
m.phase = 1;
m.cycleTimer.restart(m.fadeIn);
}
else if(m.phase == 1){
m.phase = 2;
m.cycleTimer.restart(m.stayOn);
}
else if(m.phase == 2){
interpolate(propOut, 0, m.fadeOut);
m.phase = 3;
m.cycleTimer.restart(m.fadeOut);
}
else if(m.phase == 3){
m.phase = 0;
m.cycleTimer.restart(m.stayOff);
}
}
else {
interpolate(propOut, 0, m.turnOff); #kills any currently ongoing interpolation
m.phase = 0;
}
});
m.cycleTimer.singleShot = 1;
if(propSwitch==nil) {
m.listen = nil;
return m;
}
m.listen = setlistener(propSwitch, func{m.cycleTimer.restart(0);}); #handle switch changes
m.cycleTimer.restart(0); #start the looping
return m;
},
#destructor
del: func {
if(me.listen!=nil) removelistener(me.listen);
me.cycleTimer.stop();
},
};
#By default, the switch property is initialized to 1 (only if no value is already assigned). Don't change the class implementation! To override this, set the property manually. You don't need to care if any other code already does it for you.
var navLights = nil;
if(!navStillOn) {
navLights = lightCycle.new(navSwitch, lightsPath~"nav-lights-intensity");
### Uncomment and tune those to customize times ###
#navLights.fadeIn = 0.4; #fade in time
#navLights.fadeOut = 0.4; #fade out time
#navLights.stayOn = 3 + rand()*0.05-0.025; #stable on period
#navLights.stayOff = 0.6; #stable off period
#navLights.turnOff = 0.12; #fade out time when turned off
}
### BEACON ###
var beacon = nil;
if(beaconSwitch!=nil) {
props.globals.initNode(beaconSwitch, 1, "BOOL");
beacon = aircraft.light.new(lightsPath~"beacon-state",
[0.0, 1.0 + rand()*0.05-0.025], beaconSwitch);
}
### STROBE ###
var strobe = nil;
if(strobeSwitch!=nil) {
props.globals.initNode(strobeSwitch, 1, "BOOL");
strobe = aircraft.light.new(lightsPath~"strobe-state",
[0.0, 0.87 + rand()*0.05-0.025], strobeSwitch);
}
### LIGHT FADING ###
#class for controlling fade in/out behavior - propIn is a control property (handled as a boolean) and propOut is interpolated
#all light brightness animations in xmls depend on propOut (Rembrandt brightness, material emission, flares transparency, ...)
var lightFadeInOut = {
#constructor
new: func(propSwitch, propOut) {
m = { parents: [lightFadeInOut] };
m.fadeIn = 0.3; #some sane defaults
m.fadeOut = 0.4;
if(propSwitch==nil) {
m.listen = nil;
return m;
}
props.globals.initNode(propSwitch, 1, "BOOL");
m.isOn = getprop(propSwitch);
props.globals.initNode(propOut, m.isOn, "DOUBLE");
m.listen = setlistener(propSwitch,
func {
if(m.isOn and !getprop(propSwitch)) {
interpolate(propOut, 0, m.fadeOut);
m.isOn = 0;
}
if(!m.isOn and getprop(propSwitch)) {
interpolate(propOut, 1, m.fadeIn);
m.isOn = 1;
}
}
);
return m;
},
#destructor
del: func {
if(me.listen!=nil) removelistener(me.listen);
},
};
fadeLanding = lightFadeInOut.new(landingSwitch, lightsPath~"landing-lights-intensity");
fadeLanding = lightFadeInOut.new(searchSwitch, lightsPath~"search-lights-intensity");
fadeTaxi = lightFadeInOut.new(taxiSwitch, lightsPath~"taxi-light-intensity");
fadeProbe = lightFadeInOut.new(probeSwitch, lightsPath~"probe-light-intensity");
fadeWhite = lightFadeInOut.new(whiteSwitch, lightsPath~"white-light-intensity");
if(navStillOn) {
navLights = lightFadeInOut.new(navSwitch, lightsPath~"nav-lights-intensity");
navLights.fadeIn = 0.1;
navLights.fadeOut = 0.12;
}
#manipulate times if defaults don't fit your needs:
#fadeLanding.fadeIn = 0.5;
#fadeLanding.fadeOut = 0.8;
### the rest of your model load embedded Nasal code ###
]]>
#prevent multiple timers and listeners from running and fighting on next connect
#cleanly destroy MP property mirroring
mirrorTimer.stop();
mirrorTimer = nil;
mirrorValues = nil;
#cleanly destroy nav lights
if(navStillOn) {
navLights.del();
}
else {
if(navSwitch!=nil) setprop(navSwitch, 0);
navLights.del();
if(navSwitch!=nil) navLights.cycleTimer = nil;
navLights = nil;
}
#cleanly destroy beacon
if(beaconSwitch!=nil) setprop(beaconSwitch, 0);
beacon.del();
beacon = nil;
#cleanly destroy strobe
if(strobeSwitch!=nil) setprop(strobeSwitch, 0);
strobe.del();
strobe = nil;
#cleanly destroy light fade in/out animation objects
fadeLanding.del();
fadeTaxi.del();
fadeProbe.del();
fadeWhite.del();
### the rest of your model unload embedded Nasal code ###
livery_update.stop();
foreach (var a; aliases)
a.unalias();
searchlightx.unalias();
searchlightz.unalias();
rope.unalias();
Aircraft/AS350/Models/Effects/reflect-uber1
Door_L_2
Door_R_1
Front_Door_L_pivot_2
fuselage-main.001
fuselage-main
Aircraft/AS350/Models/Effects/reflect-uber2
fuselage-mid
mirrors_1
Aircraft/AS350/Models/Effects/reflect-uber3
fuselage_tail
Aircraft/AS350/Models/Effects/reflect-uber4
fuselage_9a
fuselage_9
material
Door_L_2
Door_R_1
Front_Door_L_pivot_2
fuselage-main.001
fuselage-main
mirrors_3
sim/model/livery
texture1
as350b_01.jpg
material
fuselage-mid
mirrors_1
sim/model/livery
texture2
as350b_02.jpg
material
fuselage_tail
sim/model/livery
texture3
as350b_03.jpg
material
fuselage_9a
fuselage_9
sim/model/livery
texture4
as350b_04.jpg
material
MainHub
blade1-1
blade2-1
blade3-1
blade1-2
blade2-2
blade3-2
blade1-3
blade2-3
blade3-3
blade1-4
blade2-4
blade3-4
sim/model/livery
blades
as350b_05.jpg
material
blurred1
blurred2
blurred3
sim/model/livery
blur
rotorblur.png
fuselage_tail
fuselage-main
fuselage
fuselage_13
fuselage_0
Door_L_2
Front_Door_L_pivot_2
fuselage_9
Door_R_1
fuselage_6
fuselage_9
mirrors_3
blades
fuselage-main.001
Effects/model-transparent
sim/rendering/rembrandt/enabled
blurred
propblur
propdisc
Aircraft/AS350/Models/Effects/bk117reflectglas-uber
cockpitglass
right-rear-glass
Door_L_0-glass
right-f-door-glass
left-f-door-glass
mirrors_3
Effects/glass
cockpitglassin
right-rear-glassin
Door_L_0-glassin
right-f-door-glasin
left-f-door-glassin
Aircraft/AS350/Models/Interior/panel.xml
2.021
0
0.66
0
Aircraft/AS350/Models/Interior/Instruments/Engineswitch/engineswitch.xml
-1.96
0.085
1.183
100
180
select
pilot1
sim/current-view/view-number
0
select
pilot1
sim/current-view/view-number
12
select
crew1
sim/current-view/view-number
10
main-rotor
Aircraft/AS350/Models/mainrotor/mainrotor.xml
0.000
0.000
0
Aircraft/AS350/Models/TailRotor/tailrotor.xml
6.1
0.373
0.7
90
0
180
scale
constants/zero
0.76
0.76
0.76
Aircraft/AS350/Models/Lights/LightPack.xml
0
0
0
mainrotors_dirt
Aircraft/AS350/Models/Effects/particle/rotor_particle.xml
0.000
0.000
0.700
door_front_L
Front_Door_L_pivot_2
Front_Door_L_pivot_1
Front_Door_L_pivot_0
left-f-door-glass
left-f-door-glassin
Front_Door_L_pivo
door_front_R
Door_R_1
Door_R_2
Door_R_0
right-f-door-glass
right-f-door-glasin
door_back_R
fuselage_6.001
fuselage-main.001
right-rear-glass
right-rear-glassin
door_back_L
Door_L_2
Door_L_1
Door_L_0
Door_L_0-glassin
Door_L_0-glass
reardoor_R
door_cabin02.001
door_cabin01.001
pick
door_front_R
nasal
pick
door_front_L
nasal
pick
door_back_R
nasal
pick
door_back_L
nasal
pick
reardoor_R
nasal
select
door_front_R
sim/model/bo105/doors/door[0]/enabled
sim/aircraft
bo105
select
door_front_L
sim/model/bo105/doors/door[1]/enabled
sim/aircraft
bo105
select
door_back_R
sim/model/bo105/doors/door[2]/enabled
sim/aircraft
bo105
select
door_back_L
sim/model/bo105/doors/door[3]/enabled
sim/aircraft
bo105
select
reardoor_R
sim/model/bo105/doors/door[4]/enabled
sim/aircraft
bo105
rotate
door_front_R
sim/model/bo105/doors/door[0]/position-norm
100
-2.52
0.85
0.3
-2.2
0.75
0.88
rotate
door_front_L
sim/model/bo105/doors/door[1]/position-norm
-100
-2.52
-0.85
0.3
-2.2
-0.75
0.88
rotate
door_back_R
sim/model/bo105/doors/door[2]/position-norm
90
-0.6
0.8
0.66
-0.8
0.88
0
rotate
door_back_L
sim/model/bo105/doors/door[3]/position-norm
3.5
-1.01714
16.3654
0
0.0
0
1
rotate
reardoor_R
sim/model/bo105/doors/door[4]/position-norm
90
-2.35
0.55
-0.155
-1.85
0.55
-0.175
rotate
rotorbrake
controls/rotor/brake
60
0
-1
0
-2.16
0
1.145
pick
rotorbrake
true
nasal
rotate
powerlever
controls/engines/engine/cutoff
-40
-2.16
0
1.145
0
1
0
pick
powerlever
false
property-toggle
controls/engines/engine/cutoff
property-toggle
controls/engines/engine[1]/cutoff
Aircraft/AS350/Models/payload/loads.xml
0
0
0
select
fuselage_13
sim/multiplay/generic/string[2]
Floatation_System