示例#1
0
        //瞄准时间改这个__instance.verbProps.warmupTime,改完要在postfix里改回去
        public static bool TryStartCastOn_Prefix(Verb __instance, ref bool __result,
                                                 LocalTargetInfo castTarg, LocalTargetInfo destTarg, bool surpriseAttack = false, bool canHitNonTargetPawns = true)
        {
            if (__instance.EquipmentSource == null)
            {
                return(true);
            }
            Comp.VoidNetEquipmentPort cp = __instance.EquipmentSource.TryGetComp <Comp.VoidNetEquipmentPort>();
            if (cp == null)
            {
                return(true);
            }
            bool flag = true;

            if (!cp.TryStartCastOn(__instance, castTarg, destTarg, surpriseAttack, canHitNonTargetPawns))
            {
                flag     = false;
                __result = false;
                //只有返回true的时候设置这个才有效,因为false根本不开火
                Methons.warmupTime_Target = null;
            }
            else if (Methons.warmupTime_Target != null)
            {
                Methons.warmupTime_Before       = __instance.verbProps.warmupTime;
                __instance.verbProps.warmupTime = (float)Methons.warmupTime_Target;
                Methons.warmupTime_Target       = null;
            }
            return(flag);
        }
示例#2
0
 //子弹射出间隔时间改这个__instance.verbProps.ticksBetweenBurstShots,改完要在postfix里改回去
 //射击后僵直改__instance.EquipmentSource的StatDefOf.RangedWeapon_Cooldown,改完要在postfix里改回去
 public static bool TryCastNextBurstShot_Prefix(Verb __instance, ref int ___burstShotsLeft)
 {
     if (__instance.EquipmentSource == null)
     {
         return(true);
     }
     Comp.VoidNetEquipmentPort cp = __instance.EquipmentSource.TryGetComp <Comp.VoidNetEquipmentPort>();
     if (cp == null)
     {
         return(true);
     }
     if (!cp.TryCastNextBurstShot(__instance, ref ___burstShotsLeft))
     {
         //仍然正常进函数,但是下一次Available会返回false,让他射不出去
         ___burstShotsLeft = 1;
         disableNext       = true;
     }
     //剩余射击数为0的时候看看要不要修改rangedWeapon_Cooldown
     if (___burstShotsLeft == 1 && Methons.rangedWeapon_Cooldown != null)
     {
         Methons.NextRangedWeapon_Cooldown_Prop = Math.Max((float)Methons.rangedWeapon_Cooldown, __instance.verbProps.ticksBetweenBurstShots.TicksToSeconds());
         Methons.rangedWeapon_Cooldown          = null;
     }
     return(true);
 }
示例#3
0
 public static void Notify_EquipmentRemoved_Postfix(Pawn_EquipmentTracker __instance, ThingWithComps eq)
 {
     Comp.VoidNetEquipmentPort cp1 = eq.TryGetComp <Comp.VoidNetEquipmentPort>();
     if (cp1 != null)
     {
         cp1.Notify_Dropped(__instance.pawn);
     }
 }
示例#4
0
        public static void TryDropEquipment_Postfix(Pawn_EquipmentTracker __instance, ref bool __result,
                                                    ThingWithComps eq, ref ThingWithComps resultingEq, IntVec3 pos, bool forbid = true)
        {
            if (!__result)
            {
                return;
            }
            Comp.VoidNetEquipmentPort cp1 = eq.TryGetComp <Comp.VoidNetEquipmentPort>();
            Comp.VoidNetEquipmentPort cp2 = resultingEq.TryGetComp <Comp.VoidNetEquipmentPort>();

            if (cp1 != null && cp2 != null)
            {
                cp1.Notify_Dropped(__instance.pawn);
            }
        }