I'm creating a couple of designators to mass forbid/unforbid blueprints, because drag-select is atrocious for it, as it'll prioritize selecting any resource or animal that happens to be over your blueprints.
I've used Designator_Claim as a base, and successfully edited it to the intended functionality. But, the forbid blueprint designator, in addition to being available from the Orders tab, also shows up when I select an individual blueprint, which is redundant, as the F button is already there for that. Is there a way to remove my designator from there, so it only appears in the Orders tab?
Designator class, if needed for reference:
I've used Designator_Claim as a base, and successfully edited it to the intended functionality. But, the forbid blueprint designator, in addition to being available from the Orders tab, also shows up when I select an individual blueprint, which is redundant, as the F button is already there for that. Is there a way to remove my designator from there, so it only appears in the Orders tab?
Designator class, if needed for reference:
Code Select
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Verse;
namespace ForbidBlueprints
{
public class Designator_ForbidBlueprint : Designator
{
public override int DraggableDimensions
{
get
{
return 2;
}
}
public Designator_ForbidBlueprint()
{
this.defaultLabel = "Forbid blueprints";
this.defaultDesc = "Sets blueprints within area to forbidden";
this.icon = ContentFinder<Texture2D>.Get("UI/Designators/Claim", true);
this.soundDragSustain = SoundDefOf.DesignateDragStandard;
this.soundDragChanged = SoundDefOf.DesignateDragStandardChanged;
this.useMouseIcon = true;
this.soundSucceeded = SoundDefOf.DesignateClaim;
//this.hotKey = KeyBindingDefOf.Misc4;
}
public override AcceptanceReport CanDesignateCell(IntVec3 c)
{
if (!c.InBounds())
{
return false;
}
if (c.Fogged())
{
return false;
}
if (!(from t in c.GetThingList() where this.CanDesignateThing(t).Accepted select t).Any<Thing>())
{
return "Must designate blueprints.";
}
return true;
}
public override void DesignateSingleCell(IntVec3 c)
{
List<Thing> thingList = c.GetThingList();
for (int i = 0; i < thingList.Count; i++)
{
if (this.CanDesignateThing(thingList[i]).Accepted)
{
this.DesignateThing(thingList[i]);
}
}
}
public override AcceptanceReport CanDesignateThing(Thing t)
{
Blueprint blueprint = t as Blueprint;
if (blueprint != null && blueprint.Faction == Faction.OfPlayer && blueprint.def.IsBlueprint)
{
return true;
}
return false;
}
public override void DesignateThing(Thing t)
{
if (ForbidUtility.IsForbidden(t, Faction.OfPlayer) == false)
{
ForbidUtility.SetForbidden(t, true, true);
}
}
}
}