diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll index 27287dba..83025b9c 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/Defs/AnimationDefs/WULA_Flight_Anims.xml b/1.6/1.6/Defs/AnimationDefs/WULA_Flight_Anims.xml new file mode 100644 index 00000000..23ce6301 --- /dev/null +++ b/1.6/1.6/Defs/AnimationDefs/WULA_Flight_Anims.xml @@ -0,0 +1,73 @@ + + + + + WULA_Hover_FlyEast + 60 + + +
  • + Root + AnimationWorker_Keyframes +
  • 0(0,0,-0.05)
  • +
  • 30(0,0,0.05)
  • +
  • 60(0,0,-0.05)
  • + + +
    +
    + + WULA_Hover_FlyNorth + 60 + + +
  • + Root + AnimationWorker_Keyframes +
  • 0(0,0,-0.05)
  • +
  • 30(0,0,0.05)
  • +
  • 60(0,0,-0.05)
  • + + +
    +
    + + WULA_Hover_FlySouth + 60 + + +
  • + Root + AnimationWorker_Keyframes +
  • 0(0,0,-0.05)
  • +
  • 30(0,0,0.05)
  • +
  • 60(0,0,-0.05)
  • + + +
    +
    +
    \ No newline at end of file diff --git a/1.6/1.6/Defs/PawnKinds/PawnKinds_Wula.xml b/1.6/1.6/Defs/PawnKinds/PawnKinds_Wula.xml index 0d6b9651..e9f16490 100644 --- a/1.6/1.6/Defs/PawnKinds/PawnKinds_Wula.xml +++ b/1.6/1.6/Defs/PawnKinds/PawnKinds_Wula.xml @@ -239,6 +239,49 @@ + + Wula_Mech_Mobile_Factory + + Wula_Mech_Mobile_Factory + 1000 + false + PlayerColony + false + true + + Wula/Things/Wula_Mech_Mobile_Factory/Flying/Wula_Mech_Mobile_Factory_Flying_ + 1 + 1 + 2 + false + + +
  • + + Wula/Things/Wula_Mech_Mobile_Factory/Bodies/Naked_Thin + Wula/Things/WULA_Cat/AllegianceOverlays/None + CutoutWithOverlay + Graphic_Multi + 6 + + (1.4, 1.8, 1.4) + + +
  • +
    + 99999~99999 + + 0.7 + +
  • Wula_Mech_Mobile_Factory_Main_Weapon
  • +
    + + +
  • WULA_GiveSwitchHediff
  • +
  • WULA_RemoveSwitchHediff
  • +
    +
    + WulaSpecies diff --git a/1.6/1.6/Defs/ThingDefs_Misc/Weapons/WULA_FE_Materialist_Weapon.xml b/1.6/1.6/Defs/ThingDefs_Misc/Weapons/WULA_FE_Materialist_Weapon.xml index 7790dda0..912cf2cc 100644 --- a/1.6/1.6/Defs/ThingDefs_Misc/Weapons/WULA_FE_Materialist_Weapon.xml +++ b/1.6/1.6/Defs/ThingDefs_Misc/Weapons/WULA_FE_Materialist_Weapon.xml @@ -58,7 +58,7 @@ Wula_CR_Mobile_Factory_Turret - 由乌拉帝国的MFm-87"天秤"陆行舰所配备的炮塔之一,能够喷射穿透装甲的热熔束,处理靠近陆行舰的威胁。 + 由乌拉帝国的陆行舰所配备的炮塔之一,能够喷射穿透装甲的热熔束,处理靠近陆行舰的威胁。 None true @@ -130,7 +130,7 @@ Wula_CR_Mobile_Factory_Turret_MKII - 由乌拉帝国的MFm-87"天秤"陆行舰所配备的炮塔之一,此改进版比起其原型可以将热熔束喷到更远的地方,但是无法处理过近的目标。 + 由乌拉帝国的陆行舰所配备的炮塔之一,此改进版比起其原型可以将热熔束喷到更远的地方,但是无法处理过近的目标。
  • Verb_ArcSprayIncinerator @@ -244,7 +244,7 @@ Wula_MR_Mobile_Factory_Turret - 由乌拉帝国的MFm-87"天秤"陆行舰所配备的炮塔之一,可以射出连续短促的穿透性激光,贯穿路径上的敌军。 + 由乌拉帝国的陆行舰所配备的炮塔之一,是一种射速较快的自动炮,可以压制杀伤成片敌军。 None true @@ -255,61 +255,64 @@ 2 2.6 - 1 - 1 - 1 - 1 + 0.5 + 0.5 + 0.5 + 0.4
  • - Verb_Shoot + WulaFallenEmpire.Verb_ShootWithOffset true Bullet_Wula_MR_Mobile_Factory_Turret - 36 - 8 - 1.5 - 3 - 12 - Shot_BeamRepeater + 0 + 32 + 3 + 0.1 + 6 + 6 + Shot_ChargeRifle GunTail_Medium - 7 - Mote_BeamRepeater_Charge - 1.07 + 9 + + true + true + true +
  • Bullet_Wula_MR_Mobile_Factory_Turret - - WulaFallenEmpire.Projectile_WulaLineAttack + + + Wula/Projectile/WULA_Bullet_ChargeLanceShot_Red + Graphic_Single + MoteGlow + 2.5 + + WulaFallenEmpire.Projectile_ExplosiveWithTrail + + Bullet + 12 + 90 + 1.2 + 0.4 + Explosion_Rocket + 0.75 + 0.1 + -
  • - -1 - 0 - true - WULA_GunTail_Plasma +
  • + WULA_GunTail_Lighting + 1
  • - Normal - True - - Things/Projectile/ChargeLanceShot - Graphic_Single - TransparentPostLight - (3,1) - - - BeamBypassShields - 5 - 130 - 0.9 - 1 -
    Wula_LR_Mobile_Factory_Turret - 由乌拉帝国的MFm-87"天秤"陆行舰所配备的炮塔之一,能够在远距离上发射等离子射弹覆盖敌军。 + 由乌拉帝国的陆行舰所配备的炮塔之一,射程远威力大,可以在远距离上夷平试图抵抗的敌军。 None true @@ -330,16 +333,16 @@ Verb_Shoot true Bullet_Wula_LR_Mobile_Factory_Turret - 180 - 15 - 12 - 15 - ChargeLance_Fire - GunTail_Medium - 7 - 1 + 0 + 9 + true false - 8 + 4 + 120 + 1 + Mortar_LaunchA + 12 + 6 true @@ -348,49 +351,30 @@ Bullet_Wula_LR_Mobile_Factory_Turret - + - Wula/Projectile/WULA_Bullet_Plasma + Wula/Projectile/WULA_Shrapnel Graphic_Single - MoteGlow - - (3,4) + (2,3) WulaFallenEmpire.Projectile_ExplosiveWithTrail - - 25 - Damage_WULA_Plasma_Explosive - 40 - 0.7 - 2.0 - 2.5 - Explosion_EMP - 0.75 - 0.5 + Bomb + 45 + 60 + 6 + 1.5 true + Artillery_HitThickRoof + MortarBomb_Explode + MortarRound_PreImpact + MortarRound_Ambient + 10 - -
  • - WULA_GunTail_Plasma - 3 -
  • -
  • - 3 + WULA_Smoke_Tail + 1
  • diff --git a/1.6/1.6/Defs/ThingDefs_Misc/Weapons/WULA_FE_Remake_Weapon.xml b/1.6/1.6/Defs/ThingDefs_Misc/Weapons/WULA_FE_Remake_Weapon.xml index 422614b0..1c0fc208 100644 --- a/1.6/1.6/Defs/ThingDefs_Misc/Weapons/WULA_FE_Remake_Weapon.xml +++ b/1.6/1.6/Defs/ThingDefs_Misc/Weapons/WULA_FE_Remake_Weapon.xml @@ -1899,9 +1899,6 @@
  • Wula_Ranged_Weapon_T2
  • - -
  • RewardStandardQualitySuper
  • -
  • WULA_RW_Base_Loitering_Munition_Ability diff --git a/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies.xml b/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies.xml index 560f0f3e..424bbbed 100644 --- a/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies.xml +++ b/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies.xml @@ -977,8 +977,11 @@ 乌拉帝国的大型战争机械,简直就是一座移动堡垒——它不仅装甲厚实、火炮林立,还能在战场上生产大量的辅助战争机械以形成坚实的弹性阵线,生来就是为了粉碎坚固的堡垒和顽强的抵抗。 1 - 1.5 + 1 5 + + 9999 + 0 Mech_Warqueen @@ -993,6 +996,8 @@
  • 25 + + 1 @@ -1231,6 +1236,17 @@ 4.0 false + +
  • + + + Drafted + + + WULA_Hover_FlyNorth + WULA_Hover_FlyEast + WULA_Hover_FlySouth +
  • diff --git a/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies_FE_Materialist.xml b/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies_FE_Materialist.xml index 60649d75..5dc0e0cd 100644 --- a/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies_FE_Materialist.xml +++ b/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies_FE_Materialist.xml @@ -174,728 +174,4 @@ WULA_Mech_Flyer_Melta_Slow - - - Wula_Mech_Mobile_Factory - - Wula_Mech_Mobile_Factory - 1000 - false - PlayerColony - false - true - -
  • - - Wula/Things/Wula_Mech_Mobile_Factory/Bodies/Naked_Thin - Wula/Things/WULA_Cat/AllegianceOverlays/None - CutoutWithOverlay - Graphic_Multi - 6 - - (1.4, 1.8, 1.4) - - -
  • -
    - 99999~99999 - - 0.7 - -
  • Wula_Mech_Mobile_Factory_Main_Weapon
  • -
    - - -
  • WULA_GiveSwitchHediff
  • -
  • WULA_RemoveSwitchHediff
  • -
    -
    - - Wula_Mech_Mobile_Factory_CR - - 乌拉帝国图书馆的陆行战舰——火力强大,装甲厚重,比起其通用型MFm-87"天秤",以两具高压热熔喷火器替换了两具等离子炮,以追求在中近距离释放恐怖火力。除此之外,其也拥有生产"红火蚁"的能力——一种携带热熔喷火器的CRm-51"兵蚁"机械体的变种。 - - 10 - - - -
  • -
  • -
  • - true - 30 - MechanoidsWakeUp -
  • -
  • - MechUncontrolled - 60000 - 10 - 25 -
  • -
  • -
  • - Wula_CR_Mobile_Factory_Turret - - -
  • - PawnRenderNode_TurretGun - PawnRenderNodeWorker_TurretGun - Body - (1, 1) - 20 - Any - - - -90 - (-1, 0, -1.45) - true - -5 - - - 90 - -5 - (2.15, 0, -1) - - - -90 - (1, 0, -1.45) - - - 90 - (-2.15, 0, -1) - - -
  • - - -
  • - Wula_CR_Mobile_Factory_Turret - - -
  • - PawnRenderNode_TurretGun - PawnRenderNodeWorker_TurretGun - Body - (1, 1) - 20 - Any - - - -90 - (1, 0, -1.45) - -5 - - - -90 - (2.15, 0, -1) - - - -90 - (-1, 0, -1.45) - - - 90 - (-2.15, 0, -1) - -5 - - -
  • - - -
  • - Wula_CR_Mobile_Factory_Turret_MKII - - -
  • - PawnRenderNode_TurretGun - PawnRenderNodeWorker_TurretGun - Body - (1, 1) - 20 - Any - - - -90 - (-1.3, 0, -0.45) - true - -5 - - - 90 - -5 - (1.4, 0, -0.35) - - - -90 - (1.3, 0, -0.45) - - - 90 - (-1.4, 0, -0.35) - - -
  • - - -
  • - Wula_CR_Mobile_Factory_Turret_MKII - - -
  • - PawnRenderNode_TurretGun - PawnRenderNodeWorker_TurretGun - Body - (1, 1) - 20 - Any - - - -90 - (1.3, 0, -0.45) - true - -5 - - - -90 - (1.4, 0, -0.35) - - - -90 - (-1.3, 0, -0.45) - - - 90 - -5 - (-1.4, 0, -0.35) - - -
  • - - -
  • - Wula_MR_Mobile_Factory_Turret - - -
  • - PawnRenderNode_TurretGun - PawnRenderNodeWorker_TurretGun - Body - (1, 1) - 20 - Any - - - -90 - (1.25, 0, 0.45) - true - -5 - - - 90 - -5 - (0.6, 0, 0.15) - - - -90 - (-1.25, 0, 0.65) - - - 90 - (-0.6, 0, 0.15) - - -
  • - - -
  • - Wula_MR_Mobile_Factory_Turret - - -
  • - PawnRenderNode_TurretGun - PawnRenderNodeWorker_TurretGun - Body - (1, 1) - 20 - Any - - - -90 - (-1.25, 0, 0.45) - true - -5 - - - -90 - (0.6, 0, 0.15) - - - -90 - (1.25, 0, 0.65) - - - 90 - -5 - (-0.6, 0, 0.15) - - -
  • - - -
  • - 36000 - 4.2 - 4.4 - 0.01 - 4.0 - false -
  • -
  • - true - WULA_MechCarrierSwitchHediff - Steel - 500 - 500 - 999 - 9999 - -
  • - WULA_Mech_Flyer_Melta - 2 - 50 -
  • -
  • - WULA_Mech_Flyer_Melta_Slow - 2 - 600 -
  • - - WarqueenWarUrchinsSpawned - WarUrchinSpawned - -
  • - true - WULA_MechCarrierSwitchHediff - Steel - 500 - 500 - 999 - 9999 - -
  • - WULA_Mech_Flyer_Melta - 2 - 50 -
  • -
  • - WULA_Mech_Flyer_Melta_Slow - 2 - 600 -
  • - - WarqueenWarUrchinsSpawned - WarUrchinSpawned - -
  • - true - WULA_MechCarrierSwitchHediff - Steel - 500 - 500 - 999 - 9999 - -
  • - WULA_Mech_Flyer_Melta - 2 - 50 -
  • -
  • - WULA_Mech_Flyer_Melta_Slow - 2 - 600 -
  • - - WarqueenWarUrchinsSpawned - WarUrchinSpawned - -
  • - true - WULA_MechCarrierSwitchHediff - Steel - 500 - 500 - 999 - 9999 - -
  • - WULA_Mech_Flyer_Melta - 2 - 50 -
  • -
  • - WULA_Mech_Flyer_Melta_Slow - 2 - 600 -
  • - - WarqueenWarUrchinsSpawned - WarUrchinSpawned - -
    -
    - - Wula_Mech_Mobile_Factory_CR - - Wula_Mech_Mobile_Factory_CR - - - Wula_Mech_Mobile_Factory_LR - - 乌拉帝国图书馆的陆行战舰——火力强大,装甲厚重,比起其通用型MFm-87"天秤",以等离子炮替换了所有的炮塔,用于在远距离上释放铺天盖地的火力。这个型号的陆行舰的生产能力不如其通用型,因此更加依赖其他部队的保护。 - - 10 - - - -
  • -
  • -
  • - true - 30 - MechanoidsWakeUp -
  • -
  • - MechUncontrolled - 60000 - 10 - 25 -
  • -
  • -
  • - Wula_LR_Mobile_Factory_Turret - - -
  • - PawnRenderNode_TurretGun - PawnRenderNodeWorker_TurretGun - Body - (1, 1) - 20 - Any - - - -90 - (-1, 0, -1.45) - true - -5 - - - 90 - -5 - (2.15, 0, -1) - - - -90 - (1, 0, -1.45) - - - 90 - (-2.15, 0, -1) - - -
  • - - -
  • - Wula_LR_Mobile_Factory_Turret - - -
  • - PawnRenderNode_TurretGun - PawnRenderNodeWorker_TurretGun - Body - (1, 1) - 20 - Any - - - -90 - (1, 0, -1.45) - -5 - - - -90 - (2.15, 0, -1) - - - -90 - (-1, 0, -1.45) - - - 90 - (-2.15, 0, -1) - -5 - - -
  • - - -
  • - Wula_LR_Mobile_Factory_Turret - - -
  • - PawnRenderNode_TurretGun - PawnRenderNodeWorker_TurretGun - Body - (1, 1) - 20 - Any - - - -90 - (-1.3, 0, -0.45) - true - -5 - - - 90 - -5 - (1.4, 0, -0.35) - - - -90 - (1.3, 0, -0.45) - - - 90 - (-1.4, 0, -0.35) - - -
  • - - -
  • - Wula_LR_Mobile_Factory_Turret - - -
  • - PawnRenderNode_TurretGun - PawnRenderNodeWorker_TurretGun - Body - (1, 1) - 20 - Any - - - -90 - (1.3, 0, -0.45) - true - -5 - - - -90 - (1.4, 0, -0.35) - - - -90 - (-1.3, 0, -0.45) - - - 90 - -5 - (-1.4, 0, -0.35) - - -
  • - - -
  • - Wula_LR_Mobile_Factory_Turret - - -
  • - PawnRenderNode_TurretGun - PawnRenderNodeWorker_TurretGun - Body - (1, 1) - 20 - Any - - - -90 - (1.25, 0, 0.45) - true - -5 - - - 90 - -5 - (0.6, 0, 0.15) - - - -90 - (-1.25, 0, 0.65) - - - 90 - (-0.6, 0, 0.15) - - -
  • - - -
  • - Wula_LR_Mobile_Factory_Turret - - -
  • - PawnRenderNode_TurretGun - PawnRenderNodeWorker_TurretGun - Body - (1, 1) - 20 - Any - - - -90 - (-1.25, 0, 0.45) - true - -5 - - - -90 - (0.6, 0, 0.15) - - - -90 - (1.25, 0, 0.65) - - - 90 - -5 - (-0.6, 0, 0.15) - - -
  • - - -
  • - 36000 - 4.2 - 4.4 - 0.01 - 4.0 - false -
  • -
  • - true - WULA_MechCarrierSwitchHediff - Steel - 500 - 500 - 999 - 9999 - -
  • - WULA_Mech_Flyer - 1 - 50 -
  • -
  • - WULA_Mech_Flyer_Slow - 2 - 600 -
  • - - WarqueenWarUrchinsSpawned - WarUrchinSpawned - -
  • - true - WULA_MechCarrierSwitchHediff - Steel - 500 - 500 - 999 - 9999 - -
  • - WULA_Mech_Flyer - 1 - 50 -
  • -
  • - WULA_Mech_Flyer_Slow - 2 - 600 -
  • - - WarqueenWarUrchinsSpawned - WarUrchinSpawned - -
  • - true - WULA_MechCarrierSwitchHediff - Steel - 500 - 500 - 999 - 9999 - -
  • - WULA_Mech_Flyer - 1 - 50 -
  • -
  • - WULA_Mech_Flyer_Slow - 2 - 600 -
  • - - WarqueenWarUrchinsSpawned - WarUrchinSpawned - -
  • - true - WULA_MechCarrierSwitchHediff - Steel - 500 - 500 - 999 - 9999 - -
  • - WULA_Mech_Flyer - 1 - 50 -
  • -
  • - WULA_Mech_Flyer_Slow - 2 - 600 -
  • - - WarqueenWarUrchinsSpawned - WarUrchinSpawned - -
    -
    - - Wula_Mech_Mobile_Factory_LR - - Wula_Mech_Mobile_Factory_LR - - - Wula_Mech_Mobile_Factory_1 - 1 - 1 - - - Wula_Mech_Mobile_Factory_10 - 1 - 10 - \ No newline at end of file diff --git a/Content/Textures/Wula/Things/Wula_Mech_Mobile_Factory/Flying/Wula_Mech_Mobile_Factory_Flying_1.png b/Content/Textures/Wula/Things/Wula_Mech_Mobile_Factory/Flying/Wula_Mech_Mobile_Factory_Flying_1.png new file mode 100644 index 00000000..05a63e65 Binary files /dev/null and b/Content/Textures/Wula/Things/Wula_Mech_Mobile_Factory/Flying/Wula_Mech_Mobile_Factory_Flying_1.png differ diff --git a/Source/WulaFallenEmpire/Pawn/WULA_Flight/CompPawnFlight.cs b/Source/WulaFallenEmpire/Pawn/WULA_Flight/CompPawnFlight.cs new file mode 100644 index 00000000..82321e6f --- /dev/null +++ b/Source/WulaFallenEmpire/Pawn/WULA_Flight/CompPawnFlight.cs @@ -0,0 +1,14 @@ +using Verse; + +namespace WulaFallenEmpire +{ + /// + /// A marker component that holds custom flight properties. + /// The actual flight logic is handled by Harmony patches that check for this component + /// and use its properties to override or trigger vanilla flight behavior. + /// + public class CompPawnFlight : ThingComp + { + public CompProperties_PawnFlight Props => (CompProperties_PawnFlight)props; + } +} \ No newline at end of file diff --git a/Source/WulaFallenEmpire/Pawn/WULA_Flight/CompProperties_PawnFlight.cs b/Source/WulaFallenEmpire/Pawn/WULA_Flight/CompProperties_PawnFlight.cs new file mode 100644 index 00000000..ae079fbb --- /dev/null +++ b/Source/WulaFallenEmpire/Pawn/WULA_Flight/CompProperties_PawnFlight.cs @@ -0,0 +1,55 @@ +using Verse; +using RimWorld; +using System.Collections.Generic; + +namespace WulaFallenEmpire +{ + public enum FlightCondition + { + Drafted, + MechAlwaysExceptSpecialJobs // 新增:机械族在非特殊工作状态下始终飞行 + } + + public class CompProperties_PawnFlight : CompProperties + { + // --- Custom Flight Logic --- + public FlightCondition flightCondition = FlightCondition.Drafted; + + // --- 新增:机械族特殊工作检查 --- + public List mechForbiddenJobs = new List + { + JobDefOf.MechCharge, // 充电工作 + JobDefOf.SelfShutdown // 关机工作 + }; + + // --- Vanilla PawnKindDef Flight Parameters --- + [NoTranslate] + public string flyingAnimationFramePathPrefix; + + [NoTranslate] + public string flyingAnimationFramePathPrefixFemale; + + public int flyingAnimationFrameCount; + + public int flyingAnimationTicksPerFrame = -1; + + public float flyingAnimationDrawSize = 1f; + + public bool flyingAnimationDrawSizeIsMultiplier; + + public bool flyingAnimationInheritColors; + + // --- Vanilla PawnKindLifeStage Flight Parameters --- + public AnimationDef flyingAnimationEast; + public AnimationDef flyingAnimationNorth; + public AnimationDef flyingAnimationSouth; + public AnimationDef flyingAnimationEastFemale; + public AnimationDef flyingAnimationNorthFemale; + public AnimationDef flyingAnimationSouthFemale; + + public CompProperties_PawnFlight() + { + compClass = typeof(CompPawnFlight); + } + } +} diff --git a/Source/WulaFallenEmpire/Pawn/WULA_Flight/PawnRenderNodeWorker_AttachmentBody_NoFlight.cs b/Source/WulaFallenEmpire/Pawn/WULA_Flight/PawnRenderNodeWorker_AttachmentBody_NoFlight.cs new file mode 100644 index 00000000..7dd1cb63 --- /dev/null +++ b/Source/WulaFallenEmpire/Pawn/WULA_Flight/PawnRenderNodeWorker_AttachmentBody_NoFlight.cs @@ -0,0 +1,22 @@ +using Verse; +using UnityEngine; + +namespace WulaFallenEmpire +{ + public class PawnRenderNodeWorker_AttachmentBody_NoFlight : PawnRenderNodeWorker_AttachmentBody + { + public override bool CanDrawNow(PawnRenderNode node, PawnDrawParms parms) + { + if (parms.pawn.Flying) + { + return false; + } + return base.CanDrawNow(node, parms); + } + + public override Vector3 ScaleFor(PawnRenderNode node, PawnDrawParms parms) + { + return base.ScaleFor(node, parms); + } + } +} \ No newline at end of file diff --git a/Source/WulaFallenEmpire/Pawn/WULA_Flight/Pawn_FlightTrackerPatches.cs b/Source/WulaFallenEmpire/Pawn/WULA_Flight/Pawn_FlightTrackerPatches.cs new file mode 100644 index 00000000..000a9bb3 --- /dev/null +++ b/Source/WulaFallenEmpire/Pawn/WULA_Flight/Pawn_FlightTrackerPatches.cs @@ -0,0 +1,81 @@ +using HarmonyLib; +using Verse; +using RimWorld; +using Verse.AI; + +namespace WulaFallenEmpire +{ + [HarmonyPatch] + public static class FlightHarmonyPatches + { + // Corrected Patch 1: The method signature now correctly matches the static target method. + [HarmonyPrefix] + [HarmonyPatch(typeof(Pawn_FlightTracker), "GetBestFlyAnimation")] + public static bool GetBestFlyAnimation_Prefix(Pawn pawn, ref AnimationDef __result) // Correct parameters: Pawn pawn, not __instance and ___pawn + { + var flightComp = pawn?.TryGetComp(); + if (flightComp == null) // No props check needed, as the crash was due to wrong signature + { + return true; + } + + var compProps = flightComp.Props; + AnimationDef selectedAnim = null; + + if (pawn.gender == Gender.Female && compProps.flyingAnimationNorthFemale != null) + { + switch (pawn.Rotation.AsInt) + { + case 0: selectedAnim = compProps.flyingAnimationNorthFemale; break; + case 1: selectedAnim = compProps.flyingAnimationEastFemale; break; + case 2: selectedAnim = compProps.flyingAnimationSouthFemale; break; + case 3: selectedAnim = compProps.flyingAnimationEastFemale ?? compProps.flyingAnimationEast; break; + } + } + else + { + switch (pawn.Rotation.AsInt) + { + case 0: selectedAnim = compProps.flyingAnimationNorth; break; + case 1: selectedAnim = compProps.flyingAnimationEast; break; + case 2: selectedAnim = compProps.flyingAnimationSouth; break; + case 3: selectedAnim = compProps.flyingAnimationEast; break; + } + } + + if (selectedAnim != null) + { + __result = selectedAnim; + return false; + } + return true; + } + + // Patch 2 remains correct as Notify_JobStarted is a non-static method. + [HarmonyPrefix] + [HarmonyPatch(typeof(Pawn_FlightTracker), "Notify_JobStarted")] + public static bool Notify_JobStarted_Prefix(Job job, Pawn_FlightTracker __instance, Pawn ___pawn) + { + var flightComp = ___pawn?.TryGetComp(); + if (flightComp == null || __instance == null || !__instance.CanEverFly || ___pawn == null || ___pawn.Dead) + { + return true; + } + + var compProps = flightComp.Props; + bool shouldBeFlying = (compProps.flightCondition == FlightCondition.Drafted && ___pawn.Drafted); + + if (shouldBeFlying) + { + if (!__instance.Flying) __instance.StartFlying(); + job.flying = true; + } + else + { + if (__instance.Flying) __instance.ForceLand(); + job.flying = false; + } + return false; + } + } +} \ No newline at end of file diff --git a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj index 7f48a92a..c0afb0cd 100644 --- a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj +++ b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj @@ -175,6 +175,10 @@ + + + +