Purge Newtonsoft state annotations

This commit is contained in:
Meta Vens 2026-06-13 04:56:50 +01:00
commit b0d2aa1156
92 changed files with 891 additions and 1684 deletions

View file

@ -1,4 +1,4 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
@ -7,61 +7,55 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using JsonKnownTypes;
//using JM.LinqFaster;
using MessagePack;
using MessagePack.Formatters;
using Newtonsoft.Json;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Union(0, typeof(SimpleCommodity)),
Union(1, typeof(CompoundCommodity)),
[Union(0, typeof(SimpleCommodity)),
Union(1, typeof(CompoundCommodity)),
Union(2, typeof(EquippableItem)),
Union(3, typeof(ConsumableItem)),
JsonObject(MemberSerialization.OptIn),
JsonConverter(typeof(JsonKnownTypesConverter<ItemInstance>))]
Union(3, typeof(ConsumableItem))]
public abstract class ItemInstance
{
[JsonProperty("data"), Key(0)] public DatabaseLink<ItemData> Data;
[JsonProperty("rotation"), Key(1)] public ItemRotation Rotation;
[Key(0)] public DatabaseLink<ItemData> Data;
[Key(1)] public ItemRotation Rotation;
}
[Union(0, typeof(CompoundCommodity)),
Union(1, typeof(EquippableItem)),
Union(2, typeof(ConsumableItem)),
JsonObject(MemberSerialization.OptIn),
JsonConverter(typeof(JsonKnownTypesConverter<CraftedItemInstance>))]
[Union(0, typeof(CompoundCommodity)),
Union(1, typeof(EquippableItem)),
Union(2, typeof(ConsumableItem))]
public abstract class CraftedItemInstance : ItemInstance
{
[JsonProperty("quality"), Key(2)] public float Quality;
[Key(2)] public float Quality;
//[JsonProperty("ingredients"), Key(3)] public List<ItemInstance> Ingredients = new List<ItemInstance>();
//[JsonProperty("blueprint"), Key(4)] public Guid Blueprint;
//[JsonProperty("name"), Key(3)] public string Name;
//[JsonProperty("sourceEntity"), Key(4)] public Guid SourceEntity;
//[Key(3)] public List<ItemInstance> Ingredients = new List<ItemInstance>();
//[Key(4)] public Guid Blueprint;
//[Key(3)] public string Name;
//[Key(4)] public Guid SourceEntity;
}
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
[MessagePackObject]
public class CompoundCommodity : CraftedItemInstance { }
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
[MessagePackObject]
public class SimpleCommodity : ItemInstance
{
[JsonProperty("quantity"), Key(2)] public int Quantity;
[Key(2)] public int Quantity;
}
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
[MessagePackObject]
public class EquippableItem : CraftedItemInstance
{
[JsonProperty("durability"), Key(7)] public float Durability;
[JsonProperty("override"), Key(8)] public bool OverrideShutdown;
[Key(7)] public float Durability;
[Key(8)] public bool OverrideShutdown;
}
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
[MessagePackObject]
public class ConsumableItem : CraftedItemInstance
{
}