diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll index 390b4ae7..670226fd 100644 Binary files a/1.6/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/1.6/Assemblies/WulaFallenEmpire.dll differ diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.pdb b/1.6/1.6/Assemblies/WulaFallenEmpire.pdb index 4599713a..95970c86 100644 Binary files a/1.6/1.6/Assemblies/WulaFallenEmpire.pdb and b/1.6/1.6/Assemblies/WulaFallenEmpire.pdb differ diff --git a/Source/WulaFallenEmpire/Pawn_Comps/Pawn_Flight/CompPawnFlight.cs b/Source/WulaFallenEmpire/Pawn_Comps/Pawn_Flight/CompPawnFlight.cs index 82321e6f..efcf1a26 100644 --- a/Source/WulaFallenEmpire/Pawn_Comps/Pawn_Flight/CompPawnFlight.cs +++ b/Source/WulaFallenEmpire/Pawn_Comps/Pawn_Flight/CompPawnFlight.cs @@ -9,6 +9,40 @@ namespace WulaFallenEmpire /// public class CompPawnFlight : ThingComp { + public bool flightEnabled = true; + public CompProperties_PawnFlight Props => (CompProperties_PawnFlight)props; + + public override void PostExposeData() + { + base.PostExposeData(); + Scribe_Values.Look(ref flightEnabled, "flightEnabled", true); + } + + public override System.Collections.Generic.IEnumerable CompGetGizmosExtra() + { + if (Props.showFlightToggle && parent is Pawn pawn && pawn.Faction == RimWorld.Faction.OfPlayer) + { + yield return new Verse.Command_Toggle + { + defaultLabel = "Toggle Flight", + defaultDesc = "Toggle flight mode on or off.", + Order = 100f, + icon = Verse.ContentFinder.Get("StellarisDaughter/UI/Commands/SD_FlightToggle", false) + ?? RimWorld.TexCommand.GatherSpotActive, + isActive = () => flightEnabled, + toggleAction = () => + { + flightEnabled = !flightEnabled; + if (!flightEnabled && pawn.flight != null && pawn.flight.Flying) + { + pawn.flight.ForceLand(); + if (pawn.CurJob != null) + pawn.CurJob.flying = false; + } + } + }; + } + } } } \ No newline at end of file diff --git a/Source/WulaFallenEmpire/Pawn_Comps/Pawn_Flight/CompProperties_PawnFlight.cs b/Source/WulaFallenEmpire/Pawn_Comps/Pawn_Flight/CompProperties_PawnFlight.cs index 62618e9e..6fe4fbf2 100644 --- a/Source/WulaFallenEmpire/Pawn_Comps/Pawn_Flight/CompProperties_PawnFlight.cs +++ b/Source/WulaFallenEmpire/Pawn_Comps/Pawn_Flight/CompProperties_PawnFlight.cs @@ -14,6 +14,7 @@ namespace WulaFallenEmpire { // --- Custom Flight Logic --- public FlightCondition flightCondition = FlightCondition.Drafted; + public bool showFlightToggle = true; // --- Vanilla PawnKindDef Flight Parameters --- [NoTranslate] diff --git a/Source/WulaFallenEmpire/Pawn_Comps/Pawn_Flight/Pawn_FlightTrackerPatches.cs b/Source/WulaFallenEmpire/Pawn_Comps/Pawn_Flight/Pawn_FlightTrackerPatches.cs index 2cec548c..929620fb 100644 --- a/Source/WulaFallenEmpire/Pawn_Comps/Pawn_Flight/Pawn_FlightTrackerPatches.cs +++ b/Source/WulaFallenEmpire/Pawn_Comps/Pawn_Flight/Pawn_FlightTrackerPatches.cs @@ -65,17 +65,22 @@ namespace WulaFallenEmpire bool shouldBeFlying = false; var compProps = flightComp.Props; - if (compProps.flightCondition == FlightCondition.Always) + + // Gizmo toggle check — if flight is disabled, never fly + if (flightComp.flightEnabled) { - shouldBeFlying = true; - } - else if (compProps.flightCondition == FlightCondition.DraftedAndMove && (___pawn.Drafted || ___pawn.pather.MovingNow)) - { - shouldBeFlying = true; - } - else if (compProps.flightCondition == FlightCondition.Drafted && ___pawn.Drafted) - { - shouldBeFlying = true; + if (compProps.flightCondition == FlightCondition.Always) + { + shouldBeFlying = true; + } + else if (compProps.flightCondition == FlightCondition.DraftedAndMove && (___pawn.Drafted || ___pawn.pather.MovingNow)) + { + shouldBeFlying = true; + } + else if (compProps.flightCondition == FlightCondition.Drafted && ___pawn.Drafted) + { + shouldBeFlying = true; + } } if (shouldBeFlying) @@ -104,6 +109,14 @@ namespace WulaFallenEmpire var flightComp = ___pawn?.TryGetComp(); if (flightComp == null) return; + if (!flightComp.flightEnabled) + { + __instance.ForceLand(); + if (___pawn.CurJob != null) + ___pawn.CurJob.flying = false; + return; + } + if (___pawn.GetPosture() != PawnPosture.Standing) { __instance.ForceLand();