PapaJoesSoup / VesselMover

A KSP addon tool for repositioning landed vessels.
17 stars 5 forks source link

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

Open goduranus opened 7 years ago

goduranus commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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

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

gomker commented 7 years ago

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

DoctorDavinci commented 6 years ago

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