Behavior Canceling & Grouping

Behaviors are now grouped, behaviors within a group can cancel execution of the rest of the group
This commit is contained in:
hyperion51 2020-05-11 01:17:10 +01:00
commit fc94531566
35 changed files with 613 additions and 190 deletions

View file

@ -14,12 +14,16 @@ public class Locomotion : AgentBehavior
private Thruster _thrust;
private Turning _turning;
private VelocityLimit _velocityLimit;
private int _thrustAxis;
private int _turningAxis;
public Locomotion(GameContext context, Entity entity, ControllerData controllerData) : base(context, entity, controllerData)
{
_velocityLimit = Entity.GetBehaviors<VelocityLimit>().FirstOrDefault();
_thrust = Entity.Axes.Keys.FirstOrDefault(x => x is Thruster) as Thruster;
_turning = Entity.Axes.Keys.FirstOrDefault(x => x is Turning) as Turning;
_thrust = Entity.GetBehaviors<Thruster>().FirstOrDefault();
_turning = Entity.GetBehaviors<Turning>().FirstOrDefault();
_thrustAxis = Entity.GetAxis<Thruster>();
_turningAxis = Entity.GetAxis<Turning>();
}
public override void Update(float delta)
@ -40,15 +44,15 @@ public class Locomotion : AgentBehavior
{
float2 tangential = Entity.Velocity - dot(normalize(diff), normalize(Entity.Velocity)) * Entity.Velocity;
float2 adjustedDirection = normalize(diff) - tangential * TangentSensitivity;
Entity.Axes[_turning] = TurningInput(adjustedDirection);
Entity.Axes[_thrust] = 1;
Entity.Axes[_turningAxis].Value = TurningInput(adjustedDirection);
Entity.Axes[_thrustAxis].Value = 1;
}
// We have plenty of space, use exact maneuvering
else
{
var deltaV = desiredVelocity - Entity.Velocity;
Entity.Axes[_turning] = TurningInput(deltaV);
Entity.Axes[_thrust] = ThrustInput(deltaV);
Entity.Axes[_turningAxis].Value = TurningInput(deltaV);
Entity.Axes[_thrustAxis].Value = ThrustInput(deltaV);
}
}
}

View file

@ -12,14 +12,18 @@ public class VelocityMatch : AgentBehavior
private Thruster _thrust;
private Turning _turning;
private const float TargetThreshold = .1f;
private int _thrustAxis;
private int _turningAxis;
private GameContext _context;
public VelocityMatch(GameContext context, Entity entity, ControllerData controllerData) : base(context, entity, controllerData)
{
_context = context;
_thrust = Entity.Axes.Keys.FirstOrDefault(x => x is Thruster) as Thruster;
_turning = Entity.Axes.Keys.FirstOrDefault(x => x is Turning) as Turning;
_thrust = Entity.GetBehaviors<Thruster>().FirstOrDefault();
_turning = Entity.GetBehaviors<Turning>().FirstOrDefault();
_thrustAxis = Entity.GetAxis<Thruster>();
_turningAxis = Entity.GetAxis<Turning>();
}
public void Clear()
@ -34,8 +38,8 @@ public class VelocityMatch : AgentBehavior
var deltaV = TargetVelocity - Entity.Velocity;
if(length(deltaV) < TargetThreshold)
OnMatch?.Invoke();
Entity.Axes[_turning] = TurningInput(deltaV);
Entity.Axes[_thrust] = ThrustInput(deltaV);
Entity.Axes[_turningAxis].Value = TurningInput(deltaV);
Entity.Axes[_thrustAxis].Value = ThrustInput(deltaV);
}
}

View file

@ -0,0 +1,54 @@
using MessagePack;
using Newtonsoft.Json;
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class ActivatedItemUsageData : BehaviorData
{
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
{
return new ActivatedItemUsage(context, this, entity, item);
}
}
public class ActivatedItemUsage : IActivatedBehavior
{
private ActivatedItemUsageData _data;
private Entity Entity { get; }
private Gear Item { get; }
private GameContext Context { get; }
public BehaviorData Data => _data;
public ActivatedItemUsage(GameContext context, ActivatedItemUsageData data, Entity entity, Gear item)
{
_data = data;
Entity = entity;
Item = item;
Context = context;
}
public void Initialize()
{
}
public bool Activate()
{
throw new System.NotImplementedException();
}
public void Deactivate()
{
throw new System.NotImplementedException();
}
public bool Update(float delta)
{
return true;
}
public void Remove()
{
}
}

View file

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

View file

@ -7,13 +7,13 @@ using Newtonsoft.Json;
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class AfterburnerData : BehaviorData
{
[InspectableField, JsonProperty("thrust"), Key(0)]
[InspectableField, JsonProperty("thrust"), Key(1)]
public PerformanceStat ThrustModifier = new PerformanceStat();
[InspectableField, JsonProperty("speed"), Key(1)]
[InspectableField, JsonProperty("speed"), Key(2)]
public PerformanceStat SpeedModifier = new PerformanceStat();
[InspectableField, JsonProperty("torque"), Key(2)]
[InspectableField, JsonProperty("torque"), Key(3)]
public PerformanceStat TorqueModifier = new PerformanceStat();
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
@ -27,6 +27,7 @@ public class Afterburner : IActivatedBehavior
private List<Dictionary<IBehavior,float>> _modifiers = new List<Dictionary<IBehavior, float>>();
private AfterburnerData _data;
private Thruster _thruster;
private int _thrustAxis;
public Entity Entity { get; }
public Gear Item { get; }
@ -45,21 +46,25 @@ public class Afterburner : IActivatedBehavior
public void Initialize()
{
_thruster = Entity.GetBehaviors<Thruster>().FirstOrDefault();
_thrustAxis = Entity.GetAxis<Thruster>();
}
public void Update(float delta)
public bool Update(float delta)
{
return true;
}
public void Activate()
public bool Activate()
{
if (_thruster == null) return;
if (_thruster == null) return false;
var thrustMod = ((ThrusterData) _thruster.Data).Thrust.GetScaleModifiers(Entity);
thrustMod.Add(this,Context.Evaluate(_data.ThrustModifier,Item, Entity));
_modifiers.Add(thrustMod);
Entity.AxisOverrides[_thruster] = 1;
Entity.AxisOverrides[_thrustAxis] = 1;
return true;
// var speedMod = (Ship.Hull.ItemData as HullData).TopSpeed.GetScaleModifiers(Ship);
// _modifiers.Add(speedMod);
@ -72,11 +77,15 @@ public class Afterburner : IActivatedBehavior
public void Deactivate()
{
Entity.AxisOverrides.Remove(_thruster);
Entity.AxisOverrides.Remove(_thrustAxis);
foreach (var mod in _modifiers)
{
mod.Remove(this);
}
_modifiers.Clear();
}
public void Remove()
{
}
}

View file

@ -12,13 +12,14 @@ using static Unity.Mathematics.noise;
public interface IBehavior
{
void Initialize();
void Update(float delta);
bool Update(float delta);
void Remove();
BehaviorData Data { get; }
}
public interface IActivatedBehavior : IBehavior
{
void Activate();
bool Activate();
void Deactivate();
}
@ -68,8 +69,8 @@ public abstract class PersistentBehaviorData
JsonConverter(typeof(JsonKnownTypesConverter<BehaviorData>)), JsonObject(MemberSerialization.OptIn)]
public abstract class BehaviorData
{
// [InspectableField, JsonProperty("index"), Key(0)]
// public int Index;
[InspectableField, JsonProperty("group"), Key(0)]
public int Group;
public abstract IBehavior CreateInstance(GameContext context, Entity entity, Gear item);
}

View file

@ -7,16 +7,16 @@ using Newtonsoft.Json;
[Union(0, typeof(TowingControllerData))]
public abstract class ControllerData : BehaviorData
{
[InspectableField, JsonProperty("thrustSensitivity"), Key(0)]
[InspectableField, JsonProperty("thrustSensitivity"), Key(1)]
public float ThrustSensitivity = 1;
[InspectableField, JsonProperty("thrustSpecificity"), Key(1)]
[InspectableField, JsonProperty("thrustSpecificity"), Key(2)]
public float ThrustSpecificity = 8;
[InspectableField, JsonProperty("turningSensitivity"), Key(2)]
[InspectableField, JsonProperty("turningSensitivity"), Key(3)]
public float TurningSensitivity = 1;
[InspectableField, JsonProperty("tangentSensitivity"), Key(3)]
[InspectableField, JsonProperty("tangentSensitivity"), Key(4)]
public float TangentSensitivity = 4;
}

View file

@ -10,10 +10,10 @@ using Random = Unity.Mathematics.Random;
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class FactoryData : BehaviorData
{
[InspectableField, JsonProperty("toolingTime"), Key(0)]
[InspectableField, JsonProperty("toolingTime"), Key(1)]
public PerformanceStat ToolingTime = new PerformanceStat();
[InspectableField, JsonProperty("automation"), Key(1)]
[InspectableField, JsonProperty("automation"), Key(2)]
public int AutomationPoints;
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
@ -52,7 +52,7 @@ public class Factory : IBehavior, IPersistentBehavior//<Factory>
{
}
public void Update(float delta)
public bool Update(float delta)
{
var blueprint = Context.Cache.Get<BlueprintData>(_blueprint);
if (_retooling || _producing)
@ -198,6 +198,8 @@ public class Factory : IBehavior, IPersistentBehavior//<Factory>
}
}
}
return true;
}
public PersistentBehaviorData Store()
@ -225,6 +227,10 @@ public class Factory : IBehavior, IPersistentBehavior//<Factory>
_assignedPopulation = factoryPersistence.AssignedPopulation;
_productionQuality = factoryPersistence.ProductionQuality;
}
public void Remove()
{
}
}
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]

View file

@ -0,0 +1,95 @@
using MessagePack;
using Newtonsoft.Json;
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class HitscanData : WeaponData
{
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
{
return new Hitscan(context, this, entity, item);
}
}
public class Hitscan : IActivatedBehavior
{
private bool _firing;
private float _cooldown; // normalized
private HitscanData _data;
private Entity Entity { get; }
private Gear Item { get; }
private GameContext Context { get; }
private float _firingVisibility;
public BehaviorData Data => _data;
public Hitscan(GameContext context, HitscanData c, Entity entity, Gear item)
{
Context = context;
_data = c;
Entity = entity;
Item = item;
}
public bool Activate()
{
// Debug.Log("Activating ProjectileWeapon");
// _firing = true;
// Observable.EveryUpdate().TakeWhile(_ => _firing).Subscribe(_ =>
// {
// // Debug.Log($"Updating Observable {_cooldown}");
// if (_cooldown < 0)
// {
// _cooldown = 1;
// Fire(0);
// if(_projectileWeapon.BurstCount>1)
// Observable.Interval(TimeSpan.FromSeconds(_projectileWeapon.BurstTime.Evaluate(Hardpoint) / (_projectileWeapon.BurstCount-1))).Take(_projectileWeapon.BurstCount-1)
// .Subscribe(l => Fire(l+1));
// }
// });
return true;
}
private void Fire(long b)
{
// _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 = _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 = _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}");
}
public void Deactivate()
{
_firing = false;
}
public void Initialize()
{
}
public bool Update(float delta)
{
_cooldown -= delta / Context.Evaluate(_data.Cooldown, Item, Entity);
_firingVisibility *= Context.Evaluate(_data.VisibilityDecay, Item, Entity);
if (_firingVisibility < 0.01f)
{
Entity.VisibilitySources.Remove(this);
}
return true;
}
public void Remove()
{
}
}

View file

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

View file

@ -0,0 +1,51 @@

using System;
using MessagePack;
using Newtonsoft.Json;
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class ItemUsageData : BehaviorData
{
[InspectableDatabaseLink(typeof(SimpleCommodityData)), JsonProperty("item"), Key(1)]
public Guid Item;
[InspectableField, JsonProperty("cooldown"), Key(2)]
public PerformanceStat Cooldown = new PerformanceStat();
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
{
return new ItemUsage(context, this, entity, item);
}
}
public class ItemUsage : IBehavior
{
private ItemUsageData _data;
private Entity Entity { get; }
private Gear Item { get; }
private GameContext Context { get; }
public BehaviorData Data => _data;
public ItemUsage(GameContext context, ItemUsageData data, Entity entity, Gear item)
{
_data = data;
Entity = entity;
Item = item;
Context = context;
}
public void Initialize()
{
}
public bool Update(float delta)
{
return true;
}
public void Remove()
{
}
}

View file

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

View file

@ -5,7 +5,7 @@ using Newtonsoft.Json;
using Unity.Mathematics;
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class LauncherData : BehaviorData
public class LauncherData : WeaponData
{
[InspectablePrefab, JsonProperty("missile"), Key(9)]
public string MissilePrefab;
@ -50,16 +50,20 @@ public class Launcher : IActivatedBehavior
private float _cooldown; // normalized
private bool _locked;
private LauncherData _launcher;
public Entity Entity { get; }
public Gear Item { get; }
public GameContext Context { get; }
private LauncherData _data;
private Entity Entity { get; }
private Gear Item { get; }
private GameContext Context { get; }
private float _firingVisibility;
public BehaviorData Data => _data;
public int Group => _data.Group;
public Launcher(GameContext context, LauncherData m, Entity entity, Gear item)
{
Context = context;
_launcher = m;
_data = m;
Entity = entity;
Item = item;
// _audio = hp.Proxy.GetComponent<AudioSource>();
@ -70,10 +74,11 @@ public class Launcher : IActivatedBehavior
// _audio.volume = .5f;
}
public void Activate()
public bool Activate()
{
_locking = true;
_lockingTimer = 1;
return true;
}
private void Fire(long b)
@ -124,8 +129,9 @@ public class Launcher : IActivatedBehavior
{
}
public void Update(float delta)
public bool Update(float delta)
{
return true;
// if (Ship.Target == null)
// return;
//
@ -161,6 +167,8 @@ public class Launcher : IActivatedBehavior
// _firingVisibility = 0;
// }
}
public BehaviorData Data => _launcher;
public void Remove()
{
}
}

View file

@ -9,7 +9,7 @@ using static Unity.Mathematics.math;
[MessagePackObject, JsonObject(MemberSerialization.OptIn), EntityTypeRestriction(HullType.Ship)]
public class PatrolControllerData : ControllerData
{
[InspectableField, JsonProperty("targetDistance"), Key(4)]
[InspectableField, JsonProperty("targetDistance"), Key(5)]
public float TargetDistance = 10;
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
@ -47,13 +47,15 @@ public class PatrolController : IBehavior, IController
RandomTarget();
}
public void Update(float delta)
public bool Update(float delta)
{
_locomotion.Objective = _context.GetOrbitPosition(_targetOrbit);
_locomotion.Update(delta);
if(length(_entity.Position - _locomotion.Objective) < _data.TargetDistance)
RandomTarget();
return true;
}
public void AssignTask(Guid task, List<SimplifiedZoneData> path)
@ -66,4 +68,8 @@ public class PatrolController : IBehavior, IController
var entities = _context.ZonePlanets[_entity.Zone];
_targetOrbit = _context.Cache.Get<PlanetData>(entities[_context.Random.NextInt(entities.Length)]).Orbit;
}
public void Remove()
{
}
}

View file

@ -24,26 +24,32 @@ public class ProjectileWeaponData : WeaponData
public class ProjectileWeapon : IActivatedBehavior
{
private ProjectileWeaponData _data;
private Entity Entity { get; }
private Gear Item { get; }
private GameContext Context { get; }
private float _firingVisibility;
private bool _firing;
private float _cooldown; // normalized
private ProjectileWeaponData _projectileWeapon;
public Entity Entity { get; }
public Gear Item { get; }
public GameContext Context { get; }
private float _firingVisibility;
private float _burstCooldown;
private float _burstCooldownTime;
private int _burstRemaining;
public BehaviorData Data => _data;
public ProjectileWeapon(GameContext context, ProjectileWeaponData c, Entity entity, Gear item)
{
Context = context;
_projectileWeapon = c;
_data = c;
Entity = entity;
Item = item;
}
public void Activate()
public bool Activate()
{
_firing = true;
return true;
// Debug.Log("Activating ProjectileWeapon");
// _firing = true;
// Observable.EveryUpdate().TakeWhile(_ => _firing).Subscribe(_ =>
// {
// // Debug.Log($"Updating Observable {_cooldown}");
@ -58,9 +64,11 @@ public class ProjectileWeapon : IActivatedBehavior
// });
}
private void Fire(long b)
private void Fire()
{
// _firingVisibility += _projectileWeapon.Visibility.Evaluate(Hardpoint);
_burstRemaining--;
_firingVisibility += Context.Evaluate(_data.Visibility, Item, Entity);
Entity.AddHeat(Context.Evaluate(_data.Heat, Item, Entity));
// 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>());
@ -85,17 +93,38 @@ public class ProjectileWeapon : IActivatedBehavior
{
}
public void Update(float delta)
public bool Update(float delta)
{
_cooldown -= delta / Context.Evaluate(_projectileWeapon.Cooldown, Item, Entity);
_cooldown -= delta / Context.Evaluate(_data.Cooldown, Item, Entity);
if (_cooldown < 0)
{
_cooldown = 1;
_burstRemaining = _data.BurstCount;
_burstCooldownTime = Context.Evaluate(_data.BurstTime, Item, Entity) / _data.BurstCount;
_burstCooldown = -1;
Fire();
}
if (_burstRemaining > 0)
{
_burstCooldown -= delta / _burstCooldownTime;
if (_burstCooldown < 0)
{
_burstCooldown = 1;
Fire();
}
}
_firingVisibility *= Context.Evaluate(_projectileWeapon.VisibilityDecay, Item, Entity);
_firingVisibility *= Context.Evaluate(_data.VisibilityDecay, Item, Entity);
if (_firingVisibility < 0.01f)
{
Entity.VisibilitySources.Remove(this);
}
return true;
}
public void Remove()
{
}
public BehaviorData Data => _projectileWeapon;
}

View file

@ -6,7 +6,7 @@ using static Unity.Mathematics.math;
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class RadiatorData : BehaviorData
{
[InspectableField, JsonProperty("emissivity"), Key(0)]
[InspectableField, JsonProperty("emissivity"), Key(1)]
public PerformanceStat Emissivity = new PerformanceStat();
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
@ -37,10 +37,15 @@ public class Radiator : IBehavior
{
}
public void Update(float delta)
public bool Update(float delta)
{
var rad = pow(Entity.Temperature, Context.GlobalData.HeatRadiationPower) * Context.GlobalData.HeatRadiationMultiplier;
Entity.Temperature -= rad * delta;
Entity.VisibilitySources[this] = rad;
return true;
}
public void Remove()
{
}
}

View file

@ -4,19 +4,19 @@ using Newtonsoft.Json;
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class ReactorData : BehaviorData
{
[InspectableField, JsonProperty("charge"), Key(0)]
[InspectableField, JsonProperty("charge"), Key(1)]
public PerformanceStat Charge = new PerformanceStat();
[InspectableField, JsonProperty("capacitance"), Key(1)]
[InspectableField, JsonProperty("capacitance"), Key(2)]
public PerformanceStat Capacitance = new PerformanceStat();
[InspectableField, JsonProperty("efficiency"), Key(2)]
[InspectableField, JsonProperty("efficiency"), Key(3)]
public PerformanceStat Efficiency = new PerformanceStat();
[InspectableField, JsonProperty("overload"), Key(3)]
[InspectableField, JsonProperty("overload"), Key(4)]
public PerformanceStat OverloadEfficiency = new PerformanceStat();
[InspectableField, JsonProperty("underload"), Key(4)]
[InspectableField, JsonProperty("underload"), Key(5)]
public PerformanceStat UnderloadRecovery = new PerformanceStat();
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
@ -47,7 +47,7 @@ public class Reactor : IBehavior
{
}
public void Update(float delta)
public bool Update(float delta)
{
var cap = Context.Evaluate(_data.Capacitance, Item, Entity);
var charge = Context.Evaluate(_data.Charge, Item, Entity) * delta;
@ -67,5 +67,10 @@ public class Reactor : IBehavior
Entity.AddHeat( -Entity.Energy / Context.Evaluate(_data.OverloadEfficiency, Item, Entity));
Entity.Energy = 0;
}
return true;
}
public void Remove()
{
}
}

View file

@ -6,7 +6,7 @@ using static Unity.Mathematics.math;
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class ReflectorData : BehaviorData
{
[InspectableField, JsonProperty("crossSection"), Key(0)]
[InspectableField, JsonProperty("crossSection"), Key(1)]
public PerformanceStat CrossSection = new PerformanceStat();
// [InspectableAnimationCurve, JsonProperty("visibility"), Key(1)]
@ -40,7 +40,12 @@ public class Reflector : IBehavior
{
}
public void Update(float delta)
public bool Update(float delta)
{
return true;
}
public void Remove()
{
}
}

View file

@ -5,16 +5,16 @@ using Newtonsoft.Json;
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class SensorData : BehaviorData
{
[InspectableField, JsonProperty("radiance"), Key(0)]
[InspectableField, JsonProperty("radiance"), Key(1)]
public PerformanceStat Radiance = new PerformanceStat();
[InspectableField, JsonProperty("masking"), Key(1)]
[InspectableField, JsonProperty("masking"), Key(2)]
public PerformanceStat RadianceMasking = new PerformanceStat();
[InspectableField, JsonProperty("sensitivity"), Key(2)]
[InspectableField, JsonProperty("sensitivity"), Key(3)]
public PerformanceStat Sensitivity = new PerformanceStat();
[InspectableField, JsonProperty("range"), Key(3)]
[InspectableField, JsonProperty("range"), Key(4)]
public PerformanceStat Range = new PerformanceStat();
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
@ -27,9 +27,9 @@ public class Sensor : IBehavior
{
private SensorData _data;
public Entity Entity { get; }
public Gear Item { get; }
public GameContext Context { get; }
private Entity Entity { get; }
private Gear Item { get; }
private GameContext Context { get; }
public BehaviorData Data => _data;
@ -45,8 +45,9 @@ public class Sensor : IBehavior
{
}
public void Update(float delta)
public bool Update(float delta)
{
return true;
// var ship = Hardpoint.Ship.Ship.transform;
// var contacts =
// Physics.OverlapSphere(ship.position, _data.Range.Evaluate(Hardpoint)).Where(c=>c.attachedRigidbody?.GetComponent<Targetable>()!=null).Select(c=>c.attachedRigidbody.GetComponent<Targetable>());
@ -65,4 +66,8 @@ public class Sensor : IBehavior
// Hardpoint.Ship.VisibilitySources[this] = _data.Radiance.Evaluate(Hardpoint) / _data.RadianceMasking.Evaluate(Hardpoint);
// TODO: Handle Active Detection / Visibility From Reflected Radiance
}
public void Remove()
{
}
}

View file

@ -6,10 +6,10 @@ using static Unity.Mathematics.math;
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class ShieldData : BehaviorData
{
[InspectableField, JsonProperty("efficiency"), Key(0)]
[InspectableField, JsonProperty("efficiency"), Key(1)]
public PerformanceStat Efficiency = new PerformanceStat();
[InspectableField, JsonProperty("shielding"), Key(1)]
[InspectableField, JsonProperty("shielding"), Key(2)]
public PerformanceStat Shielding = new PerformanceStat();
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
@ -42,7 +42,12 @@ public class Shield : IBehavior
{
}
public void Update(float delta)
public bool Update(float delta)
{
return true;
}
public void Remove()
{
}
}

View file

@ -6,13 +6,13 @@ using static Unity.Mathematics.math;
[MessagePackObject, JsonObject(MemberSerialization.OptIn), EntityTypeRestriction(HullType.Ship)]
public class ThrusterData : BehaviorData
{
[InspectableField, JsonProperty("thrust"), Key(0)]
[InspectableField, JsonProperty("thrust"), Key(1)]
public PerformanceStat Thrust = new PerformanceStat();
[InspectableField, JsonProperty("visibility"), Key(1)]
[InspectableField, JsonProperty("visibility"), Key(2)]
public PerformanceStat Visibility = new PerformanceStat();
[InspectableField, JsonProperty("heat"), Key(2)]
[InspectableField, JsonProperty("heat"), Key(3)]
public PerformanceStat Heat = new PerformanceStat();
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
@ -52,11 +52,16 @@ public class Thruster : IAnalogBehavior
{
}
public void Update(float delta)
public bool Update(float delta)
{
Thrust = Context.Evaluate(_data.Thrust, Item, Entity);
Entity.Velocity += Entity.Direction * _input * Thrust / Entity.Mass * delta;
Entity.AddHeat(_input * Context.Evaluate(_data.Heat, Item, Entity) * delta);
Entity.VisibilitySources[this] = _input * Context.Evaluate(_data.Visibility, Item, Entity);
return true;
}
public void Remove()
{
}
}

View file

@ -48,7 +48,7 @@ public class TowingController : IBehavior, IPersistentBehavior, IController
_velocityMatch = new VelocityMatch(_context, _entity, _data);
}
public void Update(float delta)
public bool Update(float delta)
{
if (_path.Any())
{
@ -119,6 +119,7 @@ public class TowingController : IBehavior, IPersistentBehavior, IController
_velocityMatch.Update(delta);
}
}
return true;
}
public PersistentBehaviorData Store()
@ -148,6 +149,10 @@ public class TowingController : IBehavior, IPersistentBehavior, IController
{
_locomotion.Objective = _context.WormholePosition(_entity.Zone, _path[0].ZoneID);
}
public void Remove()
{
}
}
public class TowingControllerPersistence : PersistentBehaviorData

View file

@ -6,13 +6,13 @@ using static Unity.Mathematics.math;
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class TurningData : BehaviorData
{
[InspectableField, JsonProperty("torque"), Key(0)]
[InspectableField, JsonProperty("torque"), Key(1)]
public PerformanceStat Torque = new PerformanceStat();
[InspectableField, JsonProperty("visibility"), Key(1)]
[InspectableField, JsonProperty("visibility"), Key(2)]
public PerformanceStat Visibility = new PerformanceStat();
[InspectableField, JsonProperty("heat"), Key(2)]
[InspectableField, JsonProperty("heat"), Key(3)]
public PerformanceStat Heat = new PerformanceStat();
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
@ -52,11 +52,16 @@ public class Turning : IAnalogBehavior
{
}
public void Update(float delta)
public bool Update(float delta)
{
Torque = Context.Evaluate(_data.Torque, Item, Entity);
Entity.Direction = mul(Entity.Direction, Unity.Mathematics.float2x2.Rotate(_input * Torque / Entity.Mass * delta));
Entity.AddHeat(abs(_input) * Context.Evaluate(_data.Heat, Item, Entity) * delta);
Entity.VisibilitySources[this] = abs(_input) * Context.Evaluate(_data.Visibility, Item, Entity);
return true;
}
public void Remove()
{
}
}

View file

@ -6,7 +6,7 @@ using static Unity.Mathematics.math;
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class VelocityConversionData : BehaviorData
{
[InspectableField, JsonProperty("traction"), Key(0)]
[InspectableField, JsonProperty("traction"), Key(1)]
public PerformanceStat Traction = new PerformanceStat();
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
@ -37,7 +37,12 @@ public class VelocityConversion : IBehavior
{
}
public void Update(float delta)
public bool Update(float delta)
{
return true;
}
public void Remove()
{
}
}

View file

@ -6,7 +6,7 @@ using static Unity.Mathematics.math;
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class VelocityLimitData : BehaviorData
{
[InspectableField, JsonProperty("topSpeed"), Key(0)]
[InspectableField, JsonProperty("topSpeed"), Key(1)]
public PerformanceStat TopSpeed = new PerformanceStat();
public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item)
@ -40,10 +40,15 @@ public class VelocityLimit : IBehavior
{
}
public void Update(float delta)
public bool Update(float delta)
{
Limit = Context.Evaluate(_data.TopSpeed, Item, Entity);
if (length(Entity.Velocity) > Limit)
Entity.Velocity = normalize(Entity.Velocity) * Limit;
return true;
}
public void Remove()
{
}
}

View file

@ -5,30 +5,30 @@ using Newtonsoft.Json;
Union(1, typeof(LauncherData))]
public abstract class WeaponData : BehaviorData
{
[InspectableField, JsonProperty("damageType"), Key(0)]
[InspectableField, JsonProperty("damageType"), Key(1)]
public DamageType DamageType;
[InspectableField, JsonProperty("damage"), Key(1)]
[InspectableField, JsonProperty("damage"), Key(2)]
public PerformanceStat Damage = new PerformanceStat();
[InspectableField, JsonProperty("range"), Key(2)]
[InspectableField, JsonProperty("range"), Key(3)]
public PerformanceStat Range = new PerformanceStat();
[InspectableField, JsonProperty("cooldown"), Key(3)]
[InspectableField, JsonProperty("cooldown"), Key(4)]
public PerformanceStat Cooldown = new PerformanceStat();
[InspectableField, JsonProperty("heat"), Key(4)]
[InspectableField, JsonProperty("heat"), Key(5)]
public PerformanceStat Heat = new PerformanceStat();
[InspectableField, JsonProperty("visibility"), Key(5)]
[InspectableField, JsonProperty("visibility"), Key(6)]
public PerformanceStat Visibility = new PerformanceStat();
[InspectableField, JsonProperty("visibilityDecay"), Key(6)]
[InspectableField, JsonProperty("visibilityDecay"), Key(7)]
public PerformanceStat VisibilityDecay = new PerformanceStat();
[InspectableField, JsonProperty("burstCount"), Key(7)]
[InspectableField, JsonProperty("burstCount"), Key(8)]
public int BurstCount;
[InspectableField, JsonProperty("burstTime"), Key(8)]
[InspectableField, JsonProperty("burstTime"), Key(9)]
public PerformanceStat BurstTime = new PerformanceStat();
}

View file

@ -87,15 +87,21 @@ public class MegaCorporation : DatabaseEntry, INamedEntry
[InspectableField, JsonProperty("name"), Key(1)]
public string Name;
[InspectableTexture, JsonProperty("logo"), Key(2)]
[InspectableText, JsonProperty("description"), Key(2)]
public string Description;
[InspectableTexture, JsonProperty("logo"), Key(3)]
public string Logo;
[InspectableDatabaseLink(typeof(PersonalityAttribute)), JsonProperty("initialFleet"), Key(3)]
[InspectableDatabaseLink(typeof(PersonalityAttribute)), JsonProperty("personality"), Key(4)]
public Dictionary<Guid, float> Personality = new Dictionary<Guid, float>();
[InspectableDatabaseLink(typeof(LoadoutData)), JsonProperty("initialFleet"), Key(4)]
[InspectableDatabaseLink(typeof(LoadoutData)), JsonProperty("initialFleet"), Key(5)]
public Dictionary<Guid, int> InitialFleet = new Dictionary<Guid, int>();
[InspectableDatabaseLink(typeof(BlueprintData)), JsonProperty("initialTechs"), Key(6)]
public List<Guid> InitialTechnologies = new List<Guid>();
[IgnoreMember] public string EntryName
{
get => Name;

View file

@ -30,13 +30,14 @@ public abstract class Entity : DatabaseEntry, IMessagePackSerializationCallbackR
// [IgnoreMember] protected List<IBehavior> Behaviors;
[IgnoreMember] public Guid Zone;
[IgnoreMember] public Dictionary<Gear, List<IBehavior>> ItemBehaviors;
[IgnoreMember] public Dictionary<Gear, List<IActivatedBehavior>> Bindings;
[IgnoreMember] public Dictionary<IAnalogBehavior, float> Axes;
[IgnoreMember] public Dictionary<IAnalogBehavior, float> AxisOverrides = new Dictionary<IAnalogBehavior, float>();
[IgnoreMember] public Dictionary<int, List<IBehavior>> Behaviors;
[IgnoreMember] public Dictionary<int, List<IActivatedBehavior>> Bindings;
[IgnoreMember] public Dictionary<int, AxisSetting> Axes;
[IgnoreMember] public Dictionary<int, float> AxisOverrides = new Dictionary<int, float>();
[IgnoreMember] public readonly Dictionary<object, float> VisibilitySources = new Dictionary<object, float>();
private Dictionary<Gear, EquippableItemData> GearData;
private Dictionary<Gear, List<IBehavior>> ItemBehaviors;
[IgnoreMember] public float Mass { get; private set; }
[IgnoreMember] public float SpecificHeat { get; private set; }
@ -64,26 +65,44 @@ public abstract class Entity : DatabaseEntry, IMessagePackSerializationCallbackR
var gearData = gear.ToDictionary(id => id, id => Context.Cache.Get<Gear>(id));
GearData = gearData.Values.ToDictionary(g => g, g => g.ItemData);
// Associate items with behavior list, used only for persistence
ItemBehaviors = gear
.Where(i=> gearData[i].ItemData.Behaviors?.Any()??false)
.ToDictionary(i=> gearData[i], i => gearData[i].ItemData.Behaviors
.Select(bd => bd.CreateInstance(Context, this, gearData[i]))
.OrderBy(b => b.GetType().GetCustomAttribute<UpdateOrderAttribute>()?.Order ?? 0)
.ToList());
var behaviorGroups = ItemBehaviors
.SelectMany(x => x.Value
.Select(b => new {item = x.Key, behavior = b})
.OrderBy(ib => ib.behavior.GetType().GetCustomAttribute<UpdateOrderAttribute>()?.Order ?? 0))
.GroupBy(ib => new {ib.item, ib.behavior.Data.Group});
Bindings = ItemBehaviors
Behaviors = behaviorGroups
.Select((grouping, i) => new {index = i, group = grouping})
.ToDictionary(ig => ig.index, ig => ig.group.Select(x => x.behavior).ToList());
Bindings = Behaviors
.Where(x => x.Value.Any(g => g is IActivatedBehavior))
.Select(x=> new {gear = x.Key, behaviors = x.Value
.Select((x, i) => new {index = i, behaviors = x.Value
.Where(g => g is IActivatedBehavior)
.Cast<IActivatedBehavior>().ToList()})
.ToDictionary(x => x.gear, x => x.behaviors);
.ToDictionary(x => x.index, x => x.behaviors);
Axes = ItemBehaviors.Values
.SelectMany(behaviors=>behaviors)
.Where(b => b is IAnalogBehavior)
.ToDictionary(b => b as IAnalogBehavior, b => 0f);
Axes = Behaviors
.Where(x => x.Value.Any(g => g is IAnalogBehavior))
.Select((x, i) => new {index = i, behaviors = x.Value
.Where(g => g is IAnalogBehavior)
.Cast<IAnalogBehavior>().ToList()})
.ToDictionary(x => x.index, x => new AxisSetting{Behaviors = x.behaviors, Value = 0f});
foreach (var behavior in ItemBehaviors.Values
// Axes = Behaviors.Values
// .SelectMany(behaviors=>behaviors)
// .Where(b => b is IAnalogBehavior)
// .ToDictionary(b => b as IAnalogBehavior, b => 0f);
foreach (var behavior in Behaviors.Values
.SelectMany(behaviors=>behaviors)) behavior.Initialize();
}
@ -101,7 +120,7 @@ public abstract class Entity : DatabaseEntry, IMessagePackSerializationCallbackR
public IEnumerable<T> GetBehaviors<T>() where T : class, IBehavior
{
foreach (var behaviors in ItemBehaviors.Values)
foreach (var behaviors in Behaviors.Values)
foreach (var behavior in behaviors)
if (behavior is T b)
yield return b;
@ -109,12 +128,29 @@ public abstract class Entity : DatabaseEntry, IMessagePackSerializationCallbackR
public IEnumerable<T> GetBehaviorData<T>() where T : BehaviorData
{
foreach (var behaviors in ItemBehaviors.Values)
foreach (var behaviors in Behaviors.Values)
foreach (var behavior in behaviors)
if (behavior.Data is T b)
yield return b;
}
public int GetAxis(IAnalogBehavior behavior)
{
var axis = Axes.FirstOrDefault(x => x.Value.Behaviors.Contains(behavior));
if (axis.IsNull())
return -1;
return axis.Key;
}
public int GetAxis<T>() where T : class, IBehavior
{
foreach (var axis in Axes)
foreach (var behavior in axis.Value.Behaviors)
if (behavior is T)
return axis.Key;
return -1;
}
public void AddHeat(float heat)
{
Temperature += heat / SpecificHeat;
@ -122,63 +158,14 @@ public abstract class Entity : DatabaseEntry, IMessagePackSerializationCallbackR
public virtual void Update(float delta)
{
foreach(var analogBehavior in Axes.Keys)
analogBehavior.SetAxis(AxisOverrides.ContainsKey(analogBehavior) ? AxisOverrides[analogBehavior] : Axes[analogBehavior]);
foreach(var axis in Axes)
foreach(var analogBehavior in axis.Value.Behaviors)
analogBehavior.SetAxis(AxisOverrides.ContainsKey(axis.Key) ? AxisOverrides[axis.Key] : Axes[axis.Key].Value);
foreach (var behavior in ItemBehaviors.SelectMany(item => item.Value))
behavior.Update(delta);
foreach (var staleItem in GearData
.Where(kvp=>kvp.Key.ItemData!=kvp.Value)
.Select(kvp=>kvp.Key))
{
// Item is stale, there's an updated one in the database cache
//var actualItem = Context.Cache.Get<Gear>(staleItem.ID);
var staleBehaviors = ItemBehaviors[staleItem];
ItemBehaviors.Remove(staleItem);
// We'll be reloading the item along with its behaviors, some data must be persisted
var persistentData = staleBehaviors
.Where(b => b is IPersistentBehavior)
.Cast<IPersistentBehavior>()
.Select(b => b.Store());
// Regenerate the behavior list for the updated item
ItemBehaviors[staleItem] = staleItem.ItemData.Behaviors
.Select(bd => bd.CreateInstance(Context, this, staleItem))
.OrderBy(b => b.GetType().GetCustomAttribute<UpdateOrderAttribute>()?.Order ?? 0).ToList();
foreach(var behavior in ItemBehaviors[staleItem])
behavior.Initialize();
// Restore state for persisted behaviors
foreach(var persistentBehaviorData in ItemBehaviors[staleItem]
.Where(b => b is IPersistentBehavior)
.Cast<IPersistentBehavior>()
.Zip(persistentData, (behavior, data) => new {behavior, data}))
persistentBehaviorData.behavior.Restore(persistentBehaviorData.data);
// Regenerate activated behavior bindings
if (Bindings.ContainsKey(staleItem))
{
Bindings.Remove(staleItem);
Bindings[staleItem] = ItemBehaviors[staleItem]
.Where(b => b is IActivatedBehavior)
.Cast<IActivatedBehavior>().ToList();
}
// Remove axis bindings and overrides for analog behaviors
foreach (var axis in staleBehaviors.Where(b => b is IAnalogBehavior).Cast<IAnalogBehavior>())
{
Axes.Remove(axis);
if (AxisOverrides.ContainsKey(axis))
AxisOverrides.Remove(axis);
}
// Regenerate axis bindings for analog behaviors
foreach (var axis in ItemBehaviors[staleItem].Where(b => b is IAnalogBehavior).Cast<IAnalogBehavior>())
Axes[axis] = 0;
}
foreach (var group in Behaviors.Values)
foreach(var behavior in group)
if(!behavior.Update(delta))
break;
foreach (var item in EquippedItems
.Select(item => Context.Cache.Get<Gear>(item))
@ -191,6 +178,66 @@ public abstract class Entity : DatabaseEntry, IMessagePackSerializationCallbackR
Position = parent.Position;
Velocity = parent.Velocity;
}
// Processing stale item data properly was a pain in my ass, so the shortcut is just persisting and restoring everything
if (GearData.Any(kvp => kvp.Key.ItemData != kvp.Value))
{
OnBeforeSerialize();
OnAfterDeserialize();
}
// Here's the PITA way
// foreach (var staleItem in GearData
// .Where(kvp=>kvp.Key.ItemData!=kvp.Value)
// .Select(kvp=>kvp.Key))
// {
// // Item is stale, there's an updated one in the database cache
// //var actualItem = Context.Cache.Get<Gear>(staleItem.ID);
// var staleBehaviors = ItemBehaviors[staleItem];
// ItemBehaviors.Remove(staleItem);
//
// // We'll be reloading the item along with its behaviors, some data must be persisted
// var persistentData = staleBehaviors
// .Where(b => b is IPersistentBehavior)
// .Cast<IPersistentBehavior>()
// .Select(b => b.Store());
//
// // Regenerate the behavior list for the updated item
// ItemBehaviors[staleItem] = staleItem.ItemData.Behaviors
// .Select(bd => bd.CreateInstance(Context, this, staleItem))
// .OrderBy(b => b.GetType().GetCustomAttribute<UpdateOrderAttribute>()?.Order ?? 0).ToList();
//
// foreach(var behavior in ItemBehaviors[staleItem])
// behavior.Initialize();
//
// // Restore state for persisted behaviors
// foreach(var persistentBehaviorData in ItemBehaviors[staleItem]
// .Where(b => b is IPersistentBehavior)
// .Cast<IPersistentBehavior>()
// .Zip(persistentData, (behavior, data) => new {behavior, data}))
// persistentBehaviorData.behavior.Restore(persistentBehaviorData.data);
//
// // Regenerate activated behavior bindings
// if (Bindings.ContainsKey(staleItem))
// {
// Bindings.Remove(staleItem);
// Bindings[staleItem] = ItemBehaviors[staleItem]
// .Where(b => b is IActivatedBehavior)
// .Cast<IActivatedBehavior>().ToList();
// }
//
// // Remove axis bindings and overrides for analog behaviors
// foreach (var axis in staleBehaviors.Where(b => b is IAnalogBehavior).Cast<IAnalogBehavior>())
// {
// Axes.Remove(axis);
// if (AxisOverrides.ContainsKey(axis))
// AxisOverrides.Remove(axis);
// }
//
// // Regenerate axis bindings for analog behaviors
// foreach (var axis in ItemBehaviors[staleItem].Where(b => b is IAnalogBehavior).Cast<IAnalogBehavior>())
// Axes[axis] = 0;
// }
}
public void OnBeforeSerialize()
@ -223,4 +270,10 @@ public abstract class Entity : DatabaseEntry, IMessagePackSerializationCallbackR
.Zip(PersistedBehaviors[itemBehaviors.Key.ID], (behavior, data) => new{behavior, data})))
persistentBehaviorData.behavior.Restore(persistentBehaviorData.data);
}
}
public class AxisSetting
{
public float Value;
public List<IAnalogBehavior> Behaviors;
}

View file

@ -130,6 +130,11 @@ public static class Extensions
return isDefault;
}
public static bool IsNull<T, TU>(this KeyValuePair<T, TU> pair)
{
return pair.Equals(new KeyValuePair<T, TU>());
}
private static Dictionary<float4[], int2> _cachedIndices = new Dictionary<float4[], int2>();
public static float Evaluate(this float4[] curve, float time)

View file

@ -14,6 +14,9 @@ public class GlobalData : DatabaseEntry
[InspectableField, JsonProperty("galaxyName"), Key(1)]
public string GalaxyName;
[InspectableDatabaseLink(typeof(ZoneData)), JsonProperty("arrivalZone"), Key(2)]
public Guid ArrivalZone;
[InspectableField, JsonProperty("galaxyArms"), Key(4)]
public int Arms = 4;

View file

@ -83,28 +83,25 @@ public class CompoundCommodityData : CraftedItemData
JsonObject(MemberSerialization.OptIn), JsonConverter(typeof(JsonKnownTypesConverter<EquippableItemData>))]
public abstract class EquippableItemData : CraftedItemData
{
[InspectableField, JsonProperty("draw"), Key(6)]
public PerformanceStat EnergyDraw = new PerformanceStat();
[InspectableAnimationCurve, JsonProperty("performanceCurve"), Key(7)]
[InspectableAnimationCurve, JsonProperty("performanceCurve"), Key(6)]
public float4[] HeatPerformanceCurve;
[TemperatureInspectable, JsonProperty("minTemp"), Key(8)]
[TemperatureInspectable, JsonProperty("minTemp"), Key(7)]
public float MinimumTemperature;
[TemperatureInspectable, JsonProperty("maxTemp"), Key(9)]
[TemperatureInspectable, JsonProperty("maxTemp"), Key(8)]
public float MaximumTemperature;
[InspectableField, JsonProperty("durabilityStat"), Key(10)]
[InspectableField, JsonProperty("durabilityStat"), Key(9)]
public PerformanceStat Durability = new PerformanceStat();
[InspectableField, JsonProperty("durabilityExponent"), Key(11)]
[InspectableField, JsonProperty("durabilityExponent"), Key(10)]
public PerformanceStat DurabilityExponent = new PerformanceStat();
[InspectableField, JsonProperty("heatExponent"), Key(12)]
[InspectableField, JsonProperty("heatExponent"), Key(11)]
public PerformanceStat HeatExponent = new PerformanceStat();
[InspectableField, JsonProperty("behaviors"), Key(13)]
[InspectableField, JsonProperty("behaviors"), Key(12)]
public List<BehaviorData> Behaviors = new List<BehaviorData>();
[IgnoreMember]
@ -142,7 +139,7 @@ public abstract class EquippableItemData : CraftedItemData
[RethinkTable("Items"), Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class GearData : EquippableItemData
{
[InspectableField, JsonProperty("hardpointType"), Key(14)]
[InspectableField, JsonProperty("hardpointType"), Key(13)]
public HardpointType Hardpoint;
[IgnoreMember] public override HardpointType HardpointType => Hardpoint;
@ -151,16 +148,16 @@ public class GearData : EquippableItemData
[RethinkTable("Items"), Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class HullData : EquippableItemData
{
[InspectableField, JsonProperty("hullCapacity"), Key(14)]
[InspectableField, JsonProperty("hullCapacity"), Key(13)]
public PerformanceStat Capacity = new PerformanceStat();
[InspectableField, JsonProperty("hardpoints"), Key(15)]
[InspectableField, JsonProperty("hardpoints"), Key(14)]
public List<HardpointData> Hardpoints = new List<HardpointData>();
[InspectablePrefab, JsonProperty("prefab"), Key(16)]
[InspectablePrefab, JsonProperty("prefab"), Key(15)]
public string Prefab;
[InspectableField, JsonProperty("hullType"), Key(17)]
[InspectableField, JsonProperty("hullType"), Key(16)]
public HullType HullType;
[IgnoreMember] public override HardpointType HardpointType => HardpointType.Hull;