function SetFlapAngle { parameter angle. local flaps is getFlaps(). if flaps:LENGTH = 0 { return. } for flap in flaps { flap:GetModule("ModuleControlSurface"):SetField("deploy angle", angle). print("DEBUG: Set flap angle to " + angle). } } function SetFlaps { parameter extend is true. local flaps is getFlaps(). if flaps:LENGTH = 0 { return. } for flap in flaps { flap:GetModule("ModuleControlSurface"):SetField("deploy", extend). print("DEBUG: Set flap deployment to " + extend). } } function getFlaps { local flaps is SHIP:PartsTagged("flap"). for flap in flaps { if flap:MODULES:Find("ModuleControlSurface") = -1 { print "WARNING: Flap is not a control surface. Aborting operation.". return List(). } } return flaps. }