qud-mods/AutoDropBedding/AutoDropBeddingMenu.cs

42 lines
942 B
C#
Raw Permalink Normal View History

2023-12-19 01:24:51 -05:00
using AutoDropBedding;
namespace XRL.World.Parts
{
public class AutoDropBeddingMenu : IPart
{
private static string NAME = "SetUpBedroll";
public override bool WantEvent(int ID, int cascade) =>
ID == InventoryActionEvent.ID ||
ID == GetCookingActionsEvent.ID ||
base.WantEvent(ID, cascade);
public override bool HandleEvent(GetCookingActionsEvent E)
{
if (Config.AddMenuOptionToCamp && Helpers.HasBedroll())
{
Helpers.Log("Adding menu option.");
E.AddAction(NAME,
"Lay out bedding",
NAME,
Key: 'b',
Default: 0,
Priority: 200);
}
return base.HandleEvent(E);
}
public override bool HandleEvent(InventoryActionEvent E)
{
if (E.Command == NAME)
{
Helpers.Log("Got setup bed command.");
Helpers.PutDownBedroll(campfireCell: E.CellTarget);
E.RequestInterfaceExit();
}
return base.HandleEvent(E);
}
}
}