Skip to content

Commit

Permalink
Auto-Update shared Files
Browse files Browse the repository at this point in the history
missile-code 1.1.8->1.2.0
damage 1.4.12->1.4.13
station-manager 1.2.2->1.2.3
radar-system-database 1.1.15->1.1.16
radar-system 2.0.6->2.0.7
  • Loading branch information
github-actions[bot] committed Oct 29, 2024
1 parent bdced92 commit 37b3e76
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 90 deletions.
11 changes: 8 additions & 3 deletions Nasal/RADAR/radar-system-database.nas
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ var Database = {
"MQ-9": {killZone: 15, baseThreat:defaultFighterThreat},
"MQ-9-2": {killZone: 15, baseThreat:defaultFighterThreat},
# Helis
"212-TwinHuey": {isSlow: 1},
"412-Griffin": {isSlow: 1},
"abc212-TwinHuey": {isSlow: 1, rcsFrontal: 19},# These two helis wont work, as keys that start with numbers dont work.
"abc412-Griffin": {isSlow: 1, rcsFrontal: 19},# So doing some extra for these in methods.
"AH-1W": {isSlow: 1},
"AS532-Cougar": {isSlow: 1},
"AW139": {isSlow: 1},
Expand Down Expand Up @@ -272,7 +272,12 @@ foreach (entry ; keys(Database)) {
}

var getDBEntry = func (model) {
var entry = Database[model];
var entry = nil;
if (model == "212-TwinHuey" or model == "412-Griffin") {
entry = Database["abc" ~ model];
} else {
entry = Database[model];
}
if (entry == nil) {
entry = Database.default;
}
Expand Down
8 changes: 4 additions & 4 deletions Nasal/RADAR/radar-system.nas
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var GPS = 1;
var DualSeaterCallsign = props.globals.getNode("/sim/remote/pilot-callsign", 1);

var emptyCoord = geo.Coord.new().set_xyz(10,10,10);

var preAlphaKey = "ABC";# for hash keys that could start with number, which is not allowed.

var VectorNotification = {
new: func(type) {
Expand Down Expand Up @@ -306,7 +306,7 @@ var AIToNasal = {

me.aicontact.coord = me.aircraftPos;

me.usign = sprintf("%s%04d",me.callsign,me.id);
me.usign = sprintf("%s%s%04d",preAlphaKey,me.callsign,me.id);
me.usignLookup = [me.aicontact];

me.updateVectorFrame(me.usign,me.usignLookup);
Expand Down Expand Up @@ -442,7 +442,7 @@ var CallsignToContact = {
foreach(contact ; notification.vector) {
var cs = contact.getCallsign();
if (cs == nil or cs == "") continue;
me.radar.struct_csContact[cs] = contact;
me.radar.struct_csContact[preAlphaKey~cs] = contact;
}
}
return emesary.Transmitter.ReceiptStatus_OK;
Expand All @@ -455,7 +455,7 @@ var CallsignToContact = {

get: func (cs) {
if (!me.enabled) return nil;
return me.struct_csContact[cs];
return me.struct_csContact[preAlphaKey~cs];
},

del: func {
Expand Down
20 changes: 11 additions & 9 deletions Nasal/damage.nas
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var mlw_max=getprop("payload/d-config/mlw_max"); #
var auto_flare_caller = getprop("payload/d-config/auto_flare_caller"); # If damage.nas should detect flare releases, or if function is called from somewhere in aircraft
############################################################################################################################

var preAlphaKey = "ABC";# for hash keys that could start with number, which is not allowed.
srand();
var hp = hp_max;
setprop("sam/damage", math.max(0,100*hp/hp_max));#used in HUD
Expand Down Expand Up @@ -174,6 +175,7 @@ var warheads = {
var AIR_RADAR = "air";

var radar_signatures = {
# be careful these keys do not start with a number char
"unknown-model": AIR_RADAR,
"f-14b": AIR_RADAR,
"F-14D": AIR_RADAR,
Expand Down Expand Up @@ -328,7 +330,7 @@ var DamageRecipient =
var wh = id2warhead[DamageRecipient.emesaryID2typeID(notification.SecondaryKind)][4];
var tacID = left(md5(notification.Callsign~notification.UniqueIdentity~wh),6);
var elapsed = getprop("sim/time/elapsed-sec");
lastSeenTacObject[tacID] = elapsed;
lastSeenTacObject[preAlphaKey ~ tacID] = elapsed;
if (notification.Kind == MOVE) {
var target = ",Color=Red";
if (wh=="Flare") wh=wh~",Type=Flare";
Expand Down Expand Up @@ -381,7 +383,7 @@ var DamageRecipient =
if (tacview.starttime) {
var tacID = left(md5(notification.Callsign~notification.UniqueIdentity~typ[4]),6);
var elapsed = getprop("sim/time/elapsed-sec");
lastSeenTacObject[tacID] = elapsed;
lastSeenTacObject[preAlphaKey ~ tacID] = elapsed;
if (notification.Kind == DESTROY) {
thread.lock(tacview.mutexWrite);
tacview.write("#" ~ (systime() - tacview.starttime)~"\n");
Expand Down Expand Up @@ -412,10 +414,10 @@ var DamageRecipient =

# Missile launch warning:
if (thrustOn) {
var launch = launched[notification.Callsign~notification.UniqueIdentity];
var launch = launched[preAlphaKey ~ notification.Callsign~notification.UniqueIdentity];
if (launch == nil or elapsed - launch > 300) {
launch = elapsed;
launched[notification.Callsign~notification.UniqueIdentity] = launch;
launched[preAlphaKey ~ notification.Callsign~notification.UniqueIdentity] = launch;
if (notification.Position.direct_distance_to(ownPos)*M2NM < mlw_max) {
setprop("payload/armament/MLW-bearing", bearing);
setprop("payload/armament/MLW-launcher", notification.Callsign);
Expand Down Expand Up @@ -443,7 +445,7 @@ var DamageRecipient =
if (notification.Callsign != nil) setprop("payload/armament/MAW-semiactive-callsign", notification.Callsign);# resets every 1 seconds
}
MAW_elapsed = elapsed;
var appr = approached[notification.Callsign~notification.UniqueIdentity];
var appr = approached[preAlphaKey ~ notification.Callsign~notification.UniqueIdentity];
if (appr == nil or elapsed - appr > 450) {
if (radarOn) {
#printf("Missile Approach Warning from %03d degrees.", bearing);
Expand All @@ -454,7 +456,7 @@ var DamageRecipient =
damageLog.push(sprintf("Missile Approach Warning from %s.", notification.Callsign));
if (rwr_to_screen) screen.log.write(sprintf("Missile Approach Warning (semi-active)."), 1,0.5,0);# temporary till someone models a RWR in RIO seat
}
approached[notification.Callsign~notification.UniqueIdentity] = elapsed;
approached[preAlphaKey ~ notification.Callsign~notification.UniqueIdentity] = elapsed;
if (m28_auto) mig28.engagedBy(notification.Callsign, 1);
}
return emesary.Transmitter.ReceiptStatus_OK;
Expand Down Expand Up @@ -1381,7 +1383,7 @@ var nearby_explosion_b = func {

var callsign_struct = {};
var getCallsign = func (callsign) {
var node = callsign_struct[callsign];
var node = callsign_struct[preAlphaKey ~ callsign];
return node;
}

Expand All @@ -1406,7 +1408,7 @@ var processCallsigns = func () {
if(multiplayer.ignore[callsign] == 1) {
continue;
}
callsign_struct[callsign] = player;
callsign_struct[preAlphaKey ~ callsign] = player;
var str6 = player.getNode("sim/multiplay/generic/string[6]");
if (str6 != nil and str6.getValue() != nil and str6.getValue() != "" and size(""~str6.getValue())==4 and left(md5(myCallsign),4) == str6.getValue()) {
painted = 1;
Expand All @@ -1429,7 +1431,7 @@ var processCallsigns = func () {
if (elapsed - lastSeenTacObject[key] > 30) {
thread.lock(tacview.mutexWrite);
tacview.write("#" ~ (systime() - tacview.starttime)~"\n");
tacview.write("-"~key~"\n");
tacview.write("-"~substr(key,size(preAlphaKey))~"\n");
thread.unlock(tacview.mutexWrite);
} else {
new_lastSeenTacObject[key] = lastSeenTacObject[key];
Expand Down
Loading

0 comments on commit 37b3e76

Please sign in to comment.