Пример #1
0
        public ToolAssignment MakeNewToolAssignment()
        {
            int uniqueId       = assignments.Any() ? assignments.Max(a => a.uniqueId) + 1 : 1;
            var toolAssignment = new ToolAssignment(uniqueId, $"{"ToolAssignment".Translate()} {uniqueId}");

            toolAssignment.filter.SetAllow(ThingCategoryDefOf.Tools, true);
            assignments.Add(toolAssignment);
            return(toolAssignment);
        }
 public Dialog_ManageToolAssignments(ToolAssignment selectedToolAssignment)
 {
     forcePause              = true;
     doCloseX                = true;
     doCloseButton           = true;
     closeOnClickedOutside   = true;
     absorbInputAroundWindow = true;
     if (globalFilter == null)
     {
         globalFilter = new ThingFilter();
         globalFilter.SetAllow(ThingCategoryDefOf.Tools, true);
     }
     ToolAssignment = selectedToolAssignment;
 }
Пример #3
0
 public AcceptanceReport TryDelete(ToolAssignment toolAssignment)
 {
     foreach (Pawn pawn in PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive)
     {
         if (pawn.CanUseTools(out var tracker) && tracker.ToolAssignment == toolAssignment)
         {
             return(new AcceptanceReport("ToolAssignmentInUse".Translate(pawn)));
         }
     }
     foreach (Pawn pawn2 in PawnsFinder.AllMapsWorldAndTemporary_AliveOrDead)
     {
         if (pawn2.CanUseTools(out var tracker2) &&
             tracker2.ToolAssignment == toolAssignment)
         {
             tracker2.ToolAssignment = null;
         }
     }
     assignments.Remove(toolAssignment);
     return(AcceptanceReport.WasAccepted);
 }