protected override void OnDragTool(int cell, int distFromOrigin)
 {
     if (Grid.IsValidCell(cell))
     {
         foreach (HarvestDesignatable item in Components.HarvestDesignatables.Items)
         {
             OccupyArea area = item.area;
             if (Grid.PosToCell(item) == cell || ((Object)area != (Object)null && area.CheckIsOccupying(cell)))
             {
                 if (options["HARVEST_WHEN_READY"] == ToolParameterMenu.ToggleState.On)
                 {
                     item.SetHarvestWhenReady(true);
                 }
                 else if (options["DO_NOT_HARVEST"] == ToolParameterMenu.ToggleState.On)
                 {
                     item.SetHarvestWhenReady(false);
                 }
                 Prioritizable component = item.GetComponent <Prioritizable>();
                 if ((Object)component != (Object)null)
                 {
                     component.SetMasterPriority(ToolMenu.Instance.PriorityScreen.GetLastSelectedPriority());
                 }
             }
         }
     }
 }
Example #2
0
 protected override void OnDragTool(int cell, int distFromOrigin)
 {
     if (!Grid.Solid[cell])
     {
         foreach (Uprootable item in Components.Uprootables.Items)
         {
             if (Grid.PosToCell(item.gameObject) == cell)
             {
                 item.MarkForUproot(true);
                 break;
             }
             OccupyArea area = item.area;
             if ((Object)area != (Object)null && area.CheckIsOccupying(cell))
             {
                 item.MarkForUproot(true);
             }
         }
     }
     if (DebugHandler.InstantBuildMode)
     {
         if (Grid.IsValidCell(cell) && Grid.Solid[cell] && !Grid.Foundation[cell])
         {
             WorldDamage.Instance.DestroyCell(cell, -1);
         }
     }
     else
     {
         GameObject gameObject = PlaceDig(cell, distFromOrigin);
         if ((Object)gameObject != (Object)null)
         {
             Prioritizable component = gameObject.GetComponent <Prioritizable>();
             if ((Object)component != (Object)null)
             {
                 component.SetMasterPriority(ToolMenu.Instance.PriorityScreen.GetLastSelectedPriority());
             }
         }
     }
 }