2026-06-13 04:56:50 +01:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2020-12-22 03:13:43 +00:00
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
|
|
using System;
|
2020-03-22 19:05:26 +00:00
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
//using JM.LinqFaster;
|
|
|
|
|
using MessagePack;
|
|
|
|
|
using MessagePack.Formatters;
|
|
|
|
|
using Unity.Mathematics;
|
|
|
|
|
using static Unity.Mathematics.math;
|
|
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[Union(0, typeof(SimpleCommodity)),
|
|
|
|
|
Union(1, typeof(CompoundCommodity)),
|
2020-12-10 23:20:38 +00:00
|
|
|
Union(2, typeof(EquippableItem)),
|
2026-06-13 04:56:50 +01:00
|
|
|
Union(3, typeof(ConsumableItem))]
|
2020-12-10 23:20:38 +00:00
|
|
|
public abstract class ItemInstance
|
2020-03-22 19:05:26 +00:00
|
|
|
{
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(0)] public DatabaseLink<ItemData> Data;
|
|
|
|
|
[Key(1)] public ItemRotation Rotation;
|
2020-03-22 19:05:26 +00:00
|
|
|
}
|
|
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[Union(0, typeof(CompoundCommodity)),
|
|
|
|
|
Union(1, typeof(EquippableItem)),
|
|
|
|
|
Union(2, typeof(ConsumableItem))]
|
2020-03-22 19:05:26 +00:00
|
|
|
public abstract class CraftedItemInstance : ItemInstance
|
|
|
|
|
{
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(2)] public float Quality;
|
2020-03-22 19:05:26 +00:00
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
//[Key(3)] public List<ItemInstance> Ingredients = new List<ItemInstance>();
|
|
|
|
|
|
|
|
|
|
//[Key(4)] public Guid Blueprint;
|
|
|
|
|
|
|
|
|
|
//[Key(3)] public string Name;
|
|
|
|
|
|
|
|
|
|
//[Key(4)] public Guid SourceEntity;
|
2020-03-22 19:05:26 +00:00
|
|
|
}
|
|
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[MessagePackObject]
|
2020-12-10 23:20:38 +00:00
|
|
|
public class CompoundCommodity : CraftedItemInstance { }
|
2020-03-22 19:05:26 +00:00
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[MessagePackObject]
|
2020-03-22 19:05:26 +00:00
|
|
|
public class SimpleCommodity : ItemInstance
|
|
|
|
|
{
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(2)] public int Quantity;
|
2020-03-22 19:05:26 +00:00
|
|
|
}
|
|
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[MessagePackObject]
|
2020-12-10 23:20:38 +00:00
|
|
|
public class EquippableItem : CraftedItemInstance
|
2020-03-22 19:05:26 +00:00
|
|
|
{
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(7)] public float Durability;
|
|
|
|
|
[Key(8)] public bool OverrideShutdown;
|
2021-04-18 05:13:20 +01:00
|
|
|
}
|
|
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[MessagePackObject]
|
2021-04-18 05:13:20 +01:00
|
|
|
public class ConsumableItem : CraftedItemInstance
|
|
|
|
|
{
|
2020-03-22 19:05:26 +00:00
|
|
|
}
|