feat(flight): add toggle Gizmo, fix missing ForceLand on undraft, update to latest flight logic

This commit is contained in:
2026-02-27 14:21:08 +08:00
parent 8c991d6588
commit 9ed9cd7959
5 changed files with 58 additions and 10 deletions

View File

@@ -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<CompPawnFlight>();
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();