Item Categories

Items now have categories defined, allowing them to be better organized in the DB list view
This commit is contained in:
hyperion51 2020-05-23 01:19:07 +01:00
commit ef0c9c4054
5 changed files with 154 additions and 82 deletions

View file

@ -108,4 +108,14 @@ public class InspectableTypeAttribute : InspectableFieldAttribute
}
[AttributeUsage(AttributeTargets.Field)]
public class SimplePerformanceStatAttribute : Attribute { }
public class SimplePerformanceStatAttribute : Attribute { }
// public class CategoryAttribute : Attribute
// {
// public readonly Type Type;
//
// public CategoryAttribute(Type type)
// {
// Type = type;
// }
// }

View file

@ -60,4 +60,23 @@ public enum MegaPlacementType
Resources = 2,
Connected = 3,
Isolated = 4
}
public enum SimpleCommodityCategory
{
Minerals,
Metals,
Alloys,
Compounds,
Organics
}
public enum CompoundCommodityCategory
{
Wearables,
Consumables,
Luxuries,
Tools,
Manufacturing,
Assemblies
}

View file

@ -63,6 +63,9 @@ public class SimpleCommodityData : ItemData
// Minimum amount of resources needed for presence to register
[InspectableField, JsonProperty("floor"), Key(11)]
public float Floor = 5f;
[InspectableField, JsonProperty("category"), Key(12)]
public SimpleCommodityCategory Category;
}
[MessagePackObject,
@ -82,6 +85,9 @@ public class CompoundCommodityData : CraftedItemData
{
[InspectableDatabaseLink(typeof(PersonalityAttribute)), JsonProperty("demandProfile"), Key(7)]
public Dictionary<Guid, float> DemandProfile = new Dictionary<Guid, float>();
[InspectableField, JsonProperty("category"), Key(8)]
public CompoundCommodityCategory Category;
}
[Union(0, typeof(GearData)),
@ -154,16 +160,16 @@ public class GearData : EquippableItemData
[RethinkTable("Items"), Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class HullData : EquippableItemData
{
[InspectableField, JsonProperty("hullCapacity"), Key(13)]
[InspectableField, JsonProperty("hullCapacity"), Key(14)]
public PerformanceStat Capacity = new PerformanceStat();
[InspectableField, JsonProperty("hardpoints"), Key(14)]
[InspectableField, JsonProperty("hardpoints"), Key(15)]
public List<HardpointData> Hardpoints = new List<HardpointData>();
[InspectablePrefab, JsonProperty("prefab"), Key(15)]
[InspectablePrefab, JsonProperty("prefab"), Key(16)]
public string Prefab;
[InspectableField, JsonProperty("hullType"), Key(16)]
[InspectableField, JsonProperty("hullType"), Key(17)]
public HullType HullType;
[IgnoreMember] public override HardpointType HardpointType => HardpointType.Hull;