diff --git a/BUK-M2/BUK-M2-set.xml b/BUK-M2/BUK-M2-set.xml index 92bb3c2..7a980dd 100644 --- a/BUK-M2/BUK-M2-set.xml +++ b/BUK-M2/BUK-M2-set.xml @@ -19,7 +19,7 @@ pinto, Nikolai V. Chr. BUK-M2 - BUK-M2 is a modern Russian self-propelled surface to air missile system. + BUK-M2 (SA-17) is a modern Russian self-propelled surface to air missile system. alpha 0.1 diff --git a/BUK-M2/Dialogs/control-panel.xml b/BUK-M2/Dialogs/control-panel.xml deleted file mode 100644 index e6a5f9e..0000000 --- a/BUK-M2/Dialogs/control-panel.xml +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - control-panel - vbox - 250 - false - - - hbox - - true - - - - true - - - - - - - - vbox - 6 - - - - - - table - - - - 0 - 1 - - - - - - - - - - 2 - 1 - - - - - - - - - - 4 - 0 - - - - - 4 - 1 - - - - - - - - - - - - - - - - - vbox - 6 - - - - - - vbox - - - left - - /controls/lighting/deck-lights - true - - dialog-apply - - - property-toggle - - - - - left - - /carrier/antennas/enabled - true - - dialog-apply - - - property-toggle - - - - - - - - - vbox - 6 - - - - - - vbox - - - left - - /carrier/fdm/settings/movement - true - - dialog-apply - - - property-toggle - - - - - left - - /carrier/phalanx/settings/show-debug-aim - true - - dialog-apply - - - property-toggle - - - - - - - - - hbox - 6 - - true - - - - - diff --git a/BUK-M2/Dialogs/menu.xml b/BUK-M2/Dialogs/menu.xml deleted file mode 100644 index a34d397..0000000 --- a/BUK-M2/Dialogs/menu.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - true - - - - - dialog-show - control-panel - - - - - - - diff --git a/BUK-M2/Sim/mice.xml b/BUK-M2/Sim/mice.xml deleted file mode 100644 index 2f2bf35..0000000 --- a/BUK-M2/Sim/mice.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/BUK-M2/Systems/fbw.xml b/BUK-M2/Systems/fbw.xml deleted file mode 100644 index 107c064..0000000 --- a/BUK-M2/Systems/fbw.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - FBW Throttle - gain - 80.0 - - /controls/engines/engine[0]/throttle - - - /carrier/fbw/target/groundspeed-kt - - - - - FBW Rudder - gain - 8.0 - - /controls/flight/rudder - - - /surface-positions/rudder-pos-norm - - - - diff --git a/BUK-M2/Systems/fdm.xml b/BUK-M2/Systems/fdm.xml deleted file mode 100644 index 7a847c8..0000000 --- a/BUK-M2/Systems/fdm.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - FDM Groundspeed - noise-spike - - /carrier/fbw/target/groundspeed-kt - - - /velocities/groundspeed-kt - - - - 7 - - - - - FDM True Heading For Flags - gain - - /orientation/heading-deg - - - /orientation/true-heading-deg - - - - - - - - - - diff --git a/Frigate/Dialogs/control-panel.xml b/Frigate/Dialogs/control-panel.xml deleted file mode 100644 index e6a5f9e..0000000 --- a/Frigate/Dialogs/control-panel.xml +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - control-panel - vbox - 250 - false - - - hbox - - true - - - - true - - - - - - - - vbox - 6 - - - - - - table - - - - 0 - 1 - - - - - - - - - - 2 - 1 - - - - - - - - - - 4 - 0 - - - - - 4 - 1 - - - - - - - - - - - - - - - - - vbox - 6 - - - - - - vbox - - - left - - /controls/lighting/deck-lights - true - - dialog-apply - - - property-toggle - - - - - left - - /carrier/antennas/enabled - true - - dialog-apply - - - property-toggle - - - - - - - - - vbox - 6 - - - - - - vbox - - - left - - /carrier/fdm/settings/movement - true - - dialog-apply - - - property-toggle - - - - - left - - /carrier/phalanx/settings/show-debug-aim - true - - dialog-apply - - - property-toggle - - - - - - - - - hbox - 6 - - true - - - - - diff --git a/Frigate/Dialogs/menu.xml b/Frigate/Dialogs/menu.xml deleted file mode 100644 index a34d397..0000000 --- a/Frigate/Dialogs/menu.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - true - - - - - dialog-show - control-panel - - - - - - - diff --git a/Frigate/Nasal/damage.nas b/Frigate/Nasal/damage.nas index 44b753a..81e859c 100644 --- a/Frigate/Nasal/damage.nas +++ b/Frigate/Nasal/damage.nas @@ -27,8 +27,6 @@ var mlw_max=getprop("payload/d-config/mlw_max"); # var auto_flare_caller = getprop("payload/d-config/auto_flare_caller"); # If damage.nas should detect flare releases, or if function is called from somewhere in aircraft ############################################################################################################################ -var TRUE = 1; -var FALSE = 0; var hp = hp_max; setprop("sam/damage", math.max(0,100*hp/hp_max));#used in HUD @@ -164,7 +162,9 @@ var warheads = { "pilot": [93, 0.00,1,0],# ejected pilot "BETAB-500ShP": [94, 1160.00,1,0], "Flare": [95, 0.00,0,0], - "3M9": [96, 125.00,0,0],# 3M9 Missile used with 2K12/SA-6 + "3M9": [96, 125.00,0,0],# 3M9M3 Missile used with 2K12/SA-6 + "5V28V": [97, 478.00,0,0],# Missile used with S-200D/SA-5 + "AIM-9X": [98, 20.80,0,0], }; var AIR_RADAR = "air"; @@ -189,7 +189,8 @@ var radar_signatures = { "E-8R": AIR_RADAR, "EC-137D": AIR_RADAR, "Mig-28": AIR_RADAR, - "SA-6": AIR_RADAR,#Air radar tone chosen so that there is at least some lock tone until asset-specific is created + "SA-6": "gnd-06",#Air radar tone chosen so that there is at least some lock tone until asset-specific is created + "s-200": "gnd-05", "ZSU-23-4M": "gnd-23", "S-75": "gnd-02", "buk-m2": "gnd-11", @@ -203,7 +204,7 @@ var radar_signatures = { var id2warhead = []; var launched = {};# callsign: elapsed-sec var approached = {};# callsign: uniqueID -var heavy_smoke = [61,62,63,65,92,96]; +var heavy_smoke = [61,62,63,65,92,96,97]; var k = keys(warheads); @@ -241,6 +242,10 @@ for(var myid = 0;myid 450) { - printf("Missile Approach Warning from %03d degrees.", bearing); - damageLog.push(sprintf("Missile Approach Warning from %03d degrees from %s.", bearing, notification.Callsign)); - if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning from %03d degrees.", bearing), 1,1,0);# temporary till someone models a RWR in RIO seat + if (radarOn) { + #printf("Missile Approach Warning from %03d degrees.", bearing); + damageLog.push(sprintf("Missile Approach Warning from %03d degrees from %s.", bearing, notification.Callsign)); + if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning from %03d degrees.", bearing), 1,0.5,0);# temporary till someone models a RWR in RIO seat + } else { + #printf("Missile Approach Warning"); + damageLog.push(sprintf("Missile Approach Warning from %s.", notification.Callsign)); + if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning (semi-active)."), 1,0.5,0);# temporary till someone models a RWR in RIO seat + } approached[notification.Callsign~notification.UniqueIdentity] = elapsed; - if (m28_auto) mig28.engagedBy(notification.Callsign); + if (m28_auto) mig28.engagedBy(notification.Callsign, 1); } return emesary.Transmitter.ReceiptStatus_OK; } @@ -415,7 +433,7 @@ var DamageRecipient = # debug.dump(notification); # # - if (tacview_supported and tacview.starttime and getprop("sim/multiplay/txhost") != "mpserver.opredflag.com") { + if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto)) { var node = getCallsign(notification.RemoteCallsign); if (node != nil and notification.SecondaryKind > 20) { # its a warhead @@ -439,9 +457,10 @@ var DamageRecipient = var callsign = processCallsign(getprop("sim/multiplay/callsign")); if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) { #damage enabled and were getting hit - if (m28_auto) mig28.engagedBy(notification.Callsign); + if (notification.SecondaryKind < 0 and hitable_by_cannon) { # cannon hit + if (m28_auto) mig28.engagedBy(notification.Callsign, 0); var probability = id2shell[-1*notification.SecondaryKind-1][1]; var typ = id2shell[-1*notification.SecondaryKind-1][2]; var hit_count = notification.Distance; @@ -457,6 +476,7 @@ var DamageRecipient = } } elsif (notification.SecondaryKind > 20) { # its a warhead + if (m28_auto) mig28.engagedBy(notification.Callsign, 1); var dist = notification.Distance; var wh = id2warhead[notification.SecondaryKind - 21]; var type = wh[4];#test code @@ -549,21 +569,18 @@ var DamageRecipient = } if (notification.Kind == CREATE and getprop("payload/armament/enable-craters") == 1 and statics["obj_"~notification.UniqueIdentity] == nil) { if (notification.SecondaryKind == 0) {# TODO: make a hash with all the models - var crater_model = getprop("payload/armament/models") ~ "crater_small.xml"; - var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); + var static = geo.put_model(crater_model0, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); if (static != nil) { statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind]; #static is a PropertyNode inside /models } } elsif (notification.SecondaryKind == 1) { - var crater_model = getprop("payload/armament/models") ~ "crater_big.xml"; - var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); + var static = geo.put_model(crater_model1, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); if (static != nil) { statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind]; } } elsif (notification.SecondaryKind == 2) { - var crater_model = getprop("payload/armament/models") ~ "bomb_hit_smoke.xml"; - var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); + var static = geo.put_model(crater_model2, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); if (static != nil) { statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind]; } @@ -863,6 +880,7 @@ var flare_update_time = 0.4; var flare_duration = 8; var flare_terminal_speed = 50;#m/s var flares_max_process_per_loop = 4; +var flare_sequencer = -120; var flare_sorter = func(a, b) { if(a[0] < b[0]){ @@ -945,7 +963,9 @@ var flare_released = func { getprop("orientation/heading-deg"), FT2M*getprop("velocities/speed-down-fps"), FT2M*math.sqrt(getprop("velocities/speed-north-fps")*getprop("velocities/speed-north-fps")+getprop("velocities/speed-east-fps")*getprop("velocities/speed-east-fps")), - int(rand()*240)-120]; + flare_sequencer]; + flare_sequencer += 1; + if (flare_sequencer > 120) flare_sequencer = -120; append(flare_list, flare); var msg = notifications.ObjectInFlightNotification.new("ffly", flare[6], MOVE, 21+95); msg.Flags = 0; @@ -1233,7 +1253,7 @@ var processCallsigns = func () { var painted = 0; var paint_list = []; foreach (var player; players) { - if(player.getChild("valid") != nil and player.getChild("valid").getValue() == TRUE and player.getChild("callsign") != nil and player.getChild("callsign").getValue() != "" and player.getChild("callsign").getValue() != nil) { + if(player.getChild("valid") != nil and player.getChild("valid").getValue() == 1 and player.getChild("callsign") != nil and player.getChild("callsign").getValue() != "" and player.getChild("callsign").getValue() != nil) { var callsign = player.getChild("callsign").getValue(); callsign_struct[callsign] = player; var str6 = player.getNode("sim/multiplay/generic/string[6]"); @@ -1247,6 +1267,7 @@ var processCallsigns = func () { } if (getprop("sim/time/elapsed-sec")-MAW_elapsed > 1.1) { setprop("payload/armament/MAW-active", 0);# resets every 1.1 seconds without warning + setprop("payload/armament/MAW-semiactive", 0); } # spike handling: @@ -1293,16 +1314,16 @@ processCallsignsTimer.start(); var code_ct = func () { #ANTIC if (getprop("payload/armament/msg")) { - setprop("sim/rendering/redout/enabled", TRUE); + setprop("sim/rendering/redout/enabled", 1); #call(func{fgcommand('dialog-close', multiplayer.dialog.dialog.prop())},nil,var err= []);# props.Node.new({"dialog-name": "location-in-air"})); - call(func{multiplayer.dialog.del();},nil,var err= []); + if (!m28_auto) call(func{multiplayer.dialog.del();},nil,var err= []); if (!getprop("gear/gear[0]/wow")) { call(func{fgcommand('dialog-close', props.Node.new({"dialog-name": "WeightAndFuel"}))},nil,var err2 = []); call(func{fgcommand('dialog-close', props.Node.new({"dialog-name": "system-failures"}))},nil,var err2 = []); call(func{fgcommand('dialog-close', props.Node.new({"dialog-name": "instrument-failures"}))},nil,var err2 = []); } setprop("sim/freeze/fuel",0); - setprop("/sim/speed-up", 1); + if (!m28_auto) setprop("/sim/speed-up", 1); setprop("/gui/map/draw-traffic", 0); setprop("/sim/marker-pins/traffic", 0); setprop("/sim/gui/dialogs/map-canvas/draw-TFC", 0); @@ -1317,7 +1338,7 @@ code_ctTimer.simulatedTime = 1; -setprop("/sim/failure-manager/display-on-screen", FALSE); +setprop("/sim/failure-manager/display-on-screen", 0); code_ctTimer.start(); @@ -1337,6 +1358,22 @@ var re_init = func (node) { } stopLaunch(); damageLog.push("Aircraft was repaired due to re-init."); + + # Remove all 3D craters and re-place them. Due to re-init can remove some of them. + + foreach (var thekey ; keys(statics)) { + var sta = statics[thekey]; + if (sta[0] != nil) { + sta[0].remove(); + if (sta[5] == 0) {# TODO: make a hash with all the models + sta[0] = geo.put_model(crater_model0, sta[1], sta[2], sta[3], sta[4]); + } elsif (sta[5] == 1) { + sta[0] = geo.put_model(crater_model1, sta[1], sta[2], sta[3], sta[4]); + } elsif (sta[5] == 2) { + sta[0] = geo.put_model(crater_model2, sta[1], sta[2], sta[3], sta[4]); + } + } + } } #================================================================== @@ -1405,6 +1442,7 @@ setlistener("sim/signals/exit", writeDamageLog, 0, 0); #screen.property_display.add("payload/armament/MAW-bearing"); #screen.property_display.add("payload/armament/MAW-active"); +#screen.property_display.add("payload/armament/MAW-semiactive"); #screen.property_display.add("payload/armament/MLW-bearing"); #screen.property_display.add("payload/armament/MLW-count"); #screen.property_display.add("payload/armament/MLW-launcher"); @@ -1412,6 +1450,8 @@ setlistener("sim/signals/exit", writeDamageLog, 0, 0); #screen.property_display.add("payload/armament/spike-air"); #screen.property_display.add("payload/armament/spike-gnd-20"); #screen.property_display.add("payload/armament/spike-gnd-02"); +#screen.property_display.add("payload/armament/spike-gnd-05"); +#screen.property_display.add("payload/armament/spike-gnd-06"); #screen.property_display.add("payload/armament/spike-gnd-11"); #screen.property_display.add("payload/armament/spike-gnd-23"); #screen.property_display.add("payload/armament/spike-gnd-p2"); diff --git a/Frigate/Nasal/fdm.nas b/Frigate/Nasal/fdm.nas index 5f0b23d..4cdf778 100644 --- a/Frigate/Nasal/fdm.nas +++ b/Frigate/Nasal/fdm.nas @@ -14,7 +14,7 @@ # along with this program. If not, see . #io.include("Aircraft/ExpansionPack/Nasal/init.nas"); - +srand();# seed the random generator with systime #with("updateloop"); # Number of iterations per second diff --git a/Frigate/Nasal/radar-logic.nas b/Frigate/Nasal/radar-logic.nas index ca6aa5e..6b92c8b 100644 --- a/Frigate/Nasal/radar-logic.nas +++ b/Frigate/Nasal/radar-logic.nas @@ -15,9 +15,6 @@ if ((major == 2017 and minor == 2 and pica >= 1) or (major == 2017 and minor > 2 pickingMethod = 1; } -var FALSE = 0; -var TRUE = 1; - var AIR = 0; var MARINE = 1; var SURFACE = 2; @@ -73,6 +70,9 @@ var Contact = { obj.range = obj.rdrProp.getNode("range-nm"); obj.bearing = obj.rdrProp.getNode("bearing-deg"); obj.elevation = obj.rdrProp.getNode("elevation-deg"); + obj.ubody = obj.rdrProp.getNode("velocities/uBody-fps"); + obj.vbody = obj.rdrProp.getNode("velocities/vBody-fps"); + obj.wbody = obj.rdrProp.getNode("velocities/wBody-fps"); #}); obj.deviation = nil; @@ -84,27 +84,63 @@ var Contact = { return obj; }, + + get_uBody: func { + var body = nil; + if (me.ubody != nil) { + body = me.ubody.getValue(); + } + if(body == nil) { + body = me.get_Speed()*KT2FPS; + } + return body; + }, + + get_vBody: func { + var body = nil; + if (me.ubody != nil) { + body = me.vbody.getValue(); + } + if(body == nil) { + body = 0; + } + return body; + }, + + get_wBody: func { + var body = nil; + if (me.ubody != nil) { + body = me.wbody.getValue(); + } + if(body == nil) { + body = 0; + } + return body; + }, isValid: func () { var valid = me.valid.getValue(); if (valid == nil) { - valid = FALSE; + valid = 0; } if (me.callsign.getValue() != me.orig_callsign) { - valid = FALSE; + valid = 0; } return valid; }, isPainted: func () { - if (me.painted == nil) { - me.painted = me.node.getNode("painted"); + if (getprop("/carrier/sunk") == 1) { + return 0; } - if (me.painted == nil) { - return nil; + return isNotBehindTerrain(me.node)[0]; + }, + + isCommandActive: func { + if (getprop("/carrier/sunk") == 1) { + return 0; } - var p = me.painted.getValue(); - return p; + return isNotBehindTerrain(me.node)[0]; }, getUnique: func () { @@ -124,6 +160,7 @@ var Contact = { if(e == nil or e == 0) { # AI/MP has no radar properties var self = geo.aircraft_position(); + self.set_alt(self.alt()+fire_control.radar_elevation_above_terrain_m); me.get_Coord(); var angleInv = clamp(self.distance_to(me.coord)/self.direct_distance_to(me.coord), -1, 1); e = (self.alt()>me.coord.alt()?-1:1)*math.acos(angleInv)*R2D; @@ -343,108 +380,48 @@ var Contact = { }; var isNotBehindTerrain = func( mp ) { + var pos = mp.getNode("position"); + var alt = pos.getNode("altitude-ft").getValue(); + var lat = pos.getNode("latitude-deg").getValue(); + var lon = pos.getNode("longitude-deg").getValue(); + if(alt == nil or lat == nil or lon == nil) { + return [0,0]; # invisible and not in front of terrain + } + var aircraftPos = geo.Coord.new().set_latlon(lat, lon, alt*FT2M); -########### - var pos = mp.getNode("position"); - var alt = pos.getNode("altitude-ft").getValue(); - var lat = pos.getNode("latitude-deg").getValue(); - var lon = pos.getNode("longitude-deg").getValue(); - if(alt == nil or lat == nil or lon == nil) { - return isVisible = 0; - } - var aircraftPos = geo.Coord.new().set_latlon(lat, lon, alt*0.3048); -################# - if (pickingMethod == 1) { - var myPos = geo.aircraft_position(); - myPos.set_latlon(myPos.lat(),myPos.lon(),myPos.alt()+50); - var xyz = {"x":myPos.x(), "y":myPos.y(), "z":myPos.z()}; - var dir = {"x":aircraftPos.x()-myPos.x(), "y":aircraftPos.y()-myPos.y(), "z":aircraftPos.z()-myPos.z()}; + var myPos = geo.aircraft_position(); - # Check for terrain between own aircraft and other: - v = get_cart_ground_intersection(xyz, dir); - if (v == nil) { - return 1; - #printf("No terrain, planes has clear view of each other"); - } else { - var terrain = geo.Coord.new(); - terrain.set_latlon(v.lat, v.lon, v.elevation); - var maxDist = myPos.direct_distance_to(aircraftPos); - var terrainDist = myPos.direct_distance_to(terrain); - if (terrainDist < maxDist) { - #printf("terrain found between SAM and aircraft %.1f meter away.", terrainDist); - return 0; - } else { - #print("The planes has clear view of each other"); - return 1; - } + myPos.set_alt(myPos.alt()+fire_control.radar_elevation_above_terrain_m); + + var target_distance = myPos.direct_distance_to(aircraftPos); + + call(func { + if (target_distance*0.001 > 3.57*(math.sqrt(myPos.alt())+math.sqrt(alt*FT2M))) { + # behind earth curvature + #print("behind earth curvature"); + return [0,0]; # invisible and not in front of terrain } + },nil,nil,var err =[]); + + var xyz = {"x":myPos.x(), "y":myPos.y(), "z":myPos.z()}; + var dir = {"x":aircraftPos.x()-myPos.x(), "y":aircraftPos.y()-myPos.y(), "z":aircraftPos.z()-myPos.z()}; + + # Check for terrain between own aircraft and other: + v = get_cart_ground_intersection(xyz, dir); + if (v == nil) { + return [1,0]; # visible and not in front of terrain + #printf("No terrain, planes has clear view of each other"); + } else { + var terrain = geo.Coord.new(); + terrain.set_latlon(v.lat, v.lon, v.elevation); + var maxDist = myPos.direct_distance_to(aircraftPos); + var terrainDist = myPos.direct_distance_to(terrain); + if (terrainDist < maxDist-1) { + #printf("terrain found between me and aircraft %.1f meter away.", terrainDist); + return [0,0]; # visible and not in front of terrain } else { - var isVisible = 0; - var MyCoord = geo.aircraft_position(); - - # Because there is no terrain on earth that can be between these 2 - if(MyCoord.alt() < 8900 and aircraftPos.alt() < 8900) - { - # Temporary variable - # A (our plane) coord in meters - var a = MyCoord.x(); - var b = MyCoord.y(); - var c = MyCoord.z(); - # B (target) coord in meters - var d = aircraftPos.x(); - var e = aircraftPos.y(); - var f = aircraftPos.z(); - var difa = d - a; - var difb = e - b; - var difc = f - c; - # direct Distance in meters - var myDistance = math.sqrt( math.pow((d-a),2) + math.pow((e-b),2) + math.pow((f-c),2)); #calculating distance ourselves to avoid another call to geo.nas (read: speed, probably). - var Aprime = geo.Coord.new(); - - # Here is to limit FPS drop on very long distance - var L = 500; - if(myDistance > 50000) - { - L = myDistance / 15; - } - var step = L; - var maxLoops = int(myDistance / L); - - isVisible = 1; - # This loop will make travel a point between us and the target and check if there is terrain - for(var i = 1 ; i <= maxLoops ; i += 1) - { - #calculate intermediate step - #basically dividing the line into maxLoops number of steps, and checking at each step - #to ascii-art explain it: - # |us|----------|step 1|-----------|step 2|--------|step 3|----------|them| - #there will be as many steps as there is i - #every step will be equidistant - - #also, if i == 0 then the first step will be our plane - - var x = ((difa/(maxLoops+1))*i)+a; - var y = ((difb/(maxLoops+1))*i)+b; - var z = ((difc/(maxLoops+1))*i)+c; - #print("i:" ~ i ~ "|x,y,z | " ~ x ~ "," ~ y ~ "," ~ z); - Aprime.set_xyz(x,y,z); - var AprimeTerrainAlt = geo.elevation(Aprime.lat(), Aprime.lon()); - if(AprimeTerrainAlt == nil) - { - AprimeTerrainAlt = 0; - } - - if(AprimeTerrainAlt > Aprime.alt()) - { - #print("behind terrain"); - return 0; - } - } - } - else - { - isVisible = 1; - } - return isVisible; + #print("The planes has clear view of each other"); + return [1,1]; # visible and in front of terrain } + } } \ No newline at end of file diff --git a/Frigate/Sim/mice.xml b/Frigate/Sim/mice.xml deleted file mode 100644 index 2f2bf35..0000000 --- a/Frigate/Sim/mice.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/Frigate/Systems/fbw.xml b/Frigate/Systems/fbw.xml deleted file mode 100644 index 42678fb..0000000 --- a/Frigate/Systems/fbw.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - FBW Throttle - gain - 30.0 - - /controls/engines/engine[0]/throttle - - - /carrier/fbw/target/groundspeed-kt - - - - - Flight Deck Antennas Position - noise-spike - - - /carrier/antennas/enabled - - 0.0 - - - 1.0 - - - /carrier/antennas/antenna-pos-norm - - - - 0.2 - - - diff --git a/Frigate/Systems/fdm.xml b/Frigate/Systems/fdm.xml deleted file mode 100644 index 172191b..0000000 --- a/Frigate/Systems/fdm.xml +++ /dev/null @@ -1,410 +0,0 @@ - - - - - - - - - FDM Groundspeed - noise-spike - - /carrier/fbw/target/groundspeed-kt - - - /velocities/groundspeed-kt - - - - 0.075 - - - - - FDM True Heading For Flags - gain - - /orientation/heading-deg - - - /orientation/true-heading-deg - - - - - - - - - - FDM Wave Heading - gain - - - - - - /environment/sea/surface/wind-from-east-fps - /environment/sea/surface/wind-from-north-fps - - - /orientation/heading-deg - - - - -90 - 90 - - - - /carrier/fdm/output/wave-heading - - - - - - FDM Wave Perpendicular Normalized - gain - - -
- - /carrier/fdm/output/wave-heading - - 90.0 -
-
- - - /carrier/fdm/output/wave-perpendicular-norm - -
- - - - FDM Wave Strength - gain - - - - - - - /environment/sea/surface/wind-from-east-fps - 2.0 - - - /environment/sea/surface/wind-from-north-fps - 2.0 - - - - - - 0.5924838012958964 - - - - - /carrier/fdm/output/wave-speed-kt - - - - - FDM Heel Wave Factor - gain - - -
- - - /carrier/fdm/output/wave-speed-kt - - - - /carrier/fdm/output/wave-heading - - - - - /carrier/fdm/settings/max-heel-oscillation-wave-kt - - /carrier/fdm/settings/max-heel-oscillation-wave-kt -
-
- - - /carrier/fdm/output/heel-wave-factor - -
- - - FDM Trim Wave Factor - gain - - -
- - - - /carrier/fdm/output/wave-speed-kt - - - - /carrier/fdm/output/wave-heading - - - - - /velocities/groundspeed-kt - - /carrier/fdm/settings/max-trim-oscillation-wave-kt - - /carrier/fdm/settings/max-trim-oscillation-wave-kt -
-
- - - /carrier/fdm/output/trim-wave-factor - -
- - - - - - - - FDM Rudder - noise-spike - - /controls/flight/rudder - - - /surface-positions/rudder-pos-norm - - - - 0.2 - - - - - FDM Turn Centrifugal Force - gain - - - -
- /velocities/groundspeed-kt - 30.0 -
- /surface-positions/rudder-pos-norm - /carrier/fdm/settings/bank-limit - -1.0 -
-
- - - /carrier/fdm/target/roll-deg - -
- - - - FDM Turn PID - - /carrier/roll-deg - - - /carrier/fdm/target/roll-deg - - - /carrier/fdm/output/roll-deg - - - 0.5 - 2.0 - - /carrier/fdm/settings/bank-limit - -1.0 - - - /carrier/fdm/settings/bank-limit - - - - - - - FDM Heeling Force Oscillator - damped-oscillation - false - - 0.0 - - - /carrier/fdm/settings/heel-frequency - - - - - /carrier/fdm/settings/heel-frequency - /carrier/fdm/settings/heel-overshoot - - - - - /carrier/fdm/output/heel-osci - - - - - - FDM Heeling Degree - gain - - - - /carrier/fdm/output/heel-osci - /carrier/fdm/settings/heel-overshoot - - - - - /carrier/fdm/output/heel-deg - - - - - - FDM Roll - gain - - - /carrier/fdm/settings/movement - - /carrier/fdm/output/roll-deg - - /carrier/fdm/output/heel-deg - - /carrier/fdm/output/heel-wave-factor - - - - - 0.0 - - - /carrier/roll-deg - - - - - - - - - - FDM Trimming Force Oscillator - damped-oscillation - false - - 0.0 - - - /carrier/fdm/settings/trim-frequency - - - - - /carrier/fdm/settings/trim-frequency - /carrier/fdm/settings/trim-overshoot - - - - - /carrier/fdm/output/trim-osci - - - - - - FDM Trimming Degree - gain - - - - /carrier/fdm/output/trim-osci - /carrier/fdm/settings/trim-overshoot - - - - - /carrier/fdm/output/trim-deg - - - - - FDM Pitch - gain - - - /carrier/fdm/settings/movement - - /carrier/fdm/output/trim-deg - - /carrier/fdm/output/trim-wave-factor - - - - 0.0 - - - /carrier/pitch-deg - - - -
diff --git a/MIM-104D/Models/mim104D-1.xcf b/MIM-104D/Models/mim104D-1.xcf new file mode 100644 index 0000000..65d94b0 Binary files /dev/null and b/MIM-104D/Models/mim104D-1.xcf differ diff --git a/MIM-104D/Models/mim104D-2.xcf b/MIM-104D/Models/mim104D-2.xcf new file mode 100644 index 0000000..64196d3 Binary files /dev/null and b/MIM-104D/Models/mim104D-2.xcf differ diff --git a/MIM-104D/Models/mim104D-3.xcf b/MIM-104D/Models/mim104D-3.xcf new file mode 100644 index 0000000..acbdb09 Binary files /dev/null and b/MIM-104D/Models/mim104D-3.xcf differ diff --git a/depot/Dialogs/menu.xml b/depot/Dialogs/menu.xml deleted file mode 100644 index a34d397..0000000 --- a/depot/Dialogs/menu.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - true - - - - - dialog-show - control-panel - - - - - - - diff --git a/depot/Dialogs/type.xml b/depot/Dialogs/type.xml deleted file mode 100644 index 7659853..0000000 --- a/depot/Dialogs/type.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - type - vbox - 250 - false - - - hbox - - true - - - - true - - - - - - - - vbox - 6 - - true - - - - - - - - - - - - - diff --git a/depot/Nasal/damage.nas b/depot/Nasal/damage.nas index 44b753a..81e859c 100644 --- a/depot/Nasal/damage.nas +++ b/depot/Nasal/damage.nas @@ -27,8 +27,6 @@ var mlw_max=getprop("payload/d-config/mlw_max"); # var auto_flare_caller = getprop("payload/d-config/auto_flare_caller"); # If damage.nas should detect flare releases, or if function is called from somewhere in aircraft ############################################################################################################################ -var TRUE = 1; -var FALSE = 0; var hp = hp_max; setprop("sam/damage", math.max(0,100*hp/hp_max));#used in HUD @@ -164,7 +162,9 @@ var warheads = { "pilot": [93, 0.00,1,0],# ejected pilot "BETAB-500ShP": [94, 1160.00,1,0], "Flare": [95, 0.00,0,0], - "3M9": [96, 125.00,0,0],# 3M9 Missile used with 2K12/SA-6 + "3M9": [96, 125.00,0,0],# 3M9M3 Missile used with 2K12/SA-6 + "5V28V": [97, 478.00,0,0],# Missile used with S-200D/SA-5 + "AIM-9X": [98, 20.80,0,0], }; var AIR_RADAR = "air"; @@ -189,7 +189,8 @@ var radar_signatures = { "E-8R": AIR_RADAR, "EC-137D": AIR_RADAR, "Mig-28": AIR_RADAR, - "SA-6": AIR_RADAR,#Air radar tone chosen so that there is at least some lock tone until asset-specific is created + "SA-6": "gnd-06",#Air radar tone chosen so that there is at least some lock tone until asset-specific is created + "s-200": "gnd-05", "ZSU-23-4M": "gnd-23", "S-75": "gnd-02", "buk-m2": "gnd-11", @@ -203,7 +204,7 @@ var radar_signatures = { var id2warhead = []; var launched = {};# callsign: elapsed-sec var approached = {};# callsign: uniqueID -var heavy_smoke = [61,62,63,65,92,96]; +var heavy_smoke = [61,62,63,65,92,96,97]; var k = keys(warheads); @@ -241,6 +242,10 @@ for(var myid = 0;myid 450) { - printf("Missile Approach Warning from %03d degrees.", bearing); - damageLog.push(sprintf("Missile Approach Warning from %03d degrees from %s.", bearing, notification.Callsign)); - if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning from %03d degrees.", bearing), 1,1,0);# temporary till someone models a RWR in RIO seat + if (radarOn) { + #printf("Missile Approach Warning from %03d degrees.", bearing); + damageLog.push(sprintf("Missile Approach Warning from %03d degrees from %s.", bearing, notification.Callsign)); + if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning from %03d degrees.", bearing), 1,0.5,0);# temporary till someone models a RWR in RIO seat + } else { + #printf("Missile Approach Warning"); + damageLog.push(sprintf("Missile Approach Warning from %s.", notification.Callsign)); + if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning (semi-active)."), 1,0.5,0);# temporary till someone models a RWR in RIO seat + } approached[notification.Callsign~notification.UniqueIdentity] = elapsed; - if (m28_auto) mig28.engagedBy(notification.Callsign); + if (m28_auto) mig28.engagedBy(notification.Callsign, 1); } return emesary.Transmitter.ReceiptStatus_OK; } @@ -415,7 +433,7 @@ var DamageRecipient = # debug.dump(notification); # # - if (tacview_supported and tacview.starttime and getprop("sim/multiplay/txhost") != "mpserver.opredflag.com") { + if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto)) { var node = getCallsign(notification.RemoteCallsign); if (node != nil and notification.SecondaryKind > 20) { # its a warhead @@ -439,9 +457,10 @@ var DamageRecipient = var callsign = processCallsign(getprop("sim/multiplay/callsign")); if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) { #damage enabled and were getting hit - if (m28_auto) mig28.engagedBy(notification.Callsign); + if (notification.SecondaryKind < 0 and hitable_by_cannon) { # cannon hit + if (m28_auto) mig28.engagedBy(notification.Callsign, 0); var probability = id2shell[-1*notification.SecondaryKind-1][1]; var typ = id2shell[-1*notification.SecondaryKind-1][2]; var hit_count = notification.Distance; @@ -457,6 +476,7 @@ var DamageRecipient = } } elsif (notification.SecondaryKind > 20) { # its a warhead + if (m28_auto) mig28.engagedBy(notification.Callsign, 1); var dist = notification.Distance; var wh = id2warhead[notification.SecondaryKind - 21]; var type = wh[4];#test code @@ -549,21 +569,18 @@ var DamageRecipient = } if (notification.Kind == CREATE and getprop("payload/armament/enable-craters") == 1 and statics["obj_"~notification.UniqueIdentity] == nil) { if (notification.SecondaryKind == 0) {# TODO: make a hash with all the models - var crater_model = getprop("payload/armament/models") ~ "crater_small.xml"; - var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); + var static = geo.put_model(crater_model0, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); if (static != nil) { statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind]; #static is a PropertyNode inside /models } } elsif (notification.SecondaryKind == 1) { - var crater_model = getprop("payload/armament/models") ~ "crater_big.xml"; - var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); + var static = geo.put_model(crater_model1, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); if (static != nil) { statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind]; } } elsif (notification.SecondaryKind == 2) { - var crater_model = getprop("payload/armament/models") ~ "bomb_hit_smoke.xml"; - var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); + var static = geo.put_model(crater_model2, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); if (static != nil) { statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind]; } @@ -863,6 +880,7 @@ var flare_update_time = 0.4; var flare_duration = 8; var flare_terminal_speed = 50;#m/s var flares_max_process_per_loop = 4; +var flare_sequencer = -120; var flare_sorter = func(a, b) { if(a[0] < b[0]){ @@ -945,7 +963,9 @@ var flare_released = func { getprop("orientation/heading-deg"), FT2M*getprop("velocities/speed-down-fps"), FT2M*math.sqrt(getprop("velocities/speed-north-fps")*getprop("velocities/speed-north-fps")+getprop("velocities/speed-east-fps")*getprop("velocities/speed-east-fps")), - int(rand()*240)-120]; + flare_sequencer]; + flare_sequencer += 1; + if (flare_sequencer > 120) flare_sequencer = -120; append(flare_list, flare); var msg = notifications.ObjectInFlightNotification.new("ffly", flare[6], MOVE, 21+95); msg.Flags = 0; @@ -1233,7 +1253,7 @@ var processCallsigns = func () { var painted = 0; var paint_list = []; foreach (var player; players) { - if(player.getChild("valid") != nil and player.getChild("valid").getValue() == TRUE and player.getChild("callsign") != nil and player.getChild("callsign").getValue() != "" and player.getChild("callsign").getValue() != nil) { + if(player.getChild("valid") != nil and player.getChild("valid").getValue() == 1 and player.getChild("callsign") != nil and player.getChild("callsign").getValue() != "" and player.getChild("callsign").getValue() != nil) { var callsign = player.getChild("callsign").getValue(); callsign_struct[callsign] = player; var str6 = player.getNode("sim/multiplay/generic/string[6]"); @@ -1247,6 +1267,7 @@ var processCallsigns = func () { } if (getprop("sim/time/elapsed-sec")-MAW_elapsed > 1.1) { setprop("payload/armament/MAW-active", 0);# resets every 1.1 seconds without warning + setprop("payload/armament/MAW-semiactive", 0); } # spike handling: @@ -1293,16 +1314,16 @@ processCallsignsTimer.start(); var code_ct = func () { #ANTIC if (getprop("payload/armament/msg")) { - setprop("sim/rendering/redout/enabled", TRUE); + setprop("sim/rendering/redout/enabled", 1); #call(func{fgcommand('dialog-close', multiplayer.dialog.dialog.prop())},nil,var err= []);# props.Node.new({"dialog-name": "location-in-air"})); - call(func{multiplayer.dialog.del();},nil,var err= []); + if (!m28_auto) call(func{multiplayer.dialog.del();},nil,var err= []); if (!getprop("gear/gear[0]/wow")) { call(func{fgcommand('dialog-close', props.Node.new({"dialog-name": "WeightAndFuel"}))},nil,var err2 = []); call(func{fgcommand('dialog-close', props.Node.new({"dialog-name": "system-failures"}))},nil,var err2 = []); call(func{fgcommand('dialog-close', props.Node.new({"dialog-name": "instrument-failures"}))},nil,var err2 = []); } setprop("sim/freeze/fuel",0); - setprop("/sim/speed-up", 1); + if (!m28_auto) setprop("/sim/speed-up", 1); setprop("/gui/map/draw-traffic", 0); setprop("/sim/marker-pins/traffic", 0); setprop("/sim/gui/dialogs/map-canvas/draw-TFC", 0); @@ -1317,7 +1338,7 @@ code_ctTimer.simulatedTime = 1; -setprop("/sim/failure-manager/display-on-screen", FALSE); +setprop("/sim/failure-manager/display-on-screen", 0); code_ctTimer.start(); @@ -1337,6 +1358,22 @@ var re_init = func (node) { } stopLaunch(); damageLog.push("Aircraft was repaired due to re-init."); + + # Remove all 3D craters and re-place them. Due to re-init can remove some of them. + + foreach (var thekey ; keys(statics)) { + var sta = statics[thekey]; + if (sta[0] != nil) { + sta[0].remove(); + if (sta[5] == 0) {# TODO: make a hash with all the models + sta[0] = geo.put_model(crater_model0, sta[1], sta[2], sta[3], sta[4]); + } elsif (sta[5] == 1) { + sta[0] = geo.put_model(crater_model1, sta[1], sta[2], sta[3], sta[4]); + } elsif (sta[5] == 2) { + sta[0] = geo.put_model(crater_model2, sta[1], sta[2], sta[3], sta[4]); + } + } + } } #================================================================== @@ -1405,6 +1442,7 @@ setlistener("sim/signals/exit", writeDamageLog, 0, 0); #screen.property_display.add("payload/armament/MAW-bearing"); #screen.property_display.add("payload/armament/MAW-active"); +#screen.property_display.add("payload/armament/MAW-semiactive"); #screen.property_display.add("payload/armament/MLW-bearing"); #screen.property_display.add("payload/armament/MLW-count"); #screen.property_display.add("payload/armament/MLW-launcher"); @@ -1412,6 +1450,8 @@ setlistener("sim/signals/exit", writeDamageLog, 0, 0); #screen.property_display.add("payload/armament/spike-air"); #screen.property_display.add("payload/armament/spike-gnd-20"); #screen.property_display.add("payload/armament/spike-gnd-02"); +#screen.property_display.add("payload/armament/spike-gnd-05"); +#screen.property_display.add("payload/armament/spike-gnd-06"); #screen.property_display.add("payload/armament/spike-gnd-11"); #screen.property_display.add("payload/armament/spike-gnd-23"); #screen.property_display.add("payload/armament/spike-gnd-p2"); diff --git a/depot/Nasal/fdm.nas b/depot/Nasal/fdm.nas index 40df393..5815e41 100644 --- a/depot/Nasal/fdm.nas +++ b/depot/Nasal/fdm.nas @@ -14,7 +14,7 @@ # along with this program. If not, see . #io.include("Aircraft/ExpansionPack/Nasal/init.nas"); - +srand();# seed the random generator with systime #with("updateloop"); # Number of iterations per second diff --git a/depot/Systems/fbw.xml b/depot/Systems/fbw.xml deleted file mode 100644 index 107c064..0000000 --- a/depot/Systems/fbw.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - FBW Throttle - gain - 80.0 - - /controls/engines/engine[0]/throttle - - - /carrier/fbw/target/groundspeed-kt - - - - - FBW Rudder - gain - 8.0 - - /controls/flight/rudder - - - /surface-positions/rudder-pos-norm - - - - diff --git a/depot/Systems/fdm.xml b/depot/Systems/fdm.xml deleted file mode 100644 index 7a847c8..0000000 --- a/depot/Systems/fdm.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - FDM Groundspeed - noise-spike - - /carrier/fbw/target/groundspeed-kt - - - /velocities/groundspeed-kt - - - - 7 - - - - - FDM True Heading For Flags - gain - - /orientation/heading-deg - - - /orientation/true-heading-deg - - - - - - - - - - diff --git a/gci-radar/Nasal/damage.nas b/gci-radar/Nasal/damage.nas index 44b753a..81e859c 100644 --- a/gci-radar/Nasal/damage.nas +++ b/gci-radar/Nasal/damage.nas @@ -27,8 +27,6 @@ var mlw_max=getprop("payload/d-config/mlw_max"); # var auto_flare_caller = getprop("payload/d-config/auto_flare_caller"); # If damage.nas should detect flare releases, or if function is called from somewhere in aircraft ############################################################################################################################ -var TRUE = 1; -var FALSE = 0; var hp = hp_max; setprop("sam/damage", math.max(0,100*hp/hp_max));#used in HUD @@ -164,7 +162,9 @@ var warheads = { "pilot": [93, 0.00,1,0],# ejected pilot "BETAB-500ShP": [94, 1160.00,1,0], "Flare": [95, 0.00,0,0], - "3M9": [96, 125.00,0,0],# 3M9 Missile used with 2K12/SA-6 + "3M9": [96, 125.00,0,0],# 3M9M3 Missile used with 2K12/SA-6 + "5V28V": [97, 478.00,0,0],# Missile used with S-200D/SA-5 + "AIM-9X": [98, 20.80,0,0], }; var AIR_RADAR = "air"; @@ -189,7 +189,8 @@ var radar_signatures = { "E-8R": AIR_RADAR, "EC-137D": AIR_RADAR, "Mig-28": AIR_RADAR, - "SA-6": AIR_RADAR,#Air radar tone chosen so that there is at least some lock tone until asset-specific is created + "SA-6": "gnd-06",#Air radar tone chosen so that there is at least some lock tone until asset-specific is created + "s-200": "gnd-05", "ZSU-23-4M": "gnd-23", "S-75": "gnd-02", "buk-m2": "gnd-11", @@ -203,7 +204,7 @@ var radar_signatures = { var id2warhead = []; var launched = {};# callsign: elapsed-sec var approached = {};# callsign: uniqueID -var heavy_smoke = [61,62,63,65,92,96]; +var heavy_smoke = [61,62,63,65,92,96,97]; var k = keys(warheads); @@ -241,6 +242,10 @@ for(var myid = 0;myid 450) { - printf("Missile Approach Warning from %03d degrees.", bearing); - damageLog.push(sprintf("Missile Approach Warning from %03d degrees from %s.", bearing, notification.Callsign)); - if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning from %03d degrees.", bearing), 1,1,0);# temporary till someone models a RWR in RIO seat + if (radarOn) { + #printf("Missile Approach Warning from %03d degrees.", bearing); + damageLog.push(sprintf("Missile Approach Warning from %03d degrees from %s.", bearing, notification.Callsign)); + if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning from %03d degrees.", bearing), 1,0.5,0);# temporary till someone models a RWR in RIO seat + } else { + #printf("Missile Approach Warning"); + damageLog.push(sprintf("Missile Approach Warning from %s.", notification.Callsign)); + if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning (semi-active)."), 1,0.5,0);# temporary till someone models a RWR in RIO seat + } approached[notification.Callsign~notification.UniqueIdentity] = elapsed; - if (m28_auto) mig28.engagedBy(notification.Callsign); + if (m28_auto) mig28.engagedBy(notification.Callsign, 1); } return emesary.Transmitter.ReceiptStatus_OK; } @@ -415,7 +433,7 @@ var DamageRecipient = # debug.dump(notification); # # - if (tacview_supported and tacview.starttime and getprop("sim/multiplay/txhost") != "mpserver.opredflag.com") { + if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto)) { var node = getCallsign(notification.RemoteCallsign); if (node != nil and notification.SecondaryKind > 20) { # its a warhead @@ -439,9 +457,10 @@ var DamageRecipient = var callsign = processCallsign(getprop("sim/multiplay/callsign")); if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) { #damage enabled and were getting hit - if (m28_auto) mig28.engagedBy(notification.Callsign); + if (notification.SecondaryKind < 0 and hitable_by_cannon) { # cannon hit + if (m28_auto) mig28.engagedBy(notification.Callsign, 0); var probability = id2shell[-1*notification.SecondaryKind-1][1]; var typ = id2shell[-1*notification.SecondaryKind-1][2]; var hit_count = notification.Distance; @@ -457,6 +476,7 @@ var DamageRecipient = } } elsif (notification.SecondaryKind > 20) { # its a warhead + if (m28_auto) mig28.engagedBy(notification.Callsign, 1); var dist = notification.Distance; var wh = id2warhead[notification.SecondaryKind - 21]; var type = wh[4];#test code @@ -549,21 +569,18 @@ var DamageRecipient = } if (notification.Kind == CREATE and getprop("payload/armament/enable-craters") == 1 and statics["obj_"~notification.UniqueIdentity] == nil) { if (notification.SecondaryKind == 0) {# TODO: make a hash with all the models - var crater_model = getprop("payload/armament/models") ~ "crater_small.xml"; - var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); + var static = geo.put_model(crater_model0, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); if (static != nil) { statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind]; #static is a PropertyNode inside /models } } elsif (notification.SecondaryKind == 1) { - var crater_model = getprop("payload/armament/models") ~ "crater_big.xml"; - var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); + var static = geo.put_model(crater_model1, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); if (static != nil) { statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind]; } } elsif (notification.SecondaryKind == 2) { - var crater_model = getprop("payload/armament/models") ~ "bomb_hit_smoke.xml"; - var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); + var static = geo.put_model(crater_model2, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); if (static != nil) { statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind]; } @@ -863,6 +880,7 @@ var flare_update_time = 0.4; var flare_duration = 8; var flare_terminal_speed = 50;#m/s var flares_max_process_per_loop = 4; +var flare_sequencer = -120; var flare_sorter = func(a, b) { if(a[0] < b[0]){ @@ -945,7 +963,9 @@ var flare_released = func { getprop("orientation/heading-deg"), FT2M*getprop("velocities/speed-down-fps"), FT2M*math.sqrt(getprop("velocities/speed-north-fps")*getprop("velocities/speed-north-fps")+getprop("velocities/speed-east-fps")*getprop("velocities/speed-east-fps")), - int(rand()*240)-120]; + flare_sequencer]; + flare_sequencer += 1; + if (flare_sequencer > 120) flare_sequencer = -120; append(flare_list, flare); var msg = notifications.ObjectInFlightNotification.new("ffly", flare[6], MOVE, 21+95); msg.Flags = 0; @@ -1233,7 +1253,7 @@ var processCallsigns = func () { var painted = 0; var paint_list = []; foreach (var player; players) { - if(player.getChild("valid") != nil and player.getChild("valid").getValue() == TRUE and player.getChild("callsign") != nil and player.getChild("callsign").getValue() != "" and player.getChild("callsign").getValue() != nil) { + if(player.getChild("valid") != nil and player.getChild("valid").getValue() == 1 and player.getChild("callsign") != nil and player.getChild("callsign").getValue() != "" and player.getChild("callsign").getValue() != nil) { var callsign = player.getChild("callsign").getValue(); callsign_struct[callsign] = player; var str6 = player.getNode("sim/multiplay/generic/string[6]"); @@ -1247,6 +1267,7 @@ var processCallsigns = func () { } if (getprop("sim/time/elapsed-sec")-MAW_elapsed > 1.1) { setprop("payload/armament/MAW-active", 0);# resets every 1.1 seconds without warning + setprop("payload/armament/MAW-semiactive", 0); } # spike handling: @@ -1293,16 +1314,16 @@ processCallsignsTimer.start(); var code_ct = func () { #ANTIC if (getprop("payload/armament/msg")) { - setprop("sim/rendering/redout/enabled", TRUE); + setprop("sim/rendering/redout/enabled", 1); #call(func{fgcommand('dialog-close', multiplayer.dialog.dialog.prop())},nil,var err= []);# props.Node.new({"dialog-name": "location-in-air"})); - call(func{multiplayer.dialog.del();},nil,var err= []); + if (!m28_auto) call(func{multiplayer.dialog.del();},nil,var err= []); if (!getprop("gear/gear[0]/wow")) { call(func{fgcommand('dialog-close', props.Node.new({"dialog-name": "WeightAndFuel"}))},nil,var err2 = []); call(func{fgcommand('dialog-close', props.Node.new({"dialog-name": "system-failures"}))},nil,var err2 = []); call(func{fgcommand('dialog-close', props.Node.new({"dialog-name": "instrument-failures"}))},nil,var err2 = []); } setprop("sim/freeze/fuel",0); - setprop("/sim/speed-up", 1); + if (!m28_auto) setprop("/sim/speed-up", 1); setprop("/gui/map/draw-traffic", 0); setprop("/sim/marker-pins/traffic", 0); setprop("/sim/gui/dialogs/map-canvas/draw-TFC", 0); @@ -1317,7 +1338,7 @@ code_ctTimer.simulatedTime = 1; -setprop("/sim/failure-manager/display-on-screen", FALSE); +setprop("/sim/failure-manager/display-on-screen", 0); code_ctTimer.start(); @@ -1337,6 +1358,22 @@ var re_init = func (node) { } stopLaunch(); damageLog.push("Aircraft was repaired due to re-init."); + + # Remove all 3D craters and re-place them. Due to re-init can remove some of them. + + foreach (var thekey ; keys(statics)) { + var sta = statics[thekey]; + if (sta[0] != nil) { + sta[0].remove(); + if (sta[5] == 0) {# TODO: make a hash with all the models + sta[0] = geo.put_model(crater_model0, sta[1], sta[2], sta[3], sta[4]); + } elsif (sta[5] == 1) { + sta[0] = geo.put_model(crater_model1, sta[1], sta[2], sta[3], sta[4]); + } elsif (sta[5] == 2) { + sta[0] = geo.put_model(crater_model2, sta[1], sta[2], sta[3], sta[4]); + } + } + } } #================================================================== @@ -1405,6 +1442,7 @@ setlistener("sim/signals/exit", writeDamageLog, 0, 0); #screen.property_display.add("payload/armament/MAW-bearing"); #screen.property_display.add("payload/armament/MAW-active"); +#screen.property_display.add("payload/armament/MAW-semiactive"); #screen.property_display.add("payload/armament/MLW-bearing"); #screen.property_display.add("payload/armament/MLW-count"); #screen.property_display.add("payload/armament/MLW-launcher"); @@ -1412,6 +1450,8 @@ setlistener("sim/signals/exit", writeDamageLog, 0, 0); #screen.property_display.add("payload/armament/spike-air"); #screen.property_display.add("payload/armament/spike-gnd-20"); #screen.property_display.add("payload/armament/spike-gnd-02"); +#screen.property_display.add("payload/armament/spike-gnd-05"); +#screen.property_display.add("payload/armament/spike-gnd-06"); #screen.property_display.add("payload/armament/spike-gnd-11"); #screen.property_display.add("payload/armament/spike-gnd-23"); #screen.property_display.add("payload/armament/spike-gnd-p2"); diff --git a/gci-radar/Nasal/gci.nas b/gci-radar/Nasal/gci.nas index ba6d5fa..56a6e99 100644 --- a/gci-radar/Nasal/gci.nas +++ b/gci-radar/Nasal/gci.nas @@ -1,6 +1,6 @@ # (c) 2018 pinto # license: gplv2+ - +srand();# seed the random generator with systime # v0.2b # will only report the closest bad guy, does no threat assessment. # todo: diff --git a/gci-radar/Nasal/radar-logic.nas b/gci-radar/Nasal/radar-logic.nas index 0e46e0a..0a43172 100644 --- a/gci-radar/Nasal/radar-logic.nas +++ b/gci-radar/Nasal/radar-logic.nas @@ -15,9 +15,6 @@ if ((major == 2017 and minor == 2 and pica >= 1) or (major == 2017 and minor > 2 pickingMethod = 1; } -var FALSE = 0; -var TRUE = 1; - var AIR = 0; var MARINE = 1; var SURFACE = 2; @@ -73,6 +70,9 @@ var Contact = { obj.range = obj.rdrProp.getNode("range-nm"); obj.bearing = obj.rdrProp.getNode("bearing-deg"); obj.elevation = obj.rdrProp.getNode("elevation-deg"); + obj.ubody = obj.rdrProp.getNode("velocities/uBody-fps"); + obj.vbody = obj.rdrProp.getNode("velocities/vBody-fps"); + obj.wbody = obj.rdrProp.getNode("velocities/wBody-fps"); #}); obj.deviation = nil; @@ -84,27 +84,63 @@ var Contact = { return obj; }, + + get_uBody: func { + var body = nil; + if (me.ubody != nil) { + body = me.ubody.getValue(); + } + if(body == nil) { + body = me.get_Speed()*KT2FPS; + } + return body; + }, + + get_vBody: func { + var body = nil; + if (me.ubody != nil) { + body = me.vbody.getValue(); + } + if(body == nil) { + body = 0; + } + return body; + }, + + get_wBody: func { + var body = nil; + if (me.ubody != nil) { + body = me.wbody.getValue(); + } + if(body == nil) { + body = 0; + } + return body; + }, isValid: func () { var valid = me.valid.getValue(); if (valid == nil) { - valid = FALSE; + valid = 0; } if (me.callsign.getValue() != me.orig_callsign) { - valid = FALSE; + valid = 0; } return valid; }, isPainted: func () { - if (me.painted == nil) { - me.painted = me.node.getNode("painted"); + if (getprop("/carrier/sunk") == 1) { + return 0; } - if (me.painted == nil) { - return nil; + return isNotBehindTerrain(me.node)[0]; + }, + + isCommandActive: func { + if (getprop("/carrier/sunk") == 1) { + return 0; } - var p = me.painted.getValue(); - return p; + return isNotBehindTerrain(me.node)[0]; }, getUnique: func () { @@ -124,6 +160,7 @@ var Contact = { if(e == nil or e == 0) { # AI/MP has no radar properties var self = geo.aircraft_position(); + self.set_alt(self.alt()+fire_control.radar_elevation_above_terrain_m); me.get_Coord(); var angleInv = clamp(self.distance_to(me.coord)/self.direct_distance_to(me.coord), -1, 1); e = (self.alt()>me.coord.alt()?-1:1)*math.acos(angleInv)*R2D; @@ -343,108 +380,48 @@ var Contact = { }; var isNotBehindTerrain = func( mp ) { + var pos = mp.getNode("position"); + var alt = pos.getNode("altitude-ft").getValue(); + var lat = pos.getNode("latitude-deg").getValue(); + var lon = pos.getNode("longitude-deg").getValue(); + if(alt == nil or lat == nil or lon == nil) { + return [0,0]; # invisible and not in front of terrain + } + var aircraftPos = geo.Coord.new().set_latlon(lat, lon, alt*FT2M); -########### - var pos = mp.getNode("position"); - var alt = pos.getNode("altitude-ft").getValue(); - var lat = pos.getNode("latitude-deg").getValue(); - var lon = pos.getNode("longitude-deg").getValue(); - if(alt == nil or lat == nil or lon == nil) { - return isVisible = 0; - } - var aircraftPos = geo.Coord.new().set_latlon(lat, lon, alt*0.3048); -################# - if (pickingMethod == 1) { - var myPos = geo.aircraft_position(); - myPos.set_latlon(myPos.lat(),myPos.lon(),myPos.alt()+50); - var xyz = {"x":myPos.x(), "y":myPos.y(), "z":myPos.z()}; - var dir = {"x":aircraftPos.x()-myPos.x(), "y":aircraftPos.y()-myPos.y(), "z":aircraftPos.z()-myPos.z()}; + var myPos = geo.aircraft_position(); - # Check for terrain between own aircraft and other: - v = get_cart_ground_intersection(xyz, dir); - if (v == nil) { - return 1; - #printf("No terrain, planes has clear view of each other"); - } else { - var terrain = geo.Coord.new(); - terrain.set_latlon(v.lat, v.lon, v.elevation); - var maxDist = myPos.direct_distance_to(aircraftPos); - var terrainDist = myPos.direct_distance_to(terrain); - if (terrainDist < maxDist) { - #printf("terrain found between SAM and aircraft %.1f meter away.", terrainDist); - return 0; - } else { - #print("The planes has clear view of each other"); - return 1; - } + myPos.set_alt(myPos.alt()+fire_control.radar_elevation_above_terrain_m); + + var target_distance = myPos.direct_distance_to(aircraftPos); + + call(func { + if (target_distance*0.001 > 3.57*(math.sqrt(myPos.alt())+math.sqrt(alt*FT2M))) { + # behind earth curvature + #print("behind earth curvature"); + return [0,0]; # invisible and not in front of terrain } + },nil,nil,var err =[]); + + var xyz = {"x":myPos.x(), "y":myPos.y(), "z":myPos.z()}; + var dir = {"x":aircraftPos.x()-myPos.x(), "y":aircraftPos.y()-myPos.y(), "z":aircraftPos.z()-myPos.z()}; + + # Check for terrain between own aircraft and other: + v = get_cart_ground_intersection(xyz, dir); + if (v == nil) { + return [1,0]; # visible and not in front of terrain + #printf("No terrain, planes has clear view of each other"); + } else { + var terrain = geo.Coord.new(); + terrain.set_latlon(v.lat, v.lon, v.elevation); + var maxDist = myPos.direct_distance_to(aircraftPos); + var terrainDist = myPos.direct_distance_to(terrain); + if (terrainDist < maxDist-1) { + #printf("terrain found between me and aircraft %.1f meter away.", terrainDist); + return [0,0]; # visible and not in front of terrain } else { - var isVisible = 0; - var MyCoord = geo.aircraft_position(); - - # Because there is no terrain on earth that can be between these 2 - if(MyCoord.alt() < 8900 and aircraftPos.alt() < 8900) - { - # Temporary variable - # A (our plane) coord in meters - var a = MyCoord.x(); - var b = MyCoord.y(); - var c = MyCoord.z(); - # B (target) coord in meters - var d = aircraftPos.x(); - var e = aircraftPos.y(); - var f = aircraftPos.z(); - var difa = d - a; - var difb = e - b; - var difc = f - c; - # direct Distance in meters - var myDistance = math.sqrt( math.pow((d-a),2) + math.pow((e-b),2) + math.pow((f-c),2)); #calculating distance ourselves to avoid another call to geo.nas (read: speed, probably). - var Aprime = geo.Coord.new(); - - # Here is to limit FPS drop on very long distance - var L = 500; - if(myDistance > 50000) - { - L = myDistance / 15; - } - var step = L; - var maxLoops = int(myDistance / L); - - isVisible = 1; - # This loop will make travel a point between us and the target and check if there is terrain - for(var i = 1 ; i <= maxLoops ; i += 1) - { - #calculate intermediate step - #basically dividing the line into maxLoops number of steps, and checking at each step - #to ascii-art explain it: - # |us|----------|step 1|-----------|step 2|--------|step 3|----------|them| - #there will be as many steps as there is i - #every step will be equidistant - - #also, if i == 0 then the first step will be our plane - - var x = ((difa/(maxLoops+1))*i)+a; - var y = ((difb/(maxLoops+1))*i)+b; - var z = ((difc/(maxLoops+1))*i)+c; - #print("i:" ~ i ~ "|x,y,z | " ~ x ~ "," ~ y ~ "," ~ z); - Aprime.set_xyz(x,y,z); - var AprimeTerrainAlt = geo.elevation(Aprime.lat(), Aprime.lon()); - if(AprimeTerrainAlt == nil) - { - AprimeTerrainAlt = 0; - } - - if(AprimeTerrainAlt > Aprime.alt()) - { - #print("behind terrain"); - return 0; - } - } - } - else - { - isVisible = 1; - } - return isVisible; + #print("The planes has clear view of each other"); + return [1,1]; # visible and in front of terrain } + } } \ No newline at end of file diff --git a/gci-radar/Systems/fbw.xml b/gci-radar/Systems/fbw.xml deleted file mode 100644 index 107c064..0000000 --- a/gci-radar/Systems/fbw.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - FBW Throttle - gain - 80.0 - - /controls/engines/engine[0]/throttle - - - /carrier/fbw/target/groundspeed-kt - - - - - FBW Rudder - gain - 8.0 - - /controls/flight/rudder - - - /surface-positions/rudder-pos-norm - - - - diff --git a/gci-radar/Systems/fdm.xml b/gci-radar/Systems/fdm.xml deleted file mode 100644 index 7a847c8..0000000 --- a/gci-radar/Systems/fdm.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - FDM Groundspeed - noise-spike - - /carrier/fbw/target/groundspeed-kt - - - /velocities/groundspeed-kt - - - - 7 - - - - - FDM True Heading For Flags - gain - - /orientation/heading-deg - - - /orientation/true-heading-deg - - - - - - - - - - diff --git a/groundtarget/Dialogs/control-panel.xml b/groundtarget/Dialogs/control-panel.xml deleted file mode 100644 index e6a5f9e..0000000 --- a/groundtarget/Dialogs/control-panel.xml +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - control-panel - vbox - 250 - false - - - hbox - - true - - - - true - - - - - - - - vbox - 6 - - - - - - table - - - - 0 - 1 - - - - - - - - - - 2 - 1 - - - - - - - - - - 4 - 0 - - - - - 4 - 1 - - - - - - - - - - - - - - - - - vbox - 6 - - - - - - vbox - - - left - - /controls/lighting/deck-lights - true - - dialog-apply - - - property-toggle - - - - - left - - /carrier/antennas/enabled - true - - dialog-apply - - - property-toggle - - - - - - - - - vbox - 6 - - - - - - vbox - - - left - - /carrier/fdm/settings/movement - true - - dialog-apply - - - property-toggle - - - - - left - - /carrier/phalanx/settings/show-debug-aim - true - - dialog-apply - - - property-toggle - - - - - - - - - hbox - 6 - - true - - - - - diff --git a/groundtarget/Dialogs/menu.xml b/groundtarget/Dialogs/menu.xml deleted file mode 100644 index a34d397..0000000 --- a/groundtarget/Dialogs/menu.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - true - - - - - dialog-show - control-panel - - - - - - - diff --git a/groundtarget/Nasal/damage.nas b/groundtarget/Nasal/damage.nas index 44b753a..81e859c 100644 --- a/groundtarget/Nasal/damage.nas +++ b/groundtarget/Nasal/damage.nas @@ -27,8 +27,6 @@ var mlw_max=getprop("payload/d-config/mlw_max"); # var auto_flare_caller = getprop("payload/d-config/auto_flare_caller"); # If damage.nas should detect flare releases, or if function is called from somewhere in aircraft ############################################################################################################################ -var TRUE = 1; -var FALSE = 0; var hp = hp_max; setprop("sam/damage", math.max(0,100*hp/hp_max));#used in HUD @@ -164,7 +162,9 @@ var warheads = { "pilot": [93, 0.00,1,0],# ejected pilot "BETAB-500ShP": [94, 1160.00,1,0], "Flare": [95, 0.00,0,0], - "3M9": [96, 125.00,0,0],# 3M9 Missile used with 2K12/SA-6 + "3M9": [96, 125.00,0,0],# 3M9M3 Missile used with 2K12/SA-6 + "5V28V": [97, 478.00,0,0],# Missile used with S-200D/SA-5 + "AIM-9X": [98, 20.80,0,0], }; var AIR_RADAR = "air"; @@ -189,7 +189,8 @@ var radar_signatures = { "E-8R": AIR_RADAR, "EC-137D": AIR_RADAR, "Mig-28": AIR_RADAR, - "SA-6": AIR_RADAR,#Air radar tone chosen so that there is at least some lock tone until asset-specific is created + "SA-6": "gnd-06",#Air radar tone chosen so that there is at least some lock tone until asset-specific is created + "s-200": "gnd-05", "ZSU-23-4M": "gnd-23", "S-75": "gnd-02", "buk-m2": "gnd-11", @@ -203,7 +204,7 @@ var radar_signatures = { var id2warhead = []; var launched = {};# callsign: elapsed-sec var approached = {};# callsign: uniqueID -var heavy_smoke = [61,62,63,65,92,96]; +var heavy_smoke = [61,62,63,65,92,96,97]; var k = keys(warheads); @@ -241,6 +242,10 @@ for(var myid = 0;myid 450) { - printf("Missile Approach Warning from %03d degrees.", bearing); - damageLog.push(sprintf("Missile Approach Warning from %03d degrees from %s.", bearing, notification.Callsign)); - if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning from %03d degrees.", bearing), 1,1,0);# temporary till someone models a RWR in RIO seat + if (radarOn) { + #printf("Missile Approach Warning from %03d degrees.", bearing); + damageLog.push(sprintf("Missile Approach Warning from %03d degrees from %s.", bearing, notification.Callsign)); + if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning from %03d degrees.", bearing), 1,0.5,0);# temporary till someone models a RWR in RIO seat + } else { + #printf("Missile Approach Warning"); + damageLog.push(sprintf("Missile Approach Warning from %s.", notification.Callsign)); + if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning (semi-active)."), 1,0.5,0);# temporary till someone models a RWR in RIO seat + } approached[notification.Callsign~notification.UniqueIdentity] = elapsed; - if (m28_auto) mig28.engagedBy(notification.Callsign); + if (m28_auto) mig28.engagedBy(notification.Callsign, 1); } return emesary.Transmitter.ReceiptStatus_OK; } @@ -415,7 +433,7 @@ var DamageRecipient = # debug.dump(notification); # # - if (tacview_supported and tacview.starttime and getprop("sim/multiplay/txhost") != "mpserver.opredflag.com") { + if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto)) { var node = getCallsign(notification.RemoteCallsign); if (node != nil and notification.SecondaryKind > 20) { # its a warhead @@ -439,9 +457,10 @@ var DamageRecipient = var callsign = processCallsign(getprop("sim/multiplay/callsign")); if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) { #damage enabled and were getting hit - if (m28_auto) mig28.engagedBy(notification.Callsign); + if (notification.SecondaryKind < 0 and hitable_by_cannon) { # cannon hit + if (m28_auto) mig28.engagedBy(notification.Callsign, 0); var probability = id2shell[-1*notification.SecondaryKind-1][1]; var typ = id2shell[-1*notification.SecondaryKind-1][2]; var hit_count = notification.Distance; @@ -457,6 +476,7 @@ var DamageRecipient = } } elsif (notification.SecondaryKind > 20) { # its a warhead + if (m28_auto) mig28.engagedBy(notification.Callsign, 1); var dist = notification.Distance; var wh = id2warhead[notification.SecondaryKind - 21]; var type = wh[4];#test code @@ -549,21 +569,18 @@ var DamageRecipient = } if (notification.Kind == CREATE and getprop("payload/armament/enable-craters") == 1 and statics["obj_"~notification.UniqueIdentity] == nil) { if (notification.SecondaryKind == 0) {# TODO: make a hash with all the models - var crater_model = getprop("payload/armament/models") ~ "crater_small.xml"; - var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); + var static = geo.put_model(crater_model0, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); if (static != nil) { statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind]; #static is a PropertyNode inside /models } } elsif (notification.SecondaryKind == 1) { - var crater_model = getprop("payload/armament/models") ~ "crater_big.xml"; - var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); + var static = geo.put_model(crater_model1, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); if (static != nil) { statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind]; } } elsif (notification.SecondaryKind == 2) { - var crater_model = getprop("payload/armament/models") ~ "bomb_hit_smoke.xml"; - var static = geo.put_model(crater_model, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); + var static = geo.put_model(crater_model2, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading); if (static != nil) { statics["obj_"~notification.UniqueIdentity] = [static, notification.Position.lat(), notification.Position.lon(), notification.Position.alt(), notification.Heading, notification.SecondaryKind]; } @@ -863,6 +880,7 @@ var flare_update_time = 0.4; var flare_duration = 8; var flare_terminal_speed = 50;#m/s var flares_max_process_per_loop = 4; +var flare_sequencer = -120; var flare_sorter = func(a, b) { if(a[0] < b[0]){ @@ -945,7 +963,9 @@ var flare_released = func { getprop("orientation/heading-deg"), FT2M*getprop("velocities/speed-down-fps"), FT2M*math.sqrt(getprop("velocities/speed-north-fps")*getprop("velocities/speed-north-fps")+getprop("velocities/speed-east-fps")*getprop("velocities/speed-east-fps")), - int(rand()*240)-120]; + flare_sequencer]; + flare_sequencer += 1; + if (flare_sequencer > 120) flare_sequencer = -120; append(flare_list, flare); var msg = notifications.ObjectInFlightNotification.new("ffly", flare[6], MOVE, 21+95); msg.Flags = 0; @@ -1233,7 +1253,7 @@ var processCallsigns = func () { var painted = 0; var paint_list = []; foreach (var player; players) { - if(player.getChild("valid") != nil and player.getChild("valid").getValue() == TRUE and player.getChild("callsign") != nil and player.getChild("callsign").getValue() != "" and player.getChild("callsign").getValue() != nil) { + if(player.getChild("valid") != nil and player.getChild("valid").getValue() == 1 and player.getChild("callsign") != nil and player.getChild("callsign").getValue() != "" and player.getChild("callsign").getValue() != nil) { var callsign = player.getChild("callsign").getValue(); callsign_struct[callsign] = player; var str6 = player.getNode("sim/multiplay/generic/string[6]"); @@ -1247,6 +1267,7 @@ var processCallsigns = func () { } if (getprop("sim/time/elapsed-sec")-MAW_elapsed > 1.1) { setprop("payload/armament/MAW-active", 0);# resets every 1.1 seconds without warning + setprop("payload/armament/MAW-semiactive", 0); } # spike handling: @@ -1293,16 +1314,16 @@ processCallsignsTimer.start(); var code_ct = func () { #ANTIC if (getprop("payload/armament/msg")) { - setprop("sim/rendering/redout/enabled", TRUE); + setprop("sim/rendering/redout/enabled", 1); #call(func{fgcommand('dialog-close', multiplayer.dialog.dialog.prop())},nil,var err= []);# props.Node.new({"dialog-name": "location-in-air"})); - call(func{multiplayer.dialog.del();},nil,var err= []); + if (!m28_auto) call(func{multiplayer.dialog.del();},nil,var err= []); if (!getprop("gear/gear[0]/wow")) { call(func{fgcommand('dialog-close', props.Node.new({"dialog-name": "WeightAndFuel"}))},nil,var err2 = []); call(func{fgcommand('dialog-close', props.Node.new({"dialog-name": "system-failures"}))},nil,var err2 = []); call(func{fgcommand('dialog-close', props.Node.new({"dialog-name": "instrument-failures"}))},nil,var err2 = []); } setprop("sim/freeze/fuel",0); - setprop("/sim/speed-up", 1); + if (!m28_auto) setprop("/sim/speed-up", 1); setprop("/gui/map/draw-traffic", 0); setprop("/sim/marker-pins/traffic", 0); setprop("/sim/gui/dialogs/map-canvas/draw-TFC", 0); @@ -1317,7 +1338,7 @@ code_ctTimer.simulatedTime = 1; -setprop("/sim/failure-manager/display-on-screen", FALSE); +setprop("/sim/failure-manager/display-on-screen", 0); code_ctTimer.start(); @@ -1337,6 +1358,22 @@ var re_init = func (node) { } stopLaunch(); damageLog.push("Aircraft was repaired due to re-init."); + + # Remove all 3D craters and re-place them. Due to re-init can remove some of them. + + foreach (var thekey ; keys(statics)) { + var sta = statics[thekey]; + if (sta[0] != nil) { + sta[0].remove(); + if (sta[5] == 0) {# TODO: make a hash with all the models + sta[0] = geo.put_model(crater_model0, sta[1], sta[2], sta[3], sta[4]); + } elsif (sta[5] == 1) { + sta[0] = geo.put_model(crater_model1, sta[1], sta[2], sta[3], sta[4]); + } elsif (sta[5] == 2) { + sta[0] = geo.put_model(crater_model2, sta[1], sta[2], sta[3], sta[4]); + } + } + } } #================================================================== @@ -1405,6 +1442,7 @@ setlistener("sim/signals/exit", writeDamageLog, 0, 0); #screen.property_display.add("payload/armament/MAW-bearing"); #screen.property_display.add("payload/armament/MAW-active"); +#screen.property_display.add("payload/armament/MAW-semiactive"); #screen.property_display.add("payload/armament/MLW-bearing"); #screen.property_display.add("payload/armament/MLW-count"); #screen.property_display.add("payload/armament/MLW-launcher"); @@ -1412,6 +1450,8 @@ setlistener("sim/signals/exit", writeDamageLog, 0, 0); #screen.property_display.add("payload/armament/spike-air"); #screen.property_display.add("payload/armament/spike-gnd-20"); #screen.property_display.add("payload/armament/spike-gnd-02"); +#screen.property_display.add("payload/armament/spike-gnd-05"); +#screen.property_display.add("payload/armament/spike-gnd-06"); #screen.property_display.add("payload/armament/spike-gnd-11"); #screen.property_display.add("payload/armament/spike-gnd-23"); #screen.property_display.add("payload/armament/spike-gnd-p2"); diff --git a/groundtarget/Nasal/dialogs.nas b/groundtarget/Nasal/dialogs.nas deleted file mode 100644 index 835a812..0000000 --- a/groundtarget/Nasal/dialogs.nas +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2015 onox -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -var control_panel = gui.Dialog.new("sim/gui/dialogs/control-panel/dialog", "Aircraft/CVN-70/Dialogs/control-panel.xml"); diff --git a/groundtarget/Nasal/fdm.nas b/groundtarget/Nasal/fdm.nas index 56665f7..1dd10db 100644 --- a/groundtarget/Nasal/fdm.nas +++ b/groundtarget/Nasal/fdm.nas @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . - +srand();# seed the random generator with systime #io.include("Aircraft/ExpansionPack/Nasal/init.nas"); #with("updateloop"); diff --git a/groundtarget/Sim/mice.xml b/groundtarget/Sim/mice.xml deleted file mode 100644 index 2f2bf35..0000000 --- a/groundtarget/Sim/mice.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/groundtarget/Sim/views.xml b/groundtarget/Sim/views.xml deleted file mode 100644 index 5bc0d87..0000000 --- a/groundtarget/Sim/views.xml +++ /dev/null @@ -1,280 +0,0 @@ - - - - - - - - 1 - - - -200.0 - - - Cockpit View - false - - - - Helicopter View - - -5 - 21.925 - - - - - Chase View - false - - - - Chase View Without Yaw - false - - - - Hangar View - lookfrom - true - - true - 0 - - 2 - 15 - 113 - - 60 - 0.1f - - - - - Phalanx Forward Left - lookfrom - false - - true - 0 - - -21.1147 - 16.8345 - -121.2666 - - 90 - 60 - 0.1f - - - - - Phalanx Forward Right - lookfrom - false - - true - 0 - - 23.1336 - 16.6478 - -112.684 - - 90 - 60 - 0.1f - - - - - Phalanx Aft - lookfrom - false - - true - 0 - - 23.3165 - 18.1198 - 134.344 - - 90 - 60 - 0.1f - - - - - Landing Signal Officer View - lookfrom - false - - true - 0 - - 180 - -19.7208 - 21.925 - 100.307 - 2.5 - 60 - 0.1f - - - - - Approach View - lookfrom - false - - - /position/latitude-deg - /position/longitude-deg - /position/altitude-ft - /orientation/heading-runway-deg - /orientation/pitch-deg - /orientation/roll-deg - - -15.4979 - 21.9 - -8.315 - - 180 - 3 - 25 - 0.1f - - - - - Flight Deck Aft View - lookfrom - false - - true - 0 - - 10 - 21.925 - 42 - - 163 - 5 - 60 - 0.1f - - - - - Flight Deck Forward View - lookfrom - false - - true - 0 - - 0 - 21.925 - -35 - - 180 - 10 - 60 - 0.1f - - - - - Bubble View - lookfrom - true - - true - 0 - - 4.1 - 20.325 - -93 - - 180 - 0 - 60 - 0.1f - - - - - Goofers' View - lookfrom - false - - true - 0 - - 27.074 - 35.3325 - 42.67 - - 136 - -11 - 40 - 0.1f - - - - - Primary Flight Control View - lookfrom - true - - true - 0 - - 23.2669 - 35.082 - 20.1064 - - -5 - 60 - 0.1f - - - - - Bridge View - lookfrom - true - - true - 0 - - 29.2083 - 33.235233 - 19.45 - - -2 - 45 - 0.1f - - - - diff --git a/groundtarget/Systems/fbw.xml b/groundtarget/Systems/fbw.xml deleted file mode 100644 index 107c064..0000000 --- a/groundtarget/Systems/fbw.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - FBW Throttle - gain - 80.0 - - /controls/engines/engine[0]/throttle - - - /carrier/fbw/target/groundspeed-kt - - - - - FBW Rudder - gain - 8.0 - - /controls/flight/rudder - - - /surface-positions/rudder-pos-norm - - - - diff --git a/groundtarget/Systems/fdm.xml b/groundtarget/Systems/fdm.xml deleted file mode 100644 index 7a847c8..0000000 --- a/groundtarget/Systems/fdm.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - FDM Groundspeed - noise-spike - - /carrier/fbw/target/groundspeed-kt - - - /velocities/groundspeed-kt - - - - 7 - - - - - FDM True Heading For Flags - gain - - /orientation/heading-deg - - - /orientation/true-heading-deg - - - - - - - - - -