Skip to content

Commit

Permalink
Merge pull request #2781 from CombatExtended-Continued/turret-reload-…
Browse files Browse the repository at this point in the history
…assorted-fix

assorted turret reload fix
  • Loading branch information
N7Huntsman authored Oct 17, 2023
2 parents 180c18e + 7df3b02 commit 8eba523
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ public override bool TryMakePreToilReservations(bool errorOnFailed)
public override string GetReport()
{
string text = CE_JobDefOf.ReloadTurret.reportString;
string turretType = (turret.TryGetComp<CompMannable>() != null ? "CE_MannedTurret" : "CE_AutoTurret").Translate();
text = text.Replace("TurretType", turretType);
text = text.Replace("TargetA", TargetThingA.def.label);
text = compReloader.UseAmmo
? text.Replace("TargetB", TargetThingB.def.label)
: text.Replace("TargetB", "CE_ReloadingGenericAmmo".Translate());
Expand Down Expand Up @@ -157,7 +160,14 @@ public override IEnumerable<Toil> MakeNewToils()
}

// If ammo system is turned off we just need to go to the turret.
yield return Toils_Goto.GotoCell(turret.Position, PathEndMode.Touch);
if (turret.InteractionCell != null)
{
yield return Toils_Goto.GotoCell(turret.InteractionCell, PathEndMode.OnCell);
}
else
{
yield return Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch);
}

//If pawn fails reloading from this point, reset isReloading
this.AddFinishAction(delegate
Expand Down

0 comments on commit 8eba523

Please sign in to comment.