59 lines
2.7 KiB
C#
59 lines
2.7 KiB
C#
|
|
using RimWorld;
|
||
|
|
using UnityEngine;
|
||
|
|
using Verse;
|
||
|
|
|
||
|
|
namespace BlaxZones
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// Package Designators. "Delivery zone" in the Zone menu, dragged like a stockpile. Inserted after
|
||
|
|
/// Designator_ZoneAdd_Growing by Patches/BlaxZones_Designators.xml (a namespace-qualified
|
||
|
|
/// PatchOperationInsert; anchor on Growing, because the Fishing entry carries MayRequire Odyssey).
|
||
|
|
/// Visible reads BlaxZonesSettings.deliveryZones live.
|
||
|
|
///
|
||
|
|
/// Subclasses Designator_ZoneAdd directly, never Designator_ZoneAddStockpile, so Blax Defaults'
|
||
|
|
/// stockpile hook never reaches it. Designator_ZoneAdd compares the exact zone type and refuses
|
||
|
|
/// cells in other zones (Designator_ZoneAdd.cs:46, 73, 114, 127), and DesignateMultiCell drops
|
||
|
|
/// every cell that already has a zone (Designator_ZoneAdd.cs:142), so expanding only adds cells.
|
||
|
|
/// </summary>
|
||
|
|
public class Designator_ZoneAdd_Delivery : Designator_ZoneAdd
|
||
|
|
{
|
||
|
|
public const string IconPath = "UI/Designators/ZoneCreate_Stockpile";
|
||
|
|
|
||
|
|
/// <summary>The tooltip; mentions the 4-cell home area growth (AutoHomeAreaMaker.cs:48-58).</summary>
|
||
|
|
public const string DescKey = "BlaxZones_DesignatorDeliveryZoneDesc";
|
||
|
|
|
||
|
|
public const string TutorTag = "ZoneAdd_Delivery";
|
||
|
|
|
||
|
|
protected override string NewZoneLabel => "BlaxZones_DeliveryZone".Translate();
|
||
|
|
|
||
|
|
/// <summary>Read live by GizmoGridDrawer (Gizmo.cs:31, GizmoGridDrawer.cs:265), so the toggle needs no restart.</summary>
|
||
|
|
public override bool Visible => BlaxZonesMod.S.deliveryZones;
|
||
|
|
|
||
|
|
public Designator_ZoneAdd_Delivery()
|
||
|
|
{
|
||
|
|
zoneTypeToPlace = typeof(Zone_Delivery);
|
||
|
|
defaultLabel = "BlaxZones_DeliveryZone".Translate();
|
||
|
|
defaultDesc = DescKey.Translate();
|
||
|
|
icon = ContentFinder<Texture2D>.Get(IconPath);
|
||
|
|
defaultIconColor = Zone_Delivery.IconColor;
|
||
|
|
tutorTag = TutorTag;
|
||
|
|
// Dragged like a stockpile (Designator_ZoneAdd.cs:36-38, Designator_ZoneAddStockpile.cs:37).
|
||
|
|
soundDragSustain = SoundDefOf.Designate_DragAreaAdd;
|
||
|
|
soundDragChanged = SoundDefOf.Designate_DragZone_Changed;
|
||
|
|
soundSucceeded = SoundDefOf.Designate_ZoneAdd_Stockpile;
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override Zone MakeNewZone() => new Zone_Delivery(Find.CurrentMap.zoneManager);
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>Package Designators. The expand gizmo of a selected delivery zone; only adds new cells.</summary>
|
||
|
|
public class Designator_ZoneAdd_Delivery_Expand : Designator_ZoneAdd_Delivery
|
||
|
|
{
|
||
|
|
public Designator_ZoneAdd_Delivery_Expand()
|
||
|
|
{
|
||
|
|
defaultLabel = "DesignatorZoneExpand".Translate();
|
||
|
|
hotKey = KeyBindingDefOf.Misc6;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|