Demote runtime DTO MessagePack metadata
This commit is contained in:
parent
d9d1ee9b5c
commit
fcd5df7449
6 changed files with 25 additions and 99 deletions
|
|
@ -1,10 +1,8 @@
|
|||
using System;
|
||||
using MessagePack;
|
||||
|
||||
[MessagePackObject, Serializable]
|
||||
[Serializable]
|
||||
public class EntitySettings
|
||||
{
|
||||
[Key(0)]
|
||||
public float ShutdownPerformance = .1f;
|
||||
|
||||
public EntitySettings Copy()
|
||||
|
|
|
|||
|
|
@ -7,55 +7,33 @@ 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;
|
||||
|
||||
[Union(0, typeof(SimpleCommodity)),
|
||||
Union(1, typeof(CompoundCommodity)),
|
||||
Union(2, typeof(EquippableItem)),
|
||||
Union(3, typeof(ConsumableItem))]
|
||||
public abstract class ItemInstance
|
||||
{
|
||||
[Key(0)] public DatabaseLink<ItemData> Data;
|
||||
[Key(1)] public ItemRotation Rotation;
|
||||
public DatabaseLink<ItemData> Data;
|
||||
public ItemRotation Rotation;
|
||||
}
|
||||
|
||||
[Union(0, typeof(CompoundCommodity)),
|
||||
Union(1, typeof(EquippableItem)),
|
||||
Union(2, typeof(ConsumableItem))]
|
||||
public abstract class CraftedItemInstance : ItemInstance
|
||||
{
|
||||
[Key(2)] public float Quality;
|
||||
|
||||
//[Key(3)] public List<ItemInstance> Ingredients = new List<ItemInstance>();
|
||||
|
||||
//[Key(4)] public Guid Blueprint;
|
||||
|
||||
//[Key(3)] public string Name;
|
||||
|
||||
//[Key(4)] public Guid SourceEntity;
|
||||
public float Quality;
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public class CompoundCommodity : CraftedItemInstance { }
|
||||
|
||||
[MessagePackObject]
|
||||
public class SimpleCommodity : ItemInstance
|
||||
{
|
||||
[Key(2)] public int Quantity;
|
||||
public int Quantity;
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public class EquippableItem : CraftedItemInstance
|
||||
{
|
||||
[Key(7)] public float Durability;
|
||||
[Key(8)] public bool OverrideShutdown;
|
||||
public float Durability;
|
||||
public bool OverrideShutdown;
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public class ConsumableItem : CraftedItemInstance
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,21 +7,13 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using MessagePack;
|
||||
using UniRx;
|
||||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
using quaternion = Unity.Mathematics.quaternion;
|
||||
|
||||
[MessagePackObject]
|
||||
public class Ship : Entity
|
||||
{
|
||||
|
||||
// [Key("bindings")] public Dictionary<KeyCode,Guid> Bindings = new Dictionary<KeyCode,Guid>();
|
||||
//[IgnoreMember] public int HullHardpointCount;
|
||||
|
||||
// [IgnoreMember] public Dictionary<Targetable, float> Contacts = new Dictionary<Targetable, float>();
|
||||
// [IgnoreMember] public Targetable Target;
|
||||
public Entity HomeEntity;
|
||||
public float2 MovementDirection;
|
||||
public bool IsPlayerShip;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using MessagePack;
|
||||
using UniRx;
|
||||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
|
|
@ -22,140 +21,96 @@ public class ZonePack
|
|||
public double Time;
|
||||
}
|
||||
|
||||
[MessagePackObject,
|
||||
Union(0, typeof(PlanetData)),
|
||||
Union(1, typeof(AsteroidBeltData)),
|
||||
Union(2, typeof(GasGiantData)),
|
||||
Union(3, typeof(SunData))]
|
||||
public abstract class BodyData : DatabaseEntry, INamedEntry
|
||||
{
|
||||
[Key(1)]
|
||||
public string Name = "";
|
||||
|
||||
[Key(2)]
|
||||
public Guid Orbit;
|
||||
|
||||
[Key(3)]
|
||||
public float Mass = 0;
|
||||
|
||||
[Key(4)]
|
||||
public Dictionary<Guid, float> Resources = new Dictionary<Guid, float>();
|
||||
|
||||
[Key(5)]
|
||||
public float BodyRadiusMultiplier = 1;
|
||||
|
||||
[Key(6)]
|
||||
public float GravityRadiusMultiplier = 1;
|
||||
|
||||
[Key(7)]
|
||||
public float GravityDepthMultiplier = 1;
|
||||
|
||||
[Key(8)]
|
||||
public float GravityDepthExponent = 16;
|
||||
|
||||
[IgnoreMember] public string EntryName
|
||||
public string EntryName
|
||||
{
|
||||
get => Name;
|
||||
set => Name = value;
|
||||
}
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public class PlanetData : BodyData
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public class AsteroidBeltData : BodyData
|
||||
{
|
||||
[Key(9)]
|
||||
public Asteroid[] Asteroids;
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public class GasGiantData : BodyData
|
||||
{
|
||||
[Key(9)]
|
||||
public float FirstOffsetDomainRotationSpeed = 1;
|
||||
|
||||
[Key(10)]
|
||||
public float FirstOffsetRotationSpeed = 1;
|
||||
|
||||
[Key(11)]
|
||||
public float SecondOffsetDomainRotationSpeed = 1;
|
||||
|
||||
[Key(12)]
|
||||
public float SecondOffsetRotationSpeed = 1;
|
||||
|
||||
[Key(13)]
|
||||
public float AlbedoRotationSpeed = 1;
|
||||
|
||||
[Key(14)]
|
||||
public float WaveRadiusMultiplier = 1;
|
||||
|
||||
[Key(15)]
|
||||
public float WaveDepthMultiplier = 1;
|
||||
|
||||
[Key(16)]
|
||||
public float WaveDepthExponent = 8;
|
||||
|
||||
[Key(17)]
|
||||
public float WaveSpeedMultiplier = 8;
|
||||
|
||||
[Key(18)]
|
||||
public List<string> MaterialOverrides = new List<string>();
|
||||
|
||||
[Key(19)]
|
||||
public float4[] Colors = new float4[0];
|
||||
}
|
||||
|
||||
public class SunData : GasGiantData
|
||||
{
|
||||
[Key(20)]
|
||||
public float3 LightColor = float3.zero;
|
||||
|
||||
[Key(21)]
|
||||
public float3 FogTintColor = float3.zero;
|
||||
|
||||
[Key(22)]
|
||||
public float LightRadiusMultiplier = 1;
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public class Asteroid
|
||||
{
|
||||
[Key(0)]
|
||||
public float Distance;
|
||||
|
||||
[Key(1)]
|
||||
public float Phase;
|
||||
|
||||
[Key(2)]
|
||||
public float Size;
|
||||
|
||||
[Key(3)]
|
||||
public float RotationSpeed;
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public class OrbitData : DatabaseEntry
|
||||
{
|
||||
[Key(1)]
|
||||
public Guid Parent;
|
||||
|
||||
[Key(2)]
|
||||
public float Distance;
|
||||
|
||||
[Key(3)]
|
||||
public float Phase;
|
||||
|
||||
[Key(4)]
|
||||
public float2 FixedPosition = float2.zero;
|
||||
|
||||
// [Key(4)]
|
||||
// public float Period;
|
||||
|
||||
public static float2 Evaluate(float phase)
|
||||
{
|
||||
phase *= PI * 2;
|
||||
|
|
|
|||
Loading…
Reference in a new issue