mako.ac
0
0
var livery_update = aircraft.livery_update.new("Aircraft/Mako/Models/Liveries");
#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[3]", landingSwitch),
mpVar.new(mpPath~"sim/multiplay/generic/int[4]", taxiSwitch),
mpVar.new(mpPath~"sim/multiplay/generic/int[4]", probeSwitch),
mpVar.new(mpPath~"sim/multiplay/generic/int[0]", whiteSwitch),
];
#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");
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();
material
sim/model/livery
fuselage
canopy.frontframe
canopy.backframe
fin
rudder
turbine
left.taileron
right.taileron
left.flaperon
right.flaperon
left.missiletrain
right.missiletrain
left.slat
right.slat
shortcenterpylon
left.pilon0
right.pilon0
left.pilon1
right.pilon1
center.pilon
left.geardoor
right.geardoor
main.geardoorleft
main.geardoorright
spoiler0
spoiler1
texture
Liveries/Default.png
shader
chrome
Aircraft/Generic/Effects/glass_shader.png
canopy.backbubble
canopy.frontbubble1
canopy.frontbubble0
Effects/model-transparent
canopy.backbubble
canopy.frontbubble1
canopy.frontbubble0
cockpit
Aircraft/Mako/Models/cockpit.xml
-7.9
0
-1.7
-0.5
gear
Aircraft/Mako/Models/gear.xml
-7.9
0
-1.7
-0.5
translate
canopy.frontframe
canopy.frontbubble0
canopy.frontbubble1
/instrumentation/doors/crew/position-norm
-1.1
1.0
0.0
0.0
translate
canopy.backframe
canopy.backbubble
/instrumentation/doors/crew/position-norm
1.1
1.0
0.0
0.0
translate
canopy.backframe
canopy.backbubble
/instrumentation/doors/crew/position-norm
0.2
0.0
0.0
1.0
rotate
left.flaperon
surface-positions/flap-pos-norm
-20
1.85
-1.2
0.3
2.2
-3.616
0.3
rotate
right.flaperon
surface-positions/flap-pos-norm
20
1.85
1.2
0.3
2.2
3.616
0.3
rotate
left.taileron
surface-positions/left-taileron-pos-norm
15
4.5
-0.95
0.1
0
1
0
rotate
right.taileron
surface-positions/right-taileron-pos-norm
15
4.5
0.95
0.1
0
1
0
rotate
rudder
/surface-positions/rudder-pos-norm
-20
4.3
0
1.11
4.66
0
2.61
rotate
spoiler0
surface-positions/speedbrake-pos-norm
30
0
-0.55
-0.245
0.94
-0.56
-0.4667
0.58
rotate
spoiler1
surface-positions/speedbrake-pos-norm
-30
0
-0.55
0.245
0.94
-0.56
0.4667
0.58
rotate
left.slat
surface-positions/slat-pos-norm
-25
-0.47
-1.56
0.31
1.42
-3.6
0.28
>
rotate
right.slat
surface-positions/slat-pos-norm
-25
-0.47
1.56
0.31
1.42
3.6
0.28
>
rotate
main.geardoorleft
gear/gear[0]/position-norm
0.0
0
0.1
-90
1.0
-90
3.221
-0.346
1.081
1
0
0
rotate
main.geardoorright
gear/gear[0]/position-norm
0.0
0
0.1
90
1.0
90
3.221
0.346
1.081
1
0
0
rotate
left.geardoor
gear/gear[1]/position-norm
0.0
0
0.01
-90
1.0
-90
8.193
-1.219
1.649
1
0
0
rotate
right.geardoor
gear/gear[2]/position-norm
0.0
0
0.01
90
1.0
90
8.193
1.219
1.649
1
0
0
Aircraft/Mako/Models/Effects/Afterburner/EJ200-L.xml
6.85
0
0.1
Aircraft/Mako/Models/Effects/nozzles/Nozzles.xml
-8.83
0.95
0.3
Aircraft/Mako/Models/Effects/Tiptrail/Tiptrail.xml
2
4.04
0.4
Aircraft/Mako/Models/Effects/Tiptrail/Tiptrail.xml
2
-4.04
0.4
Aircraft/Mako/Models/Effects/smoke/smokeL.xml
6
0.00
0.2
Aircraft/Mako/Models/Effects/trail/trailL.xml
24
0.00
0.2
Aircraft/Mako/Models/Effects/Vapour/Vapour.xml
-1
0.00
1.0
Aircraft/Mako/Models/Effects/Vapour/Vapour2.xml
2.5
-2.5
0.8
Aircraft/Mako/Models/Effects/Vapour/Vapour2.xml
2.5
2.5
0.8