diff --git a/Models/Interior/Instruments/Smart/dashboard1.png b/Models/Interior/Instruments/Smart/dashboard1.png new file mode 100644 index 0000000..6c9ece4 Binary files /dev/null and b/Models/Interior/Instruments/Smart/dashboard1.png differ diff --git a/Models/Interior/Instruments/Smart/dashboard1.svg b/Models/Interior/Instruments/Smart/dashboard1.svg new file mode 100644 index 0000000..7814d42 --- /dev/null +++ b/Models/Interior/Instruments/Smart/dashboard1.svg @@ -0,0 +1 @@ +dashboard1 \ No newline at end of file diff --git a/Models/followmeEV.xml b/Models/followmeEV.xml index 75f6529..e5ccff7 100644 --- a/Models/followmeEV.xml +++ b/Models/followmeEV.xml @@ -48,6 +48,15 @@ Aircraft/followme_e-tron/Models/Interior/race/interior.xml + + + + sim/multiplay/generic/string[3] + 404Design + + + Aircraft/followme_e-tron/Models/Interior/404Design/interior.xml + material diff --git a/Nasal/SmartInstruments.nas b/Nasal/SmartInstruments.nas new file mode 100644 index 0000000..2785a11 --- /dev/null +++ b/Nasal/SmartInstruments.nas @@ -0,0 +1,152 @@ +var smartInstruments = canvas.new({ + "name": "smartInstruments", # The name is optional but allow for easier identification + "size": [1024, 1024], # Size of the underlying texture (should be a power of 2, required) [Resolution] + "view": [1509, 736], # Virtual resolution (Defines the coordinate system of the canvas [Dimensions] + # which will be stretched the size of the texture, required) + "mipmapping": 0 # Enable mipmapping (optional) +}); +smartInstruments.addPlacement({"node": "instrumentScreen"}); + +var group = smartInstruments.createGroup(); + +canvas.parsesvg( + group, + "Aircraft/followme_e-tron/Models/Interior/Instruments/Smart/dashboard1.svg", +); + +#Background +var path = "Aircraft/followme_e-tron/Models/Interior/Instruments/Smart/dashboard1.png"; +# create an image child for the texture +var backgroundImage = group.createChild("image") + .setFile(path) + .setTranslation(0, 0) + .setSize(1509, 736); + +# Create a text element and set some values(Self test) +var selfTestText = group.createChild("text", "optional-id-for element") + .setTranslation(530, 140) # The origin is in the top left corner + .setAlignment("left-center") # All values from osgText are supported (see $FG_ROOT/Docs/README.osgtext) + .setFont("ExoRegular-ymMe.ttf") # Fonts are loaded either from $AIRCRAFT_DIR/Fonts or $FG_ROOT/Fonts + .setFontSize(50) # Set fontsize and optionally character aspect ratio + .setColor(1,0,0) # Text color + .setText("SELF TEST NORMAL") + .show(); + +selfTestText.hide(); + + +#//speedometer +var speedometer = group.createChild("text", "optional-id-for element") + .setTranslation(1205, 380) # The origin is in the top left corner + .setAlignment("center-center") # All values from osgText are supported (see $FG_ROOT/Docs/README.osgtext) + .setFont("trueno-font/Trueno-wml2.ttf") # Fonts are loaded either from $AIRCRAFT_DIR/Fonts or $FG_ROOT/Fonts + .setFontSize(148) # Set fontsize and optionally character aspect ratio + .setColor(1,1,1) # Text color + .setText("--"); +speedometer.show(); +speedometer.enableUpdate(); + +#//power +var power = group.createChild("text", "optional-id-for element") + .setTranslation(295, 380) # The origin is in the top left corner + .setAlignment("center-center") # All values from osgText are supported (see $FG_ROOT/Docs/README.osgtext) + .setFont("trueno-font/Trueno-wml2.ttf") # Fonts are loaded either from $AIRCRAFT_DIR/Fonts or $FG_ROOT/Fonts + .setFontSize(148) # Set fontsize and optionally character aspect ratio + .setColor(1,1,1) # Text color + .setText("--"); +power.show(); +power.enableUpdate(); + +#//Drive Mode +var driveMode = group.createChild("text", "optional-id-for element") + .setTranslation(780, 628) # The origin is in the top left corner + .setAlignment("center-center") # All values from osgText are supported (see $FG_ROOT/Docs/README.osgtext) + .setFont("ExoRegular-ymMe.ttf") # Fonts are loaded either from $AIRCRAFT_DIR/Fonts or $FG_ROOT/Fonts + .setFontSize(40) # Set fontsize and optionally character aspect ratio + .setColor(1,1,1) # Text color + .setText("Performance"); +driveMode.show(); +driveMode.enableUpdate(); + +#//Gear +var gearDisplay = group.createChild("text", "optional-id-for element") + .setTranslation(940, 620) # The origin is in the top left corner + .setAlignment("center-center") # All values from osgText are supported (see $FG_ROOT/Docs/README.osgtext) + .setFont("ExoRegular-ymMe.ttf") # Fonts are loaded either from $AIRCRAFT_DIR/Fonts or $FG_ROOT/Fonts + .setFontSize(70) # Set fontsize and optionally character aspect ratio + .setColor(1,1,1) # Text color + .setText("D"); +gearDisplay.show(); +gearDisplay.enableUpdate(); + +#//Temperature +var tempDisplay = group.createChild("text", "optional-id-for element") + .setTranslation(420, 220) # The origin is in the top left corner + .setAlignment("left-center") # All values from osgText are supported (see $FG_ROOT/Docs/README.osgtext) + .setFont("ExoRegular-ymMe.ttf") # Fonts are loaded either from $AIRCRAFT_DIR/Fonts or $FG_ROOT/Fonts + .setFontSize(30) # Set fontsize and optionally character aspect ratio + .setColor(1,1,1) # Text color + .setText("30 °C"); +tempDisplay.show(); +tempDisplay.enableUpdate(); + +#//Time +var timeDisplay = group.createChild("text", "optional-id-for element") + .setTranslation(1055, 215) # The origin is in the top left corner + .setAlignment("right-center") # All values from osgText are supported (see $FG_ROOT/Docs/README.osgtext) + .setFont("ExoRegular-ymMe.ttf") # Fonts are loaded either from $AIRCRAFT_DIR/Fonts or $FG_ROOT/Fonts + .setFontSize(40) # Set fontsize and optionally character aspect ratio + .setColor(1,1,1) # Text color + .setText("9:41"); +timeDisplay.show(); +timeDisplay.enableUpdate(); +#props.getNode("/dev/smart/size", 1).setValue(30); +#props.getNode("/dev/smart/x", 1).setValue(520); +#props.getNode("/dev/smart/y", 1).setValue(220); + +var runtimeTextAdjust = func(text){ + var x = props.getNode("/dev/smart/x", 1).getValue(); + var y = props.getNode("/dev/smart/y", 1).getValue(); + text.setTranslation(x, y); + var siz = props.getNode("/dev/smart/size", 1).getValue(); + text.setFontSize(siz); +} + +var instrumentUpdate = func(){ + var currentSpeed = props.getNode("/", 1).getValue("sim/multiplay/generic/float[15]"); + var currentSpeedKMH = sprintf("%i", currentSpeed*1.852); + speedometer.updateText(currentSpeedKMH); + if(autospeed.active == 1){ + speedometer.setColor(0.34, 0.63, 1); + }else{ + speedometer.setColor(1, 1, 1); + } + power.updateText(sprintf("%i", engine.engine_1.activePower_kW)); + if(engine.engine_1.direction == 1){ + gearDisplay.updateText("D"); + }else if(engine.engine_1.direction == -1){ + gearDisplay.updateText("R"); + } + if(engine.engine_1.mode == 1){ + driveMode.updateText("Performance"); + }else if(engine.engine_1.mode == 0.65){ + driveMode.updateText("Comfort"); + }else if(engine.engine_1.mode == 0.4){ + driveMode.updateText("Low Power"); + } + + var tempC = props.getNode("/", 1).getValue("environment/temperature-degc"); + tempDisplay.updateText(sprintf("%0.1f", tempC)~" °C"); + var hour = props.getNode("/", 1).getValue("sim/time/real/hour"); + var minute = props.getNode("/", 1).getValue("sim/time/real/minute"); + if(minute == 0 or minute == "0") minute = "00"; + timeDisplay.updateText(hour~":"~minute); + #runtimeTextAdjust(timeDisplay); +} + +var updateTimer = maketimer(0.1, func instrumentUpdate()); +updateTimer.start(); + + +var window = canvas.Window.new([756,368],"dialog"); +window.setCanvas(smartInstruments); diff --git a/Nasal/systems.nas b/Nasal/systems.nas index 5809d62..98ddccc 100644 --- a/Nasal/systems.nas +++ b/Nasal/systems.nas @@ -69,6 +69,8 @@ props.getNode("systems/safety/aeb_activated", 1).setValue(0); props.getNode("systems/safety/aeb_on", 1).setValue(0); props.getNode("systems/auto_hold_enabled", 1).setValue(0); props.getNode("systems/auto_hold_working", 1).setValue(0); +props.getNode("controls/lighting/indicator/left_switch", 1).setValue(0); +props.getNode("controls/lighting/indicator/right_switch", 1).setValue(0); #var Led = { # @@ -140,6 +142,9 @@ var IndicatorController = { leftIndicator : Indicator.new("left"), rightIndicator : Indicator.new("right"), + leftIndicatorSwitchNode: props.getNode("/controls/lighting/indicator/left_switch", 1), + rightIndicatorSwitchNode: props.getNode("/controls/lighting/indicator/right_switch", 1), + mode:0, falseLight: 0, @@ -245,16 +250,22 @@ var IndicatorController = { if(isInternalView()) playAudio('IndicatorEnd.wav'); if(me.getMode() != 4){ me.setMode(4); + me.rightIndicatorSwitchNode.setValue(1); + me.leftIndicatorSwitchNode.setValue(0); }else if(me.getMode() == 4){ me.setMode(0); + me.rightIndicatorSwitchNode.setValue(0); } }, left_indicator_toggle : func(){ if(isInternalView()) playAudio('IndicatorEnd.wav'); if(me.getMode() != 5){ me.setMode(5); + me.leftIndicatorSwitchNode.setValue(1); + me.rightIndicatorSwitchNode.setValue(0); }else if(me.getMode() == 5){ me.setMode(0); + me.leftIndicatorSwitchNode.setValue(0); } }, diff --git a/followme_e-tron-main.xml b/followme_e-tron-main.xml index 6423c9d..16b6feb 100644 --- a/followme_e-tron-main.xml +++ b/followme_e-tron-main.xml @@ -116,6 +116,9 @@ + + + @@ -415,6 +418,9 @@ + + Aircraft/followme_e-tron/Nasal/SmartInstruments.nas + Aircraft/followme_e-tron/Nasal/engine.nas