Repository
https://github.com/HerbyW/DC-10-Air-Tanker
Introduction
FlightGear (http://www.flightgear.org) is an open source flight simulator that is even used in flight schools to train basic maneuvers, radio communication and navigation tasks. It is available for windows, mac and linux.
In this article I want to go through the latest 3 commits I made to further improve my new development of the McDonnell Douglas DC-10-30 Air Tanker, this version is used for fire fighting with water or retardant.
New Features
Adding the new instruments for retardant control with all animations
https://github.com/HerbyW/DC-10-Air-Tanker/commit/0c271a92cc47a997a73cc3c0829236d66538797f
Finally I found 2 videos on youtube with the instruments in the cockpit used for firefighting. There is one at the engineers panel and one in the middle of the cockpit. Watching them carefully and putting the information together I was able to decide what switches I need and what they do.
With Blender I made the 3D models, with scribus the liveries and in xml-files I wrote the animation descriptions for each switch and button.
This is the final result, the model implemented in the cockpit:
You see 3 open property browsers with the properties of all switches and buttons, and they are showing what is set in the cockpit by clicking with the mouse. As example one more picture with different positions of switches and therefore different property values.
I am very happy with the result! As there is no engineers panel in the model I put them both in the middle console of the cockpit, so it is easy to handle them from the pilot seat.
Implementation of Multiplayer firefighting action, more cleaning code
https://github.com/HerbyW/DC-10-Air-Tanker/commit/4beee5fa0d2b7e6525a8bdc222c353a0d4601d09
The next step was to go again into detail to the FDM (flight dynamic model)and change some values of fuselage elements, also to add the water tank as a element of producing drag during flight.
<fuselage ax="12.90" ay="0.0" az="1.42" bx="10.90" by="0.0" bz="1.42" width="1.96" taper="0.5" midpoint="1" />
<fuselage ax="10.90" ay="0.0" az="1.42" bx="-4.12" by="0.0" bz="1.42" width="1.96" taper="1.0" midpoint="0.5" />
<fuselage ax="-4.12" ay="0.0" az="1.42" bx="-6.12" by="0.0" bz="1.42" width="1.96" taper="0.5" midpoint="0" />
As more information was gathered about the aircraft I found out that both of the center tanks are not used in this variant, so I set them to 100 lbs to let them be here but without any usage.
The code of the main-set.xml file was going to be unreadable due to all-in writing and as in all of my aircraft I split it up in different files for help, views, keyboard, flightrecorder and menu.
The last step was the basic implementation of multiplayer functionality for fire fighting action:
Shift+Strg+MouseClick in the scenery will now set up a fire, you may make as much as you want, but be aware that they are spreading depending on the surface and you have to fight very bravely to hold them in control. This part is done with nasal scripting like this:
# make fire with Strg+Shift+MouseClick
setlistener("/sim/signals/click", func {
if (__kbd.shift.getBoolValue()) {
if (__kbd.ctrl.getBoolValue()) {
var click_pos = geo.click_position();
wildfire.ignite(click_pos);
setprop("/sim/messages/copilot", "Wildfire in new spot detected!");
}
}
});
Deleting fire, or setting ground to incombustible is done with this code:
# Retardant system control for deleting fires, MP-retardant will be active 4.5 seconds after start, so it looks like real!
# create timer with 2 second interval
var retardant = maketimer(2, func
{
if (getprop("/sim/model/dc10/retardant") > 0)
{
var drop_pos = geo.aircraft_position();
settimer( func { wildfire.resolve_retardant_drop(drop_pos, 40, 1); }, 4.5);
}
}
);
# start the timer (with 2 second interval)
retardant.start();
Retardant computer programming ready for test! All functions to set in the cockpit!
https://github.com/HerbyW/DC-10-Air-Tanker/commit/c135a13516f3ea131fb3b004000d10daa24fba8d
The final result is visible here:
After setting the values for quantity (from 25-100% of the overall amount of retardant available) and coverage level (thickness or density of retardant which reaches the ground) manually for each of the 3 water tanks and then pressing the release button it makes what it should! A message is coming up to confirm the action.
Programming a computer is tricky, but after some hours the logic became clear and then the coding was not to difficult.
You may look into the code, I try to make it clear to understand with lots of comments. Some bugs are still there and need further thinking but the basics are working very well now.
https://github.com/HerbyW/DC-10-Air-Tanker/blob/master/Nasal/firefighting.nas
Roadmap
Next will be the further improvement of fire fighting action like retardant coverage on ground depending on the coverage level and animation of refilling on ground with some vehicles.
How to contribute?
Pull request to my github repository or direct contact via Mumble FlightGear Chat.
GitHub Account
https://github.com/HerbyW
It contains my real name, my git username, my steemit username and my callsign in the multiplayer.