I did a search on "ground automatic canopy opening" and found that the Bloch MB-174 incorporates this feature. From the plane's class (MB_174xyz.class) we see the operative code to enable this as shown below. For any desired plane having an openable canopy this code could be incorporated. It might be best to do this on a plane by plane basis, although it's certainly laborious if many planes are desired to feature this.
public void setOnGround(Point3d point3d, Orient orient, Vector3d vector3d)
{
super.setOnGround(point3d, orient, vector3d);
if(super.FM.isPlayers())
{
((FlightModelMain) (super.FM)).CT.bHasCockpitDoorControl = true;
((FlightModelMain) (super.FM)).CT.dvCockpitDoor = 0.5F;
((FlightModelMain) (super.FM)).CT.cockpitDoorControl = 1.0F;
}
}
public void update(float f)
{
.
.
.
.
if(!super.FM.isPlayers() && ((FlightModelMain) (super.FM)).Gears.onGround())
if(((FlightModelMain) (super.FM)).EI.engines[1].getRPM() < 100F)
((FlightModelMain) (super.FM)).CT.cockpitDoorControl = 1.0F;
else
((FlightModelMain) (super.FM)).CT.cockpitDoorControl = 0.0F;
.
.
.
.
}
Method setOnGround() establishes when the gear is on the ground for all planes. Additionally for the player, it sets the canopy to open when the plane's gear is in contact with the ground. And I think it sets for the player a slower sliding speed while opening /closing (dvCockpitDoor = 0.5 versus 0.75 as set in the daughter class and used by AI.)
The important bit is in method update(), where a continuous check is performed on AI planes to see if the gear is on the ground. If so, AND if the motor RPM is less than 100%, the canopy is set to open. In all other instances it's set to close.
I can see how this might be refined. For instance, we might like to have the canopy open and close at some point well after take-off and/or well before landing. Additional checks on one or both of airspeed and height above ground would be necessary to incorporate. I'll do a class search to see if any plane already does anything like this...