Sim: Fix that some callsigns could mess up emesary communications.

This commit is contained in:
Nikolai V. Chr 2022-07-15 23:19:12 +02:00
parent 9684e5e388
commit 641f407599
13 changed files with 224 additions and 64 deletions

View File

@ -347,8 +347,7 @@ var DamageRecipient =
}
# Missile approach warning:
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign != callsign) return emesary.Transmitter.ReceiptStatus_OK;
if (!radarOn) return emesary.Transmitter.ReceiptStatus_OK;# this should be little more complex later
var heading = getprop("orientation/heading-deg");
@ -379,8 +378,7 @@ var DamageRecipient =
# debug.dump(notification);
#
#
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) {
#damage enabled and were getting hit
if (m28_auto) mig28.engagedBy(notification.Callsign);
@ -1243,6 +1241,20 @@ var printDamageLog = func {
print();
}
var processCallsign = func (callsign) {
# Convert the callsign to one that emesary can work with.
var l = size(callsign);
callsign = l < 8?callsign:left(callsign, 7);
var newCallsign = "";
for(var ii = 0; ii < l; ii += 1) {
var ev = emesary.TransferString.getalphanumericchar(substr(callsign,ii,1));
if (ev != nil) {
newCallsign ~= ev;
}
}
return newCallsign;
}
#TODO testing:
var writeDamageLog = func {

View File

@ -347,8 +347,7 @@ var DamageRecipient =
}
# Missile approach warning:
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign != callsign) return emesary.Transmitter.ReceiptStatus_OK;
if (!radarOn) return emesary.Transmitter.ReceiptStatus_OK;# this should be little more complex later
var heading = getprop("orientation/heading-deg");
@ -379,8 +378,7 @@ var DamageRecipient =
# debug.dump(notification);
#
#
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) {
#damage enabled and were getting hit
if (m28_auto) mig28.engagedBy(notification.Callsign);
@ -1243,6 +1241,20 @@ var printDamageLog = func {
print();
}
var processCallsign = func (callsign) {
# Convert the callsign to one that emesary can work with.
var l = size(callsign);
callsign = l < 8?callsign:left(callsign, 7);
var newCallsign = "";
for(var ii = 0; ii < l; ii += 1) {
var ev = emesary.TransferString.getalphanumericchar(substr(callsign,ii,1));
if (ev != nil) {
newCallsign ~= ev;
}
}
return newCallsign;
}
#TODO testing:
var writeDamageLog = func {

View File

@ -347,8 +347,7 @@ var DamageRecipient =
}
# Missile approach warning:
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign != callsign) return emesary.Transmitter.ReceiptStatus_OK;
if (!radarOn) return emesary.Transmitter.ReceiptStatus_OK;# this should be little more complex later
var heading = getprop("orientation/heading-deg");
@ -379,8 +378,7 @@ var DamageRecipient =
# debug.dump(notification);
#
#
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) {
#damage enabled and were getting hit
if (m28_auto) mig28.engagedBy(notification.Callsign);
@ -1243,6 +1241,20 @@ var printDamageLog = func {
print();
}
var processCallsign = func (callsign) {
# Convert the callsign to one that emesary can work with.
var l = size(callsign);
callsign = l < 8?callsign:left(callsign, 7);
var newCallsign = "";
for(var ii = 0; ii < l; ii += 1) {
var ev = emesary.TransferString.getalphanumericchar(substr(callsign,ii,1));
if (ev != nil) {
newCallsign ~= ev;
}
}
return newCallsign;
}
#TODO testing:
var writeDamageLog = func {

View File

@ -509,10 +509,10 @@ var AIM = {
if (m.vector_thrust == nil) {
m.vector_thrust = FALSE;
}
if (m.flareResistance == nil) {
if (m.flareResistance == nil or !m.gnd_launch) {
m.flareResistance = 0.85;
}
if (m.chaffResistance == nil) {
if (m.chaffResistance == nil or !m.gnd_launch) {
m.chaffResistance = 0.85;
}
if (m.guidanceLaw == nil) {
@ -1910,7 +1910,7 @@ var AIM = {
setNewTargetInFlight: func (tagt) {
me.Tgt = tagt;
me.callsign = tagt==nil?"Unknown":me.Tgt.get_Callsign();
me.callsign = tagt==nil?"Unknown":damage.processCallsign(me.Tgt.get_Callsign());
me.printStatsDetails("Target set to %s", me.callsign);
me.newTargetAssigned = tagt==nil?FALSE:TRUE;
me.t_coord = tagt==nil?nil:me.Tgt.get_Coord();
@ -2543,9 +2543,12 @@ var AIM = {
me.prevGuidance = me.guidance;
if (me.counter > -1) {
if (me.counter > -1 and !me.ai.getNode("valid").getBoolValue()) {
# TODO: Why is this placed so late? Don't remember.
me.ai.getNode("valid").setBoolValue(1);
thread.lock(mutexTimer);
append(AIM.timerQueue, [me, me.setModelAdded, [], -1]);
thread.unlock(mutexTimer);
}
#############################################################################################################
#
@ -3075,8 +3078,9 @@ var AIM = {
me.chaffLast = me.chaffNumber;
me.chaffTime = getprop("sim/time/elapsed-sec");
me.aspectDeg = me.aspectToExhaust(me.coord, me.Tgt) / 180;# 0 = viewing engine, 1 = front
me.chaffLock = rand() < (1-me.chaffResistance - ((1-me.chaffResistance) * 0.5 * me.aspectDeg));# 50% less chance to be fooled if front aspect
me.semi = me.guidance == "semi-radar"?0.5:1;
me.chaffChance = (1-me.chaffResistance)*me.semi;
me.chaffLock = rand() < (me.chaffChance - (me.chaffChance * 0.5 * me.aspectDeg));# 50% less chance to be fooled if front aspect
if (me.chaffLock == TRUE) {
me.printStats(me.type~": Missile locked on chaff from "~me.callsign);
@ -4094,6 +4098,9 @@ var AIM = {
}
me.ai.getNode("valid", 1).setBoolValue(0);
thread.lock(mutexTimer);
append(AIM.timerQueue, [me, me.setModelRemoved, [], -1]);
thread.unlock(mutexTimer);
if (event == "exploded" and !me.inert and wh_mass > 0) {
me.animate_explosion(hitGround);
me.explodeSound = TRUE;
@ -4120,7 +4127,7 @@ var AIM = {
me.printStats(phrase);
if(getprop("payload/armament/msg") and wh_mass > 0){
var cs = me.testMe.get_Callsign();
var cs = damage.processCallsign(me.testMe.get_Callsign());
var cc = me.testMe.get_Coord();
thread.lock(mutexTimer);
append(AIM.timerQueue, [AIM, AIM.notifyHit, [explode_coord.alt() - cc.alt(),min_distance,cs,explode_coord.course_to(cc),"mhit1",me.typeID, me.typeLong,0], -1]);
@ -4134,8 +4141,7 @@ var AIM = {
var min_distance = geo.aircraft_position().direct_distance_to(explode_coord);
if (min_distance < me.reportDist) {
# hitting oneself :)
var cs = getprop("sim/multiplay/callsign");
cs = size(cs) < 8 ? cs : left(cs,7);
var cs = damage.processCallsign(getprop("sim/multiplay/callsign"));
var phrase = sprintf("%s %s: %.1f meters from: %s", me.type,event, min_distance, cs);# if we mention ourself then we need to explicit add ourself as author.
me.printStats(phrase);
if (wh_mass > 0) {
@ -4605,7 +4611,7 @@ var AIM = {
me.Tgt = me.tagt;
me.callsign = me.Tgt.get_Callsign();
me.callsign = damage.processCallsign(me.Tgt.get_Callsign());
settimer(func me.update_lock(), 0.1);
},
@ -5428,6 +5434,14 @@ var AIM = {
thread.unlock(mutexETA);
return retur;
},
setModelAdded: func {
setprop("ai/models/model-added", me.ai.getPath());
},
setModelRemoved: func {
setprop("ai/models/model-removed", me.ai.getPath());
},
};
var backtrace = func(desc = nil, dump_vars = 1, skip_level = 0, levels = 3) {
var d = (desc == nil) ? "" : " '" ~ desc ~ "'";

View File

@ -347,8 +347,7 @@ var DamageRecipient =
}
# Missile approach warning:
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign != callsign) return emesary.Transmitter.ReceiptStatus_OK;
if (!radarOn) return emesary.Transmitter.ReceiptStatus_OK;# this should be little more complex later
var heading = getprop("orientation/heading-deg");
@ -379,8 +378,7 @@ var DamageRecipient =
# debug.dump(notification);
#
#
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) {
#damage enabled and were getting hit
if (m28_auto) mig28.engagedBy(notification.Callsign);
@ -1243,6 +1241,20 @@ var printDamageLog = func {
print();
}
var processCallsign = func (callsign) {
# Convert the callsign to one that emesary can work with.
var l = size(callsign);
callsign = l < 8?callsign:left(callsign, 7);
var newCallsign = "";
for(var ii = 0; ii < l; ii += 1) {
var ev = emesary.TransferString.getalphanumericchar(substr(callsign,ii,1));
if (ev != nil) {
newCallsign ~= ev;
}
}
return newCallsign;
}
#TODO testing:
var writeDamageLog = func {

View File

@ -347,8 +347,7 @@ var DamageRecipient =
}
# Missile approach warning:
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign != callsign) return emesary.Transmitter.ReceiptStatus_OK;
if (!radarOn) return emesary.Transmitter.ReceiptStatus_OK;# this should be little more complex later
var heading = getprop("orientation/heading-deg");
@ -379,8 +378,7 @@ var DamageRecipient =
# debug.dump(notification);
#
#
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) {
#damage enabled and were getting hit
if (m28_auto) mig28.engagedBy(notification.Callsign);
@ -1243,6 +1241,20 @@ var printDamageLog = func {
print();
}
var processCallsign = func (callsign) {
# Convert the callsign to one that emesary can work with.
var l = size(callsign);
callsign = l < 8?callsign:left(callsign, 7);
var newCallsign = "";
for(var ii = 0; ii < l; ii += 1) {
var ev = emesary.TransferString.getalphanumericchar(substr(callsign,ii,1));
if (ev != nil) {
newCallsign ~= ev;
}
}
return newCallsign;
}
#TODO testing:
var writeDamageLog = func {

View File

@ -509,10 +509,10 @@ var AIM = {
if (m.vector_thrust == nil) {
m.vector_thrust = FALSE;
}
if (m.flareResistance == nil) {
if (m.flareResistance == nil or !m.gnd_launch) {
m.flareResistance = 0.85;
}
if (m.chaffResistance == nil) {
if (m.chaffResistance == nil or !m.gnd_launch) {
m.chaffResistance = 0.85;
}
if (m.guidanceLaw == nil) {
@ -1910,7 +1910,7 @@ var AIM = {
setNewTargetInFlight: func (tagt) {
me.Tgt = tagt;
me.callsign = tagt==nil?"Unknown":me.Tgt.get_Callsign();
me.callsign = tagt==nil?"Unknown":damage.processCallsign(me.Tgt.get_Callsign());
me.printStatsDetails("Target set to %s", me.callsign);
me.newTargetAssigned = tagt==nil?FALSE:TRUE;
me.t_coord = tagt==nil?nil:me.Tgt.get_Coord();
@ -2543,9 +2543,12 @@ var AIM = {
me.prevGuidance = me.guidance;
if (me.counter > -1) {
if (me.counter > -1 and !me.ai.getNode("valid").getBoolValue()) {
# TODO: Why is this placed so late? Don't remember.
me.ai.getNode("valid").setBoolValue(1);
thread.lock(mutexTimer);
append(AIM.timerQueue, [me, me.setModelAdded, [], -1]);
thread.unlock(mutexTimer);
}
#############################################################################################################
#
@ -3075,8 +3078,9 @@ var AIM = {
me.chaffLast = me.chaffNumber;
me.chaffTime = getprop("sim/time/elapsed-sec");
me.aspectDeg = me.aspectToExhaust(me.coord, me.Tgt) / 180;# 0 = viewing engine, 1 = front
me.chaffLock = rand() < (1-me.chaffResistance - ((1-me.chaffResistance) * 0.5 * me.aspectDeg));# 50% less chance to be fooled if front aspect
me.semi = me.guidance == "semi-radar"?0.5:1;
me.chaffChance = (1-me.chaffResistance)*me.semi;
me.chaffLock = rand() < (me.chaffChance - (me.chaffChance * 0.5 * me.aspectDeg));# 50% less chance to be fooled if front aspect
if (me.chaffLock == TRUE) {
me.printStats(me.type~": Missile locked on chaff from "~me.callsign);
@ -4094,6 +4098,9 @@ var AIM = {
}
me.ai.getNode("valid", 1).setBoolValue(0);
thread.lock(mutexTimer);
append(AIM.timerQueue, [me, me.setModelRemoved, [], -1]);
thread.unlock(mutexTimer);
if (event == "exploded" and !me.inert and wh_mass > 0) {
me.animate_explosion(hitGround);
me.explodeSound = TRUE;
@ -4120,7 +4127,7 @@ var AIM = {
me.printStats(phrase);
if(getprop("payload/armament/msg") and wh_mass > 0){
var cs = me.testMe.get_Callsign();
var cs = damage.processCallsign(me.testMe.get_Callsign());
var cc = me.testMe.get_Coord();
thread.lock(mutexTimer);
append(AIM.timerQueue, [AIM, AIM.notifyHit, [explode_coord.alt() - cc.alt(),min_distance,cs,explode_coord.course_to(cc),"mhit1",me.typeID, me.typeLong,0], -1]);
@ -4134,8 +4141,7 @@ var AIM = {
var min_distance = geo.aircraft_position().direct_distance_to(explode_coord);
if (min_distance < me.reportDist) {
# hitting oneself :)
var cs = getprop("sim/multiplay/callsign");
cs = size(cs) < 8 ? cs : left(cs,7);
var cs = damage.processCallsign(getprop("sim/multiplay/callsign"));
var phrase = sprintf("%s %s: %.1f meters from: %s", me.type,event, min_distance, cs);# if we mention ourself then we need to explicit add ourself as author.
me.printStats(phrase);
if (wh_mass > 0) {
@ -4605,7 +4611,7 @@ var AIM = {
me.Tgt = me.tagt;
me.callsign = me.Tgt.get_Callsign();
me.callsign = damage.processCallsign(me.Tgt.get_Callsign());
settimer(func me.update_lock(), 0.1);
},
@ -5428,6 +5434,14 @@ var AIM = {
thread.unlock(mutexETA);
return retur;
},
setModelAdded: func {
setprop("ai/models/model-added", me.ai.getPath());
},
setModelRemoved: func {
setprop("ai/models/model-removed", me.ai.getPath());
},
};
var backtrace = func(desc = nil, dump_vars = 1, skip_level = 0, levels = 3) {
var d = (desc == nil) ? "" : " '" ~ desc ~ "'";

View File

@ -341,8 +341,7 @@ var DamageRecipient =
}
# Missile approach warning:
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign != callsign) return emesary.Transmitter.ReceiptStatus_OK;
if (!radarOn) return emesary.Transmitter.ReceiptStatus_OK;# this should be little more complex later
var heading = getprop("orientation/heading-deg");
@ -373,8 +372,7 @@ var DamageRecipient =
# debug.dump(notification);
#
#
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) {
#damage enabled and were getting hit
if (m28_auto) mig28.engagedBy(notification.Callsign);
@ -1237,6 +1235,20 @@ var printDamageLog = func {
print();
}
var processCallsign = func (callsign) {
# Convert the callsign to one that emesary can work with.
var l = size(callsign);
callsign = l < 8?callsign:left(callsign, 7);
var newCallsign = "";
for(var ii = 0; ii < l; ii += 1) {
var ev = emesary.TransferString.getalphanumericchar(substr(callsign,ii,1));
if (ev != nil) {
newCallsign ~= ev;
}
}
return newCallsign;
}
#TODO testing:
var writeDamageLog = func {

View File

@ -347,8 +347,7 @@ var DamageRecipient =
}
# Missile approach warning:
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign != callsign) return emesary.Transmitter.ReceiptStatus_OK;
if (!radarOn) return emesary.Transmitter.ReceiptStatus_OK;# this should be little more complex later
var heading = getprop("orientation/heading-deg");
@ -379,8 +378,7 @@ var DamageRecipient =
# debug.dump(notification);
#
#
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) {
#damage enabled and were getting hit
if (m28_auto) mig28.engagedBy(notification.Callsign);
@ -1243,6 +1241,20 @@ var printDamageLog = func {
print();
}
var processCallsign = func (callsign) {
# Convert the callsign to one that emesary can work with.
var l = size(callsign);
callsign = l < 8?callsign:left(callsign, 7);
var newCallsign = "";
for(var ii = 0; ii < l; ii += 1) {
var ev = emesary.TransferString.getalphanumericchar(substr(callsign,ii,1));
if (ev != nil) {
newCallsign ~= ev;
}
}
return newCallsign;
}
#TODO testing:
var writeDamageLog = func {

View File

@ -347,8 +347,7 @@ var DamageRecipient =
}
# Missile approach warning:
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign != callsign) return emesary.Transmitter.ReceiptStatus_OK;
if (!radarOn) return emesary.Transmitter.ReceiptStatus_OK;# this should be little more complex later
var heading = getprop("orientation/heading-deg");
@ -379,8 +378,7 @@ var DamageRecipient =
# debug.dump(notification);
#
#
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) {
#damage enabled and were getting hit
if (m28_auto) mig28.engagedBy(notification.Callsign);
@ -1243,6 +1241,20 @@ var printDamageLog = func {
print();
}
var processCallsign = func (callsign) {
# Convert the callsign to one that emesary can work with.
var l = size(callsign);
callsign = l < 8?callsign:left(callsign, 7);
var newCallsign = "";
for(var ii = 0; ii < l; ii += 1) {
var ev = emesary.TransferString.getalphanumericchar(substr(callsign,ii,1));
if (ev != nil) {
newCallsign ~= ev;
}
}
return newCallsign;
}
#TODO testing:
var writeDamageLog = func {

View File

@ -347,8 +347,7 @@ var DamageRecipient =
}
# Missile approach warning:
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign != callsign) return emesary.Transmitter.ReceiptStatus_OK;
if (!radarOn) return emesary.Transmitter.ReceiptStatus_OK;# this should be little more complex later
var heading = getprop("orientation/heading-deg");
@ -379,8 +378,7 @@ var DamageRecipient =
# debug.dump(notification);
#
#
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) {
#damage enabled and were getting hit
if (m28_auto) mig28.engagedBy(notification.Callsign);
@ -1243,6 +1241,20 @@ var printDamageLog = func {
print();
}
var processCallsign = func (callsign) {
# Convert the callsign to one that emesary can work with.
var l = size(callsign);
callsign = l < 8?callsign:left(callsign, 7);
var newCallsign = "";
for(var ii = 0; ii < l; ii += 1) {
var ev = emesary.TransferString.getalphanumericchar(substr(callsign,ii,1));
if (ev != nil) {
newCallsign ~= ev;
}
}
return newCallsign;
}
#TODO testing:
var writeDamageLog = func {

View File

@ -341,8 +341,7 @@ var DamageRecipient =
}
# Missile approach warning:
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign != callsign) return emesary.Transmitter.ReceiptStatus_OK;
if (!radarOn) return emesary.Transmitter.ReceiptStatus_OK;# this should be little more complex later
var heading = getprop("orientation/heading-deg");
@ -373,8 +372,7 @@ var DamageRecipient =
# debug.dump(notification);
#
#
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) {
#damage enabled and were getting hit
if (m28_auto) mig28.engagedBy(notification.Callsign);
@ -1237,6 +1235,20 @@ var printDamageLog = func {
print();
}
var processCallsign = func (callsign) {
# Convert the callsign to one that emesary can work with.
var l = size(callsign);
callsign = l < 8?callsign:left(callsign, 7);
var newCallsign = "";
for(var ii = 0; ii < l; ii += 1) {
var ev = emesary.TransferString.getalphanumericchar(substr(callsign,ii,1));
if (ev != nil) {
newCallsign ~= ev;
}
}
return newCallsign;
}
#TODO testing:
var writeDamageLog = func {

View File

@ -347,8 +347,7 @@ var DamageRecipient =
}
# Missile approach warning:
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign != callsign) return emesary.Transmitter.ReceiptStatus_OK;
if (!radarOn) return emesary.Transmitter.ReceiptStatus_OK;# this should be little more complex later
var heading = getprop("orientation/heading-deg");
@ -379,8 +378,7 @@ var DamageRecipient =
# debug.dump(notification);
#
#
var callsign = getprop("sim/multiplay/callsign");
callsign = size(callsign) < 8 ? callsign : left(callsign,7);
var callsign = processCallsign(getprop("sim/multiplay/callsign"));
if (notification.RemoteCallsign == callsign and getprop("payload/armament/msg") == 1) {
#damage enabled and were getting hit
if (m28_auto) mig28.engagedBy(notification.Callsign);
@ -1243,6 +1241,20 @@ var printDamageLog = func {
print();
}
var processCallsign = func (callsign) {
# Convert the callsign to one that emesary can work with.
var l = size(callsign);
callsign = l < 8?callsign:left(callsign, 7);
var newCallsign = "";
for(var ii = 0; ii < l; ii += 1) {
var ev = emesary.TransferString.getalphanumericchar(substr(callsign,ii,1));
if (ev != nil) {
newCallsign ~= ev;
}
}
return newCallsign;
}
#TODO testing:
var writeDamageLog = func {