diff --git a/BUK-M2/Nasal/damage.nas b/BUK-M2/Nasal/damage.nas index 1bae576..bfdeaf2 100644 --- a/BUK-M2/Nasal/damage.nas +++ b/BUK-M2/Nasal/damage.nas @@ -293,7 +293,7 @@ var DamageRecipient = # " RemoteCallsign=",notification.RemoteCallsign, # " Flags=",notification.Flags, # " Radar=",bits.test(notification.Flags, 0), -# " Thrust=",bits.test(notification.Flags, 1)); +# " Thrust=",bits.test(notification.Flags, 1), # " CWI=",bits.test(notification.Flags, 2)); # # todo: @@ -449,28 +449,40 @@ var DamageRecipient = damageLog.push("Ignored hit by "~notification.Callsign); return emesary.Transmitter.ReceiptStatus_NotProcessed; } - 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 or notification.SecondaryKind < -40)) { - # its a warhead - var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; - var lbs = wh[1]; - var hitCoord = geo.Coord.new(); - hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); - if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check - hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); - } - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); - thread.unlock(tacview.mutexWrite); - } elsif (node != nil and notification.SecondaryKind < 0) { - # its a cannon or rocket - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); - thread.unlock(tacview.mutexWrite); - } - } var callsign = processCallsign(getprop("sim/multiplay/callsign")); + if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto or notification.RemoteCallsign == callsign)) { + var node = getCallsign(notification.RemoteCallsign); + if (notification.RemoteCallsign == callsign) node = 1; + if (node != nil and (notification.SecondaryKind > 20 or notification.SecondaryKind < -40)) { + # its a warhead + var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; + var lbs = wh[1]; + var hitCoord = geo.Coord.new(); + if (notification.RemoteCallsign == callsign) { + hitCoord = geo.aircraft_position(); + } else { + hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); + } + if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check + hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); + } + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); + thread.unlock(tacview.mutexWrite); + } elsif (node == 1 and notification.SecondaryKind < 0) { + # its a cannon or rocket + var hitCoord = geo.aircraft_position(); + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(), hitCoord.lon(), hitCoord.alt(), 5); + thread.unlock(tacview.mutexWrite); + } elsif (node != nil and notification.SecondaryKind < 0) { + # its a cannon or rocket + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); + thread.unlock(tacview.mutexWrite); + } + } + if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) { #damage enabled and were getting hit diff --git a/Frigate/Nasal/damage.nas b/Frigate/Nasal/damage.nas index 1bae576..bfdeaf2 100644 --- a/Frigate/Nasal/damage.nas +++ b/Frigate/Nasal/damage.nas @@ -293,7 +293,7 @@ var DamageRecipient = # " RemoteCallsign=",notification.RemoteCallsign, # " Flags=",notification.Flags, # " Radar=",bits.test(notification.Flags, 0), -# " Thrust=",bits.test(notification.Flags, 1)); +# " Thrust=",bits.test(notification.Flags, 1), # " CWI=",bits.test(notification.Flags, 2)); # # todo: @@ -449,28 +449,40 @@ var DamageRecipient = damageLog.push("Ignored hit by "~notification.Callsign); return emesary.Transmitter.ReceiptStatus_NotProcessed; } - 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 or notification.SecondaryKind < -40)) { - # its a warhead - var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; - var lbs = wh[1]; - var hitCoord = geo.Coord.new(); - hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); - if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check - hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); - } - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); - thread.unlock(tacview.mutexWrite); - } elsif (node != nil and notification.SecondaryKind < 0) { - # its a cannon or rocket - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); - thread.unlock(tacview.mutexWrite); - } - } var callsign = processCallsign(getprop("sim/multiplay/callsign")); + if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto or notification.RemoteCallsign == callsign)) { + var node = getCallsign(notification.RemoteCallsign); + if (notification.RemoteCallsign == callsign) node = 1; + if (node != nil and (notification.SecondaryKind > 20 or notification.SecondaryKind < -40)) { + # its a warhead + var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; + var lbs = wh[1]; + var hitCoord = geo.Coord.new(); + if (notification.RemoteCallsign == callsign) { + hitCoord = geo.aircraft_position(); + } else { + hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); + } + if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check + hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); + } + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); + thread.unlock(tacview.mutexWrite); + } elsif (node == 1 and notification.SecondaryKind < 0) { + # its a cannon or rocket + var hitCoord = geo.aircraft_position(); + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(), hitCoord.lon(), hitCoord.alt(), 5); + thread.unlock(tacview.mutexWrite); + } elsif (node != nil and notification.SecondaryKind < 0) { + # its a cannon or rocket + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); + thread.unlock(tacview.mutexWrite); + } + } + if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) { #damage enabled and were getting hit diff --git a/MIM-104D/Nasal/damage.nas b/MIM-104D/Nasal/damage.nas index 1bae576..bfdeaf2 100644 --- a/MIM-104D/Nasal/damage.nas +++ b/MIM-104D/Nasal/damage.nas @@ -293,7 +293,7 @@ var DamageRecipient = # " RemoteCallsign=",notification.RemoteCallsign, # " Flags=",notification.Flags, # " Radar=",bits.test(notification.Flags, 0), -# " Thrust=",bits.test(notification.Flags, 1)); +# " Thrust=",bits.test(notification.Flags, 1), # " CWI=",bits.test(notification.Flags, 2)); # # todo: @@ -449,28 +449,40 @@ var DamageRecipient = damageLog.push("Ignored hit by "~notification.Callsign); return emesary.Transmitter.ReceiptStatus_NotProcessed; } - 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 or notification.SecondaryKind < -40)) { - # its a warhead - var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; - var lbs = wh[1]; - var hitCoord = geo.Coord.new(); - hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); - if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check - hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); - } - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); - thread.unlock(tacview.mutexWrite); - } elsif (node != nil and notification.SecondaryKind < 0) { - # its a cannon or rocket - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); - thread.unlock(tacview.mutexWrite); - } - } var callsign = processCallsign(getprop("sim/multiplay/callsign")); + if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto or notification.RemoteCallsign == callsign)) { + var node = getCallsign(notification.RemoteCallsign); + if (notification.RemoteCallsign == callsign) node = 1; + if (node != nil and (notification.SecondaryKind > 20 or notification.SecondaryKind < -40)) { + # its a warhead + var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; + var lbs = wh[1]; + var hitCoord = geo.Coord.new(); + if (notification.RemoteCallsign == callsign) { + hitCoord = geo.aircraft_position(); + } else { + hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); + } + if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check + hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); + } + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); + thread.unlock(tacview.mutexWrite); + } elsif (node == 1 and notification.SecondaryKind < 0) { + # its a cannon or rocket + var hitCoord = geo.aircraft_position(); + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(), hitCoord.lon(), hitCoord.alt(), 5); + thread.unlock(tacview.mutexWrite); + } elsif (node != nil and notification.SecondaryKind < 0) { + # its a cannon or rocket + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); + thread.unlock(tacview.mutexWrite); + } + } + if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) { #damage enabled and were getting hit diff --git a/S-200/Nasal/damage.nas b/S-200/Nasal/damage.nas index 1bae576..bfdeaf2 100644 --- a/S-200/Nasal/damage.nas +++ b/S-200/Nasal/damage.nas @@ -293,7 +293,7 @@ var DamageRecipient = # " RemoteCallsign=",notification.RemoteCallsign, # " Flags=",notification.Flags, # " Radar=",bits.test(notification.Flags, 0), -# " Thrust=",bits.test(notification.Flags, 1)); +# " Thrust=",bits.test(notification.Flags, 1), # " CWI=",bits.test(notification.Flags, 2)); # # todo: @@ -449,28 +449,40 @@ var DamageRecipient = damageLog.push("Ignored hit by "~notification.Callsign); return emesary.Transmitter.ReceiptStatus_NotProcessed; } - 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 or notification.SecondaryKind < -40)) { - # its a warhead - var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; - var lbs = wh[1]; - var hitCoord = geo.Coord.new(); - hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); - if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check - hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); - } - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); - thread.unlock(tacview.mutexWrite); - } elsif (node != nil and notification.SecondaryKind < 0) { - # its a cannon or rocket - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); - thread.unlock(tacview.mutexWrite); - } - } var callsign = processCallsign(getprop("sim/multiplay/callsign")); + if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto or notification.RemoteCallsign == callsign)) { + var node = getCallsign(notification.RemoteCallsign); + if (notification.RemoteCallsign == callsign) node = 1; + if (node != nil and (notification.SecondaryKind > 20 or notification.SecondaryKind < -40)) { + # its a warhead + var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; + var lbs = wh[1]; + var hitCoord = geo.Coord.new(); + if (notification.RemoteCallsign == callsign) { + hitCoord = geo.aircraft_position(); + } else { + hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); + } + if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check + hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); + } + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); + thread.unlock(tacview.mutexWrite); + } elsif (node == 1 and notification.SecondaryKind < 0) { + # its a cannon or rocket + var hitCoord = geo.aircraft_position(); + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(), hitCoord.lon(), hitCoord.alt(), 5); + thread.unlock(tacview.mutexWrite); + } elsif (node != nil and notification.SecondaryKind < 0) { + # its a cannon or rocket + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); + thread.unlock(tacview.mutexWrite); + } + } + if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) { #damage enabled and were getting hit diff --git a/S-300/Nasal/damage.nas b/S-300/Nasal/damage.nas index 1bae576..bfdeaf2 100644 --- a/S-300/Nasal/damage.nas +++ b/S-300/Nasal/damage.nas @@ -293,7 +293,7 @@ var DamageRecipient = # " RemoteCallsign=",notification.RemoteCallsign, # " Flags=",notification.Flags, # " Radar=",bits.test(notification.Flags, 0), -# " Thrust=",bits.test(notification.Flags, 1)); +# " Thrust=",bits.test(notification.Flags, 1), # " CWI=",bits.test(notification.Flags, 2)); # # todo: @@ -449,28 +449,40 @@ var DamageRecipient = damageLog.push("Ignored hit by "~notification.Callsign); return emesary.Transmitter.ReceiptStatus_NotProcessed; } - 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 or notification.SecondaryKind < -40)) { - # its a warhead - var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; - var lbs = wh[1]; - var hitCoord = geo.Coord.new(); - hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); - if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check - hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); - } - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); - thread.unlock(tacview.mutexWrite); - } elsif (node != nil and notification.SecondaryKind < 0) { - # its a cannon or rocket - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); - thread.unlock(tacview.mutexWrite); - } - } var callsign = processCallsign(getprop("sim/multiplay/callsign")); + if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto or notification.RemoteCallsign == callsign)) { + var node = getCallsign(notification.RemoteCallsign); + if (notification.RemoteCallsign == callsign) node = 1; + if (node != nil and (notification.SecondaryKind > 20 or notification.SecondaryKind < -40)) { + # its a warhead + var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; + var lbs = wh[1]; + var hitCoord = geo.Coord.new(); + if (notification.RemoteCallsign == callsign) { + hitCoord = geo.aircraft_position(); + } else { + hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); + } + if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check + hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); + } + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); + thread.unlock(tacview.mutexWrite); + } elsif (node == 1 and notification.SecondaryKind < 0) { + # its a cannon or rocket + var hitCoord = geo.aircraft_position(); + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(), hitCoord.lon(), hitCoord.alt(), 5); + thread.unlock(tacview.mutexWrite); + } elsif (node != nil and notification.SecondaryKind < 0) { + # its a cannon or rocket + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); + thread.unlock(tacview.mutexWrite); + } + } + if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) { #damage enabled and were getting hit diff --git a/S-75/Nasal/damage.nas b/S-75/Nasal/damage.nas index 1bae576..bfdeaf2 100644 --- a/S-75/Nasal/damage.nas +++ b/S-75/Nasal/damage.nas @@ -293,7 +293,7 @@ var DamageRecipient = # " RemoteCallsign=",notification.RemoteCallsign, # " Flags=",notification.Flags, # " Radar=",bits.test(notification.Flags, 0), -# " Thrust=",bits.test(notification.Flags, 1)); +# " Thrust=",bits.test(notification.Flags, 1), # " CWI=",bits.test(notification.Flags, 2)); # # todo: @@ -449,28 +449,40 @@ var DamageRecipient = damageLog.push("Ignored hit by "~notification.Callsign); return emesary.Transmitter.ReceiptStatus_NotProcessed; } - 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 or notification.SecondaryKind < -40)) { - # its a warhead - var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; - var lbs = wh[1]; - var hitCoord = geo.Coord.new(); - hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); - if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check - hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); - } - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); - thread.unlock(tacview.mutexWrite); - } elsif (node != nil and notification.SecondaryKind < 0) { - # its a cannon or rocket - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); - thread.unlock(tacview.mutexWrite); - } - } var callsign = processCallsign(getprop("sim/multiplay/callsign")); + if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto or notification.RemoteCallsign == callsign)) { + var node = getCallsign(notification.RemoteCallsign); + if (notification.RemoteCallsign == callsign) node = 1; + if (node != nil and (notification.SecondaryKind > 20 or notification.SecondaryKind < -40)) { + # its a warhead + var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; + var lbs = wh[1]; + var hitCoord = geo.Coord.new(); + if (notification.RemoteCallsign == callsign) { + hitCoord = geo.aircraft_position(); + } else { + hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); + } + if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check + hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); + } + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); + thread.unlock(tacview.mutexWrite); + } elsif (node == 1 and notification.SecondaryKind < 0) { + # its a cannon or rocket + var hitCoord = geo.aircraft_position(); + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(), hitCoord.lon(), hitCoord.alt(), 5); + thread.unlock(tacview.mutexWrite); + } elsif (node != nil and notification.SecondaryKind < 0) { + # its a cannon or rocket + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); + thread.unlock(tacview.mutexWrite); + } + } + if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) { #damage enabled and were getting hit diff --git a/SA-3/Nasal/damage.nas b/SA-3/Nasal/damage.nas index 1bae576..bfdeaf2 100644 --- a/SA-3/Nasal/damage.nas +++ b/SA-3/Nasal/damage.nas @@ -293,7 +293,7 @@ var DamageRecipient = # " RemoteCallsign=",notification.RemoteCallsign, # " Flags=",notification.Flags, # " Radar=",bits.test(notification.Flags, 0), -# " Thrust=",bits.test(notification.Flags, 1)); +# " Thrust=",bits.test(notification.Flags, 1), # " CWI=",bits.test(notification.Flags, 2)); # # todo: @@ -449,28 +449,40 @@ var DamageRecipient = damageLog.push("Ignored hit by "~notification.Callsign); return emesary.Transmitter.ReceiptStatus_NotProcessed; } - 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 or notification.SecondaryKind < -40)) { - # its a warhead - var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; - var lbs = wh[1]; - var hitCoord = geo.Coord.new(); - hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); - if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check - hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); - } - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); - thread.unlock(tacview.mutexWrite); - } elsif (node != nil and notification.SecondaryKind < 0) { - # its a cannon or rocket - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); - thread.unlock(tacview.mutexWrite); - } - } var callsign = processCallsign(getprop("sim/multiplay/callsign")); + if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto or notification.RemoteCallsign == callsign)) { + var node = getCallsign(notification.RemoteCallsign); + if (notification.RemoteCallsign == callsign) node = 1; + if (node != nil and (notification.SecondaryKind > 20 or notification.SecondaryKind < -40)) { + # its a warhead + var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; + var lbs = wh[1]; + var hitCoord = geo.Coord.new(); + if (notification.RemoteCallsign == callsign) { + hitCoord = geo.aircraft_position(); + } else { + hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); + } + if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check + hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); + } + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); + thread.unlock(tacview.mutexWrite); + } elsif (node == 1 and notification.SecondaryKind < 0) { + # its a cannon or rocket + var hitCoord = geo.aircraft_position(); + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(), hitCoord.lon(), hitCoord.alt(), 5); + thread.unlock(tacview.mutexWrite); + } elsif (node != nil and notification.SecondaryKind < 0) { + # its a cannon or rocket + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); + thread.unlock(tacview.mutexWrite); + } + } + if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) { #damage enabled and were getting hit diff --git a/SA-6/Nasal/damage.nas b/SA-6/Nasal/damage.nas index 1bae576..bfdeaf2 100644 --- a/SA-6/Nasal/damage.nas +++ b/SA-6/Nasal/damage.nas @@ -293,7 +293,7 @@ var DamageRecipient = # " RemoteCallsign=",notification.RemoteCallsign, # " Flags=",notification.Flags, # " Radar=",bits.test(notification.Flags, 0), -# " Thrust=",bits.test(notification.Flags, 1)); +# " Thrust=",bits.test(notification.Flags, 1), # " CWI=",bits.test(notification.Flags, 2)); # # todo: @@ -449,28 +449,40 @@ var DamageRecipient = damageLog.push("Ignored hit by "~notification.Callsign); return emesary.Transmitter.ReceiptStatus_NotProcessed; } - 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 or notification.SecondaryKind < -40)) { - # its a warhead - var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; - var lbs = wh[1]; - var hitCoord = geo.Coord.new(); - hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); - if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check - hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); - } - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); - thread.unlock(tacview.mutexWrite); - } elsif (node != nil and notification.SecondaryKind < 0) { - # its a cannon or rocket - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); - thread.unlock(tacview.mutexWrite); - } - } var callsign = processCallsign(getprop("sim/multiplay/callsign")); + if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto or notification.RemoteCallsign == callsign)) { + var node = getCallsign(notification.RemoteCallsign); + if (notification.RemoteCallsign == callsign) node = 1; + if (node != nil and (notification.SecondaryKind > 20 or notification.SecondaryKind < -40)) { + # its a warhead + var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; + var lbs = wh[1]; + var hitCoord = geo.Coord.new(); + if (notification.RemoteCallsign == callsign) { + hitCoord = geo.aircraft_position(); + } else { + hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); + } + if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check + hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); + } + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); + thread.unlock(tacview.mutexWrite); + } elsif (node == 1 and notification.SecondaryKind < 0) { + # its a cannon or rocket + var hitCoord = geo.aircraft_position(); + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(), hitCoord.lon(), hitCoord.alt(), 5); + thread.unlock(tacview.mutexWrite); + } elsif (node != nil and notification.SecondaryKind < 0) { + # its a cannon or rocket + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); + thread.unlock(tacview.mutexWrite); + } + } + if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) { #damage enabled and were getting hit diff --git a/ZSU-23/Nasal/damage.nas b/ZSU-23/Nasal/damage.nas index 1bae576..bfdeaf2 100644 --- a/ZSU-23/Nasal/damage.nas +++ b/ZSU-23/Nasal/damage.nas @@ -293,7 +293,7 @@ var DamageRecipient = # " RemoteCallsign=",notification.RemoteCallsign, # " Flags=",notification.Flags, # " Radar=",bits.test(notification.Flags, 0), -# " Thrust=",bits.test(notification.Flags, 1)); +# " Thrust=",bits.test(notification.Flags, 1), # " CWI=",bits.test(notification.Flags, 2)); # # todo: @@ -449,28 +449,40 @@ var DamageRecipient = damageLog.push("Ignored hit by "~notification.Callsign); return emesary.Transmitter.ReceiptStatus_NotProcessed; } - 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 or notification.SecondaryKind < -40)) { - # its a warhead - var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; - var lbs = wh[1]; - var hitCoord = geo.Coord.new(); - hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); - if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check - hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); - } - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); - thread.unlock(tacview.mutexWrite); - } elsif (node != nil and notification.SecondaryKind < 0) { - # its a cannon or rocket - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); - thread.unlock(tacview.mutexWrite); - } - } var callsign = processCallsign(getprop("sim/multiplay/callsign")); + if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto or notification.RemoteCallsign == callsign)) { + var node = getCallsign(notification.RemoteCallsign); + if (notification.RemoteCallsign == callsign) node = 1; + if (node != nil and (notification.SecondaryKind > 20 or notification.SecondaryKind < -40)) { + # its a warhead + var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; + var lbs = wh[1]; + var hitCoord = geo.Coord.new(); + if (notification.RemoteCallsign == callsign) { + hitCoord = geo.aircraft_position(); + } else { + hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); + } + if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check + hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); + } + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); + thread.unlock(tacview.mutexWrite); + } elsif (node == 1 and notification.SecondaryKind < 0) { + # its a cannon or rocket + var hitCoord = geo.aircraft_position(); + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(), hitCoord.lon(), hitCoord.alt(), 5); + thread.unlock(tacview.mutexWrite); + } elsif (node != nil and notification.SecondaryKind < 0) { + # its a cannon or rocket + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); + thread.unlock(tacview.mutexWrite); + } + } + if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) { #damage enabled and were getting hit diff --git a/depot/Nasal/damage.nas b/depot/Nasal/damage.nas index 1bae576..bfdeaf2 100644 --- a/depot/Nasal/damage.nas +++ b/depot/Nasal/damage.nas @@ -293,7 +293,7 @@ var DamageRecipient = # " RemoteCallsign=",notification.RemoteCallsign, # " Flags=",notification.Flags, # " Radar=",bits.test(notification.Flags, 0), -# " Thrust=",bits.test(notification.Flags, 1)); +# " Thrust=",bits.test(notification.Flags, 1), # " CWI=",bits.test(notification.Flags, 2)); # # todo: @@ -449,28 +449,40 @@ var DamageRecipient = damageLog.push("Ignored hit by "~notification.Callsign); return emesary.Transmitter.ReceiptStatus_NotProcessed; } - 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 or notification.SecondaryKind < -40)) { - # its a warhead - var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; - var lbs = wh[1]; - var hitCoord = geo.Coord.new(); - hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); - if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check - hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); - } - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); - thread.unlock(tacview.mutexWrite); - } elsif (node != nil and notification.SecondaryKind < 0) { - # its a cannon or rocket - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); - thread.unlock(tacview.mutexWrite); - } - } var callsign = processCallsign(getprop("sim/multiplay/callsign")); + if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto or notification.RemoteCallsign == callsign)) { + var node = getCallsign(notification.RemoteCallsign); + if (notification.RemoteCallsign == callsign) node = 1; + if (node != nil and (notification.SecondaryKind > 20 or notification.SecondaryKind < -40)) { + # its a warhead + var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; + var lbs = wh[1]; + var hitCoord = geo.Coord.new(); + if (notification.RemoteCallsign == callsign) { + hitCoord = geo.aircraft_position(); + } else { + hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); + } + if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check + hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); + } + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); + thread.unlock(tacview.mutexWrite); + } elsif (node == 1 and notification.SecondaryKind < 0) { + # its a cannon or rocket + var hitCoord = geo.aircraft_position(); + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(), hitCoord.lon(), hitCoord.alt(), 5); + thread.unlock(tacview.mutexWrite); + } elsif (node != nil and notification.SecondaryKind < 0) { + # its a cannon or rocket + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); + thread.unlock(tacview.mutexWrite); + } + } + if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) { #damage enabled and were getting hit diff --git a/fleet/Nasal/damage.nas b/fleet/Nasal/damage.nas index 1bae576..bfdeaf2 100644 --- a/fleet/Nasal/damage.nas +++ b/fleet/Nasal/damage.nas @@ -293,7 +293,7 @@ var DamageRecipient = # " RemoteCallsign=",notification.RemoteCallsign, # " Flags=",notification.Flags, # " Radar=",bits.test(notification.Flags, 0), -# " Thrust=",bits.test(notification.Flags, 1)); +# " Thrust=",bits.test(notification.Flags, 1), # " CWI=",bits.test(notification.Flags, 2)); # # todo: @@ -449,28 +449,40 @@ var DamageRecipient = damageLog.push("Ignored hit by "~notification.Callsign); return emesary.Transmitter.ReceiptStatus_NotProcessed; } - 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 or notification.SecondaryKind < -40)) { - # its a warhead - var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; - var lbs = wh[1]; - var hitCoord = geo.Coord.new(); - hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); - if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check - hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); - } - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); - thread.unlock(tacview.mutexWrite); - } elsif (node != nil and notification.SecondaryKind < 0) { - # its a cannon or rocket - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); - thread.unlock(tacview.mutexWrite); - } - } var callsign = processCallsign(getprop("sim/multiplay/callsign")); + if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto or notification.RemoteCallsign == callsign)) { + var node = getCallsign(notification.RemoteCallsign); + if (notification.RemoteCallsign == callsign) node = 1; + if (node != nil and (notification.SecondaryKind > 20 or notification.SecondaryKind < -40)) { + # its a warhead + var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; + var lbs = wh[1]; + var hitCoord = geo.Coord.new(); + if (notification.RemoteCallsign == callsign) { + hitCoord = geo.aircraft_position(); + } else { + hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); + } + if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check + hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); + } + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); + thread.unlock(tacview.mutexWrite); + } elsif (node == 1 and notification.SecondaryKind < 0) { + # its a cannon or rocket + var hitCoord = geo.aircraft_position(); + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(), hitCoord.lon(), hitCoord.alt(), 5); + thread.unlock(tacview.mutexWrite); + } elsif (node != nil and notification.SecondaryKind < 0) { + # its a cannon or rocket + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); + thread.unlock(tacview.mutexWrite); + } + } + if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) { #damage enabled and were getting hit diff --git a/gci-radar/Nasal/damage.nas b/gci-radar/Nasal/damage.nas index 1bae576..bfdeaf2 100644 --- a/gci-radar/Nasal/damage.nas +++ b/gci-radar/Nasal/damage.nas @@ -293,7 +293,7 @@ var DamageRecipient = # " RemoteCallsign=",notification.RemoteCallsign, # " Flags=",notification.Flags, # " Radar=",bits.test(notification.Flags, 0), -# " Thrust=",bits.test(notification.Flags, 1)); +# " Thrust=",bits.test(notification.Flags, 1), # " CWI=",bits.test(notification.Flags, 2)); # # todo: @@ -449,28 +449,40 @@ var DamageRecipient = damageLog.push("Ignored hit by "~notification.Callsign); return emesary.Transmitter.ReceiptStatus_NotProcessed; } - 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 or notification.SecondaryKind < -40)) { - # its a warhead - var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; - var lbs = wh[1]; - var hitCoord = geo.Coord.new(); - hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); - if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check - hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); - } - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); - thread.unlock(tacview.mutexWrite); - } elsif (node != nil and notification.SecondaryKind < 0) { - # its a cannon or rocket - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); - thread.unlock(tacview.mutexWrite); - } - } var callsign = processCallsign(getprop("sim/multiplay/callsign")); + if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto or notification.RemoteCallsign == callsign)) { + var node = getCallsign(notification.RemoteCallsign); + if (notification.RemoteCallsign == callsign) node = 1; + if (node != nil and (notification.SecondaryKind > 20 or notification.SecondaryKind < -40)) { + # its a warhead + var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; + var lbs = wh[1]; + var hitCoord = geo.Coord.new(); + if (notification.RemoteCallsign == callsign) { + hitCoord = geo.aircraft_position(); + } else { + hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); + } + if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check + hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); + } + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); + thread.unlock(tacview.mutexWrite); + } elsif (node == 1 and notification.SecondaryKind < 0) { + # its a cannon or rocket + var hitCoord = geo.aircraft_position(); + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(), hitCoord.lon(), hitCoord.alt(), 5); + thread.unlock(tacview.mutexWrite); + } elsif (node != nil and notification.SecondaryKind < 0) { + # its a cannon or rocket + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); + thread.unlock(tacview.mutexWrite); + } + } + if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) { #damage enabled and were getting hit diff --git a/groundtarget/Nasal/damage.nas b/groundtarget/Nasal/damage.nas index 1bae576..bfdeaf2 100644 --- a/groundtarget/Nasal/damage.nas +++ b/groundtarget/Nasal/damage.nas @@ -293,7 +293,7 @@ var DamageRecipient = # " RemoteCallsign=",notification.RemoteCallsign, # " Flags=",notification.Flags, # " Radar=",bits.test(notification.Flags, 0), -# " Thrust=",bits.test(notification.Flags, 1)); +# " Thrust=",bits.test(notification.Flags, 1), # " CWI=",bits.test(notification.Flags, 2)); # # todo: @@ -449,28 +449,40 @@ var DamageRecipient = damageLog.push("Ignored hit by "~notification.Callsign); return emesary.Transmitter.ReceiptStatus_NotProcessed; } - 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 or notification.SecondaryKind < -40)) { - # its a warhead - var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; - var lbs = wh[1]; - var hitCoord = geo.Coord.new(); - hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); - if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check - hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); - } - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); - thread.unlock(tacview.mutexWrite); - } elsif (node != nil and notification.SecondaryKind < 0) { - # its a cannon or rocket - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); - thread.unlock(tacview.mutexWrite); - } - } var callsign = processCallsign(getprop("sim/multiplay/callsign")); + if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto or notification.RemoteCallsign == callsign)) { + var node = getCallsign(notification.RemoteCallsign); + if (notification.RemoteCallsign == callsign) node = 1; + if (node != nil and (notification.SecondaryKind > 20 or notification.SecondaryKind < -40)) { + # its a warhead + var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; + var lbs = wh[1]; + var hitCoord = geo.Coord.new(); + if (notification.RemoteCallsign == callsign) { + hitCoord = geo.aircraft_position(); + } else { + hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); + } + if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check + hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); + } + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); + thread.unlock(tacview.mutexWrite); + } elsif (node == 1 and notification.SecondaryKind < 0) { + # its a cannon or rocket + var hitCoord = geo.aircraft_position(); + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(), hitCoord.lon(), hitCoord.alt(), 5); + thread.unlock(tacview.mutexWrite); + } elsif (node != nil and notification.SecondaryKind < 0) { + # its a cannon or rocket + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); + thread.unlock(tacview.mutexWrite); + } + } + if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) { #damage enabled and were getting hit diff --git a/missile-frigate/Nasal/damage.nas b/missile-frigate/Nasal/damage.nas index 1bae576..bfdeaf2 100644 --- a/missile-frigate/Nasal/damage.nas +++ b/missile-frigate/Nasal/damage.nas @@ -293,7 +293,7 @@ var DamageRecipient = # " RemoteCallsign=",notification.RemoteCallsign, # " Flags=",notification.Flags, # " Radar=",bits.test(notification.Flags, 0), -# " Thrust=",bits.test(notification.Flags, 1)); +# " Thrust=",bits.test(notification.Flags, 1), # " CWI=",bits.test(notification.Flags, 2)); # # todo: @@ -449,28 +449,40 @@ var DamageRecipient = damageLog.push("Ignored hit by "~notification.Callsign); return emesary.Transmitter.ReceiptStatus_NotProcessed; } - 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 or notification.SecondaryKind < -40)) { - # its a warhead - var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; - var lbs = wh[1]; - var hitCoord = geo.Coord.new(); - hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); - if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check - hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); - } - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); - thread.unlock(tacview.mutexWrite); - } elsif (node != nil and notification.SecondaryKind < 0) { - # its a cannon or rocket - thread.lock(tacview.mutexWrite); - tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); - thread.unlock(tacview.mutexWrite); - } - } var callsign = processCallsign(getprop("sim/multiplay/callsign")); + if (tacview_supported and tacview.starttime and (getprop("sim/multiplay/txhost") != "mpserver.opredflag.com" or m28_auto or notification.RemoteCallsign == callsign)) { + var node = getCallsign(notification.RemoteCallsign); + if (notification.RemoteCallsign == callsign) node = 1; + if (node != nil and (notification.SecondaryKind > 20 or notification.SecondaryKind < -40)) { + # its a warhead + var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)]; + var lbs = wh[1]; + var hitCoord = geo.Coord.new(); + if (notification.RemoteCallsign == callsign) { + hitCoord = geo.aircraft_position(); + } else { + hitCoord.set_latlon(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M+notification.RelativeAltitude); + } + if (notification.Distance > math.abs(notification.RelativeAltitude)) {#just a sanity check + hitCoord = hitCoord.apply_course_distance(notification.Bearing, math.sqrt(notification.Distance*notification.Distance-notification.RelativeAltitude*notification.RelativeAltitude)); + } + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(),hitCoord.lon(),hitCoord.alt(), lbs*0.5); + thread.unlock(tacview.mutexWrite); + } elsif (node == 1 and notification.SecondaryKind < 0) { + # its a cannon or rocket + var hitCoord = geo.aircraft_position(); + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(hitCoord.lat(), hitCoord.lon(), hitCoord.alt(), 5); + thread.unlock(tacview.mutexWrite); + } elsif (node != nil and notification.SecondaryKind < 0) { + # its a cannon or rocket + thread.lock(tacview.mutexWrite); + tacview.writeExplosion(node.getNode("position/latitude-deg").getValue(), node.getNode("position/longitude-deg").getValue(), node.getNode("position/altitude-ft").getValue()*FT2M, 5); + thread.unlock(tacview.mutexWrite); + } + } + if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) { #damage enabled and were getting hit diff --git a/oprf-versions.json b/oprf-versions.json index 4bf4079..8ad6f7e 100644 --- a/oprf-versions.json +++ b/oprf-versions.json @@ -81,59 +81,59 @@ ], "damage": [ { - "version": "1.4.5", + "version": "1.4.7", "path": "BUK-M2/Nasal/damage.nas" }, { - "version": "1.4.5", + "version": "1.4.7", "path": "depot/Nasal/damage.nas" }, { - "version": "1.4.5", + "version": "1.4.7", "path": "fleet/Nasal/damage.nas" }, { - "version": "1.4.5", + "version": "1.4.7", "path": "Frigate/Nasal/damage.nas" }, { - "version": "1.4.5", + "version": "1.4.7", "path": "gci-radar/Nasal/damage.nas" }, { - "version": "1.4.5", + "version": "1.4.7", "path": "groundtarget/Nasal/damage.nas" }, { - "version": "1.4.5", + "version": "1.4.7", "path": "MIM-104D/Nasal/damage.nas" }, { - "version": "1.4.5", + "version": "1.4.7", "path": "missile-frigate/Nasal/damage.nas" }, { - "version": "1.4.5", + "version": "1.4.7", "path": "S-200/Nasal/damage.nas" }, { - "version": "1.4.5", + "version": "1.4.7", "path": "S-300/Nasal/damage.nas" }, { - "version": "1.4.5", + "version": "1.4.7", "path": "S-75/Nasal/damage.nas" }, { - "version": "1.4.5", + "version": "1.4.7", "path": "SA-3/Nasal/damage.nas" }, { - "version": "1.4.5", + "version": "1.4.7", "path": "SA-6/Nasal/damage.nas" }, { - "version": "1.4.5", + "version": "1.4.7", "path": "ZSU-23/Nasal/damage.nas" } ],