Blueprints & Resources

Added the ability to associate simple commodities with resource maps
Added resource placement to zone generator
Added crafting blueprints and stat addressing system
Refactored Thrusters and Shields into Behaviors
Fixed server losing database connection
Updated icons
This commit is contained in:
hyperion51 2020-04-09 07:48:45 +01:00
commit fd92c80876
58 changed files with 1399 additions and 855 deletions

View file

@ -6,33 +6,31 @@ using Newtonsoft.Json;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[RethinkTable("Galaxy")]
[MessagePackObject]
[JsonObject(MemberSerialization.OptIn)]
[RethinkTable("Galaxy"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class ZoneData : DatabaseEntry, INamedEntry
{
[JsonProperty("name")] [Key(1)]
[JsonProperty("name"), Key(1)]
public string Name;
[JsonProperty("position")] [Key(2)]
[JsonProperty("position"), Key(2)]
public float2 Position = 500;
[JsonProperty("wormholes")] [Key(3)]
[JsonProperty("wormholes"), Key(3)]
public List<Guid> Wormholes = new List<Guid>();
[JsonProperty("stations")] [Key(4)]
[JsonProperty("stations"), Key(4)]
public List<Guid> Stations = new List<Guid>();
[JsonProperty("planets")] [Key(5)]
[JsonProperty("planets"), Key(5)]
public List<Guid> Planets = new List<Guid>();
[JsonProperty("orbits")] [Key(6)]
[JsonProperty("orbits"), Key(6)]
public List<Guid> Orbits = new List<Guid>();
[JsonProperty("radius")] [Key(7)]
[JsonProperty("radius"), Key(7)]
public float Radius = 2000;
[JsonProperty("visited")] [Key(8)]
[JsonProperty("visited"), Key(8)]
public bool Visited;
[IgnoreMember] public string EntryName
@ -42,31 +40,29 @@ public class ZoneData : DatabaseEntry, INamedEntry
}
}
[RethinkTable("Galaxy")]
[MessagePackObject]
[JsonObject(MemberSerialization.OptIn)]
[RethinkTable("Galaxy"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class Station : DatabaseEntry, INamedEntry
{
[JsonProperty("name")] [Key(1)]
[JsonProperty("name"), Key(1)]
public string Name;
// Can be Planet or Orbit
[JsonProperty("parent")] [Key(2)]
[JsonProperty("parent"), Key(2)]
public Guid Parent;
[JsonProperty("owner")] [Key(3)]
[JsonProperty("owner"), Key(3)]
public Guid Owner;
[JsonProperty("inventory")] [Key(4)]
[JsonProperty("inventory"), Key(4)]
public List<ItemInstance> Inventory = new List<ItemInstance>();
[JsonProperty("buying")] [Key(5)]
[JsonProperty("buying"), Key(5)]
public Dictionary<Guid, float> BuyPrices = new Dictionary<Guid, float>();
[JsonProperty("selling")] [Key(6)]
[JsonProperty("selling"), Key(6)]
public Dictionary<Guid, float> SellPrices = new Dictionary<Guid, float>();
[JsonProperty("zone")] [Key(7)]
[JsonProperty("zone"), Key(7)]
public Guid Zone;
[IgnoreMember] public string EntryName
@ -76,25 +72,26 @@ public class Station : DatabaseEntry, INamedEntry
}
}
[RethinkTable("Galaxy")]
[MessagePackObject]
[JsonObject(MemberSerialization.OptIn)]
[RethinkTable("Galaxy"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class PlanetData : DatabaseEntry, INamedEntry
{
[JsonProperty("name")] [Key(1)]
[JsonProperty("name"), Key(1)]
public string Name;
[JsonProperty("orbit")] [Key(2)]
[JsonProperty("orbit"), Key(2)]
public Guid Orbit;
[JsonProperty("mass")] [Key(3)]
[JsonProperty("mass"), Key(3)]
public float Mass;
[JsonProperty("zone")] [Key(4)]
[JsonProperty("zone"), Key(4)]
public Guid Zone;
[JsonProperty("belt")] [Key(5)]
[JsonProperty("belt"), Key(5)]
public bool Belt;
[JsonProperty("resources"), Key(5)]
public Dictionary<Guid, float> Resources = new Dictionary<Guid, float>();
// [JsonProperty("radius")] [Key(5)]
// public float GravityRadius;
@ -106,24 +103,22 @@ public class PlanetData : DatabaseEntry, INamedEntry
}
}
[RethinkTable("Galaxy")]
[MessagePackObject]
[JsonObject(MemberSerialization.OptIn)]
[RethinkTable("Galaxy"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class OrbitData : DatabaseEntry
{
[JsonProperty("parent")] [Key(1)]
[JsonProperty("parent"), Key(1)]
public Guid Parent;
[JsonProperty("distance")] [Key(2)]
[JsonProperty("distance"), Key(2)]
public float Distance;
[JsonProperty("phase")] [Key(3)]
[JsonProperty("phase"), Key(3)]
public float Phase;
[JsonProperty("period")] [Key(4)]
[JsonProperty("period"), Key(4)]
public float Period;
[JsonProperty("zone")] [Key(5)]
[JsonProperty("zone"), Key(5)]
public Guid Zone;
public static float2 Evaluate(float phase)