Initial Emesary convertion (incomplete)

pull/7/head
J Maverick 16 4 years ago
parent 75d3676be1
commit d07fe92385

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 B

@ -0,0 +1,74 @@
<?xml version="1.0"?>
<PropertyList>
<particlesystem>
<name>bombhit-smoke</name>
<texture>smoke.png</texture>
<emissive>false</emissive>
<lighting>false</lighting>
<align>billboard</align>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>30</theta-min-deg>
<theta-max-deg>60</theta-max-deg>
<phi-min-deg>-180</phi-min-deg>
<phi-max-deg> 180</phi-max-deg>
<speed-mps>
<value>5</value>
<spread>5</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>-60</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>60</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>3</value>
<spread>5</spread>
</particles-per-sec>
</counter>
<particle>
<start>
<color>
<red><value>0.0</value></red>
<green><value>0.0</value></green>
<blue><value>0.0</value></blue>
<alpha><value>0.2</value></alpha>
</color>
<size>
<value>12.0</value>
</size>
</start>
<end>
<color>
<red><value>0.0</value></red>
<green><value>0.0</value></green>
<blue><value>0.0</value></blue>
<alpha><value>0.05</value></alpha>
</color>
<size>
<value>80.0</value>
</size>
</end>
<life-sec>
<value>120</value>
</life-sec>
<mass-kg>0.025</mass-kg>
<radius-m>0.40</radius-m>
</particle>
<program>
<fluid>air</fluid>
<gravity>true</gravity>
<wind>true</wind>
</program>
</particlesystem>
</PropertyList>

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

@ -0,0 +1,103 @@
<?xml version="1.0"?>
<PropertyList>
<path>crater.ac</path>
<animation>
<type>scale</type>
<object-name>Sphere</object-name>
<x-offset>1.75</x-offset>
<y-offset>1.75</y-offset>
<z-offset>1.25</z-offset>
</animation>
<animation>
<object-name>Sphere</object-name>
<enable-hot type="bool">true</enable-hot>
</animation>
<particlesystem>
<name>explosion-smoke-longterm</name>
<texture>smoke.png</texture>
<emissive type="bool">false</emissive>
<lighting type="bool">false</lighting>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>0</theta-min-deg>
<theta-max-deg>20</theta-max-deg>
<phi-min-deg>-180</phi-min-deg>
<phi-max-deg>180</phi-max-deg>
<speed-mps>
<value>30</value>
<spread>10</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>5</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>2</value>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 0.3 </value></red>
<green><value> 0.3 </value></green>
<blue><value> 0.25 </value></blue>
<alpha><value> 0.3 </value></alpha>
</color>
<size>
<value>6</value>
</size>
</start>
<end>
<color>
<red><value> 0.4 </value></red>
<green><value> 0.4 </value></green>
<blue><value> 0.4 </value></blue>
<alpha><value> 0.05 </value></alpha>
</color>
<size>
<value>12</value>
</size>
</end>
<life-sec>
<value>90</value>
</life-sec>
<mass-kg> 4.0 </mass-kg>
<radius-m> 0.4 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> true </gravity>
<wind typ="bool"> true </wind>
</program>
</particlesystem>
</PropertyList>

@ -0,0 +1,95 @@
<?xml version="1.0"?>
<PropertyList>
<path>crater.ac</path>
<animation>
<object-name>Sphere</object-name>
<enable-hot type="bool">true</enable-hot>
</animation>
<particlesystem>
<name>explosion-smoke-longterm</name>
<texture>smoke.png</texture>
<emissive type="bool">false</emissive>
<lighting type="bool">false</lighting>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>0</theta-min-deg>
<theta-max-deg>20</theta-max-deg>
<phi-min-deg>-180</phi-min-deg>
<phi-max-deg>180</phi-max-deg>
<speed-mps>
<value>30</value>
<spread>10</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>5</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>2</value>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 0.3 </value></red>
<green><value> 0.3 </value></green>
<blue><value> 0.25 </value></blue>
<alpha><value> 0.3 </value></alpha>
</color>
<size>
<value>6</value>
</size>
</start>
<end>
<color>
<red><value> 0.4 </value></red>
<green><value> 0.4 </value></green>
<blue><value> 0.4 </value></blue>
<alpha><value> 0.05 </value></alpha>
</color>
<size>
<value>10</value>
</size>
</end>
<life-sec>
<value>50</value>
</life-sec>
<mass-kg> 5.0 </mass-kg>
<radius-m> 0.4 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> true </gravity>
<wind typ="bool"> true </wind>
</program>
</particlesystem>
</PropertyList>

@ -0,0 +1,87 @@
<PropertyList>
<path>aim-emesary.ac</path>
<particlesystem>
<name>emesary-heavy-smoke</name>
<texture>smoke.png</texture>
<emissive type="bool">false</emissive>
<lighting type="bool">false</lighting>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>-1.5</theta-min-deg>
<theta-max-deg>1.5</theta-max-deg>
<phi-min-deg>-1.5</phi-min-deg>
<phi-max-deg>1.5</phi-max-deg>
<speed-mps>
<value>0</value>
<spread>0</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>0</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>100</value>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 0.3 </value></red>
<green><value> 0.3 </value></green>
<blue><value> 0.2 </value></blue>
<alpha><value> 0.5 </value></alpha>
</color>
<size>
<value>9</value>
</size>
</start>
<end>
<color>
<red><value> 0.2 </value></red>
<green><value> 0.2 </value></green>
<blue><value> 0.2 </value></blue>
<alpha><value> 0.1 </value></alpha>
</color>
<size>
<value>15</value>
</size>
</end>
<life-sec>
<value>50</value>
</life-sec>
<mass-kg> 0.5 </mass-kg>
<radius-m> 0.5 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> true </gravity>
<wind typ="bool"> true </wind>
</program>
</particlesystem>
</PropertyList>

@ -0,0 +1,87 @@
<PropertyList>
<path>aim-emesary.ac</path>
<particlesystem>
<name>emesary-light-smoke</name>
<texture>smoke.png</texture>
<emissive type="bool">false</emissive>
<lighting type="bool">false</lighting>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>-1.5</theta-min-deg>
<theta-max-deg>1.5</theta-max-deg>
<phi-min-deg>-1.5</phi-min-deg>
<phi-max-deg>1.5</phi-max-deg>
<speed-mps>
<value>0</value>
<spread>0</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>0</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>0</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>100</value>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red><value> 1.0 </value></red>
<green><value> 1.0 </value></green>
<blue><value> 0.9 </value></blue>
<alpha><value> 0.5 </value></alpha>
</color>
<size>
<value>1.5</value>
</size>
</start>
<end>
<color>
<red><value> 0.9 </value></red>
<green><value> 0.9 </value></green>
<blue><value> 0.9 </value></blue>
<alpha><value> 0.1 </value></alpha>
</color>
<size>
<value>3</value>
</size>
</end>
<life-sec>
<value>50</value>
</life-sec>
<mass-kg> 0.5 </mass-kg>
<radius-m> 0.5 </radius-m>
</particle>
<program>
<fluid> air </fluid>
<gravity type="bool"> true </gravity>
<wind typ="bool"> true </wind>
</program>
</particlesystem>
</PropertyList>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<PropertyList>
<path>parachutist.ac</path>
<offsets>
<x-m> 0.5</x-m>
<y-m> 0.000</y-m>
<z-m> 1.50</z-m>
</offsets>
</PropertyList>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

@ -0,0 +1,144 @@
<?xml version="1.0"?>
<PropertyList>
<path>Models/Effects/procedural_light.ac</path>
<animation>
<type>scale</type>
<object-name>procedural_light</object-name>
<x-offset>1000</x-offset>
<y-offset>1000</y-offset>
<z-offset>1000</z-offset>
</animation>
<effect>
<inherits-from>Effects/procedural-light</inherits-from>
<object-name>procedural_light</object-name>
<parameters>
<light_color_base_r type="float">0.84</light_color_base_r>
<light_color_base_g type="float">0.55</light_color_base_g>
<light_color_base_b type="float">0.42</light_color_base_b>
<light_color_center_r type="float">1.0</light_color_center_r>
<light_color_center_g type="float">0.9</light_color_center_g>
<light_color_center_b type="float">0.7</light_color_center_b>
<intensity_scale type="float">1.0</intensity_scale>
<is_directional type="bool">false</is_directional>
<is_strobe type="bool">false</is_strobe>
<outer_gain type="float">1</outer_gain>
</parameters>
</effect>
<animation>
<type>dist-scale</type>
<object-name>procedural_light</object-name>
<interpolation>
<entry><ind>0</ind> <dep>0.0075</dep></entry>
<entry><ind>3750</ind> <dep>0.750</dep></entry>
<entry><ind>10000</ind><dep>1.000</dep></entry>
</interpolation>
</animation>
<particlesystem>
<name>flare-smoke</name>
<texture>smoke.png</texture>
<emissive>false</emissive>
<lighting>false</lighting>
<offsets>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
<pitch-deg>90</pitch-deg>
<roll-deg>90</roll-deg>
</offsets>
<attach>world</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>-5</theta-min-deg>
<theta-max-deg>5</theta-max-deg>
<phi-min-deg>-5</phi-min-deg>
<phi-max-deg>5</phi-max-deg>
<speed-mps>
<value>0</value>
<spread>2</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>10</x-min-deg-sec>
<y-min-deg-sec>10</y-min-deg-sec>
<z-min-deg-sec>10</z-min-deg-sec>
<x-max-deg-sec>40</x-max-deg-sec>
<y-max-deg-sec>40</y-max-deg-sec>
<z-max-deg-sec>40</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>25</value>
<spread>5</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red>
<expression><product><value>0.9</value><property>/rendering/scene/diffuse/red</property></product></expression>
</red>
<green>
<expression><product><value>0.9</value><property>/rendering/scene/diffuse/red</property></product></expression>
</green>
<blue>
<expression><product><value>0.9</value><property>/rendering/scene/diffuse/red</property></product></expression>
</blue>
<alpha>
<value>1</value>
</alpha>
</color>
<size>
<value>0.6</value>
</size>
</start>
<end>
<color>
<red>
<expression><product><value>0.9</value><property>/rendering/scene/diffuse/red</property></product></expression>
</red>
<green>
<expression><product><value>0.9</value><property>/rendering/scene/diffuse/red</property></product></expression>
</green>
<blue>
<expression><product><value>0.9</value><property>/rendering/scene/diffuse/red</property></product></expression>
</blue>
<alpha>
<value>0.05</value>
</alpha>
</color>
<size>
<value>6.0</value>
</size>
</end>
<life-sec>
<value>2.75</value>
</life-sec>
<mass-kg>0.00001</mass-kg>
<radius-m>0.015</radius-m>
</particle>
<program>
<fluid>air</fluid>
<gravity type="bool">false</gravity>
<wind type="bool">true</wind>
</program>
</particlesystem>
</PropertyList>

@ -0,0 +1,260 @@
#
#
# 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.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;
},
};

@ -0,0 +1,84 @@
# 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("f16mp.geo",geoRoutedNotifications, 18, "", geoBridgedTransmitter);
# bridge should be tuned to be around 90% of the packet size full.
geooutgoingBridge.TransmitFrequencySeconds = 0.75;
geooutgoingBridge.MPStringMaxLen = 150;
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("f16mp.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("f16mp.object",objectRoutedNotifications, 17, "", objectBridgedTransmitter);
objectoutgoingBridge.TransmitFrequencySeconds = 0.2;
objectoutgoingBridge.MessageLifeTime = 1;
objectoutgoingBridge.MPStringMaxLen = 150;
emesary_mp_bridge.IncomingMPBridge.startMPBridge(objectRoutedNotifications, 17, emesary.GlobalTransmitter);
#
# 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);

File diff suppressed because it is too large Load Diff

@ -0,0 +1,97 @@
<?xml version="1.0"?>
<PropertyList>
<name>flightlog</name>
<modal>false</modal>
<layout>vbox</layout>
<draggable>true</draggable>
<resizable>true</resizable>
<group>
<layout>hbox</layout>
<empty><stretch>1</stretch></empty>
<text>
<label>Combat event log</label>
</text>
<empty><stretch>1</stretch></empty>
<button>
<pref-width>16</pref-width>
<pref-height>16</pref-height>
<legend></legend>
<default>1</default>
<keynum>27</keynum>
<border>2</border>
<binding>
<command>dialog-close</command>
</binding>
<binding>
<command>dialog-apply</command>
</binding>
</button>
</group>
<hrule/>
<nasal>
<open>
<![CDATA[
setprop("sim/model/mig21/event-log", "Click refresh to see the combat event log..");
]]>
</open>
<close>
<![CDATA[
setprop("sim/model/mig21/event-log", "");
]]>
</close>
</nasal>
<button>
<!--<x>0</x>
<y>0</y>-->
<halign>centre</halign>
<legend>Refresh</legend>
<binding>
<command>nasal</command>
<script><![CDATA[
var str = "";
if (getprop("velocities/groundspeed-kt") < 10) {
var buffer = damage.damageLog.get_buffer();
foreach(entry; buffer) {
str = str~""~entry.time~" "~entry.message~"\n";
}
} else {
str = "The aircraft must be still to read the combat event log.";
}
setprop("sim/model/mig21/event-log", str);
]]></script>
</binding>
</button>
<text>
<halign>left</halign>
<label>Event log:</label>
</text>
<textbox>
<!-- position -->
<!--<x>100</x>
<y>100</y>-->
<!-- dimensions -->
<pref-width>500</pref-width>
<pref-height>500</pref-height>
<property>/sim/model/mig21/event-log</property>
<live>true</live>
<slider>15</slider> <!--width for slider -->
<wrap>false</wrap> <!-- don't wrap text; default: true -->
<top-line>0</top-line> <!-- line to show at top, -ve numbers show last line -->
<editable>false</editable> <!-- if the puLargeInput is supposed to be editable -->
</textbox>
<empty><stretch>1</stretch></empty>
</PropertyList>
Loading…
Cancel
Save