R66.ac
var livery_update = aircraft.livery_update.new("Aircraft/Robinson-R66/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);
}
#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();
Aircraft/Robinson-R66/Sounds/raven-mp-sound.xml
material
fuse
patins2212
door
porteBD1
porteBD1.001
porteAD1
porteAD1.001
porteAG1.001
porteAG1
porteBG1.001
porteBG1
sim/model/livery
texture
texture.png
Aircraft/Robinson-R66/Models/Effects/reflect-uber
fuse
patins2212
door
porteBD1
porteBD1.001
porteAD1
porteAD1.001
porteAG1.001
porteAG1
porteBG1.001
porteBG1
Aircraft/Robinson-R66/Models/Effects/bk117reflectglas-uber
vitres
vitreAD
vitreBD
vitreAG
vitreBG
select
vitres
vitreAD
vitreBD
vitreAG
vitreBG
sim/current-view/internal
false
noshadow
vitres
verrelampe
vitreAG
vitreAD
vitreBG
vitreBD
vitresin
vitreAGin
vitreADin
vitreBG
vitreBDin
Effects/glass
vitresin
vitreAGin
vitreADin
vitreBGin
vitreBDin
select
vitresin
vitreAGin
vitreADin
vitreBGin
vitreBDin
sim/current-view/internal
true
Interieur
Aircraft/Robinson-R66/Models/Interior/interior.xml
noshadow
Interieur
Aircraft/Robinson-R66/Models/MainRotor/mainrotor.xml
-0.17
0.017
1.67
Aircraft/Robinson-R66/Models/TailRotor/tailrotor.xml
5.75
-0.247
0.6
90
PorteAvantGauche
porteAG
windowFR
PorteAvantDroite
porteAD
windowFL
PorteArriereGauche
porteBG
windowRR
PorteArriereDroite
porteBD
windowRL
pick
PorteAvantGauche
false
nasal
rotate
PorteAvantGauche
instrumentation/doors/Lcrew/position-norm
-80
-3.795
-0.607
-0.603
-3.631
-0.625
-0.266
pick
PorteAvantDroite
false
nasal
rotate
PorteAvantDroite
instrumentation/doors/Rcrew/position-norm
80
-3.795
0.607
-0.603
-3.631
0.625
-0.266
pick
PorteArriereGauche
false
nasal
rotate
PorteArriereGauche
instrumentation/doors/Lpassenger/position-norm
-80
-3.181
-0.646
-0.726
-3.046
-0.666
-0.346
pick
PorteArriereDroite
false
nasal
rotate
PorteArriereDroite
instrumentation/doors/Rpassenger/position-norm
80
-3.181
0.646
-0.726
-3.046
0.666
-0.346
pick
RemoveRRDoor
false
property-toggle
sim/model/Robinson-R66/remove-door-rr
pick
RemoveRFDoor
false
property-toggle
sim/model/Robinson-R66/remove-door-rf
pick
RemoveLRDoor
false
property-toggle
sim/model/Robinson-R66/remove-door-lr
pick
RemoveLFDoor
false
property-toggle
sim/model/Robinson-R66/remove-door-lf
select
porteBD
windowRL
intporteBD
intvitreBD
sim/model/Robinson-R66/remove-door-rr
select
porteAD
windowFL
intporteAD
intvitreAD
sim/model/Robinson-R66/remove-door-rf
select
porteBG
windowRR
intporteBG
intvitreBG
sim/model/Robinson-R66/remove-door-lr
select
porteAG
windowFR
intporteAG
intvitreAG
sim/model/Robinson-R66/remove-door-lf