Updated damage

This commit is contained in:
Nikolai V Chr
2020-02-08 19:11:04 +01:00
parent a8760a53d1
commit eae4e138b0
26 changed files with 13254 additions and 806 deletions
+52 -7
View File
@@ -30,6 +30,7 @@ var TRUE = 1;
var FALSE = 0;
var hp = hp_max;
setprop("sam/damage", math.max(0,100*hp/hp_max));#used in HUD
var cannon_types = {
#
@@ -43,12 +44,14 @@ var cannon_types = {
" Gun Splash On ": 0.100, # 30mm
" GSh-30 hit": 0.100, # 30mm
" GAU-8/A hit": 0.100, # 30mm
" Mk3Z hit": 0.100, # 30mm Jaguar
" BK27 cannon hit": 0.070, # 27mm
" GSh-23 hit": 0.065, # 23mm
" M61A1 shell hit": 0.050, # 20mm
" 50 BMG hit": 0.015, # 12.7mm (non-explosive)
" 7.62 hit": 0.005, # 7.62mm (non-explosive)
" Hydra-70 hit": 0.25, #
" 7.62 hit": 0.005, # 7.62mm (non-explosive)
" Hydra-70 hit": 0.250, # F-16
" SNEB hit": 0.250, # Jaguar
};
# lbs of warheads is explosive+fragmentation+fuse, so total warhead mass.
@@ -59,13 +62,16 @@ var warhead_lbs = {
"AGM-84": 488.00,
"AGM-88": 146.00,
"AGM65": 200.00,
"AGM-119": 264.50,
"AGM-154A": 493.00,
"AGM-158": 1000.00,
"ALARM": 450.00,
"AM39-Exocet": 364.00,
"AS-37-Martel": 330.00,
"AS30L": 529.00,
"CBU-87": 100.00,# bomblet warhead. Mix of armour piecing and HE. 100 due to need to be able to kill buk-m2.
"BL755": 100.00,# 800lb bomblet warhead. Mix of armour piecing and HE. 100 due to need to be able to kill buk-m2.
"CBU-87": 100.00,# bomblet warhead. Mix of armour piecing and HE. 100 due to need to be able to kill buk-m2.
"CBU-105": 100.00,# bomblet warhead. Mix of armour piecing and HE. 100 due to need to be able to kill buk-m2.
"Exocet": 364.00,
"FAB-100": 92.59,
"FAB-250": 202.85,
@@ -73,7 +79,7 @@ var warhead_lbs = {
"GBU-12": 190.00,
"GBU-24": 945.00,
"GBU-31": 945.00,
"GBU-54" 190.00,
"GBU-54": 190.00,
"GBU12": 190.00,
"GBU16": 450.00,
"HVAR": 7.50,#P51
@@ -86,6 +92,7 @@ var warhead_lbs = {
"M90": 10.00,# bomblet warhead. x3 of real mass.
"MK-82": 192.00,
"MK-83": 445.00,
"MK-83HD": 445.00,
"MK-84": 945.00,
"OFAB-100": 92.59,
"RB-04E": 661.00,
@@ -96,7 +103,7 @@ var warhead_lbs = {
"RN-18T": 1200.00, #fictional, thermobaeric replacement for the RN-28 nuclear bomb
"RS-2US": 28.66,
"S-21": 245.00,
"S-24": 271.00,
"S-24": 271.00,
"SCALP": 992.00,
"Sea Eagle": 505.00,
"SeaEagle": 505.00,
@@ -120,6 +127,7 @@ var warhead_air_lbs = {
"KN-06": 315.00,
"M317": 145.00,
"Magic-2": 27.00,
"Majic": 26.45,
"Matra MICA": 30.00,
"Matra R550 Magic 2": 27.00,
"MATRA-R530": 55.00,
@@ -147,12 +155,15 @@ var warhead_air_lbs = {
"RB-74": 20.80,
"RB-99": 44.00,
"S530D": 66.00,
"S48N6": 330.00,# 48N6 from S-300pmu
};
var cluster = {
# cluster munition list
"M90": nil,
"CBU-87": nil,
"CBU-105": nil,
"BL755": nil,
};
var fireMsgs = {
@@ -232,7 +243,7 @@ var incoming_listener = func {
probability = (maxDist/hpDist)*probability;
}
var failed = fail_systems(probability, hp_max);
var percent = 100 * prob;
var percent = 100 * probability;
printf("Took %.1f%% damage from %s clusterbomb at %0.1f meters from bomblet. %s systems was hit", percent,type,distance,failed);
nearby_explosion();
return;
@@ -358,14 +369,48 @@ var fail_systems = func (probability, factor = 100) {#this factor needs tuning a
var mode_list = keys(failure_modes);
var failed = 0;
foreach(var failure_mode_id; mode_list) {
#print(failure_mode_id);
if (rand() < probability) {
FailureMgr.set_failure_level(failure_mode_id, 1);
failed += 1;
if (failure_mode_id == "Engines/engine") {
# fail UH1 yasim:
setprop("sim/model/uh1/state",0);
setprop("controls/engines/engine/magnetos", 0);
#set a listener so that if a restart is attempted, it'll fail.
yasim_list = setlistener("sim/model/uh1/state",func {setprop("sim/model/uh1/state",0);});
}
}
}
if (rand() < probability) {
# fail UH1 yasim:
setprop("sim/model/uh1/state",0);
setprop("controls/engines/engine/magnetos", 0);
#set a listener so that if a restart is attempted, it'll fail.
if (yasim_list == nil) {
yasim_list = setlistener("sim/model/uh1/state",func {setprop("sim/model/uh1/state",0);});
}
}
return failed;
}
};
var yasim_list = nil;
var repairYasim = func {
if (yasim_list != nil) {
removelistener(yasim_list);
yasim_list = nil;
}
setprop("sim/crashed", 0);
var failure_modes = FailureMgr._failmgr.failure_modes;
var mode_list = keys(failure_modes);
foreach(var failure_mode_id; mode_list) {
FailureMgr.set_failure_level(failure_mode_id, 0);
}
}
setlistener("/sim/signals/reinit", repairYasim);
hp_f = [hp_max,hp_max,hp_max,hp_max,hp_max,hp_max,hp_max];
@@ -519,4 +564,4 @@ var re_init = func {
}
}
setlistener("/sim/signals/reinit", re_init, 0, 0);
setlistener("/sim/signals/reinit", re_init, 0, 0);