// really only used by pawns (JobDriver_Reload) at this point... TODO: Finish making sure this is only used by pawns and fix up the error checking. /// <summary> /// Overrides a Pawn's current activities to start reloading a gun or turret. Has a code path to resume the interrupted job. /// </summary> public void TryStartReload() { if (!HasMagazine) { if (!CanBeFiredNow) { DoOutOfAmmoAction(); } return; } if (Wielder == null && turret == null) { return; } // secondary branch for if we ended up being called up by a turret somehow... if (turret != null) { turret.TryOrderReload(); return; } // R&G compatibility, prevents an initial attempt to reload while moving if (Wielder.stances.curStance.GetType() == rgStance) { return; } if (UseAmmo) { TryUnload(); // Check for ammo if (Wielder != null && !HasAmmo) { DoOutOfAmmoAction(); return; } } if (Props.reloadOneAtATime && UseAmmo && selectedAmmo == CurrentAmmo && CurMagCount == Props.magazineSize) { //Because reloadOneAtATime weapons don't dump their mag at the start of a reload, have to stop the reloading process here if the mag was already full return; } // Issue reload job if (Wielder != null) { Job reloadJob = TryMakeReloadJob(); if (reloadJob == null) { return; } reloadJob.playerForced = true; Wielder.jobs.StartJob(reloadJob, JobCondition.InterruptForced, null, Wielder.CurJob?.def != reloadJob.def, true); } }
// really only used by pawns (JobDriver_Reload) at this point... TODO: Finish making sure this is only used by pawns and fix up the error checking. /// <summary> /// Overrides a Pawn's current activities to start reloading a gun or turret. Has a code path to resume the interrupted job. /// </summary> public void TryStartReload() { if (!HasMagazine) { return; } if (Wielder == null && turret == null) { return; } // secondary branch for if we ended up being called up by a turret somehow... if (turret != null) { turret.TryOrderReload(); return; } if (UseAmmo) { TryUnload(); // Check for ammo if (Wielder != null && !HasAmmo) { DoOutOfAmmoAction(); return; } } // Issue reload job if (Wielder != null) { Job reloadJob = TryMakeReloadJob(); if (reloadJob == null) { return; } reloadJob.playerForced = true; Wielder.jobs.StartJob(reloadJob, JobCondition.InterruptForced, null, Wielder.CurJob?.def != reloadJob.def, true); } }