VesselMover icon indicating copy to clipboard operation
VesselMover copied to clipboard

Request, Set "Gear = True" on vessel spawn

Open goduranus opened this issue 7 years ago • 4 comments

Right now all airplanes are spawned as "Gear = False", but since they almost always have gears deployed, could you change it so that when they spawn "Gear = True"?

This will allow the user to set parts to Gear action group to let the AI pilot activate them automatically as the plane takes off. But right now with Gear = False the AI pilot will toggle Gear twice to raise gears, which also toggles off any parts bound to Gear action group again.

goduranus avatar Aug 10 '17 12:08 goduranus

I did some simple searching and found this particular bit of SirDiazo's AutoAction mod which has examples on setting craft action groups. It's beyond my programming abilities but hopefully I've found something useful that if anyone would like to tackle this issue can use as a reference:

https://github.com/formicant/AutoAction/blob/master/AutoAction/AutoActionFlight.cs

	void ProcessModule(ModuleAutoAction module)
	{
		var actionGroups = FlightGlobals.ActiveVessel.ActionGroups;
		actionGroups.SetGroup(KSPActionGroup.Abort, module.ActivateAbort ?? _defaultActivateAbort);
		actionGroups.SetGroup(KSPActionGroup.Brakes, module.ActivateBrakes ?? _defaultActivateBrakes);
		actionGroups.SetGroup(KSPActionGroup.Gear, module.ActivateGear ?? _defaultActivateGear);
		actionGroups.SetGroup(KSPActionGroup.Light, module.ActivateLights ?? _defaultActivateLights);
		actionGroups.SetGroup(KSPActionGroup.RCS, module.ActivateRcs ?? _defaultActivateRcs);
		actionGroups.SetGroup(KSPActionGroup.SAS, module.ActivateSas ?? _defaultActivateSas);

		FlightInputHandler.state.mainThrottle = Mathf.Max(0, Mathf.Min(1, (module.SetThrottle ?? _defaultSetThrottle) / 100F));
		SetPrecisionMode(module.SetPrecCtrl ?? _defaultSetPrecCtrl);

		CallActionGroup(module.ActivateGroupA);
		CallActionGroup(module.ActivateGroupB);
		CallActionGroup(module.ActivateGroupC);
		CallActionGroup(module.ActivateGroupD);
		CallActionGroup(module.ActivateGroupE);
	}

goduranus avatar Aug 10 '17 13:08 goduranus

Taking a guess, maybe in VesselSpawn.cs, line 657, add this?

v.ActionGroups.SetGroup(KSPActionGroup.Gear, true);

goduranus avatar Aug 10 '17 13:08 goduranus

Thanks for the info, will get this added in my next sprint

gomker avatar Aug 21 '17 04:08 gomker

linking this as reference .... this issue is the likely cause of this one: https://github.com/PapaJoesSoup/VesselMover/issues/11

DoctorDavinci avatar Dec 08 '17 23:12 DoctorDavinci