After some more tweaking...
I've set, for the moment, a 20% chance of a locked control. In my new method, aircraft.FM.CT.anchorControl(), I've expanded the randomized range of deflection from 0.7-0.99 to 0.33-0.99.
I also perform a check on whether the control has already been disabled (including locked), and if so do not again call methods aircraft.FM.CT.resetControl() and my new method, aircraft.FM.CT.anchorControl(), which would be redundant. Previously they would be called for every qualifying hit, thus only increasing the chance for my new method causing a locking of the control to a certain deflection.
My current AircraftState.doSetControlsDamage() (including the System.out commands for output to log.lst).
private void doSetControlsDamage(int i, Actor actor1)
{
switch(i)
{
case 0: // '\0' //AILERON
if(aircraft.FM.CT.bHasAileronControl) //does not get assessed after first setting of failed control
{
if(TrueRandom.nextFloat() < 0.8F)
aircraft.FM.CT.resetControl(0); //normal action; sets Ailerons, AileronControl and trimAileron to 0
else
{
aircraft.FM.CT.anchorControl(0); //NEW method to impart a 'jammed' control with a random deflection
bLockedAileron = true;
}
if(aircraft.FM.isPlayers())
HUD.log("FailedAroneAU");
aircraft.FM.CT.bHasAileronControl = false;
aircraft.FM.setCapableOfACM(false);
System.out.println("Ail_ctrl_hit, " + " Ailerons:" + aircraft.FM.CT.getAileron() + " " + aircraft.typedName());
Aircraft.debugprintln(aircraft, "Aileron control damaged! ");
}
if(((!(aircraft.FM.CT.bHasRudderControl) && TrueRandom.nextInt(0, 99) < 80 + aircraft.FM.subSkill * 3)) || bLockedAileron || TrueRandom.nextInt(0, 99) < 50 + aircraft.FM.subSkill * 3) //ace (3) more likely to bail
{
aircraft.FM.setCapableOfBMP(false, actor1);
aircraft.FM.setReadyToDie(true);
aircraft.FM.setTakenMortalDamage(true, actor1);
Voice.speakMayday(aircraft);
Aircraft.debugprintln(aircraft, "Aileron control cut, bailing out! ");
System.out.println("Ail cut----bail, Rud_ctl?" + aircraft.FM.CT.bHasRudderControl + " AilLock?" + bLockedAileron + " " + aircraft.typedName());
hitDaSilk();
}
break;
case 1: // '\001' //ELEVATOR
if(aircraft.FM.CT.bHasElevatorControl)
{
if(TrueRandom.nextFloat() < 0.8F)
aircraft.FM.CT.resetControl(1);
else
{
aircraft.FM.CT.anchorControl(1);
bLockedElevator = true;
}
if(aircraft.FM.isPlayers())
HUD.log("FailedVatorAU");
aircraft.FM.CT.bHasElevatorControl = false;
aircraft.FM.setCapableOfACM(false);
System.out.println("Elev_ctrl_hit, " + " Elevators:" + aircraft.FM.CT.getElevator() + " " + aircraft.typedName());
Aircraft.debugprintln(aircraft, "Elevator control damaged! ");
}
if(Math.abs(aircraft.FM.Vwld.z) > 7D) //7m/s ~14kt, up or down; is assessed with each qualifying hit
{
aircraft.FM.setCapableOfBMP(false, actor1);
System.out.println("Elev_no_BMP " + aircraft.typedName());
}
if(aircraft.FM.Vwld.z < -21D || bLockedElevator || TrueRandom.nextInt(0, 99) < 75 + aircraft.FM.subSkill * 3) //21m/s ~42kt, down only, is assessed with each qualifying hit
{
aircraft.FM.setCapableOfBMP(false, actor1);
aircraft.FM.setReadyToDie(true);
aircraft.FM.setTakenMortalDamage(true, actor1);
Voice.speakMayday(aircraft);
Aircraft.debugprintln(aircraft, "Elevator control cut, bailing out! ");
System.out.println("Elev_cut----bail, VSI(m/s):" + aircraft.FM.Vwld.z + " ElevLock?" + bLockedElevator + " " +aircraft.typedName());
hitDaSilk();
}
break;
case 2: // '\002' //RUDDER
if(aircraft.FM.CT.bHasRudderControl)
{
if(TrueRandom.nextFloat() < 0.8F)
aircraft.FM.CT.resetControl(2);
else
{
aircraft.FM.CT.anchorControl(2);
bLockedRudder = true;
}
if(aircraft.FM.isPlayers())
HUD.log("FailedRudderAU");
aircraft.FM.CT.bHasRudderControl = false;
System.out.println("Rud_ctrl_hit, " + " Rudder:" + aircraft.FM.CT.getRudder() + " " + aircraft.typedName());
}
Aircraft.debugprintln(aircraft, "Rudder control damaged! ");
if((!(aircraft.FM.CT.bHasAileronControl) && TrueRandom.nextInt(0, 99) < 80 + aircraft.FM.subSkill * 3) || bLockedRudder || TrueRandom.nextInt(0, 99) < 10 + aircraft.FM.subSkill * 2)
{
aircraft.FM.setCapableOfACM(false);
aircraft.FM.setCapableOfBMP(false, actor1);
aircraft.FM.setReadyToDie(true);
aircraft.FM.setTakenMortalDamage(true, actor1);
Voice.speakMayday(aircraft);
Aircraft.debugprintln(aircraft, "Rudder control cut, bailing out! ");
System.out.println("Rud_cut----bail, Ail_ctl?" + aircraft.FM.CT.bHasAileronControl + " RudLock?" + bLockedRudder + " " + aircraft.typedName());
hitDaSilk();
}
break;
default:
throw new RuntimeException("(" + aircraft.typedName() + ") A.S.: Corrupt data in (C.A.D./null)");
}
}
One mission result of taking down 12 P-40Bs, as recorded to log.lst. Out of seven chances for a locked control, such has occurred once. Again, the last character on each line is the plane's ID. Note particularly the greatly reduced number of qualifying events, due to not reduntantly calling the methods in Controls.class for every hit.
[2024-03-19 18:03:14.646] dT: 1039 Rud_ctrl_hit, Rudder:0.0 G
[2024-03-19 18:03:24.385] dT: 325 Ail_ctrl_hit, Ailerons:0.0 G
[2024-03-19 18:03:24.385] dT: 0 Ail cut----bail, Rud_ctl?false AilLock?false G
-----------------------------------------------------------------------------------------------
[2024-03-19 18:04:03.426] dT: 1301 Elev_ctrl_hit, Elevators:0.0 C
[2024-03-19 18:04:03.426] dT: 0 Elev_cut----bail, VSI(m/s):-6.065972568628225 ElevLock?false C
-----------------------------------------------------------------------------------------------
[2024-03-19 18:06:36.231] dT: 5093 Elev_ctrl_hit, Elevators:-0.34874916 A
[2024-03-19 18:06:36.231] dT: 0 Elev_no_BMP A
[2024-03-19 18:06:36.231] dT: 0 Elev_cut----bail, VSI(m/s):24.28779131466929 ElevLock?true A
[2024-03-19 18:06:50.999] dT: 357 Ail cut----bail, Rud_ctl?true AilLock?false A
-----------------------------------------------------------------------------------------------
[2024-03-19 18:07:30.614] dT: 1322 Rud_ctrl_hit, Rudder:0.0 L
[2024-03-19 18:07:33.075] dT: 82 Rud_cut----bail, Ail_ctl?true RudLock?false L
-----------------------------------------------------------------------------------------------
[2024-03-19 18:08:04.246] dT: 1039 Elev_ctrl_hit, Elevators:0.0 F
[2024-03-19 18:08:04.246] dT: 0 Elev_no_BMP F
[2024-03-19 18:08:04.247] dT: 0 Elev_cut----bail, VSI(m/s):41.93601136302307 ElevLock?false F
[2024-03-19 18:08:04.565] dT: 11 Elev_no_BMP F
[2024-03-19 18:08:06.692] dT: 71 Rud_ctrl_hit, Rudder:0.74826646 F
[2024-03-19 18:08:06.692] dT: 0 Rud_cut----bail, Ail_ctl?true RudLock?true F