oprf_assets/S-300/Nasal/ArmamentNotification.nas
NikolaiVChr 84e66cd6f9 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 15:12:24 +00:00

303 lines
14 KiB
Plaintext

#
#
# Use to transmit events that happen at a specific place; can be used to make
# models that are simulated locally (e.g. tankers) appear on other player's MP sessions.
var ArmamentNotification_Id = 19;
var ArmamentNotification =
{
# new:
# _ident - the identifier for the notification. not bridged.
# _name - name of the notification, bridged.
# _kind - created, moved, deleted, impact (see notifications.nas)
# _secondary_kind - This is the entity on which the activity is being performed. See below for predefined types.
##
new: func(_ident="none", _kind=0, _secondary_kind=0)
{
var new_class = emesary.Notification.new("ArmamentNotification", _ident, ArmamentNotification_Id);
new_class.Kind = _kind;
new_class.SecondaryKind = _secondary_kind;
new_class.RelativeAltitude = 0;
new_class.IsDistinct = 0;
new_class.Distance = 0;
new_class.Bearing = 0;
new_class.RemoteCallsign = ""; # associated remote callsign.
new_class.bridgeProperties = func
{
return
[
{
getValue:func{return emesary.TransferByte.encode(new_class.Kind);},
setValue:func(v,root,pos){var dv=emesary.TransferByte.decode(v,pos);new_class.Kind=dv.value;return dv},
},
{
getValue:func{return emesary.TransferByte.encode(new_class.SecondaryKind);},
setValue:func(v,root,pos){var dv=emesary.TransferByte.decode(v,pos);new_class.SecondaryKind=dv.value;return dv},
},
{
getValue:func{return emesary.TransferFixedDouble.encode(new_class.RelativeAltitude,2,1/10);},
setValue:func(v,root,pos){var dv=emesary.TransferFixedDouble.decode(v,2,1/10,pos);new_class.RelativeAltitude=dv.value;return dv},
},
{
getValue:func{return emesary.TransferFixedDouble.encode(new_class.Distance,2,1/10);},
setValue:func(v,root,pos){var dv=emesary.TransferFixedDouble.decode(v,2,1/10,pos);new_class.Distance=dv.value;return dv},
},
{
getValue:func{return emesary.TransferFixedDouble.encode(geo.normdeg180(new_class.Bearing),1,1.54);},
setValue:func(v,root,pos){var dv=emesary.TransferFixedDouble.decode(v,1,1.54,pos);new_class.Bearing=geo.normdeg(dv.value);return dv},
},
{
getValue:func{return emesary.TransferString.encode(new_class.RemoteCallsign);},
setValue:func(v,root,pos){var dv=emesary.TransferString.decode(v,pos);new_class.RemoteCallsign=dv.value;return dv},
},
];
};
return new_class;
},
};
var ArmamentInFlightNotification_Id = 21;
var ArmamentInFlightNotification =
{
# new:
# _ident - the identifier for the notification. not bridged.
# _name - name of the notification, bridged.
# _kind - created, moved, deleted (see below). This is the activity that the notification represents, called kind to avoid confusion with notification type.
# _secondary_kind - This is the entity on which the activity is being performed. See below for predefined types.
#
# UniqueIdentity - an identity that is unique to the sending instance of FG. Can be combined with the callsign to create an MP unique ID.
##
new: func(_ident="none", _unique=0, _kind=0, _secondary_kind=0)
{
var new_class = emesary.Notification.new("ArmamentInFlightNotification", _ident, ArmamentInFlightNotification_Id);
new_class.Kind = _kind;
new_class.SecondaryKind = _secondary_kind;
new_class.Position = geo.aircraft_position();
new_class.UniqueIndex = 0;
new_class.Heading = 360;
new_class.Pitch = 90;
new_class.u_fps = 0;
new_class.IsDistinct = 0;
new_class.Callsign = nil; # populated automatically by the incoming bridge when routed
new_class.RemoteCallsign = ""; # associated remote callsign.
new_class.Flags = 0; # 8 bits for whatever.
new_class.UniqueIdentity = _unique;
new_class.isValid = func {
var valid = "";
var limitMin = -124;
var limitMax = 123;
# 1 byte integer
if (int(me.Kind) > limitMax or int(me.Kind) < limitMin) {
valid ~= "|ArmamentInFlight.Kind is "~me.Kind;
}
# 1 byte integer
if (int(me.SecondaryKind) > limitMax or int(me.SecondaryKind) < limitMin) {
valid ~= "|ArmamentInFlight.SecondaryKind is "~me.SecondaryKind;
}
# 1 byte float
if (int((me.u_fps-3348)*0.03703) > limitMax or int((me.u_fps-3348)*0.03703) < limitMin) {
valid ~= "|ArmamentInFlight.u_fps is "~me.u_fps;
}
# 1 byte float
if (int(me.Pitch*1.38) > limitMax or int(me.Pitch*1.38) < limitMin) {
valid ~= "|ArmamentInFlight.Pitch is "~me.Pitch;
}
# 1 byte float
if (int(geo.normdeg180(me.Heading)/1.54) > limitMax or int(geo.normdeg180(me.Heading)/1.54) < limitMin) {
valid ~= "|ArmamentInFlight.Heading is "~me.Heading;
}
# 1 byte integer
if (int(me.Flags) > limitMax or int(me.Flags) < limitMin) {
valid ~= "|ArmamentInFlight.Flags is "~me.Flags;
}
# 1 byte integer
if (int(me.UniqueIdentity) > limitMax or int(me.UniqueIdentity) < limitMin) {
valid ~= "|ArmamentInFlight.UniqueIdentity is "~me.UniqueIdentity;
}
# 7 byte string
if (size(me.RemoteCallsign) > 7) {
valid ~= "|ArmamentInFlight.RemoteCallsign is "~me.RemoteCallsign;
}
if (valid != "") {
print("\nEMESARY ENCODING WILL FAIL:");
print(" "~valid);
}
};
new_class.GetBridgeMessageNotificationTypeKey = func {
return new_class.NotificationType~"."~new_class.Ident~"."~new_class.UniqueIndex;
};
new_class.bridgeProperties = func
{
return
[
{
getValue:func{return emesary.TransferCoord.encode(new_class.Position);},
setValue:func(v,root,pos){var dv=emesary.TransferCoord.decode(v, pos);new_class.Position=dv.value;return dv},
},
{
getValue:func{return emesary.TransferByte.encode(new_class.Kind);},
setValue:func(v,root,pos){var dv=emesary.TransferByte.decode(v,pos);new_class.Kind=dv.value;return dv},
},
{
getValue:func{return emesary.TransferByte.encode(new_class.SecondaryKind);},
setValue:func(v,root,pos){var dv=emesary.TransferByte.decode(v,pos);new_class.SecondaryKind=dv.value;return dv},
},
{
#0..6696 fps (3967kts), mach 6.1 (SL) - factor 0.03703
getValue:func{return emesary.TransferFixedDouble.encode(new_class.u_fps-3348,1,1/0.03703);},
setValue:func(v,root,pos){var dv=emesary.TransferFixedDouble.decode(v,1,1/0.03703,pos);new_class.u_fps=dv.value+3348;return dv},
},
{
getValue:func{return emesary.TransferFixedDouble.encode(geo.normdeg180(new_class.Heading),1,1.54);},#1.0/0.65
setValue:func(v,root,pos){var dv=emesary.TransferFixedDouble.decode(v,1,1.54,pos);new_class.Heading=geo.normdeg(dv.value);return dv},
},
{
getValue:func{return emesary.TransferFixedDouble.encode(new_class.Pitch, 1, 1/1.38);},
setValue:func(v,root,pos){var dv=emesary.TransferFixedDouble.decode(v,1, 1/1.38, pos);new_class.Pitch=dv.value;return dv},
},
{
getValue:func{return emesary.TransferString.encode(new_class.RemoteCallsign);},
setValue:func(v,root,pos){var dv=emesary.TransferString.decode(v,pos);new_class.RemoteCallsign=dv.value;return dv},
},
{
getValue:func{return emesary.TransferByte.encode(new_class.Flags);},
setValue:func(v,root,pos){var dv=emesary.TransferByte.decode(v,pos);new_class.Flags=dv.value;return dv},
},
{
getValue:func{return emesary.TransferByte.encode(new_class.UniqueIdentity);},
setValue:func(v,root,pos){var dv=emesary.TransferByte.decode(v,pos);new_class.UniqueIdentity=dv.value;return dv},
},
];
};
return new_class;
},
};
var StaticNotification_Id = 25;
var StaticNotification =
{
# new:
# _ident - the identifier for the notification. not bridged.
# _kind - created, moved, deleted (see below). This is the activity that the notification represents, called kind to avoid confusion with notification type.
# _secondary_kind - This is the entity on which the activity is being performed. See below for predefined types.
#
# UniqueIdentity - an identity that is unique to the sending instance of FG. Can be combined with the callsign to create an MP unique ID.
##
new: func(_ident="stat", _unique=0, _kind=0, _secondary_kind=0)
{
var new_class = emesary.Notification.new("StaticNotification", _ident, StaticNotification_Id);
# _ident -> "stat"
new_class.UniqueIdentity = _unique; # random from 0 to 15000000 that identifies each static object
new_class.Kind = _kind; # 1=create, 2=move, 3=delete, 4=request_all
new_class.SecondaryKind = _secondary_kind; # 0 = small crater, 1 = big crater, 2 = smoke
new_class.IsDistinct = 0; # keep it 0
new_class.Callsign = nil; # populated automatically by the incoming bridge when routed
new_class.Position = geo.aircraft_position(); # position
new_class.Heading = 360; # heading
new_class.Flags1 = 0; # 7 bits for whatever.
new_class.Flags2 = 0; # 7 bits for whatever.
new_class.GetBridgeMessageNotificationTypeKey = func {
return new_class.NotificationType~"."~new_class.Ident~"."~new_class.UniqueIdentity;
};
new_class.bridgeProperties = func
{
return
[
{
getValue:func{return emesary.TransferCoord.encode(new_class.Position);},
setValue:func(v,root,pos){var dv=emesary.TransferCoord.decode(v, pos);new_class.Position=dv.value;return dv},
},
{
getValue:func{return emesary.TransferByte.encode(new_class.Kind);},
setValue:func(v,root,pos){var dv=emesary.TransferByte.decode(v,pos);new_class.Kind=dv.value;return dv},
},
{
getValue:func{return emesary.TransferByte.encode(new_class.SecondaryKind);},
setValue:func(v,root,pos){var dv=emesary.TransferByte.decode(v,pos);new_class.SecondaryKind=dv.value;return dv},
},
{
getValue:func{return emesary.TransferFixedDouble.encode(geo.normdeg180(new_class.Heading),1,1.54);},#1.0/0.65
setValue:func(v,root,pos){var dv=emesary.TransferFixedDouble.decode(v,1,1.54,pos);new_class.Heading=geo.normdeg(dv.value);return dv},
},
{
getValue:func{return emesary.TransferByte.encode(new_class.Flags1);},
setValue:func(v,root,pos){var dv=emesary.TransferByte.decode(v,pos);new_class.Flags1=dv.value;return dv},
},
{
getValue:func{return emesary.TransferByte.encode(new_class.Flags2);},
setValue:func(v,root,pos){var dv=emesary.TransferByte.decode(v,pos);new_class.Flags2=dv.value;return dv},
},
{
getValue:func{return emesary.TransferInt.encode(new_class.UniqueIdentity,3);},
setValue:func(v,root,pos){var dv=emesary.TransferInt.decode(v,3,pos);new_class.UniqueIdentity=dv.value;return dv},
},
];
};
return new_class;
},
};
var ObjectInFlightNotification_Id = 22;
var ObjectInFlightNotification =
{
# new:
# _ident - the identifier for the notification. not bridged.
# _name - name of the notification, bridged.
# _kind - created, moved, deleted (see below). This is the activity that the notification represents, called kind to avoid confusion with notification type.
# _secondary_kind - This is the entity on which the activity is being performed. See below for predefined types.
#
# UniqueIdentity - an identity that is unique to the sending instance of FG. Can be combined with the callsign to create an MP unique ID.
##
new: func(_ident="none", _unique=0, _kind=0, _secondary_kind=0)
{
var new_class = emesary.Notification.new("ObjectInFlightNotification", _ident, ObjectInFlightNotification_Id);
new_class.Kind = _kind;
new_class.SecondaryKind = _secondary_kind;
new_class.Position = geo.aircraft_position();
new_class.UniqueIndex = 0;
new_class.IsDistinct = 1;
new_class.Callsign = nil; # populated automatically by the incoming bridge when routed
new_class.UniqueIdentity = _unique;
new_class.GetBridgeMessageNotificationTypeKey = func {
return new_class.NotificationType~"."~new_class.Ident~"."~new_class.UniqueIndex;
};
new_class.bridgeProperties = func
{
return
[
{
getValue:func{return emesary.TransferCoord.encode(new_class.Position);},
setValue:func(v,root,pos){var dv=emesary.TransferCoord.decode(v, pos);new_class.Position=dv.value;return dv},
},
{
getValue:func{return emesary.TransferByte.encode(new_class.Kind);},
setValue:func(v,root,pos){var dv=emesary.TransferByte.decode(v,pos);new_class.Kind=dv.value;return dv},
},
{
getValue:func{return emesary.TransferByte.encode(new_class.SecondaryKind);},
setValue:func(v,root,pos){var dv=emesary.TransferByte.decode(v,pos);new_class.SecondaryKind=dv.value;return dv},
},
{
getValue:func{return emesary.TransferByte.encode(new_class.UniqueIdentity);},
setValue:func(v,root,pos){var dv=emesary.TransferByte.decode(v,pos);new_class.UniqueIdentity=dv.value;return dv},
},
];
};
return new_class;
},
};