Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Source/ProjectRimFactory/Common/HarmonyPatches/PatchStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using UnityEngine;
using HarmonyLib;
using ProjectRimFactory.Storage;
using Verse.AI;

namespace ProjectRimFactory.Common.HarmonyPatches
{
Expand Down Expand Up @@ -55,6 +56,26 @@ static bool Prefix(Vector3 clickPos, Pawn pawn, out List<FloatMenuOption> __resu
if (pawn.Map.GetComponent<PRFMapComponent>().iHideRightMenus.Contains(clickPos.ToIntVec3()))
{
__result = new List<FloatMenuOption>();
if (pawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation) && !pawn.skills.GetSkill(SkillDefOf.Construction).TotallyDisabled)
{
foreach (LocalTargetInfo item13 in GenUI.TargetsAt(clickPos, TargetingParameters.ForRepair(pawn), thingsOnly: true))
{
Thing repairTarget = item13.Thing;
if (!pawn.CanReach(repairTarget, PathEndMode.Touch, Danger.Deadly))
{
__result.Add(new FloatMenuOption("CannotRepair".Translate(repairTarget) + ": " + "NoPath".Translate().CapitalizeFirst(), null));
}
else if (RepairUtility.PawnCanRepairNow(pawn, repairTarget))
{
FloatMenuOption item5 = FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption("RepairThing".Translate(repairTarget), delegate
{
Job job = JobMaker.MakeJob(JobDefOf.Repair, repairTarget);
pawn.jobs.TryTakeOrderedJob(job, JobTag.Misc);
}), pawn, repairTarget);
__result.Add(item5);
}
}
}
return false;
}
__result = null;
Expand Down