Damage update

This commit is contained in:
Nikolai V Chr 2020-11-06 09:49:40 +01:00
parent e030f66382
commit d3e55ed89b
8 changed files with 52 additions and 116 deletions

View File

@ -551,7 +551,7 @@ var deadreckon_updatetime = 0.1;# 1/15 of missile send rate
var time_before_delete = 2.5;# time since last notification before deleting
var dynamic_loop = func {
# This keeps track of flying missiles/parachutes/flares and manages ModelManager.
# This keeps track of MP flying missiles/parachutes/flares and manages ModelManager.
var new_dynamic3d = [];
var stime = systime();
foreach (dynamic3d_entry ; dynamic3d) {
@ -747,7 +747,6 @@ var ModelManager = {
};
var reckon_create = func (kee, dyna, stime) {
#print("ES create "~kee);
var path = getprop("payload/armament/models") ~ "parachutist.xml";
if (dyna[7]==1) {
path = getprop("payload/armament/models") ~ "light_smoke.xml";
@ -755,10 +754,11 @@ var reckon_create = func (kee, dyna, stime) {
path = getprop("payload/armament/models") ~ "heavy_smoke.xml";
} elsif (dyna[7] ==3) {
path = getprop("payload/armament/models") ~ "the-flare.xml";
} elsif (dyna[7] == -1) {
return nil;
}
var static = ModelManager.new(path, dyna[1],dyna[2],dyna[3]*M2FT,dyna[5],dyna[6],dyna[7]==0);#path,lat,lon,alt_m,heading,pitch
if (static != nil) {
#static.place();
var entry = [kee, stime, static, dyna[4]];
return entry;
}
@ -767,7 +767,6 @@ var reckon_create = func (kee, dyna, stime) {
}
var reckon_update = func (dyna, entry, stime) {
#print("ES update");
var static = entry[2];
var dynami2 = [entry[0], stime, static, dyna[4]];
# translate
@ -777,7 +776,6 @@ var reckon_update = func (dyna, entry, stime) {
}
var reckon_move = func (entry, stime) {
#print("ES move");
var static = entry[2];
var time_then = entry[1];
var time_now = stime;
@ -787,7 +785,6 @@ var reckon_move = func (entry, stime) {
}
var reckon_delete = func (entry) {
#print("ES delete");
entry[2].del();
}
@ -816,7 +813,7 @@ var flare_sorter = func(a, b) {
}
var animate_flare = func {
# This detects own flares and send out notifications about their position every 0.75s
# Send out notifications about own flare positions every 0.4s
if (!getprop("payload/armament/msg")) {
return;
}
@ -858,11 +855,9 @@ var animate_flare = func {
notifications.objectBridgedTransmitter.NotifyAll(msg);
flares_sent += 1;
}
#print("Update flare "~flare[5]);
append(old_flares, flare);
}
flare_list = old_flares;
#print(flares_sent~" flares sent, out of "~size(flare_list));
if(auto_flare_caller) {
auto_flare_released();
}
@ -871,7 +866,7 @@ var flaretimer = maketimer(flare_update_time, animate_flare);
flaretimer.start();
var auto_flare_released = func {
# new flare
# This detects own flares releases
var prop = getprop("rotors/main/blade[3]/flap-deg");
var stime = systime();
if (prop != nil and prop != 0 and prop != last_prop and stime-last_release > 1) {
@ -885,7 +880,7 @@ var flare_released = func {
if (!getprop("payload/armament/msg")) {
return;
}
# new flare
# We released a flare. If you call this method manually, then make sure 'auto_flare_caller' is false.
var stime = systime();
var flare =[stime, stime,
geo.aircraft_position(),
@ -904,7 +899,6 @@ var flare_released = func {
msg.Heading = 0;
msg.u_fps = 0;
notifications.objectBridgedTransmitter.NotifyAll(msg);
#print("Adding flare "~flare[6]);
}
#==================================================================
@ -929,9 +923,7 @@ var check_for_Request = func {
msg.IsDistinct = 0;
msg.Heading = 0;
notifications.hitBridgedTransmitter.NotifyAll(msg);
#print("REQUEST_ALL");
} else {
#print("REQUEST_NONE");
}
}

View File

@ -551,7 +551,7 @@ var deadreckon_updatetime = 0.1;# 1/15 of missile send rate
var time_before_delete = 2.5;# time since last notification before deleting
var dynamic_loop = func {
# This keeps track of flying missiles/parachutes/flares and manages ModelManager.
# This keeps track of MP flying missiles/parachutes/flares and manages ModelManager.
var new_dynamic3d = [];
var stime = systime();
foreach (dynamic3d_entry ; dynamic3d) {
@ -747,7 +747,6 @@ var ModelManager = {
};
var reckon_create = func (kee, dyna, stime) {
#print("ES create "~kee);
var path = getprop("payload/armament/models") ~ "parachutist.xml";
if (dyna[7]==1) {
path = getprop("payload/armament/models") ~ "light_smoke.xml";
@ -755,10 +754,11 @@ var reckon_create = func (kee, dyna, stime) {
path = getprop("payload/armament/models") ~ "heavy_smoke.xml";
} elsif (dyna[7] ==3) {
path = getprop("payload/armament/models") ~ "the-flare.xml";
} elsif (dyna[7] == -1) {
return nil;
}
var static = ModelManager.new(path, dyna[1],dyna[2],dyna[3]*M2FT,dyna[5],dyna[6],dyna[7]==0);#path,lat,lon,alt_m,heading,pitch
if (static != nil) {
#static.place();
var entry = [kee, stime, static, dyna[4]];
return entry;
}
@ -767,7 +767,6 @@ var reckon_create = func (kee, dyna, stime) {
}
var reckon_update = func (dyna, entry, stime) {
#print("ES update");
var static = entry[2];
var dynami2 = [entry[0], stime, static, dyna[4]];
# translate
@ -777,7 +776,6 @@ var reckon_update = func (dyna, entry, stime) {
}
var reckon_move = func (entry, stime) {
#print("ES move");
var static = entry[2];
var time_then = entry[1];
var time_now = stime;
@ -787,7 +785,6 @@ var reckon_move = func (entry, stime) {
}
var reckon_delete = func (entry) {
#print("ES delete");
entry[2].del();
}
@ -816,7 +813,7 @@ var flare_sorter = func(a, b) {
}
var animate_flare = func {
# This detects own flares and send out notifications about their position every 0.75s
# Send out notifications about own flare positions every 0.4s
if (!getprop("payload/armament/msg")) {
return;
}
@ -858,11 +855,9 @@ var animate_flare = func {
notifications.objectBridgedTransmitter.NotifyAll(msg);
flares_sent += 1;
}
#print("Update flare "~flare[5]);
append(old_flares, flare);
}
flare_list = old_flares;
#print(flares_sent~" flares sent, out of "~size(flare_list));
if(auto_flare_caller) {
auto_flare_released();
}
@ -871,7 +866,7 @@ var flaretimer = maketimer(flare_update_time, animate_flare);
flaretimer.start();
var auto_flare_released = func {
# new flare
# This detects own flares releases
var prop = getprop("rotors/main/blade[3]/flap-deg");
var stime = systime();
if (prop != nil and prop != 0 and prop != last_prop and stime-last_release > 1) {
@ -885,7 +880,7 @@ var flare_released = func {
if (!getprop("payload/armament/msg")) {
return;
}
# new flare
# We released a flare. If you call this method manually, then make sure 'auto_flare_caller' is false.
var stime = systime();
var flare =[stime, stime,
geo.aircraft_position(),
@ -904,7 +899,6 @@ var flare_released = func {
msg.Heading = 0;
msg.u_fps = 0;
notifications.objectBridgedTransmitter.NotifyAll(msg);
#print("Adding flare "~flare[6]);
}
#==================================================================
@ -929,9 +923,7 @@ var check_for_Request = func {
msg.IsDistinct = 0;
msg.Heading = 0;
notifications.hitBridgedTransmitter.NotifyAll(msg);
#print("REQUEST_ALL");
} else {
#print("REQUEST_NONE");
}
}

View File

@ -14,7 +14,7 @@ var full_damage_dist_m = 3;# Can vary from aircraft to aircraft depending on how
# For assets this should be average radius of the asset.
var use_hitpoints_instead_of_failure_modes_bool = 1;# mainly used by assets that don't have failure modes.
var hp_max = 80;# given a direct hit, how much pounds of warhead is needed to kill. Only used if hitpoints is enabled.
var hitable_by_air_munitions = 1; # if anti-air can do damage
var hitable_by_air_munitions = 0; # if anti-air can do damage
var hitable_by_cannon = 1; # if cannon can do damage
#var hitable_by_ground_munitions = 1;# if anti-ground/marine can do damage
var is_fleet = 0; # Is really 7 ships, 3 of which has offensive missiles.
@ -551,7 +551,7 @@ var deadreckon_updatetime = 0.1;# 1/15 of missile send rate
var time_before_delete = 2.5;# time since last notification before deleting
var dynamic_loop = func {
# This keeps track of flying missiles/parachutes/flares and manages ModelManager.
# This keeps track of MP flying missiles/parachutes/flares and manages ModelManager.
var new_dynamic3d = [];
var stime = systime();
foreach (dynamic3d_entry ; dynamic3d) {
@ -747,7 +747,6 @@ var ModelManager = {
};
var reckon_create = func (kee, dyna, stime) {
#print("ES create "~kee);
var path = getprop("payload/armament/models") ~ "parachutist.xml";
if (dyna[7]==1) {
path = getprop("payload/armament/models") ~ "light_smoke.xml";
@ -755,10 +754,11 @@ var reckon_create = func (kee, dyna, stime) {
path = getprop("payload/armament/models") ~ "heavy_smoke.xml";
} elsif (dyna[7] ==3) {
path = getprop("payload/armament/models") ~ "the-flare.xml";
} elsif (dyna[7] == -1) {
return nil;
}
var static = ModelManager.new(path, dyna[1],dyna[2],dyna[3]*M2FT,dyna[5],dyna[6],dyna[7]==0);#path,lat,lon,alt_m,heading,pitch
if (static != nil) {
#static.place();
var entry = [kee, stime, static, dyna[4]];
return entry;
}
@ -767,7 +767,6 @@ var reckon_create = func (kee, dyna, stime) {
}
var reckon_update = func (dyna, entry, stime) {
#print("ES update");
var static = entry[2];
var dynami2 = [entry[0], stime, static, dyna[4]];
# translate
@ -777,7 +776,6 @@ var reckon_update = func (dyna, entry, stime) {
}
var reckon_move = func (entry, stime) {
#print("ES move");
var static = entry[2];
var time_then = entry[1];
var time_now = stime;
@ -787,7 +785,6 @@ var reckon_move = func (entry, stime) {
}
var reckon_delete = func (entry) {
#print("ES delete");
entry[2].del();
}
@ -816,7 +813,7 @@ var flare_sorter = func(a, b) {
}
var animate_flare = func {
# This detects own flares and send out notifications about their position every 0.75s
# Send out notifications about own flare positions every 0.4s
if (!getprop("payload/armament/msg")) {
return;
}
@ -858,11 +855,9 @@ var animate_flare = func {
notifications.objectBridgedTransmitter.NotifyAll(msg);
flares_sent += 1;
}
#print("Update flare "~flare[5]);
append(old_flares, flare);
}
flare_list = old_flares;
#print(flares_sent~" flares sent, out of "~size(flare_list));
if(auto_flare_caller) {
auto_flare_released();
}
@ -871,7 +866,7 @@ var flaretimer = maketimer(flare_update_time, animate_flare);
flaretimer.start();
var auto_flare_released = func {
# new flare
# This detects own flares releases
var prop = getprop("rotors/main/blade[3]/flap-deg");
var stime = systime();
if (prop != nil and prop != 0 and prop != last_prop and stime-last_release > 1) {
@ -885,7 +880,7 @@ var flare_released = func {
if (!getprop("payload/armament/msg")) {
return;
}
# new flare
# We released a flare. If you call this method manually, then make sure 'auto_flare_caller' is false.
var stime = systime();
var flare =[stime, stime,
geo.aircraft_position(),
@ -904,7 +899,6 @@ var flare_released = func {
msg.Heading = 0;
msg.u_fps = 0;
notifications.objectBridgedTransmitter.NotifyAll(msg);
#print("Adding flare "~flare[6]);
}
#==================================================================
@ -929,9 +923,7 @@ var check_for_Request = func {
msg.IsDistinct = 0;
msg.Heading = 0;
notifications.hitBridgedTransmitter.NotifyAll(msg);
#print("REQUEST_ALL");
} else {
#print("REQUEST_NONE");
}
}

View File

@ -551,7 +551,7 @@ var deadreckon_updatetime = 0.1;# 1/15 of missile send rate
var time_before_delete = 2.5;# time since last notification before deleting
var dynamic_loop = func {
# This keeps track of flying missiles/parachutes/flares and manages ModelManager.
# This keeps track of MP flying missiles/parachutes/flares and manages ModelManager.
var new_dynamic3d = [];
var stime = systime();
foreach (dynamic3d_entry ; dynamic3d) {
@ -747,7 +747,6 @@ var ModelManager = {
};
var reckon_create = func (kee, dyna, stime) {
#print("ES create "~kee);
var path = getprop("payload/armament/models") ~ "parachutist.xml";
if (dyna[7]==1) {
path = getprop("payload/armament/models") ~ "light_smoke.xml";
@ -755,10 +754,11 @@ var reckon_create = func (kee, dyna, stime) {
path = getprop("payload/armament/models") ~ "heavy_smoke.xml";
} elsif (dyna[7] ==3) {
path = getprop("payload/armament/models") ~ "the-flare.xml";
} elsif (dyna[7] == -1) {
return nil;
}
var static = ModelManager.new(path, dyna[1],dyna[2],dyna[3]*M2FT,dyna[5],dyna[6],dyna[7]==0);#path,lat,lon,alt_m,heading,pitch
if (static != nil) {
#static.place();
var entry = [kee, stime, static, dyna[4]];
return entry;
}
@ -767,7 +767,6 @@ var reckon_create = func (kee, dyna, stime) {
}
var reckon_update = func (dyna, entry, stime) {
#print("ES update");
var static = entry[2];
var dynami2 = [entry[0], stime, static, dyna[4]];
# translate
@ -777,7 +776,6 @@ var reckon_update = func (dyna, entry, stime) {
}
var reckon_move = func (entry, stime) {
#print("ES move");
var static = entry[2];
var time_then = entry[1];
var time_now = stime;
@ -787,7 +785,6 @@ var reckon_move = func (entry, stime) {
}
var reckon_delete = func (entry) {
#print("ES delete");
entry[2].del();
}
@ -816,7 +813,7 @@ var flare_sorter = func(a, b) {
}
var animate_flare = func {
# This detects own flares and send out notifications about their position every 0.75s
# Send out notifications about own flare positions every 0.4s
if (!getprop("payload/armament/msg")) {
return;
}
@ -858,11 +855,9 @@ var animate_flare = func {
notifications.objectBridgedTransmitter.NotifyAll(msg);
flares_sent += 1;
}
#print("Update flare "~flare[5]);
append(old_flares, flare);
}
flare_list = old_flares;
#print(flares_sent~" flares sent, out of "~size(flare_list));
if(auto_flare_caller) {
auto_flare_released();
}
@ -871,7 +866,7 @@ var flaretimer = maketimer(flare_update_time, animate_flare);
flaretimer.start();
var auto_flare_released = func {
# new flare
# This detects own flares releases
var prop = getprop("rotors/main/blade[3]/flap-deg");
var stime = systime();
if (prop != nil and prop != 0 and prop != last_prop and stime-last_release > 1) {
@ -885,7 +880,7 @@ var flare_released = func {
if (!getprop("payload/armament/msg")) {
return;
}
# new flare
# We released a flare. If you call this method manually, then make sure 'auto_flare_caller' is false.
var stime = systime();
var flare =[stime, stime,
geo.aircraft_position(),
@ -904,7 +899,6 @@ var flare_released = func {
msg.Heading = 0;
msg.u_fps = 0;
notifications.objectBridgedTransmitter.NotifyAll(msg);
#print("Adding flare "~flare[6]);
}
#==================================================================
@ -929,9 +923,7 @@ var check_for_Request = func {
msg.IsDistinct = 0;
msg.Heading = 0;
notifications.hitBridgedTransmitter.NotifyAll(msg);
#print("REQUEST_ALL");
} else {
#print("REQUEST_NONE");
}
}

View File

@ -551,7 +551,7 @@ var deadreckon_updatetime = 0.1;# 1/15 of missile send rate
var time_before_delete = 2.5;# time since last notification before deleting
var dynamic_loop = func {
# This keeps track of flying missiles/parachutes/flares and manages ModelManager.
# This keeps track of MP flying missiles/parachutes/flares and manages ModelManager.
var new_dynamic3d = [];
var stime = systime();
foreach (dynamic3d_entry ; dynamic3d) {
@ -747,7 +747,6 @@ var ModelManager = {
};
var reckon_create = func (kee, dyna, stime) {
#print("ES create "~kee);
var path = getprop("payload/armament/models") ~ "parachutist.xml";
if (dyna[7]==1) {
path = getprop("payload/armament/models") ~ "light_smoke.xml";
@ -755,10 +754,11 @@ var reckon_create = func (kee, dyna, stime) {
path = getprop("payload/armament/models") ~ "heavy_smoke.xml";
} elsif (dyna[7] ==3) {
path = getprop("payload/armament/models") ~ "the-flare.xml";
} elsif (dyna[7] == -1) {
return nil;
}
var static = ModelManager.new(path, dyna[1],dyna[2],dyna[3]*M2FT,dyna[5],dyna[6],dyna[7]==0);#path,lat,lon,alt_m,heading,pitch
if (static != nil) {
#static.place();
var entry = [kee, stime, static, dyna[4]];
return entry;
}
@ -767,7 +767,6 @@ var reckon_create = func (kee, dyna, stime) {
}
var reckon_update = func (dyna, entry, stime) {
#print("ES update");
var static = entry[2];
var dynami2 = [entry[0], stime, static, dyna[4]];
# translate
@ -777,7 +776,6 @@ var reckon_update = func (dyna, entry, stime) {
}
var reckon_move = func (entry, stime) {
#print("ES move");
var static = entry[2];
var time_then = entry[1];
var time_now = stime;
@ -787,7 +785,6 @@ var reckon_move = func (entry, stime) {
}
var reckon_delete = func (entry) {
#print("ES delete");
entry[2].del();
}
@ -816,7 +813,7 @@ var flare_sorter = func(a, b) {
}
var animate_flare = func {
# This detects own flares and send out notifications about their position every 0.75s
# Send out notifications about own flare positions every 0.4s
if (!getprop("payload/armament/msg")) {
return;
}
@ -858,11 +855,9 @@ var animate_flare = func {
notifications.objectBridgedTransmitter.NotifyAll(msg);
flares_sent += 1;
}
#print("Update flare "~flare[5]);
append(old_flares, flare);
}
flare_list = old_flares;
#print(flares_sent~" flares sent, out of "~size(flare_list));
if(auto_flare_caller) {
auto_flare_released();
}
@ -871,7 +866,7 @@ var flaretimer = maketimer(flare_update_time, animate_flare);
flaretimer.start();
var auto_flare_released = func {
# new flare
# This detects own flares releases
var prop = getprop("rotors/main/blade[3]/flap-deg");
var stime = systime();
if (prop != nil and prop != 0 and prop != last_prop and stime-last_release > 1) {
@ -885,7 +880,7 @@ var flare_released = func {
if (!getprop("payload/armament/msg")) {
return;
}
# new flare
# We released a flare. If you call this method manually, then make sure 'auto_flare_caller' is false.
var stime = systime();
var flare =[stime, stime,
geo.aircraft_position(),
@ -904,7 +899,6 @@ var flare_released = func {
msg.Heading = 0;
msg.u_fps = 0;
notifications.objectBridgedTransmitter.NotifyAll(msg);
#print("Adding flare "~flare[6]);
}
#==================================================================
@ -929,9 +923,7 @@ var check_for_Request = func {
msg.IsDistinct = 0;
msg.Heading = 0;
notifications.hitBridgedTransmitter.NotifyAll(msg);
#print("REQUEST_ALL");
} else {
#print("REQUEST_NONE");
}
}

View File

@ -14,7 +14,7 @@ var full_damage_dist_m = 10;# Can vary from aircraft to aircraft depending on ho
# For assets this should be average radius of the asset.
var use_hitpoints_instead_of_failure_modes_bool = 1;# mainly used by assets that don't have failure modes.
var hp_max = 80;# given a direct hit, how much pounds of warhead is needed to kill. Only used if hitpoints is enabled.
var hitable_by_air_munitions = 1; # if anti-air can do damage
var hitable_by_air_munitions = 0; # if anti-air can do damage
var hitable_by_cannon = 1; # if cannon can do damage
#var hitable_by_ground_munitions = 1;# if anti-ground/marine can do damage
var is_fleet = 0; # Is really 7 ships, 3 of which has offensive missiles.
@ -551,7 +551,7 @@ var deadreckon_updatetime = 0.1;# 1/15 of missile send rate
var time_before_delete = 2.5;# time since last notification before deleting
var dynamic_loop = func {
# This keeps track of flying missiles/parachutes/flares and manages ModelManager.
# This keeps track of MP flying missiles/parachutes/flares and manages ModelManager.
var new_dynamic3d = [];
var stime = systime();
foreach (dynamic3d_entry ; dynamic3d) {
@ -747,7 +747,6 @@ var ModelManager = {
};
var reckon_create = func (kee, dyna, stime) {
#print("ES create "~kee);
var path = getprop("payload/armament/models") ~ "parachutist.xml";
if (dyna[7]==1) {
path = getprop("payload/armament/models") ~ "light_smoke.xml";
@ -755,10 +754,11 @@ var reckon_create = func (kee, dyna, stime) {
path = getprop("payload/armament/models") ~ "heavy_smoke.xml";
} elsif (dyna[7] ==3) {
path = getprop("payload/armament/models") ~ "the-flare.xml";
} elsif (dyna[7] == -1) {
return nil;
}
var static = ModelManager.new(path, dyna[1],dyna[2],dyna[3]*M2FT,dyna[5],dyna[6],dyna[7]==0);#path,lat,lon,alt_m,heading,pitch
if (static != nil) {
#static.place();
var entry = [kee, stime, static, dyna[4]];
return entry;
}
@ -767,7 +767,6 @@ var reckon_create = func (kee, dyna, stime) {
}
var reckon_update = func (dyna, entry, stime) {
#print("ES update");
var static = entry[2];
var dynami2 = [entry[0], stime, static, dyna[4]];
# translate
@ -777,7 +776,6 @@ var reckon_update = func (dyna, entry, stime) {
}
var reckon_move = func (entry, stime) {
#print("ES move");
var static = entry[2];
var time_then = entry[1];
var time_now = stime;
@ -787,7 +785,6 @@ var reckon_move = func (entry, stime) {
}
var reckon_delete = func (entry) {
#print("ES delete");
entry[2].del();
}
@ -816,7 +813,7 @@ var flare_sorter = func(a, b) {
}
var animate_flare = func {
# This detects own flares and send out notifications about their position every 0.75s
# Send out notifications about own flare positions every 0.4s
if (!getprop("payload/armament/msg")) {
return;
}
@ -858,11 +855,9 @@ var animate_flare = func {
notifications.objectBridgedTransmitter.NotifyAll(msg);
flares_sent += 1;
}
#print("Update flare "~flare[5]);
append(old_flares, flare);
}
flare_list = old_flares;
#print(flares_sent~" flares sent, out of "~size(flare_list));
if(auto_flare_caller) {
auto_flare_released();
}
@ -871,7 +866,7 @@ var flaretimer = maketimer(flare_update_time, animate_flare);
flaretimer.start();
var auto_flare_released = func {
# new flare
# This detects own flares releases
var prop = getprop("rotors/main/blade[3]/flap-deg");
var stime = systime();
if (prop != nil and prop != 0 and prop != last_prop and stime-last_release > 1) {
@ -885,7 +880,7 @@ var flare_released = func {
if (!getprop("payload/armament/msg")) {
return;
}
# new flare
# We released a flare. If you call this method manually, then make sure 'auto_flare_caller' is false.
var stime = systime();
var flare =[stime, stime,
geo.aircraft_position(),
@ -904,7 +899,6 @@ var flare_released = func {
msg.Heading = 0;
msg.u_fps = 0;
notifications.objectBridgedTransmitter.NotifyAll(msg);
#print("Adding flare "~flare[6]);
}
#==================================================================
@ -929,9 +923,7 @@ var check_for_Request = func {
msg.IsDistinct = 0;
msg.Heading = 0;
notifications.hitBridgedTransmitter.NotifyAll(msg);
#print("REQUEST_ALL");
} else {
#print("REQUEST_NONE");
}
}

View File

@ -14,7 +14,7 @@ var full_damage_dist_m = 2;# Can vary from aircraft to aircraft depending on how
# For assets this should be average radius of the asset.
var use_hitpoints_instead_of_failure_modes_bool = 1;# mainly used by assets that don't have failure modes.
var hp_max = 5;# given a direct hit, how much pounds of warhead is needed to kill. Only used if hitpoints is enabled.
var hitable_by_air_munitions = 1; # if anti-air can do damage
var hitable_by_air_munitions = 0; # if anti-air can do damage
var hitable_by_cannon = 1; # if cannon can do damage
#var hitable_by_ground_munitions = 1;# if anti-ground/marine can do damage
var is_fleet = 0; # Is really 7 ships, 3 of which has offensive missiles.
@ -551,7 +551,7 @@ var deadreckon_updatetime = 0.1;# 1/15 of missile send rate
var time_before_delete = 2.5;# time since last notification before deleting
var dynamic_loop = func {
# This keeps track of flying missiles/parachutes/flares and manages ModelManager.
# This keeps track of MP flying missiles/parachutes/flares and manages ModelManager.
var new_dynamic3d = [];
var stime = systime();
foreach (dynamic3d_entry ; dynamic3d) {
@ -747,7 +747,6 @@ var ModelManager = {
};
var reckon_create = func (kee, dyna, stime) {
#print("ES create "~kee);
var path = getprop("payload/armament/models") ~ "parachutist.xml";
if (dyna[7]==1) {
path = getprop("payload/armament/models") ~ "light_smoke.xml";
@ -755,10 +754,11 @@ var reckon_create = func (kee, dyna, stime) {
path = getprop("payload/armament/models") ~ "heavy_smoke.xml";
} elsif (dyna[7] ==3) {
path = getprop("payload/armament/models") ~ "the-flare.xml";
} elsif (dyna[7] == -1) {
return nil;
}
var static = ModelManager.new(path, dyna[1],dyna[2],dyna[3]*M2FT,dyna[5],dyna[6],dyna[7]==0);#path,lat,lon,alt_m,heading,pitch
if (static != nil) {
#static.place();
var entry = [kee, stime, static, dyna[4]];
return entry;
}
@ -767,7 +767,6 @@ var reckon_create = func (kee, dyna, stime) {
}
var reckon_update = func (dyna, entry, stime) {
#print("ES update");
var static = entry[2];
var dynami2 = [entry[0], stime, static, dyna[4]];
# translate
@ -777,7 +776,6 @@ var reckon_update = func (dyna, entry, stime) {
}
var reckon_move = func (entry, stime) {
#print("ES move");
var static = entry[2];
var time_then = entry[1];
var time_now = stime;
@ -787,7 +785,6 @@ var reckon_move = func (entry, stime) {
}
var reckon_delete = func (entry) {
#print("ES delete");
entry[2].del();
}
@ -816,7 +813,7 @@ var flare_sorter = func(a, b) {
}
var animate_flare = func {
# This detects own flares and send out notifications about their position every 0.75s
# Send out notifications about own flare positions every 0.4s
if (!getprop("payload/armament/msg")) {
return;
}
@ -858,11 +855,9 @@ var animate_flare = func {
notifications.objectBridgedTransmitter.NotifyAll(msg);
flares_sent += 1;
}
#print("Update flare "~flare[5]);
append(old_flares, flare);
}
flare_list = old_flares;
#print(flares_sent~" flares sent, out of "~size(flare_list));
if(auto_flare_caller) {
auto_flare_released();
}
@ -871,7 +866,7 @@ var flaretimer = maketimer(flare_update_time, animate_flare);
flaretimer.start();
var auto_flare_released = func {
# new flare
# This detects own flares releases
var prop = getprop("rotors/main/blade[3]/flap-deg");
var stime = systime();
if (prop != nil and prop != 0 and prop != last_prop and stime-last_release > 1) {
@ -885,7 +880,7 @@ var flare_released = func {
if (!getprop("payload/armament/msg")) {
return;
}
# new flare
# We released a flare. If you call this method manually, then make sure 'auto_flare_caller' is false.
var stime = systime();
var flare =[stime, stime,
geo.aircraft_position(),
@ -904,7 +899,6 @@ var flare_released = func {
msg.Heading = 0;
msg.u_fps = 0;
notifications.objectBridgedTransmitter.NotifyAll(msg);
#print("Adding flare "~flare[6]);
}
#==================================================================
@ -929,9 +923,7 @@ var check_for_Request = func {
msg.IsDistinct = 0;
msg.Heading = 0;
notifications.hitBridgedTransmitter.NotifyAll(msg);
#print("REQUEST_ALL");
} else {
#print("REQUEST_NONE");
}
}

View File

@ -14,7 +14,7 @@ var full_damage_dist_m = 20;# Can vary from aircraft to aircraft depending on ho
# For assets this should be average radius of the asset.
var use_hitpoints_instead_of_failure_modes_bool = 1;# mainly used by assets that don't have failure modes.
var hp_max = 200;# given a direct hit, how much pounds of warhead is needed to kill. Only used if hitpoints is enabled.
var hitable_by_air_munitions = 1; # if anti-air can do damage
var hitable_by_air_munitions = 0; # if anti-air can do damage
var hitable_by_cannon = 1; # if cannon can do damage
#var hitable_by_ground_munitions = 1;# if anti-ground/marine can do damage
var is_fleet = 0; # Is really 7 ships, 3 of which has offensive missiles.
@ -551,7 +551,7 @@ var deadreckon_updatetime = 0.1;# 1/15 of missile send rate
var time_before_delete = 2.5;# time since last notification before deleting
var dynamic_loop = func {
# This keeps track of flying missiles/parachutes/flares and manages ModelManager.
# This keeps track of MP flying missiles/parachutes/flares and manages ModelManager.
var new_dynamic3d = [];
var stime = systime();
foreach (dynamic3d_entry ; dynamic3d) {
@ -747,7 +747,6 @@ var ModelManager = {
};
var reckon_create = func (kee, dyna, stime) {
#print("ES create "~kee);
var path = getprop("payload/armament/models") ~ "parachutist.xml";
if (dyna[7]==1) {
path = getprop("payload/armament/models") ~ "light_smoke.xml";
@ -755,10 +754,11 @@ var reckon_create = func (kee, dyna, stime) {
path = getprop("payload/armament/models") ~ "heavy_smoke.xml";
} elsif (dyna[7] ==3) {
path = getprop("payload/armament/models") ~ "the-flare.xml";
} elsif (dyna[7] == -1) {
return nil;
}
var static = ModelManager.new(path, dyna[1],dyna[2],dyna[3]*M2FT,dyna[5],dyna[6],dyna[7]==0);#path,lat,lon,alt_m,heading,pitch
if (static != nil) {
#static.place();
var entry = [kee, stime, static, dyna[4]];
return entry;
}
@ -767,7 +767,6 @@ var reckon_create = func (kee, dyna, stime) {
}
var reckon_update = func (dyna, entry, stime) {
#print("ES update");
var static = entry[2];
var dynami2 = [entry[0], stime, static, dyna[4]];
# translate
@ -777,7 +776,6 @@ var reckon_update = func (dyna, entry, stime) {
}
var reckon_move = func (entry, stime) {
#print("ES move");
var static = entry[2];
var time_then = entry[1];
var time_now = stime;
@ -787,7 +785,6 @@ var reckon_move = func (entry, stime) {
}
var reckon_delete = func (entry) {
#print("ES delete");
entry[2].del();
}
@ -816,7 +813,7 @@ var flare_sorter = func(a, b) {
}
var animate_flare = func {
# This detects own flares and send out notifications about their position every 0.75s
# Send out notifications about own flare positions every 0.4s
if (!getprop("payload/armament/msg")) {
return;
}
@ -858,11 +855,9 @@ var animate_flare = func {
notifications.objectBridgedTransmitter.NotifyAll(msg);
flares_sent += 1;
}
#print("Update flare "~flare[5]);
append(old_flares, flare);
}
flare_list = old_flares;
#print(flares_sent~" flares sent, out of "~size(flare_list));
if(auto_flare_caller) {
auto_flare_released();
}
@ -871,7 +866,7 @@ var flaretimer = maketimer(flare_update_time, animate_flare);
flaretimer.start();
var auto_flare_released = func {
# new flare
# This detects own flares releases
var prop = getprop("rotors/main/blade[3]/flap-deg");
var stime = systime();
if (prop != nil and prop != 0 and prop != last_prop and stime-last_release > 1) {
@ -885,7 +880,7 @@ var flare_released = func {
if (!getprop("payload/armament/msg")) {
return;
}
# new flare
# We released a flare. If you call this method manually, then make sure 'auto_flare_caller' is false.
var stime = systime();
var flare =[stime, stime,
geo.aircraft_position(),
@ -904,7 +899,6 @@ var flare_released = func {
msg.Heading = 0;
msg.u_fps = 0;
notifications.objectBridgedTransmitter.NotifyAll(msg);
#print("Adding flare "~flare[6]);
}
#==================================================================
@ -929,9 +923,7 @@ var check_for_Request = func {
msg.IsDistinct = 0;
msg.Heading = 0;
notifications.hitBridgedTransmitter.NotifyAll(msg);
#print("REQUEST_ALL");
} else {
#print("REQUEST_NONE");
}
}