oprf_assets/ZSU-23/Nasal/GeoBridgedTransmitter.nas

83 lines
4.7 KiB
Plaintext
Raw Normal View History

2021-04-15 03:28:19 +08:00
# Emesary bridged transmitter for armament notifications.
#
# Richard Harrison 2017
#
# NOTES:
# 1.The incoming bridges that is defined here will apply to all models that
# are loaded over MP; it is better to create the bridges here rather than in the model.xml
# So given that we don't want a bridge on all MP models only those that are on OPRF
# aircraft that want to receive notifications we will create the incoming bridge here
# and thus only an OPRF model will receive notifications from another OPRF model.
#
# 2. The Emesary MP bridge requires two sides; the outgoing and incoming.
# - The outgoing aircraft will forwards all received notifications via MP;
# and these will be received by a similarly equipped craft.
# - The receiving aircraft will receive all notifications from other MP craft via
# the globalTransmitter - which is bridged via property #18 /sim/multiplay/emesary/bridge[18]
#------------------------------------------------------------------------------------------
# Setup the bridge
# armament notification 24 bytes
# geoEventNotification - 34 bytes + the length of the RemoteCallsign and Name fields.
#NOTE: due to bug in Emesary MP Bridge (fixed in 2019.2 after 24/3/2020) we can only
# reliably send one message type per bridge - so for the maximum compatibility
# we will use two bridges.
# If at some point in the future we target 2019.2 as a min ver we can use a single
# bridge and setup the notification list to contain all of the armament hit/flying notifications
#i.e. change to [notifications.ArmamentInFlightNotification.new(nil), notifications.ArmamentNotification.new(nil)];
var geoRoutedNotifications = [notifications.ArmamentInFlightNotification.new()];
var geoBridgedTransmitter = emesary.Transmitter.new("geoOutgoingBridge");
var geooutgoingBridge = emesary_mp_bridge.OutgoingMPBridge.new("mp.geo",geoRoutedNotifications, 18, "", geoBridgedTransmitter);
# bridge should be tuned to be around 90% of the packet size full.
geooutgoingBridge.TransmitFrequencySeconds = 0.75;
Update OPRF Assets Fetched vector None->2.0.3 (BUK-M2/Nasal/vector.nas) Fetched vector None->2.0.3 (depot/Nasal/vector.nas) Fetched vector None->2.0.3 (fleet/Nasal/vector.nas) Fetched vector None->2.0.3 (Frigate/Nasal/vector.nas) Fetched vector None->2.0.3 (gci-radar/Nasal/vector.nas) Fetched vector None->2.0.3 (groundtarget/Nasal/vector.nas) Fetched vector None->2.0.3 (MIM-104D/Nasal/vector.nas) Fetched vector None->2.0.3 (missile-frigate/Nasal/vector.nas) Fetched vector None->2.0.3 (S-200/Nasal/vector.nas) Fetched vector None->2.0.3 (S-300/Nasal/vector.nas) Fetched vector None->2.0.3 (S-75/Nasal/vector.nas) Fetched vector None->2.0.3 (SA-6/Nasal/vector.nas) Fetched vector None->2.0.3 (ZSU-23/Nasal/vector.nas) Fetched missile-code None->1.1.1 (BUK-M2/Nasal/guided-missiles.nas) Fetched missile-code None->1.1.1 (MIM-104D/Nasal/guided-missiles.nas) Fetched missile-code None->1.1.1 (S-75/Nasal/guided-missiles.nas) Fetched missile-code None->1.1.1 (SA-6/Nasal/guided-missiles.nas) Fetched damage None->1.2.1 (BUK-M2/Nasal/damage.nas) Fetched damage None->1.2.1 (depot/Nasal/damage.nas) Fetched damage None->1.2.1 (fleet/Nasal/damage.nas) Fetched damage None->1.2.1 (Frigate/Nasal/damage.nas) Fetched damage None->1.2.1 (gci-radar/Nasal/damage.nas) Fetched damage None->1.2.1 (groundtarget/Nasal/damage.nas) Fetched damage None->1.2.1 (MIM-104D/Nasal/damage.nas) Fetched damage None->1.2.1 (missile-frigate/Nasal/damage.nas) Fetched damage None->1.2.1 (S-200/Nasal/damage.nas) Fetched damage None->1.2.1 (S-300/Nasal/damage.nas) Fetched damage None->1.2.1 (S-75/Nasal/damage.nas) Fetched damage None->1.2.1 (SA-6/Nasal/damage.nas) Fetched damage None->1.2.1 (ZSU-23/Nasal/damage.nas) Fetched datalink None->1.1.0 (BUK-M2/Nasal/datalink.nas) Fetched datalink None->1.1.0 (fleet/Nasal/datalink.nas) Fetched datalink None->1.1.0 (MIM-104D/Nasal/datalink.nas) Fetched datalink None->1.1.0 (missile-frigate/Nasal/datalink.nas) Fetched datalink None->1.1.0 (S-200/Nasal/datalink.nas) Fetched datalink None->1.1.0 (S-300/Nasal/datalink.nas) Fetched datalink None->1.1.0 (S-75/Nasal/datalink.nas) Fetched datalink None->1.1.0 (SA-6/Nasal/datalink.nas) Fetched datalink None->1.1.0 (ZSU-23/Nasal/datalink.nas) Fetched armament-notification None->1.1.0 (BUK-M2/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (depot/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (fleet/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (Frigate/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (gci-radar/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (groundtarget/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (MIM-104D/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (missile-frigate/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (S-200/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (S-300/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (S-75/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (SA-6/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (ZSU-23/Nasal/ArmamentNotification.nas) Fetched geo-bridged-transmitter None->1.0.1 (BUK-M2/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (depot/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (fleet/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (Frigate/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (gci-radar/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (groundtarget/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (MIM-104D/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (missile-frigate/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (S-200/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (S-300/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (S-75/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (SA-6/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (ZSU-23/Nasal/GeoBridgedTransmitter.nas) Fetched asset-fire-control None->1.0.0 (BUK-M2/Nasal/fire-control.nas) Fetched asset-fire-control None->1.0.0 (MIM-104D/Nasal/fire-control.nas) Fetched asset-fire-control None->1.0.0 (S-75/Nasal/fire-control.nas) Fetched asset-fire-control None->1.0.0 (SA-6/Nasal/fire-control.nas) Fetched asset-radar-logic None->1.1.0 (BUK-M2/Nasal/radar-logic.nas) Fetched asset-radar-logic None->1.1.0 (MIM-104D/Nasal/radar-logic.nas) Fetched asset-radar-logic None->1.1.0 (S-75/Nasal/radar-logic.nas) Fetched asset-radar-logic None->1.1.0 (SA-6/Nasal/radar-logic.nas) Fetched asset-radar-logic None->1.1.0 (gci-radar/Nasal/radar-logic.nas)
2023-09-28 23:12:24 +08:00
geooutgoingBridge.MPStringMaxLen = 175; # each is 34 bytes
2021-04-15 03:28:19 +08:00
emesary_mp_bridge.IncomingMPBridge.startMPBridge(geoRoutedNotifications, 18, emesary.GlobalTransmitter);
#----- bridge hit (armament) notifications
var hitRoutedNotifications = [notifications.ArmamentNotification.new(),notifications.StaticNotification.new()];
var hitBridgedTransmitter = emesary.Transmitter.new("armamentNotificationBridge");
var hitoutgoingBridge = emesary_mp_bridge.OutgoingMPBridge.new("mp.hit",hitRoutedNotifications, 19, "", hitBridgedTransmitter);
hitoutgoingBridge.TransmitFrequencySeconds = 1.5;
hitoutgoingBridge.MPStringMaxLen = 120;
emesary_mp_bridge.IncomingMPBridge.startMPBridge(hitRoutedNotifications, 19, emesary.GlobalTransmitter);
#----- bridge object notifications
var objectRoutedNotifications = [notifications.ObjectInFlightNotification.new()];
var objectBridgedTransmitter = emesary.Transmitter.new("objectNotificationBridge");
var objectoutgoingBridge = emesary_mp_bridge.OutgoingMPBridge.new("mp.object",objectRoutedNotifications, 17, "", objectBridgedTransmitter);
objectoutgoingBridge.TransmitFrequencySeconds = 0.2;
objectoutgoingBridge.MessageLifeTime = 1;
objectoutgoingBridge.MPStringMaxLen = 150;
emesary_mp_bridge.IncomingMPBridge.startMPBridge(objectRoutedNotifications, 17, emesary.GlobalTransmitter);
Update OPRF Assets Fetched vector None->2.0.3 (BUK-M2/Nasal/vector.nas) Fetched vector None->2.0.3 (depot/Nasal/vector.nas) Fetched vector None->2.0.3 (fleet/Nasal/vector.nas) Fetched vector None->2.0.3 (Frigate/Nasal/vector.nas) Fetched vector None->2.0.3 (gci-radar/Nasal/vector.nas) Fetched vector None->2.0.3 (groundtarget/Nasal/vector.nas) Fetched vector None->2.0.3 (MIM-104D/Nasal/vector.nas) Fetched vector None->2.0.3 (missile-frigate/Nasal/vector.nas) Fetched vector None->2.0.3 (S-200/Nasal/vector.nas) Fetched vector None->2.0.3 (S-300/Nasal/vector.nas) Fetched vector None->2.0.3 (S-75/Nasal/vector.nas) Fetched vector None->2.0.3 (SA-6/Nasal/vector.nas) Fetched vector None->2.0.3 (ZSU-23/Nasal/vector.nas) Fetched missile-code None->1.1.1 (BUK-M2/Nasal/guided-missiles.nas) Fetched missile-code None->1.1.1 (MIM-104D/Nasal/guided-missiles.nas) Fetched missile-code None->1.1.1 (S-75/Nasal/guided-missiles.nas) Fetched missile-code None->1.1.1 (SA-6/Nasal/guided-missiles.nas) Fetched damage None->1.2.1 (BUK-M2/Nasal/damage.nas) Fetched damage None->1.2.1 (depot/Nasal/damage.nas) Fetched damage None->1.2.1 (fleet/Nasal/damage.nas) Fetched damage None->1.2.1 (Frigate/Nasal/damage.nas) Fetched damage None->1.2.1 (gci-radar/Nasal/damage.nas) Fetched damage None->1.2.1 (groundtarget/Nasal/damage.nas) Fetched damage None->1.2.1 (MIM-104D/Nasal/damage.nas) Fetched damage None->1.2.1 (missile-frigate/Nasal/damage.nas) Fetched damage None->1.2.1 (S-200/Nasal/damage.nas) Fetched damage None->1.2.1 (S-300/Nasal/damage.nas) Fetched damage None->1.2.1 (S-75/Nasal/damage.nas) Fetched damage None->1.2.1 (SA-6/Nasal/damage.nas) Fetched damage None->1.2.1 (ZSU-23/Nasal/damage.nas) Fetched datalink None->1.1.0 (BUK-M2/Nasal/datalink.nas) Fetched datalink None->1.1.0 (fleet/Nasal/datalink.nas) Fetched datalink None->1.1.0 (MIM-104D/Nasal/datalink.nas) Fetched datalink None->1.1.0 (missile-frigate/Nasal/datalink.nas) Fetched datalink None->1.1.0 (S-200/Nasal/datalink.nas) Fetched datalink None->1.1.0 (S-300/Nasal/datalink.nas) Fetched datalink None->1.1.0 (S-75/Nasal/datalink.nas) Fetched datalink None->1.1.0 (SA-6/Nasal/datalink.nas) Fetched datalink None->1.1.0 (ZSU-23/Nasal/datalink.nas) Fetched armament-notification None->1.1.0 (BUK-M2/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (depot/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (fleet/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (Frigate/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (gci-radar/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (groundtarget/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (MIM-104D/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (missile-frigate/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (S-200/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (S-300/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (S-75/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (SA-6/Nasal/ArmamentNotification.nas) Fetched armament-notification None->1.1.0 (ZSU-23/Nasal/ArmamentNotification.nas) Fetched geo-bridged-transmitter None->1.0.1 (BUK-M2/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (depot/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (fleet/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (Frigate/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (gci-radar/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (groundtarget/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (MIM-104D/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (missile-frigate/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (S-200/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (S-300/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (S-75/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (SA-6/Nasal/GeoBridgedTransmitter.nas) Fetched geo-bridged-transmitter None->1.0.1 (ZSU-23/Nasal/GeoBridgedTransmitter.nas) Fetched asset-fire-control None->1.0.0 (BUK-M2/Nasal/fire-control.nas) Fetched asset-fire-control None->1.0.0 (MIM-104D/Nasal/fire-control.nas) Fetched asset-fire-control None->1.0.0 (S-75/Nasal/fire-control.nas) Fetched asset-fire-control None->1.0.0 (SA-6/Nasal/fire-control.nas) Fetched asset-radar-logic None->1.1.0 (BUK-M2/Nasal/radar-logic.nas) Fetched asset-radar-logic None->1.1.0 (MIM-104D/Nasal/radar-logic.nas) Fetched asset-radar-logic None->1.1.0 (S-75/Nasal/radar-logic.nas) Fetched asset-radar-logic None->1.1.0 (SA-6/Nasal/radar-logic.nas) Fetched asset-radar-logic None->1.1.0 (gci-radar/Nasal/radar-logic.nas)
2023-09-28 23:12:24 +08:00
#
# debug all messages - this can be removed when testing isn't required.
var debugRecipient = emesary.Recipient.new("Debug");
debugRecipient.Receive = func(notification)
{
if (notification.NotificationType != "FrameNotification") {
print ("recv(0): type=",notification.NotificationType, " fromIncoming=",notification.FromIncomingBridge);
if (notification.NotificationType == "ArmamentInFlightNotification") {
print("recv(1): ",notification.NotificationType, " ", notification.Ident);
debug.dump(notification);
} else if (notification.NotificationType == "ArmamentNotification") {
if (notification.FromIncomingBridge) {
print("recv(2): ",notification.NotificationType, " ", notification.Ident,
" Kind=",notification.Kind,
" SecondaryKind=",notification.SecondaryKind,
" RelativeAltitude=",notification.RelativeAltitude,
" Distance=",notification.Distance,
" Bearing=",notification.Bearing,
" RemoteCallsign=",notification.RemoteCallsign);
debug.dump(notification);
}
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed; # we're not processing it, just looking
}
# uncomment next line to activate debug recipient.
#emesary.GlobalTransmitter.Register(debugRecipient);