bombableinclude.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <?xml version="1.0"?>
  2. <PropertyList>
  3. <!-- Nasal code -->
  4. <nasal>
  5. <load>
  6. <![CDATA[
  7. print("Loading VampireF3 ", cmdarg().getPath());
  8. var nodeName = cmdarg().getPath();
  9. ##checks whether it has been initialized already; if so, just return
  10. if ( bombable.check_overall_initialized (nodeName) ) return;
  11. ############################################
  12. #A-10 INITIALIZER
  13. var object_init = func() {
  14. # Datas of this object are under: cmdarg().getPath()
  15. var thisNodeName = cmdarg().getPath();
  16. var thisNode = props.globals.getNode(thisNodeName);
  17. # Add some useful nodes
  18. ########################################################################
  19. ########################################################################
  20. # INITIALIZE BOMBABLE
  21. #
  22. # Initialize constants and main routines for maintaining altitude
  23. # relative to ground-level, relocating after file/reset, and
  24. # creating bombable/shootable objects.
  25. #
  26. # These routines are found in FG/nasal/bombable.nas
  27. #
  28. ########################################################################
  29. # INITIALIZE BOMBABLE Object
  30. # This object will be slurped in the object's node as a child
  31. # node named "bombable".
  32. # All distances are specified in meters.
  33. # All altitudes are relative to current ground level at the object's
  34. # location
  35. #
  36. thisNodeName = cmdarg().getPath();
  37. var bombableObject = {
  38. objectNodeName : thisNodeName,
  39. objectNode : props.globals.getNode(thisNodeName),
  40. updateTime_s : 1/3, #time, in seconds, between the updates that
  41. #keep the object at its AGL. Tradeoff is high-speed updates look more
  42. #realistic but slow down the framerate/cause jerkiness. Faster-moving
  43. #objects will need more frequent updates to look realistic.
  44. #update time faster than about 1/3 seems to have a noticeable effect
  45. #on frame rate
  46. #########################################
  47. # ALTITUDE DEFINITIONS
  48. #
  49. altitudes : {
  50. wheelsOnGroundAGL_m : 1 , #altitude correction to add to your aircraft or ship that is needed to put wheels on ground (or, for a ship, make it float in the water at the correct level). For most objects this is 0 but some models need a small correction to place them exactly at ground level
  51. minimumAGL_m : 100, #minimum altitude above ground level this object is allowed to fly
  52. maximumAGL_m : 10000, #maximum altitude AGL this object is allowed to fly, ie, operational ceiling
  53. crashedAGL_m : -0.6, #altitude AGL when crashed. Ships will sink to this level, aircraft or vehicles will sink into the ground as landing gear collapses or tires deflate. Should be negative, even just -0.001.
  54. },
  55. #
  56. #########################################
  57. # VELOCITIES DEFINITIONS
  58. #
  59. velocities : {
  60. maxSpeedReduce_percent : 0.5, #max % to reduce speed, per step, when damaged
  61. minSpeed_kt : 112, #minimum speed to reduce to when damaged. Ground vehicles and ships might stop completely when damaged but aircraft will need a minimum speed so they keep moving until they hit the ground.
  62. damagedAltitudeChangeMaxRate_meterspersecond : 30, #max rate to sink or fly downwards when damaged, in meters/second
  63. },
  64. #
  65. #########################################
  66. # EVASION DEFINITIONS
  67. #
  68. # The evasion system makes the AI aircraft dodge when they come under
  69. # fire.
  70. evasions : {
  71. dodgeDelayMax_sec : 15, #max time to delay/wait between dodges
  72. dodgeDelayMin_sec : 5, #minimum time to delay/wait between dodges
  73. dodgeMax_deg : 75, #Max amount to turn when dodging
  74. #90 degrees = instant turn, unrealistic
  75. #up to 80 is usually OK, somewhere in 80-85 starts to be unrealistically fast
  76. #>85 is usually very unrealistic. You must test this in your scenario, however.
  77. dodgeMin_deg : 57, #minimum amount to turn when dodging
  78. dodgeROverLPreference_percent : 50, # Preference for right turns vs. left when dodging. 90% means 90% right turns, 50% means 50% right turns.
  79. dodgeAltMin_m : -6000, #Aircraft will begin to move up or down
  80. dodgeAltMax_m : 6000, #Max & Min are relative to current alt
  81. dodgeVertSpeedClimb_mps : 500, #Max speed to climb when evading
  82. dodgeVertSpeedDive_mps : 1000, #Max speed to dive when evading
  83. },
  84. #
  85. #########################################
  86. # ATTACK DEFINITIONS
  87. #
  88. # The attack system makes the AI aircraft turn and fly towards
  89. # other aircraft
  90. attacks : {
  91. maxDistance_m : 14000, #max distance to turn & attack main aircraft
  92. minDistance_m : 500, #min distance to turn & attack main aircraft, ie, fly away this far before turning to attack again
  93. continueAttackAngle_deg : 40, #when within minDistance_m, the aircraft will continue to turn towards the main aircraft and attack *if* if the angle is less than this amount from dead ahead
  94. altitudeHigherCutoff_m : 20000, # will attack the main aircraft unless this amount higher than it or more
  95. altitudeLowerCutoff_m : 15000, # will attack the main aircraft unless this amount lower than it or more
  96. climbPower : 11000, # How powerful the aircraft is when climbing during an attack; 4000 would be typical for, say a Zero--scale accordingly for others; higher is stronger
  97. divePower : 15000, # How powerful the aircraft is when diving during and attack; 6000 typical of a Zero--could be much more than climbPower if the aircraft is a weak climber but a strong diver
  98. rollMin_deg : 58, #when turning on attack, roll to this angle min
  99. rollMax_deg : 74, #when turning on attack, roll to this angle max
  100. #90 degrees = instant turn, unrealistic
  101. #up to 80 might be OK, depending on aircraft & speed; somewhere in 80-85 starts to be unrealistically fast
  102. #>85 is usually very unrealistic. You must test this in your scenario, however.
  103. attackCheckTime_sec : 10, # check for need to attack/correct course this often
  104. attackCheckTimeEngaged_sec : 0.5, # once engaged with enemy, check/update course this frequently
  105. },
  106. #
  107. #########################################
  108. # WEAPONS DEFINITIONS
  109. #
  110. # The weapons system makes the AI aircraft fire on the main aircraft
  111. # You can define any number of weapons--just enclose each in curly brackets
  112. # and separate with commas (,).
  113. weapons : {
  114. front_gun : #internal name - this can be any name you want; must be a valid nasal variable name
  115. {
  116. name : "Machine Gun", # name presented to users, ie in on-screen messages
  117. maxDamage_percent : 5, # maximum percentage damage one hit from the aircraft's main weapon/machine guns will do to an opponent
  118. maxDamageDistance_m : 900, # maximum distance at which the aircrafts main weapon/maching guns will be able to damage an opponent
  119. weaponAngle_deg : { heading: 0, elevation: 0 }, # direction the aircraft's main weapon is aimed.
  120. # 0,0 = straight ahead, 90,0=directly right, 0,90=directly up, 0,180=directly back, etc.
  121. weaponOffset_m : {x:2, y:0, z:0}, # Offset of the weapon from the main aircraft center
  122. weaponSize_m : {start:.1, end:.1}, # Visual size of the weapon's projectile, in meters, at start & end of its path
  123. },
  124. },
  125. #
  126. #########################################
  127. # DIMENSION DEFINITIONS
  128. #
  129. # All dimensions are in meters
  130. #
  131. #
  132. dimensions : {
  133. width_m : 11.58, #width of your object, ie, for aircraft, wingspan
  134. length_m : 9.37, #length of your object, ie, for aircraft, distance nose to tail
  135. height_m : 2.69, #height of your object, ie, for aircraft ground to highest point when sitting on runway
  136. damageRadius_m : 5.5, #typically 1/2 the longest dimension of the object. Hits within this distance of the
  137. #center of object have some possibility of damage
  138. vitalDamageRadius_m : 2.2, #typically the radius of the fuselage or cockpit or other most
  139. # vital area at the center of the object. Always smaller than damageRadius_m
  140. crashRadius_m : 6, #It's a crash if the main aircraft hits in this area.
  141. },
  142. #
  143. #########################################
  144. # VULNERABILITIES DEFINITIONS
  145. #
  146. vulnerabilities : {
  147. damageVulnerability : 9, #Vulnerability to damage from armament, 1=normal M1 tank; higher to make objects easier to kill and lower to make them more difficult. This is a multiplier, so 5 means 5X easier to kill than an M1, 1/5 means 5X harder to kill.
  148. engineDamageVulnerability_percent : 6, #Chance that a small-caliber machine-gun round will damage the engine.
  149. fireVulnerability_percent : 5, #Vulnerability to catching on fire. 100% means even the slightest impact will set it on fire; 20% means quite difficult to set on fire; 0% means set on fire only when completely damaged; -1% means never set on fire.
  150. fireDamageRate_percentpersecond : .1, #Amount of damage to add, per second, when on fire. 100%=completely damaged. Warthog is relatively damage-resistant.
  151. fireExtinguishMaxTime_seconds : 80, #Once a fire starts, for this many seconds there is a chance to put out the fire; fires lasting longer than this won't be put out until the object burns out.
  152. fireExtinguishSuccess_percentage : 45, #Chance of the crew putting out the fire within the MaxTime above. Warthoge is relatively damage-resistant.
  153. explosiveMass_kg : 27772 , #mass of the object in KG, but give at least a 2-10X bonus to anything carrying flammables or high explosives.
  154. },
  155. #
  156. #########################################
  157. # LIVERY DEFINITIONS
  158. #
  159. # Path to livery files to use at different damage levels.
  160. # Path is relative to the AI aircraft's directory.
  161. # The object will start with the first livery listed and
  162. # change to succeeding liveries as the damage
  163. # level increases. The final livery should indicate full damage/
  164. # object destroyed.
  165. #
  166. # If you don't want to specify any special liveries simply set
  167. # damageLivery : nil and the object's normal livery will be used.
  168. #
  169. damageLiveries : {
  170. damageLivery : [ ]
  171. },
  172. };
  173. #########################################
  174. # INITIALIZE ROUTINES
  175. #
  176. # OVERALL INITIALIZER: Needed to make all the others work
  177. bombable.initialize ( bombableObject );
  178. #
  179. # LOCATION: Relocate object to maintain its position after file/reset
  180. # (best not used for airplanes)
  181. # bombable.location_init ( thisNodeName );
  182. #
  183. # GROUND: Keep object at altitude relative to ground level
  184. bombable.ground_init ( thisNodeName );
  185. #
  186. # ATTACK: Make the object attack the main aircraft
  187. bombable.attack_init ( thisNodeName );
  188. #
  189. # WEAPONS: Make the object shoot the main aircraft
  190. bombable.weapons_init ( thisNodeName );
  191. #
  192. # BOMBABLE: Make the object bombable/damageable
  193. bombable.bombable_init ( thisNodeName );
  194. #
  195. # SMOKE/CONTRAIL: Start a flare, contrail, smoke trail, or exhaust
  196. # trail for the object.
  197. # Smoke types available: flare, jetcontrail, pistonexhaust, smoketrail,
  198. # damagedengine
  199. bombable.startSmoke("jetcontrail", thisNodeName );
  200. #F-15E already has contrails, we're leaving this out
  201. #
  202. # END INITIALIZE BOMBABLE
  203. ########################################################################
  204. ########################################################################
  205. }
  206. object_init();
  207. ]]>
  208. </load>
  209. <unload>
  210. <![CDATA[
  211. print("Unload Jaguar.");
  212. var nodeName= cmdarg().getPath();
  213. bombable.de_overall_initialize( nodeName );
  214. bombable.initialize_del( nodeName );
  215. bombable.ground_del( nodeName );
  216. bombable.location_del (nodeName);
  217. bombable.bombable_del( nodeName );
  218. bombable.attack_del( nodeName );
  219. bombable.weapons_del (nodeName);
  220. # </unload>
  221. ]]>
  222. </unload>
  223. </nasal>
  224. </PropertyList>