Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request, Set "Gear = True" on vessel spawn #37

Open
goduranus opened this issue Aug 10, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@goduranus
Copy link

commented Aug 10, 2017

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 goduranus changed the title Set "Gear = True" on vessel spawn Request, Set "Gear = True" on vessel spawn Aug 10, 2017

@goduranus

This comment has been minimized.

Copy link
Author

commented Aug 10, 2017

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

This comment has been minimized.

Copy link
Author

commented Aug 10, 2017

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

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

@gomker gomker self-assigned this Aug 21, 2017

@gomker gomker added the enhancement label Aug 21, 2017

@gomker

This comment has been minimized.

Copy link
Collaborator

commented Aug 21, 2017

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

@DoctorDavinci

This comment has been minimized.

Copy link

commented Dec 8, 2017

linking this as reference .... this issue is the likely cause of this one: #11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.