2024-08-29 20:23:33 +05:00
|
|
|
|
/*
|
|
|
|
|
|
* This file is sublicensed under MIT License
|
|
|
|
|
|
* https://github.com/space-wizards/space-station-14/blob/master/LICENSE.TXT
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
using Content.Shared._CP14.Workbench.Prototypes;
|
2024-08-06 21:25:59 +10:00
|
|
|
|
using Robust.Shared.Prototypes;
|
|
|
|
|
|
using Robust.Shared.Serialization;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Content.Shared._CP14.Workbench;
|
|
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
|
public enum CP14WorkbenchUiKey
|
|
|
|
|
|
{
|
|
|
|
|
|
Key,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
2025-07-05 20:44:38 +03:00
|
|
|
|
public sealed class CP14WorkbenchUiCraftMessage(ProtoId<CP14WorkbenchRecipePrototype> recipe)
|
|
|
|
|
|
: BoundUserInterfaceMessage
|
2024-08-06 21:25:59 +10:00
|
|
|
|
{
|
2025-07-05 20:44:38 +03:00
|
|
|
|
public readonly ProtoId<CP14WorkbenchRecipePrototype> Recipe = recipe;
|
2024-08-06 21:25:59 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
2025-07-05 20:44:38 +03:00
|
|
|
|
public sealed class CP14WorkbenchUiRecipesState(List<CP14WorkbenchUiRecipesEntry> recipes) : BoundUserInterfaceState
|
2024-08-06 21:25:59 +10:00
|
|
|
|
{
|
2025-07-05 20:44:38 +03:00
|
|
|
|
public readonly List<CP14WorkbenchUiRecipesEntry> Recipes = recipes;
|
2024-08-06 21:25:59 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
2025-07-05 20:44:38 +03:00
|
|
|
|
public readonly struct CP14WorkbenchUiRecipesEntry(ProtoId<CP14WorkbenchRecipePrototype> protoId, bool craftable)
|
|
|
|
|
|
: IEquatable<CP14WorkbenchUiRecipesEntry>
|
2024-08-06 21:25:59 +10:00
|
|
|
|
{
|
2025-07-05 20:44:38 +03:00
|
|
|
|
public readonly ProtoId<CP14WorkbenchRecipePrototype> ProtoId = protoId;
|
|
|
|
|
|
public readonly bool Craftable = craftable;
|
2024-08-06 21:25:59 +10:00
|
|
|
|
|
2025-04-25 13:39:20 +03:00
|
|
|
|
public int CompareTo(CP14WorkbenchUiRecipesEntry other)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Craftable.CompareTo(other.Craftable);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-06 21:25:59 +10:00
|
|
|
|
public override bool Equals(object? obj)
|
|
|
|
|
|
{
|
|
|
|
|
|
return obj is CP14WorkbenchUiRecipesEntry other && Equals(other);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool Equals(CP14WorkbenchUiRecipesEntry other)
|
|
|
|
|
|
{
|
|
|
|
|
|
return ProtoId.Id == other.ProtoId.Id;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
|
{
|
|
|
|
|
|
return HashCode.Combine(ProtoId, Craftable);
|
|
|
|
|
|
}
|
2025-04-25 13:39:20 +03:00
|
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
|
{
|
|
|
|
|
|
return $"{ProtoId} ({Craftable})";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static int CompareTo(CP14WorkbenchUiRecipesEntry left, CP14WorkbenchUiRecipesEntry right)
|
|
|
|
|
|
{
|
|
|
|
|
|
return right.CompareTo(left);
|
|
|
|
|
|
}
|
2024-08-06 21:25:59 +10:00
|
|
|
|
}
|