diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll index 6a67b5e..5474b98 100644 Binary files a/1.6/1.6/Assemblies/ArachnaeSwarm.dll and b/1.6/1.6/Assemblies/ArachnaeSwarm.dll differ diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.pdb b/1.6/1.6/Assemblies/ArachnaeSwarm.pdb index d83e0e4..c671261 100644 Binary files a/1.6/1.6/Assemblies/ArachnaeSwarm.pdb and b/1.6/1.6/Assemblies/ArachnaeSwarm.pdb differ diff --git a/Source/ArachnaeSwarm/Pawn_Comps/ARA_Flight/CompPawnFlight.cs b/Source/ArachnaeSwarm/Pawn_Comps/ARA_Flight/CompPawnFlight.cs index 58d39e2..e33760b 100644 --- a/Source/ArachnaeSwarm/Pawn_Comps/ARA_Flight/CompPawnFlight.cs +++ b/Source/ArachnaeSwarm/Pawn_Comps/ARA_Flight/CompPawnFlight.cs @@ -9,6 +9,40 @@ namespace ArachnaeSwarm /// 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/ArachnaeSwarm/Pawn_Comps/ARA_Flight/CompProperties_PawnFlight.cs b/Source/ArachnaeSwarm/Pawn_Comps/ARA_Flight/CompProperties_PawnFlight.cs index 5d6e2a4..831aec7 100644 --- a/Source/ArachnaeSwarm/Pawn_Comps/ARA_Flight/CompProperties_PawnFlight.cs +++ b/Source/ArachnaeSwarm/Pawn_Comps/ARA_Flight/CompProperties_PawnFlight.cs @@ -14,6 +14,7 @@ namespace ArachnaeSwarm { // --- Custom Flight Logic --- public FlightCondition flightCondition = FlightCondition.Drafted; + public bool showFlightToggle = true; // --- Vanilla PawnKindDef Flight Parameters --- [NoTranslate] diff --git a/Source/ArachnaeSwarm/Pawn_Comps/ARA_Flight/Pawn_FlightTrackerPatches.cs b/Source/ArachnaeSwarm/Pawn_Comps/ARA_Flight/Pawn_FlightTrackerPatches.cs index 95ea492..e2a2571 100644 --- a/Source/ArachnaeSwarm/Pawn_Comps/ARA_Flight/Pawn_FlightTrackerPatches.cs +++ b/Source/ArachnaeSwarm/Pawn_Comps/ARA_Flight/Pawn_FlightTrackerPatches.cs @@ -65,17 +65,22 @@ namespace ArachnaeSwarm 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 ArachnaeSwarm 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();