Stat Effects and Tech Tree Improvements

Tech tree layout is now correct thanks to MSAGL
Blueprint stat effects can now target item stats
Durability is now a PerformanceStat
This commit is contained in:
hyperion51 2020-04-16 03:08:18 +01:00
commit d8ff1e2289
23 changed files with 356 additions and 210 deletions

View file

@ -1439,8 +1439,8 @@
<e p="Behaviors" t="Include">
<e p="Afterburner.cs" t="Include" />
<e p="Behaviors.cs" t="Include" />
<e p="Cannon.cs" t="Include" />
<e p="Launcher.cs" t="Include" />
<e p="ProjectileWeapon.cs" t="Include" />
<e p="Radiator.cs" t="Include" />
<e p="Reactor.cs" t="Include" />
<e p="Reflector.cs" t="Include" />
@ -1464,6 +1464,7 @@
<e p="ItemData.cs" t="Include" />
<e p="ItemInstance.cs" t="Include" />
<e p="JsonConverters.cs" t="Include" />
<e p="Locomotion.cs" t="Include" />
<e p="MathFormatters.cs" t="Include" />
<e p="MathResolver.cs" t="Include" />
<e p="Messages.cs" t="Include" />
@ -1870,6 +1871,7 @@
</e>
</e>
</e>
<e p="OrbitalEntity.cs" t="Include" />
<e p="Rect.cs" t="Include" />
<e p="Ship.cs" t="Include" />
<e p="ZoneData.cs" t="Include" />

View file

@ -9,8 +9,8 @@
<e p="Assets\Scripts\ServerShared\Behaviors" t="Include">
<e p="Afterburner.cs" t="Include" />
<e p="Behaviors.cs" t="Include" />
<e p="Cannon.cs" t="Include" />
<e p="Launcher.cs" t="Include" />
<e p="ProjectileWeapon.cs" t="Include" />
<e p="Radiator.cs" t="Include" />
<e p="Reactor.cs" t="Include" />
<e p="Reflector.cs" t="Include" />
@ -33,6 +33,7 @@
<e p="Assets\Scripts\ServerShared\ItemData.cs" t="Include" />
<e p="Assets\Scripts\ServerShared\ItemInstance.cs" t="Include" />
<e p="Assets\Scripts\ServerShared\JsonConverters.cs" t="Include" />
<e p="Assets\Scripts\ServerShared\Locomotion.cs" t="Include" />
<e p="Assets\Scripts\ServerShared\MathFormatters.cs" t="Include" />
<e p="Assets\Scripts\ServerShared\MathResolver.cs" t="Include" />
<e p="Assets\Scripts\ServerShared\Messages.cs" t="Include" />
@ -439,6 +440,7 @@
</e>
</e>
</e>
<e p="Assets\Scripts\ServerShared\OrbitalEntity.cs" t="Include" />
<e p="Assets\Scripts\ServerShared\Rect.cs" t="Include" />
<e p="Assets\Scripts\ServerShared\Ship.cs" t="Include" />
<e p="Assets\Scripts\ServerShared\ZoneData.cs" t="Include" />

View file

@ -1,9 +1,9 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Economy.Shared.Unity", "Economy.Shared.Unity.csproj", "{A62B36C2-E9DE-B992-0779-F5FCF5968986}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{29B684F0-E616-CD9C-EFF8-10A39DB37A52}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Economy.Shared.Unity", "Economy.Shared.Unity.csproj", "{A62B36C2-E9DE-B992-0779-F5FCF5968986}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MessagePack", "MessagePack.csproj", "{21EF11C5-27DC-3D88-B027-9A4B6F36BAE4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-firstpass", "Assembly-CSharp-firstpass.csproj", "{7D8742A4-0DFC-5667-0A98-3CA4312F9253}"
@ -16,14 +16,14 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A62B36C2-E9DE-B992-0779-F5FCF5968986}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A62B36C2-E9DE-B992-0779-F5FCF5968986}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A62B36C2-E9DE-B992-0779-F5FCF5968986}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A62B36C2-E9DE-B992-0779-F5FCF5968986}.Release|Any CPU.Build.0 = Release|Any CPU
{29B684F0-E616-CD9C-EFF8-10A39DB37A52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{29B684F0-E616-CD9C-EFF8-10A39DB37A52}.Debug|Any CPU.Build.0 = Debug|Any CPU
{29B684F0-E616-CD9C-EFF8-10A39DB37A52}.Release|Any CPU.ActiveCfg = Release|Any CPU
{29B684F0-E616-CD9C-EFF8-10A39DB37A52}.Release|Any CPU.Build.0 = Release|Any CPU
{A62B36C2-E9DE-B992-0779-F5FCF5968986}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A62B36C2-E9DE-B992-0779-F5FCF5968986}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A62B36C2-E9DE-B992-0779-F5FCF5968986}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A62B36C2-E9DE-B992-0779-F5FCF5968986}.Release|Any CPU.Build.0 = Release|Any CPU
{21EF11C5-27DC-3D88-B027-9A4B6F36BAE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{21EF11C5-27DC-3D88-B027-9A4B6F36BAE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{21EF11C5-27DC-3D88-B027-9A4B6F36BAE4}.Release|Any CPU.ActiveCfg = Release|Any CPU

View file

@ -503,17 +503,17 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -26.586945
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@ -523,7 +523,7 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
value: 45.17389
objectReference: {fileID: 0}
- target: {fileID: 7200536746924797989, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@ -4593,13 +4593,13 @@ MonoBehaviour:
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_textInfo:
textComponent: {fileID: 258993626}
characterCount: 0
characterCount: 13
spriteCount: 0
spaceCount: 0
wordCount: 0
spaceCount: 2
wordCount: 2
linkCount: 0
lineCount: 0
pageCount: 0
lineCount: 1
pageCount: 1
materialCount: 1
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
@ -11572,17 +11572,17 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -26.586945
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@ -11592,7 +11592,7 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
value: 45.17389
objectReference: {fileID: 0}
- target: {fileID: 7200536746924797989, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@ -12623,17 +12623,17 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -26.586945
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@ -12643,7 +12643,7 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
value: 45.17389
objectReference: {fileID: 0}
- target: {fileID: 7200536746924797989, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@ -17573,13 +17573,13 @@ MonoBehaviour:
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_textInfo:
textComponent: {fileID: 904172350}
characterCount: 0
characterCount: 2
spriteCount: 0
spaceCount: 0
wordCount: 0
wordCount: 1
linkCount: 0
lineCount: 0
pageCount: 0
lineCount: 1
pageCount: 1
materialCount: 1
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
@ -24811,17 +24811,17 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -26.586945
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@ -24831,7 +24831,7 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
value: 45.17389
objectReference: {fileID: 0}
- target: {fileID: 7200536746924797989, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@ -38696,17 +38696,17 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -26.586945
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@ -38716,7 +38716,7 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
value: 45.17389
objectReference: {fileID: 0}
- target: {fileID: 7200536746924797989, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@ -43789,17 +43789,17 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -26.586945
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@ -43809,7 +43809,7 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
value: 45.17389
objectReference: {fileID: 0}
- target: {fileID: 7200536746924797989, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}

View file

@ -784,7 +784,7 @@ public class DatabaseInspector : EditorWindow
{
using (new VerticalScope())
{
var behaviorNames = item.Behaviors.Select(b => b.GetType().Name).ToArray();
var behaviorNames = new []{item.Name}.Concat(item.Behaviors.Select(b => b.GetType().Name)).ToArray();
var selectedBehaviorIndex = Array.IndexOf(behaviorNames, effect.Behavior);
if (selectedBehaviorIndex == -1)
{
@ -794,42 +794,32 @@ public class DatabaseInspector : EditorWindow
using (new HorizontalScope())
{
GUILayout.Label("Behavior", GUILayout.Width(width));
if(behaviorNames.Length==0)
GUILayout.Label("No Behaviors!");
else
{
var newSelection = Popup(selectedBehaviorIndex, behaviorNames);
if (newSelection != selectedBehaviorIndex)
GUI.changed = true;
effect.Behavior = behaviorNames[newSelection];
}
var newSelection = Popup(selectedBehaviorIndex, behaviorNames);
if (newSelection != selectedBehaviorIndex)
GUI.changed = true;
effect.Behavior = behaviorNames[newSelection];
}
using (new HorizontalScope())
{
GUILayout.Label("Stat", GUILayout.Width(width));
if(behaviorNames.Length==0)
GUILayout.Label("No Behaviors!");
var stats = (selectedBehaviorIndex == 0 ? item.GetType() : item.Behaviors[selectedBehaviorIndex-1].GetType()).GetFields()
.Where(f => f.FieldType == typeof(PerformanceStat)).ToArray();
if(stats.Length==0)
GUILayout.Label("No Stats!");
else
{
var stats = item.Behaviors[selectedBehaviorIndex].GetType().GetFields()
.Where(f => f.FieldType == typeof(PerformanceStat)).ToArray();
if(stats.Length==0)
GUILayout.Label("No Stats!");
else
var statNames = stats.Select(s => s.Name).ToArray();
var selectedStatIndex = Array.IndexOf(statNames, effect.Stat);
if (selectedStatIndex == -1)
{
var statNames = stats.Select(s => s.Name).ToArray();
var selectedStatIndex = Array.IndexOf(statNames, effect.Stat);
if (selectedStatIndex == -1)
{
selectedStatIndex = 0;
GUI.changed = true;
}
var newSelection = Popup(selectedStatIndex, statNames);
if (newSelection != selectedStatIndex)
GUI.changed = true;
effect.Stat = statNames[newSelection];
selectedStatIndex = 0;
GUI.changed = true;
}
var newSelection = Popup(selectedStatIndex, statNames);
if (newSelection != selectedStatIndex)
GUI.changed = true;
effect.Stat = statNames[newSelection];
}
}
}

View file

@ -31,7 +31,7 @@ public interface IAnalogBehavior : IBehavior
}
[InspectableField,
Union(0, typeof(CannonData)),
Union(0, typeof(ProjectileWeaponData)),
Union(1, typeof(LauncherData)),
Union(2, typeof(ReactorData)),
Union(3, typeof(RadiatorData)),

View file

@ -2,7 +2,7 @@ using MessagePack;
using Newtonsoft.Json;
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class CannonData : WeaponData, IBehaviorData
public class ProjectileWeaponData : WeaponData, IBehaviorData
{
[InspectablePrefab, JsonProperty("bullet"), Key(9)]
public string BulletPrefab;
@ -18,31 +18,31 @@ public class CannonData : WeaponData, IBehaviorData
public IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
{
return new Cannon(context, this, entity, item);
return new ProjectileWeapon(context, this, entity, item);
}
}
public class Cannon : IActivatedBehavior
public class ProjectileWeapon : IActivatedBehavior
{
private bool _firing;
private float _cooldown; // normalized
private CannonData _cannon;
private ProjectileWeaponData _projectileWeapon;
public Entity Entity { get; }
public Gear Item { get; }
public GameContext Context { get; }
private float _firingVisibility;
public Cannon(GameContext context, CannonData c, Entity entity, Gear item)
public ProjectileWeapon(GameContext context, ProjectileWeaponData c, Entity entity, Gear item)
{
Context = context;
_cannon = c;
_projectileWeapon = c;
Entity = entity;
Item = item;
}
public void Activate()
{
// Debug.Log("Activating Cannon");
// Debug.Log("Activating ProjectileWeapon");
// _firing = true;
// Observable.EveryUpdate().TakeWhile(_ => _firing).Subscribe(_ =>
// {
@ -51,8 +51,8 @@ public class Cannon : IActivatedBehavior
// {
// _cooldown = 1;
// Fire(0);
// if(_cannon.BurstCount>1)
// Observable.Interval(TimeSpan.FromSeconds(_cannon.BurstTime.Evaluate(Hardpoint) / (_cannon.BurstCount-1))).Take(_cannon.BurstCount-1)
// if(_projectileWeapon.BurstCount>1)
// Observable.Interval(TimeSpan.FromSeconds(_projectileWeapon.BurstTime.Evaluate(Hardpoint) / (_projectileWeapon.BurstCount-1))).Take(_projectileWeapon.BurstCount-1)
// .Subscribe(l => Fire(l+1));
// }
// });
@ -60,19 +60,19 @@ public class Cannon : IActivatedBehavior
private void Fire(long b)
{
// _firingVisibility += _cannon.Visibility.Evaluate(Hardpoint);
// Hardpoint.Temperature += _cannon.Heat.Evaluate(Hardpoint) / Hardpoint.HeatCapacity;
// var inst = GameObject.Instantiate(_cannon.BulletPrefab).transform;
// _firingVisibility += _projectileWeapon.Visibility.Evaluate(Hardpoint);
// Hardpoint.Temperature += _projectileWeapon.Heat.Evaluate(Hardpoint) / Hardpoint.HeatCapacity;
// var inst = GameObject.Instantiate(_projectileWeapon.BulletPrefab).transform;
// Physics.IgnoreCollision(Hardpoint.Ship.Ship.GetComponent<Collider>(), inst.GetComponent<Collider>());
// var bullet = inst.GetComponent<Bullet>();
// bullet.Target = Hardpoint.Ship.Ship.Target;
// bullet.Source = Hardpoint.Ship.Ship.Hitpoints;
// bullet.Lifetime = _cannon.Range.Evaluate(Hardpoint) / _cannon.Velocity.Evaluate(Hardpoint);
// bullet.Damage = _cannon.Damage.Evaluate(Hardpoint);
// bullet.Lifetime = _projectileWeapon.Range.Evaluate(Hardpoint) / _projectileWeapon.Velocity.Evaluate(Hardpoint);
// bullet.Damage = _projectileWeapon.Damage.Evaluate(Hardpoint);
// inst.position = Hardpoint.Proxy.position;
// inst.rotation = Hardpoint.Proxy.rotation;
// inst.GetComponent<Rigidbody>().velocity = _cannon.Velocity.Evaluate(Hardpoint) * Vector3.RotateTowards(-inst.forward, Hardpoint.Ship.Ship.Direction, _cannon.Deflection * Mathf.Deg2Rad, 1);
// Hardpoint.Ship.Ship.AudioSource.PlayOneShot(_cannon.Sounds.RandomElement());
// inst.GetComponent<Rigidbody>().velocity = _projectileWeapon.Velocity.Evaluate(Hardpoint) * Vector3.RotateTowards(-inst.forward, Hardpoint.Ship.Ship.Direction, _projectileWeapon.Deflection * Mathf.Deg2Rad, 1);
// Hardpoint.Ship.Ship.AudioSource.PlayOneShot(_projectileWeapon.Sounds.RandomElement());
// Debug.Log($"Firing bullet {b}");
}
@ -87,9 +87,9 @@ public class Cannon : IActivatedBehavior
public void Update(float delta)
{
_cooldown -= delta / Context.Evaluate(_cannon.Cooldown, Item, Entity);
_cooldown -= delta / Context.Evaluate(_projectileWeapon.Cooldown, Item, Entity);
_firingVisibility *= Context.Evaluate(_cannon.VisibilityDecay, Item, Entity);
_firingVisibility *= Context.Evaluate(_projectileWeapon.VisibilityDecay, Item, Entity);
if (_firingVisibility < 0.01f)
{
@ -97,5 +97,5 @@ public class Cannon : IActivatedBehavior
}
}
public IBehaviorData Data => _cannon;
public IBehaviorData Data => _projectileWeapon;
}

View file

@ -1,7 +1,7 @@
using MessagePack;
using Newtonsoft.Json;
[Union(0, typeof(CannonData)),
[Union(0, typeof(ProjectileWeaponData)),
Union(1, typeof(LauncherData))]
public abstract class WeaponData
{

View file

@ -30,7 +30,7 @@ public interface INamedEntry
Union(11, typeof(Player)),
Union(12, typeof(Corporation)),
Union(13, typeof(Ship)),
Union(14, typeof(Station)),
Union(14, typeof(StationData)),
Union(15, typeof(OrbitData)),
Union(16, typeof(PlanetData)),
JsonObject(MemberSerialization.OptIn), JsonConverter(typeof(JsonKnownTypesConverter<DatabaseEntry>))]

View file

@ -14,6 +14,7 @@ public class Entity
public float Energy;
public float2 Position;
public float2 Direction;
public float2 Velocity;
protected readonly GameContext Context;
protected readonly List<IBehavior> Behaviors;

View file

@ -7,23 +7,87 @@ using static Unity.Mathematics.math;
public class GameContext
{
private Action<string> _logger;
private DatabaseCache _cache;
public GlobalData GlobalData => _cache.GetAll<GlobalData>().FirstOrDefault();
private Dictionary<BlueprintStatEffect, PerformanceStat> AffectedStats =
new Dictionary<BlueprintStatEffect, PerformanceStat>();
private double _time;
private float _deltaTime;
public GlobalData GlobalData => Cache.GetAll<GlobalData>().FirstOrDefault();
public DatabaseCache Cache { get; }
public double Time
{
get => _time;
set
{
_deltaTime = (float) (value - _time);
_time = value;
}
}
private Dictionary<ZoneData, Dictionary<DatabaseEntry, Entity>> ZoneContents = new Dictionary<ZoneData, Dictionary<DatabaseEntry, Entity>>();
// private readonly Dictionary<CraftedItemData, int> Tier = new Dictionary<CraftedItemData, int>();
public GameContext(DatabaseCache cache, Action<string> logger)
{
_cache = cache;
Cache = cache;
_logger = logger;
var globalData = _cache.GetAll<GlobalData>().FirstOrDefault();
var globalData = Cache.GetAll<GlobalData>().FirstOrDefault();
if (globalData == null)
{
globalData = new GlobalData();
_cache.Add(globalData);
Cache.Add(globalData);
}
}
public void Log(string s)
{
_logger(s);
}
public Dictionary<DatabaseEntry, Entity> InitializeZone(Guid zoneID)
{
var contents = new Dictionary<DatabaseEntry, Entity>();
var zoneData = Cache.Get<ZoneData>(zoneID);
var planetsData = zoneData.Planets.Select(id => Cache.Get<PlanetData>(id)).ToArray();
var planetEntities = planetsData.ToDictionary(p => p,
p => new OrbitalEntity(this, Enumerable.Empty<Gear>(), Enumerable.Empty<ItemInstance>(), p.Orbit));
foreach(var kvp in planetEntities)
contents.Add(kvp.Key, kvp.Value);
var stationsData = zoneData.Stations.Select(id => Cache.Get<StationData>(id));
var stationEntities = stationsData.ToDictionary(s => s,
s => new OrbitalEntity(this, Enumerable.Empty<Gear>(), Enumerable.Empty<ItemInstance>(), s.Parent));
foreach(var kvp in stationEntities)
contents.Add(kvp.Key, kvp.Value);
ZoneContents.Add(zoneData, contents);
return contents;
}
public void Update()
{
foreach (var kvp in ZoneContents)
{
var zone = kvp.Key;
var entities = kvp.Value.Values;
foreach (var entity in entities)
{
entity.Update(_deltaTime);
}
}
}
public void UnloadZone(ZoneData zone)
{
ZoneContents.Remove(zone);
}
// public int ItemTier(CraftedItemData itemData)
// {
@ -36,22 +100,22 @@ public class GameContext
public ItemData GetData(ItemInstance item)
{
return _cache.Get<ItemData>(item.Data);
return Cache.Get<ItemData>(item.Data);
}
public SimpleCommodityData GetData(SimpleCommodity item)
{
return _cache.Get<SimpleCommodityData>(item.Data);
return Cache.Get<SimpleCommodityData>(item.Data);
}
public CraftedItemData GetData(CraftedItemInstance item)
{
return _cache.Get<CraftedItemData>(item.Data);
return Cache.Get<CraftedItemData>(item.Data);
}
public EquippableItemData GetData(Gear gear)
{
return _cache.Get<EquippableItemData>(gear.Data);
return Cache.Get<EquippableItemData>(gear.Data);
}
public float GetMass(ItemInstance item)
@ -82,16 +146,13 @@ public class GameContext
return 0;
}
private Dictionary<BlueprintStatEffect, PerformanceStat> AffectedStats =
new Dictionary<BlueprintStatEffect, PerformanceStat>();
public PerformanceStat GetAffectedStat(BlueprintData blueprint, BlueprintStatEffect effect)
{
// We've already cached this effect's stat, return it directly
if (AffectedStats.ContainsKey(effect)) return AffectedStats[effect];
// Get the data for the item the blueprint is for, return null if not found or not equippable
var blueprintItem = _cache.Get<EquippableItemData>(blueprint.Item);
var blueprintItem = Cache.Get<EquippableItemData>(blueprint.Item);
if (blueprintItem == null)
{
_logger($"Attempted to get stat effect but Blueprint {blueprint.ID} is not for an equippable item!");
@ -99,25 +160,25 @@ public class GameContext
}
// Get the first behavior of the type specified in the blueprint stat effect, return null if not found
var effectBehavior =
var effectObject = effect.StatReference.Behavior == blueprintItem.Name ? (object) blueprintItem :
blueprintItem.Behaviors.FirstOrDefault(b => b.GetType().Name == effect.StatReference.Behavior);
if (effectBehavior == null)
if (effectObject == null)
{
_logger($"Attempted to get stat effect for Blueprint {blueprint.ID} but stat references missing behavior \"{effect.StatReference.Behavior}\"!");
return AffectedStats[effect] = null;
}
// Get the first field in the behavior matching the name specified in the stat effect, return null if not found
var type = effectBehavior.GetType();
var type = effectObject.GetType();
var field = type.GetField(effect.StatReference.Stat);
if (field == null)
{
_logger($"Attempted to get stat effect for Blueprint {blueprint.ID} but behavior {effect.StatReference.Behavior} does not have a stat named \"{effect.StatReference.Stat}\"!");
_logger($"Attempted to get stat effect for Blueprint {blueprint.ID} but object {effect.StatReference.Behavior} does not have a stat named \"{effect.StatReference.Stat}\"!");
return AffectedStats[effect] = null;
}
// Finally we've confirmed the stat effect is valid, return the affected stat
return AffectedStats[effect] = field.GetValue(effectBehavior) as PerformanceStat;
return AffectedStats[effect] = field.GetValue(effectObject) as PerformanceStat;
}
// Determine quality of either the item itself or the specific ingredient this stat depends on
@ -170,7 +231,7 @@ public class GameContext
var itemData = GetData(item);
var heat = !stat.HeatDependent ? 1 : pow(itemData.Performance(entity.Temperature), Evaluate(itemData.HeatExponent,item));
var durability = !stat.DurabilityDependent ? 1 : pow(item.Durability / itemData.Durability, Evaluate(itemData.DurabilityExponent,item));
var durability = !stat.DurabilityDependent ? 1 : pow(item.Durability / Evaluate(itemData.Durability, item), Evaluate(itemData.DurabilityExponent,item));
var quality = pow(Quality(stat, item), stat.QualityExponent);
var scaleModifier = stat.GetScaleModifiers(entity).Values.Aggregate(1.0f, (current, mod) => current * mod);
@ -185,7 +246,7 @@ public class GameContext
public SimpleCommodity CreateInstance(Guid data, int count)
{
var item = _cache.Get<SimpleCommodityData>(data);
var item = Cache.Get<SimpleCommodityData>(data);
if (item != null)
return new SimpleCommodity
{
@ -200,14 +261,14 @@ public class GameContext
public CraftedItemInstance CreateInstance(Guid data, float quality)
{
var item = _cache.Get<CraftedItemData>(data);
var item = Cache.Get<CraftedItemData>(data);
if (item == null)
{
_logger("Attempted to create crafted item instance using missing or incorrect item id!");
return null;
}
var blueprint = _cache.GetAll<BlueprintData>().FirstOrDefault(b => b.Item == data);
var blueprint = Cache.GetAll<BlueprintData>().FirstOrDefault(b => b.Item == data);
if (blueprint == null)
{
_logger("Attempted to create crafted item instance which has no blueprint!");
@ -216,7 +277,7 @@ public class GameContext
var ingredients = blueprint.Ingredients.SelectMany(ci =>
{
var ingredient = _cache.Get(ci.Key);
var ingredient = Cache.Get(ci.Key);
return ingredient is SimpleCommodityData
? (IEnumerable<ItemInstance>) new[] {CreateInstance(ci.Key, ci.Value)}
: Enumerable.Range(0, ci.Value).Select(i => CreateInstance(ci.Key, quality));
@ -225,15 +286,16 @@ public class GameContext
if (item is EquippableItemData equippableItemData)
{
return new Gear
var newGear = new Gear
{
Context = this,
Data = data,
Durability = equippableItemData.Durability,
ID = Guid.NewGuid(),
Ingredients = ingredients,
Quality = quality
};
newGear.Durability = Evaluate(equippableItemData.Durability, newGear);
return newGear;
}
return new CompoundCommodity
@ -245,4 +307,4 @@ public class GameContext
Quality = quality
};
}
}
}

View file

@ -87,8 +87,8 @@ public abstract class EquippableItemData : CraftedItemData
[TemperatureInspectable, JsonProperty("maxTemp"), Key(9)]
public float MaximumTemperature;
[InspectableField, JsonProperty("durability"), Key(10)]
public float Durability;
[InspectableField, JsonProperty("durabilityStat"), Key(10)]
public PerformanceStat Durability = new PerformanceStat();
[InspectableField, JsonProperty("durabilityExponent"), Key(11)]
public PerformanceStat DurabilityExponent = new PerformanceStat();

View file

@ -0,0 +1,17 @@
using System.Collections;
using System.Collections.Generic;
public class Locomotion
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c3af5050375d08242a52bdf7f7de558e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,54 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.Mathematics;
using static Unity.Mathematics.math;
using float2 = Unity.Mathematics.float2;
public class OrbitalEntity : Entity
{
private Guid _orbitData;
private static Dictionary<Guid, float2> _orbitPositions = new Dictionary<Guid, float2>();
public OrbitalEntity(GameContext context, IEnumerable<Gear> items, IEnumerable<ItemInstance> cargo, Guid orbit) : base(context, items, cargo)
{
_orbitData = orbit;
}
public static void ClearOrbits()
{
_orbitPositions.Clear();
}
// Determine orbital position recursively, caching parent positions to avoid repeated calculations
private float2 GetOrbitPosition(Guid orbit)
{
// Root orbit is fixed at center
if(orbit==Guid.Empty)
return float2.zero;
if (!_orbitPositions.ContainsKey(orbit))
{
var orbitData = Context.Cache.Get<OrbitData>(orbit);
_orbitPositions[orbit] = GetOrbitPosition(orbitData.Parent) + (orbitData.Period < .01f ? float2.zero :
OrbitData.Evaluate((float) (Context.Time / -orbitData.Period + orbitData.Phase)) *
orbitData.Distance);
}
var position = _orbitPositions[orbit];
if (float.IsNaN(position.x))
{
Context.Log("Orbit position is NaN, something went very wrong!");
return float2.zero;
}
return _orbitPositions[orbit];
}
public override void Update(float delta)
{
var newPosition = GetOrbitPosition(_orbitData);
Velocity = (newPosition - Position) / delta;
Position = newPosition;
base.Update(delta);
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f27ff1f1a3592a446ac8e200a46f7bc0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -20,10 +20,8 @@ public class Ship : Entity
// [IgnoreMember] public Dictionary<Targetable, float> Contacts = new Dictionary<Targetable, float>();
// [IgnoreMember] public Targetable Target;
[IgnoreMember] public float2 Velocity;
private HullData _hullData;
public Ship(GameContext context, IEnumerable<Gear> items, IEnumerable<ItemInstance> cargo) : base(context, items, cargo)
{

View file

@ -41,7 +41,7 @@ public class ZoneData : DatabaseEntry, INamedEntry
}
[RethinkTable("Galaxy"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class Station : DatabaseEntry, INamedEntry
public class StationData : DatabaseEntry, INamedEntry
{
[JsonProperty("name"), Key(1)]
public string Name;
@ -90,7 +90,7 @@ public class PlanetData : DatabaseEntry, INamedEntry
[JsonProperty("belt"), Key(5)]
public bool Belt;
[JsonProperty("resources"), Key(5)]
[JsonProperty("resources"), Key(6)]
public Dictionary<Guid, float> Resources = new Dictionary<Guid, float>();
// [JsonProperty("radius")] [Key(5)]

View file

@ -34,6 +34,7 @@ public class StrategyGameManager : MonoBehaviour
public float ZoneMassPower = .5f;
public MeshRenderer ZoneBackground;
public MeshRenderer ZoneBoundary;
public bool TestMode;
private DatabaseCache _cache;
private GameContext _context;
@ -43,13 +44,11 @@ public class StrategyGameManager : MonoBehaviour
private Guid _populatedZone;
private Guid _selectedZone;
private GalaxyZone _selectedGalaxyZone;
private ZoneResponseMessage _zoneResponse;
private Dictionary<Guid, GalaxyResponseZone> _galaxyResponseZones;
private Dictionary<Guid, GalaxyZone> _galaxyZoneObjects = new Dictionary<Guid, GalaxyZone>();
private Dictionary<Guid, ZoneObject> _zoneObjects = new Dictionary<Guid, ZoneObject>();
private Dictionary<Guid, ParticleSystem> _zoneBelts = new Dictionary<Guid, ParticleSystem>();
private Dictionary<OrbitalEntity, ZoneObject> _zoneObjects = new Dictionary<OrbitalEntity, ZoneObject>();
private Dictionary<OrbitalEntity, ParticleSystem> _zoneBelts = new Dictionary<OrbitalEntity, ParticleSystem>();
private List<ZoneObject> _wormholes = new List<ZoneObject>();
private Dictionary<Guid, float2> _orbitPositions = new Dictionary<Guid, float2>();
private Vector3 _galaxyCameraPos = -Vector3.forward;
private float _galaxyOrthoSize = 50;
private Material _boundaryMaterial;
@ -60,36 +59,41 @@ public class StrategyGameManager : MonoBehaviour
{
_galaxyOrthoSize = GalaxyScale / 2;
_cache = new DatabaseCache();
// Request galaxy description from the server
CultClient.Send(new GalaxyRequestMessage());
// Request blueprints from the server
CultClient.Send(new BlueprintsRequestMessage());
// Listen for the server's galaxy description
CultClient.AddMessageListener<GalaxyResponseMessage>(galaxy =>
if (TestMode)
{
_galaxy = galaxy;
_galaxyResponseZones = _galaxy.Zones.ToDictionary(z => z.ZoneID);
_cache.Add(_galaxy.GlobalData, true);
_context = new GameContext(_cache, Debug.Log);
if (_currentTab == GalaxyTabButton && !_galaxyPopulated) PopulateGalaxy();
});
CultClient.AddMessageListener<BlueprintsResponseMessage>(response => _cache.AddAll(response.Blueprints, true));
// Listen for zone descriptions from the server
CultClient.AddMessageListener<ZoneResponseMessage>(zone =>
}
else
{
_zoneResponse = zone;
// Request galaxy description from the server
CultClient.Send(new GalaxyRequestMessage());
// Request blueprints from the server
CultClient.Send(new BlueprintsRequestMessage());
// Listen for the server's galaxy description
CultClient.AddMessageListener<GalaxyResponseMessage>(galaxy =>
{
_galaxy = galaxy;
_galaxyResponseZones = _galaxy.Zones.ToDictionary(z => z.ZoneID);
_cache.Add(_galaxy.GlobalData, true);
_context = new GameContext(_cache, Debug.Log);
if (_currentTab == GalaxyTabButton && !_galaxyPopulated) PopulateGalaxy();
});
CultClient.AddMessageListener<BlueprintsResponseMessage>(response => _cache.AddAll(response.Blueprints, true));
// Listen for zone descriptions from the server
CultClient.AddMessageListener<ZoneResponseMessage>(zone =>
{
// Cache zone data and contents
_cache.Add(zone.Zone);
foreach (var entry in zone.Contents) _cache.Add(entry);
// Cache zone data and contents
_cache.Add(zone.Zone);
foreach (var entry in zone.Contents) _cache.Add(entry);
if (_currentTab == ZoneTabButton && _populatedZone != zone.Zone.ID) PopulateZone();
});
if (_currentTab == ZoneTabButton && _populatedZone != zone.Zone.ID) PopulateZone();
});
}
PrimaryTabGroup.OnTabChange += button =>
{
@ -103,7 +107,7 @@ public class StrategyGameManager : MonoBehaviour
if (_currentTab == ZoneTabButton)
{
if (_populatedZone != _selectedZone && _zoneResponse?.Zone.ID == _selectedZone)
if (_populatedZone != _selectedZone)
PopulateZone();
Camera.transform.position = -Vector3.forward;
}
@ -112,6 +116,7 @@ public class StrategyGameManager : MonoBehaviour
{
if (!_techLayoutGenerated)
{
TechTree.Initialize();
TechTree.Blueprints = _cache.GetAll<BlueprintData>().ToArray();
TechTree.GenerateTechs();
}
@ -124,6 +129,8 @@ public class StrategyGameManager : MonoBehaviour
private void Update()
{
_context.Time = Time.time;
_context.Update();
if (_currentTab == GalaxyTabButton)
{
_galaxyCameraPos = Camera.transform.position;
@ -131,47 +138,18 @@ public class StrategyGameManager : MonoBehaviour
}
if (_currentTab == ZoneTabButton && _populatedZone == _selectedZone)
{
_orbitPositions.Clear();
foreach (var planet in _zoneObjects)
{
var planetData = _cache.Get<PlanetData>(planet.Key);
planet.Value.transform.position = (Vector2) GetOrbitPosition(planetData.Orbit) * ZoneSizeScale;
planet.Value.transform.position = (Vector2) planet.Key.Position * ZoneSizeScale;
}
foreach (var belt in _zoneBelts)
{
var planetData = _cache.Get<PlanetData>(belt.Key);
belt.Value.transform.position = float3(GetOrbitPosition(_cache.Get<OrbitData>(planetData.Orbit).Parent) * ZoneSizeScale, .15f);
belt.Value.transform.position = float3(belt.Key.Position * ZoneSizeScale, .15f);
}
}
}
// Determine orbital position recursively, caching parent positions to avoid repeated calculations
private float2 GetOrbitPosition(Guid orbit)
{
// Root orbit is fixed at center
if(orbit==Guid.Empty)
return float2.zero;
if (!_orbitPositions.ContainsKey(orbit))
{
var orbitData = _cache.Get<OrbitData>(orbit);
_orbitPositions[orbit] = GetOrbitPosition(orbitData.Parent) + (orbitData.Period < .01f ? float2.zero :
OrbitData.Evaluate(Time.time / -orbitData.Period + orbitData.Phase) *
orbitData.Distance);
}
var position = _orbitPositions[orbit];
if (float.IsNaN(position.x))
{
Debug.Log("Orbit position is NaN, something went very wrong!");
return float2.zero;
}
return _orbitPositions[orbit];
}
void PopulateGalaxy()
{
_galaxyPopulated = true;
@ -240,40 +218,48 @@ public class StrategyGameManager : MonoBehaviour
foreach (var belt in _zoneBelts.Values) Destroy(belt.gameObject);
_zoneBelts.Clear();
if(_populatedZone!=Guid.Empty)
_context.UnloadZone(_cache.Get<ZoneData>(_populatedZone));
_populatedZone = _selectedZone;
var zoneData = _cache.Get<ZoneData>(_populatedZone);
var zoneContents = _context.InitializeZone(_populatedZone);
float zoneDepth = 0;
foreach (var entry in _zoneResponse.Contents)
foreach (var kvp in zoneContents)
{
if (entry is PlanetData planet)
var entity = kvp.Value;
if (kvp.Key is PlanetData planetData)
{
if (!planet.Belt)
if (!planetData.Belt)
{
var planetObject = Instantiate(ZoneObjectPrefab, ZoneRoot);
_zoneObjects[planet.ID] = planetObject;
planetObject.Label.text = planet.Name;
_zoneObjects[entity as OrbitalEntity] = planetObject;
planetObject.Label.text = planetData.Name;
planetObject.GravityMesh.gameObject.SetActive(true);
planetObject.GravityMesh.transform.localScale =
Vector3.one * (pow(planet.Mass, _context.GlobalData.GravityRadiusExponent) *
Vector3.one * (pow(planetData.Mass, _context.GlobalData.GravityRadiusExponent) *
_context.GlobalData.GravityRadiusMultiplier * 2 * ZoneSizeScale);
var depth = pow(planet.Mass, ZoneMassPower) * ZoneMassScale;
var depth = pow(planetData.Mass, ZoneMassPower) * ZoneMassScale;
if (depth > zoneDepth)
zoneDepth = depth;
planetObject.GravityMesh.material.SetFloat("_Depth", depth);
planetObject.Icon.material.SetTexture("_MainTex",
planet.Mass > _context.GlobalData.SunMass ? SunSprite :
planet.Mass > _context.GlobalData.GasGiantMass ? GasGiantSprite :
planetData.Mass > _context.GlobalData.SunMass ? SunSprite :
planetData.Mass > _context.GlobalData.GasGiantMass ? GasGiantSprite :
PlanetSprite);
}
else
{
var beltObject = Instantiate(BeltPrefab, ZoneRoot);
_zoneBelts[planet.ID] = beltObject;
var orbit = _cache.Get<OrbitData>(planet.Orbit);
var orbit = _cache.Get<OrbitData>(planetData.Orbit);
_zoneBelts[entity as OrbitalEntity] = beltObject;
var beltEmission = beltObject.emission;
beltEmission.rateOverTime =
new ParticleSystem.MinMaxCurve(
pow(planet.Mass,_context.GlobalData.BeltMassExponent)
pow(planetData.Mass,_context.GlobalData.BeltMassExponent)
/ _context.GlobalData.BeltMassRatio * orbit.Distance);
var beltShape = beltObject.shape;
beltShape.radius = orbit.Distance * ZoneSizeScale;
@ -285,18 +271,19 @@ public class StrategyGameManager : MonoBehaviour
}
}
}
var radius = (_zoneResponse.Zone.Radius * ZoneSizeScale * 2);
var radius = (zoneData.Radius * ZoneSizeScale * 2);
_backgroundMaterial.SetFloat("_ClipDistance", radius);
_backgroundMaterial.SetFloat("_HeightRange", zoneDepth + _boundaryMaterial.GetFloat("_Depth"));
ZoneBoundary.transform.localScale = Vector3.one * radius;
foreach (var wormhole in _zoneResponse.Zone.Wormholes)
foreach (var wormhole in zoneData.Wormholes)
{
var otherZone = _galaxyResponseZones[wormhole];
var wormholeObject = Instantiate(ZoneObjectPrefab, ZoneRoot);
_wormholes.Add(wormholeObject);
var direction = otherZone.Position - _zoneResponse.Zone.Position;
wormholeObject.transform.position = (Vector2) (normalize(direction) * _zoneResponse.Zone.Radius * .95f * ZoneSizeScale);
var direction = otherZone.Position - zoneData.Position;
wormholeObject.transform.position = (Vector2) (normalize(direction) * zoneData.Radius * .95f * ZoneSizeScale);
wormholeObject.GravityMesh.gameObject.SetActive(false);
wormholeObject.Icon.material.SetTexture("_MainTex", WormholeSprite);
wormholeObject.Label.text = otherZone.Name;

View file

@ -72,6 +72,12 @@ public class TechTreeMsagl : MonoBehaviour
public BlueprintData[] Blueprints { get; set; }
void Start()
{
if(TestMode)
Initialize();
}
public void Initialize()
{
_icons = Resources.LoadAll<Texture2D>(IconsPath);
}
@ -159,18 +165,21 @@ public class TechTreeMsagl : MonoBehaviour
foreach (var sourceBlueprint in Blueprints.Where(sb =>
targetBlueprint.Dependencies.Any(dep => sb.ID == dep)))
{
graph.Edges.Add(new Edge(nodeMap[sourceBlueprint], nodeMap[targetBlueprint]));
var edge = new Edge(nodeMap[sourceBlueprint], nodeMap[targetBlueprint]);
graph.Edges.Add(edge);
var splitName = sourceBlueprint.Name.Split(' ');
if (splitName.Length > 1)
{
var nameStart = string.Join(" ", splitName.Take(splitName.Length - 1));
if(targetBlueprint.Name.StartsWith(nameStart))
settings.AddSameLayerNeighbors(nodeMap[sourceBlueprint], nodeMap[targetBlueprint]);
edge.Weight *= 10;
}
}
}
}
settings.BrandesThreshold = 9999;
var islands = graph.GetClusteredConnectedComponents();
var islandMap =
graph.Nodes.ToDictionary(n => n, n => islands.Find(c => c.Nodes.Any(cn => cn.UserData == n)));

View file

@ -157,11 +157,11 @@ namespace ChatApp.Server
OrbitData[] orbits;
PlanetData[] planets;
ZoneGenerator.GenerateZone(
global: context.GlobalData,
zone: zone,
mapLayers: mapLayers.Values,
resources: cache.GetAll<SimpleCommodityData>(),
orbitData: out orbits,
global: context.GlobalData,
zone: zone,
mapLayers: mapLayers.Values,
resources: cache.GetAll<SimpleCommodityData>(),
orbitData: out orbits,
planetsData: out planets);
cache.AddAll(orbits);
cache.AddAll(planets);

View file

@ -64,8 +64,8 @@
<Compile Include="Assets\Scripts\ServerShared\Attributes.cs" />
<Compile Include="Assets\Scripts\ServerShared\Behaviors\Afterburner.cs" />
<Compile Include="Assets\Scripts\ServerShared\Behaviors\Behaviors.cs" />
<Compile Include="Assets\Scripts\ServerShared\Behaviors\Cannon.cs" />
<Compile Include="Assets\Scripts\ServerShared\Behaviors\Launcher.cs" />
<Compile Include="Assets\Scripts\ServerShared\Behaviors\ProjectileWeapon.cs" />
<Compile Include="Assets\Scripts\ServerShared\Behaviors\Radiator.cs" />
<Compile Include="Assets\Scripts\ServerShared\Behaviors\Reactor.cs" />
<Compile Include="Assets\Scripts\ServerShared\Behaviors\Reflector.cs" />
@ -87,6 +87,7 @@
<Compile Include="Assets\Scripts\ServerShared\ItemData.cs" />
<Compile Include="Assets\Scripts\ServerShared\ItemInstance.cs" />
<Compile Include="Assets\Scripts\ServerShared\JsonConverters.cs" />
<Compile Include="Assets\Scripts\ServerShared\Locomotion.cs" />
<Compile Include="Assets\Scripts\ServerShared\MathFormatters.cs" />
<Compile Include="Assets\Scripts\ServerShared\MathResolver.cs" />
<Compile Include="Assets\Scripts\ServerShared\Messages.cs" />
@ -445,6 +446,7 @@
<Compile Include="Assets\Scripts\ServerShared\NIH\RethinkDb.Driver\Utils\QueryHelper.cs" />
<Compile Include="Assets\Scripts\ServerShared\NIH\RethinkDb.Driver\Utils\StringHelper.cs" />
<Compile Include="Assets\Scripts\ServerShared\NIH\RethinkDb.Driver\Utils\TaskHelper.cs" />
<Compile Include="Assets\Scripts\ServerShared\OrbitalEntity.cs" />
<Compile Include="Assets\Scripts\ServerShared\Rect.cs" />
<Compile Include="Assets\Scripts\ServerShared\Ship.cs" />
<Compile Include="Assets\Scripts\ServerShared\ZoneData.cs" />