2026-06-13 04:30:24 +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 MessagePack;
|
2020-11-29 22:50:12 +00:00
|
|
|
using UniRx;
|
2020-03-24 00:02:23 +00:00
|
|
|
using Unity.Mathematics;
|
2020-03-29 04:19:24 +01:00
|
|
|
using static Unity.Mathematics.math;
|
2021-03-08 22:58:37 +00:00
|
|
|
using float2 = Unity.Mathematics.float2;
|
2020-11-29 22:50:12 +00:00
|
|
|
using float3 = Unity.Mathematics.float3;
|
2020-03-22 19:05:26 +00:00
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[MessagePackObject]
|
2021-03-15 11:40:46 +00:00
|
|
|
public class ZonePack
|
2020-11-27 22:47:33 +00:00
|
|
|
{
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(0)]
|
2020-11-29 22:50:12 +00:00
|
|
|
public List<BodyData> Planets = new List<BodyData>();
|
2026-06-13 04:56:50 +01:00
|
|
|
|
|
|
|
|
[Key(1)]
|
2020-11-27 22:47:33 +00:00
|
|
|
public List<OrbitData> Orbits = new List<OrbitData>();
|
2026-06-13 04:56:50 +01:00
|
|
|
|
|
|
|
|
[Key(2)]
|
2021-03-13 03:23:58 +00:00
|
|
|
public List<EntityPack> Entities = new List<EntityPack>();
|
2026-06-13 04:56:50 +01:00
|
|
|
|
|
|
|
|
[Key(3)]
|
2021-03-15 11:40:46 +00:00
|
|
|
public float Radius = 2000;
|
|
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(4)]
|
2021-03-15 11:40:46 +00:00
|
|
|
public float Mass = 10000;
|
2021-03-27 10:03:24 +00:00
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(5)]
|
2021-03-27 10:03:24 +00:00
|
|
|
public double Time;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
|
|
|
|
|
2020-11-27 22:47:33 +00:00
|
|
|
}
|
|
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
// [LegacyCatalogGroup("Galaxy"), MessagePackObject]
|
2020-06-01 03:11:04 +01:00
|
|
|
// public class StationData : DatabaseEntry, INamedEntry
|
|
|
|
|
// {
|
2026-06-13 04:56:50 +01:00
|
|
|
// [Key(1)]
|
2020-06-01 03:11:04 +01:00
|
|
|
// public string Name;
|
2026-06-13 04:56:50 +01:00
|
|
|
//
|
2020-06-01 03:11:04 +01:00
|
|
|
// // Can be Planet or Orbit
|
2026-06-13 04:56:50 +01:00
|
|
|
// [Key(2)]
|
2020-06-01 03:11:04 +01:00
|
|
|
// public Guid Parent;
|
|
|
|
|
//
|
2026-06-13 04:56:50 +01:00
|
|
|
// [Key(3)]
|
2020-06-01 03:11:04 +01:00
|
|
|
// public Guid Owner;
|
|
|
|
|
//
|
2026-06-13 04:56:50 +01:00
|
|
|
// [Key(4)]
|
2020-06-01 03:11:04 +01:00
|
|
|
// public List<ItemInstance> Inventory = new List<ItemInstance>();
|
|
|
|
|
//
|
2026-06-13 04:56:50 +01:00
|
|
|
// [Key(5)]
|
2020-06-01 03:11:04 +01:00
|
|
|
// public Dictionary<Guid, float> BuyPrices = new Dictionary<Guid, float>();
|
|
|
|
|
//
|
2026-06-13 04:56:50 +01:00
|
|
|
// [Key(6)]
|
2020-06-01 03:11:04 +01:00
|
|
|
// public Dictionary<Guid, float> SellPrices = new Dictionary<Guid, float>();
|
|
|
|
|
//
|
2026-06-13 04:56:50 +01:00
|
|
|
// [Key(7)]
|
2020-06-01 03:11:04 +01:00
|
|
|
// public Guid Zone;
|
2026-06-13 04:56:50 +01:00
|
|
|
//
|
2020-06-01 03:11:04 +01:00
|
|
|
// [IgnoreMember] public string EntryName
|
|
|
|
|
// {
|
|
|
|
|
// get => Name;
|
|
|
|
|
// set => Name = value;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
2020-03-22 19:05:26 +00:00
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[MessagePackObject,
|
2020-11-29 22:50:12 +00:00
|
|
|
Union(0, typeof(PlanetData)),
|
2020-11-27 22:47:33 +00:00
|
|
|
Union(1, typeof(AsteroidBeltData)),
|
|
|
|
|
Union(2, typeof(GasGiantData)),
|
|
|
|
|
Union(3, typeof(SunData))]
|
2020-11-29 22:50:12 +00:00
|
|
|
public abstract class BodyData : DatabaseEntry, INamedEntry
|
2020-03-22 19:05:26 +00:00
|
|
|
{
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(1)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public string Name = "";
|
2020-04-09 07:48:45 +01:00
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(2)]
|
2020-03-22 19:05:26 +00:00
|
|
|
public Guid Orbit;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(3)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public float Mass = 0;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(4)]
|
2020-04-09 07:48:45 +01:00
|
|
|
public Dictionary<Guid, float> Resources = new Dictionary<Guid, float>();
|
2020-05-02 01:30:33 +01:00
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(5)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public float BodyRadiusMultiplier = 1;
|
2020-12-01 00:16:11 +00:00
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(6)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public float GravityRadiusMultiplier = 1;
|
2020-11-27 22:47:33 +00:00
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(7)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public float GravityDepthMultiplier = 1;
|
2020-11-29 22:50:12 +00:00
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(8)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public float GravityDepthExponent = 16;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
2020-03-22 19:05:26 +00:00
|
|
|
[IgnoreMember] public string EntryName
|
|
|
|
|
{
|
2025-07-18 00:21:33 +01:00
|
|
|
get => Name;
|
|
|
|
|
set => Name = value;
|
2020-03-22 19:05:26 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[MessagePackObject]
|
2020-11-29 22:50:12 +00:00
|
|
|
public class PlanetData : BodyData
|
2020-11-27 22:47:33 +00:00
|
|
|
{
|
2026-06-13 04:56:50 +01:00
|
|
|
|
2020-11-29 22:50:12 +00:00
|
|
|
}
|
|
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[MessagePackObject]
|
2020-11-29 22:50:12 +00:00
|
|
|
public class AsteroidBeltData : BodyData
|
|
|
|
|
{
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(9)]
|
2020-11-27 22:47:33 +00:00
|
|
|
public Asteroid[] Asteroids;
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[MessagePackObject]
|
2020-11-29 22:50:12 +00:00
|
|
|
public class GasGiantData : BodyData
|
2020-11-27 22:47:33 +00:00
|
|
|
{
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(9)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public float FirstOffsetDomainRotationSpeed = 1;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
|
|
|
|
[Key(10)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public float FirstOffsetRotationSpeed = 1;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
|
|
|
|
[Key(11)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public float SecondOffsetDomainRotationSpeed = 1;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
|
|
|
|
[Key(12)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public float SecondOffsetRotationSpeed = 1;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
|
|
|
|
[Key(13)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public float AlbedoRotationSpeed = 1;
|
2020-12-01 00:16:11 +00:00
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(14)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public float WaveRadiusMultiplier = 1;
|
2020-12-01 00:16:11 +00:00
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(15)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public float WaveDepthMultiplier = 1;
|
2020-12-01 00:16:11 +00:00
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(16)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public float WaveDepthExponent = 8;
|
2020-12-01 00:16:11 +00:00
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(17)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public float WaveSpeedMultiplier = 8;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
|
|
|
|
[Key(18)]
|
2020-11-27 22:47:33 +00:00
|
|
|
public List<string> MaterialOverrides = new List<string>();
|
2026-06-13 04:56:50 +01:00
|
|
|
|
|
|
|
|
[Key(19)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public float4[] Colors = new float4[0];
|
2020-11-27 22:47:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class SunData : GasGiantData
|
|
|
|
|
{
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(20)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public float3 LightColor = float3.zero;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
|
|
|
|
[Key(21)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public float3 FogTintColor = float3.zero;
|
2021-04-12 04:20:52 +01:00
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(22)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public float LightRadiusMultiplier = 1;
|
2020-11-27 22:47:33 +00:00
|
|
|
}
|
|
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[MessagePackObject]
|
2020-05-28 04:50:40 +01:00
|
|
|
public class Asteroid
|
|
|
|
|
{
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(0)]
|
2020-05-28 04:50:40 +01:00
|
|
|
public float Distance;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
|
|
|
|
[Key(1)]
|
2020-05-28 04:50:40 +01:00
|
|
|
public float Phase;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
|
|
|
|
[Key(2)]
|
2020-05-28 04:50:40 +01:00
|
|
|
public float Size;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
|
|
|
|
[Key(3)]
|
2020-05-28 04:50:40 +01:00
|
|
|
public float RotationSpeed;
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[MessagePackObject]
|
2020-03-22 19:05:26 +00:00
|
|
|
public class OrbitData : DatabaseEntry
|
|
|
|
|
{
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(1)]
|
2020-03-29 04:19:24 +01:00
|
|
|
public Guid Parent;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(2)]
|
2025-07-18 00:21:33 +01:00
|
|
|
public float Distance;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
2026-06-13 04:56:50 +01:00
|
|
|
[Key(3)]
|
2020-03-22 19:05:26 +00:00
|
|
|
public float Phase;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
|
|
|
|
[Key(4)]
|
2021-03-08 22:58:37 +00:00
|
|
|
public float2 FixedPosition = float2.zero;
|
2026-06-13 04:56:50 +01:00
|
|
|
|
|
|
|
|
// [Key(4)]
|
2020-12-01 00:16:11 +00:00
|
|
|
// public float Period;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
2020-03-29 04:19:24 +01:00
|
|
|
public static float2 Evaluate(float phase)
|
|
|
|
|
{
|
2020-05-10 00:16:33 +01:00
|
|
|
phase *= PI * 2;
|
2020-05-27 03:43:30 +01:00
|
|
|
return new float2(cos(phase), sin(phase));
|
2020-03-29 04:19:24 +01:00
|
|
|
}
|
2020-03-22 19:05:26 +00:00
|
|
|
}
|