Replace runtime MessagePack DTO keys

This commit is contained in:
Meta Vens 2026-06-13 15:02:32 +01:00
commit 066597e70b
41 changed files with 298 additions and 314 deletions

View file

@ -2,7 +2,6 @@
"name": "Aetheria.Shared.Unity",
"rootNamespace": "",
"references": [
"MessagePack",
"Unity.Mathematics",
"UniRx",
"Ink",

View file

@ -4,7 +4,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using GameCult.Aetheria.State.Unity;
using MessagePack;
using Unity.Mathematics;
public interface IRuntimeItemCatalogReader
@ -223,9 +222,9 @@ public sealed class AetheriaRuntimeItemCatalog : IRuntimeItemCatalogReader
{
return type
.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
.Select(field => (attribute: field.GetCustomAttribute<KeyAttribute>(), field))
.Where(entry => entry.attribute?.IntKey != null)
.Select(entry => (entry.attribute.IntKey.GetValueOrDefault(), entry.field));
.Select(field => (attribute: field.GetCustomAttribute<RuntimeCatalogKeyAttribute>(), field))
.Where(entry => entry.attribute != null)
.Select(entry => (entry.attribute.Key, entry.field));
}
private static object ConvertValue(AetheriaRuntimeBehaviorValue value, Type targetType)
@ -253,7 +252,7 @@ public sealed class AetheriaRuntimeItemCatalog : IRuntimeItemCatalogReader
return ConvertList(value, targetType);
}
if (targetType.GetCustomAttribute<MessagePackObjectAttribute>() != null)
if (GetKeyedFields(targetType).Any())
{
return ConvertKeyedObject(value, targetType);
}

View file

@ -2,50 +2,49 @@
* 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 MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject, EntityTypeRestriction(HullType.Ship), RuntimeInspectable]
[Inspectable, EntityTypeRestriction(HullType.Ship), RuntimeInspectable]
public class AetherDriveData : BehaviorData
{
[Inspectable, Key(1)]
[Inspectable, RuntimeCatalogKey(1)]
public float3 RotorDiameter;
[Inspectable, Key(2)]
[Inspectable, RuntimeCatalogKey(2)]
public float3 RotorMass;
[Inspectable, Key(3), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(3), RuntimeInspectable]
public PerformanceStat MaximumRpm;
[Inspectable, Key(4)]
[Inspectable, RuntimeCatalogKey(4)]
public float3 CouplingLambda;
[Inspectable, Key(5)]
[Inspectable, RuntimeCatalogKey(5)]
public PerformanceStat LambdaMultiplier;
[Inspectable, Key(6), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(6), RuntimeInspectable]
public PerformanceStat CouplingEfficiency;
[Inspectable, Key(7), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(7), RuntimeInspectable]
public PerformanceStat Torque;
[Inspectable, Key(8), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(8), RuntimeInspectable]
public BezierCurve TorqueProfile;
[Inspectable, Key(9), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(9), RuntimeInspectable]
public PerformanceStat EnergyDraw;
[Inspectable, Key(10), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(10), RuntimeInspectable]
public PerformanceStat PassiveCoupling;
[InspectableAudioParameter, Key(11), RuntimeInspectable]
[InspectableAudioParameter, RuntimeCatalogKey(11), RuntimeInspectable]
public uint RpmAudioParameter;
[InspectableAudioParameter, Key(12), RuntimeInspectable]
[InspectableAudioParameter, RuntimeCatalogKey(12), RuntimeInspectable]
public uint TorqueRatioAudioParameter;
[InspectablePrefab, Key(13)]
[InspectablePrefab, RuntimeCatalogKey(13)]
public string Particles;
public override Behavior CreateInstance(EquippedItem item)

View file

@ -1,11 +1,10 @@
using System;
using System.Collections;
using System.Collections.Generic;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject, RuntimeInspectable]
[Inspectable, RuntimeInspectable]
public class AutoWeaponData : InstantWeaponData
{
public override Behavior CreateInstance(EquippedItem item)

View file

@ -6,7 +6,6 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
using static Unity.Mathematics.noise;
@ -28,7 +27,7 @@ public abstract class Behavior
if(Item != null)
{
var hardpoint = Entity.Hardpoints[Item.Position.x, Item.Position.y];
if (hardpoint != null && Entity.HardpointTransforms.ContainsKey(hardpoint))
if (hardpoint != null && Entity.HardpointTransforms.ContainsRuntimeCatalogKey(hardpoint))
{
return normalize(Entity.HardpointTransforms[hardpoint].direction);
}
@ -140,7 +139,6 @@ public interface IPopulationAssignment
int AssignedPopulation { get; set; }
}
[MessagePackObject]
public abstract class PersistentBehaviorData
{
}
@ -148,7 +146,7 @@ public abstract class PersistentBehaviorData
[Inspectable]
public abstract class BehaviorData
{
[Inspectable, Key(0)]
[Inspectable, RuntimeCatalogKey(0)]
public int Group;
public abstract Behavior CreateInstance(EquippedItem item);

View file

@ -3,17 +3,16 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
using System.Collections.Generic;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject, RuntimeInspectable]
[Inspectable, RuntimeInspectable]
public class CapacitorData : BehaviorData
{
[Inspectable, Key(1), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(1), RuntimeInspectable]
public PerformanceStat Capacity = new PerformanceStat();
[Inspectable, Key(2), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(2), RuntimeInspectable]
public PerformanceStat Efficiency = new PerformanceStat();
public override Behavior CreateInstance(EquippedItem item)

View file

@ -1,47 +1,46 @@
using System;
using System.Collections;
using System.Collections.Generic;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject, RuntimeInspectable]
[Inspectable, RuntimeInspectable]
public class ChargedWeaponData : InstantWeaponData
{
[Inspectable, Key(21), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(21), RuntimeInspectable]
public PerformanceStat ChargeTime = new PerformanceStat();
[Inspectable, Key(22), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(22), RuntimeInspectable]
public PerformanceStat ChargeEnergy = new PerformanceStat();
[Inspectable, Key(23), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(23), RuntimeInspectable]
public PerformanceStat ChargeHeat = new PerformanceStat();
[Inspectable, Key(24)]
[Inspectable, RuntimeCatalogKey(24)]
public bool CanFireEarly;
[Inspectable, Key(25)]
[Inspectable, RuntimeCatalogKey(25)]
public float FailureCharge;
[Inspectable, Key(26)]
[Inspectable, RuntimeCatalogKey(26)]
public float FailureDamage = 1;
[Inspectable, Key(27)]
[Inspectable, RuntimeCatalogKey(27)]
public float ChargeFiringDamageMultiplier = 1;
[Inspectable, Key(28)]
[Inspectable, RuntimeCatalogKey(28)]
public float ChargeFiringSpreadMultiplier = 1;
[Inspectable, Key(29)]
[Inspectable, RuntimeCatalogKey(29)]
public float ChargeFiringBurstCountMultiplier = 1;
[Inspectable, Key(30)]
[Inspectable, RuntimeCatalogKey(30)]
public float ChargeFiringVisibilityMultiplier = 1;
[Inspectable, Key(31)]
[Inspectable, RuntimeCatalogKey(31)]
public float ChargeFiringVelocityMultiplier = 1;
[Inspectable, Key(32)]
[Inspectable, RuntimeCatalogKey(32)]
public float ChargeFiringHeatMultiplier = 1;
public override Behavior CreateInstance(EquippedItem item)

View file

@ -3,11 +3,10 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
using System.Collections.Generic;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject, RuntimeInspectable]
[Inspectable, RuntimeInspectable]
public class CockpitData : BehaviorData
{
public override Behavior CreateInstance(EquippedItem item)

View file

@ -3,14 +3,13 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
using System;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject]
[Inspectable]
public class ConstantWeaponData : WeaponData
{
[InspectablePrefab, Key(17)]
[InspectablePrefab, RuntimeCatalogKey(17)]
public float AmmoInterval = 1;
public override Behavior CreateInstance(EquippedItem item)

View file

@ -4,14 +4,13 @@
using System;
using System.Linq;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject, Order(-10), RuntimeInspectable]
[Inspectable, Order(-10), RuntimeInspectable]
public class CooldownData : BehaviorData
{
[Inspectable, Key(1), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(1), RuntimeInspectable]
public PerformanceStat Cooldown = new PerformanceStat();
public override Behavior CreateInstance(EquippedItem item)

View file

@ -4,14 +4,13 @@
using System;
using System.Linq;
using MessagePack;
[Inspectable, MessagePackObject, Order(-20), RuntimeInspectable]
[Inspectable, Order(-20), RuntimeInspectable]
public class EnergyDrawData : BehaviorData
{
[Inspectable, Key(1), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(1), RuntimeInspectable]
public PerformanceStat EnergyDraw = new PerformanceStat();
[Inspectable, Key(2)]
[Inspectable, RuntimeCatalogKey(2)]
public bool PerSecond;
public override Behavior CreateInstance(EquippedItem item)

View file

@ -4,14 +4,13 @@
using System;
using System.Linq;
using MessagePack;
[Inspectable, MessagePackObject, Order(10)]
[Inspectable, Order(10)]
public class HeatData : BehaviorData
{
[Inspectable, Key(1), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(1), RuntimeInspectable]
public PerformanceStat Heat = new PerformanceStat();
[Inspectable, Key(2)]
[Inspectable, RuntimeCatalogKey(2)]
public bool PerSecond;
public override Behavior CreateInstance(EquippedItem item)

View file

@ -3,11 +3,10 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
using System.Collections.Generic;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject, RuntimeInspectable]
[Inspectable, RuntimeInspectable]
public class HeatStorageData : BehaviorData
{
public override Behavior CreateInstance(EquippedItem item)

View file

@ -1,23 +1,22 @@
using System;
using System.Collections;
using System.Collections.Generic;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject, RuntimeInspectable]
[Inspectable, RuntimeInspectable]
public class InstantWeaponData : WeaponData
{
[Inspectable, Key(17)]
[Inspectable, RuntimeCatalogKey(17)]
public PerformanceStat Count = new PerformanceStat();
[Inspectable, Key(18)]
[Inspectable, RuntimeCatalogKey(18)]
public PerformanceStat BurstTime = new PerformanceStat();
[Inspectable, Key(19), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(19), RuntimeInspectable]
public PerformanceStat Cooldown = new PerformanceStat();
[InspectablePrefab, Key(20)]
[InspectablePrefab, RuntimeCatalogKey(20)]
public bool SingleAmmoBurst;
public override Behavior CreateInstance(EquippedItem item)

View file

@ -4,11 +4,10 @@
using System;
using System.Linq;
using MessagePack;
[Inspectable, MessagePackObject, Order(-5), RuntimeInspectable]
[Inspectable, Order(-5), RuntimeInspectable]
public class ItemUsageData : BehaviorData
{
[InspectableDatabaseLink(typeof(SimpleCommodityData)), Key(1), RuntimeInspectable]
[InspectableDatabaseLink(typeof(SimpleCommodityData)), RuntimeCatalogKey(1), RuntimeInspectable]
public Guid Item;
public override Behavior CreateInstance(EquippedItem item)

View file

@ -2,28 +2,27 @@
* 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 MessagePack;
using Unity.Mathematics;
[Inspectable, MessagePackObject]
[Inspectable]
public class LauncherData : LockWeaponData
{
[InspectableAnimationCurve, Key(26)]
[InspectableAnimationCurve, RuntimeCatalogKey(26)]
public float4[] GuidanceCurve;
[InspectableAnimationCurve, Key(27)]
[InspectableAnimationCurve, RuntimeCatalogKey(27)]
public float4[] ThrustCurve;
[InspectableAnimationCurve, Key(28)]
[InspectableAnimationCurve, RuntimeCatalogKey(28)]
public float4[] LiftCurve;
[Inspectable, Key(29)]
[Inspectable, RuntimeCatalogKey(29)]
public PerformanceStat Thrust = new PerformanceStat();
[Inspectable, Key(30)]
[Inspectable, RuntimeCatalogKey(30)]
public float DodgeFrequency;
[Inspectable, Key(31), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(31), RuntimeInspectable]
public PerformanceStat MissileVelocity = new PerformanceStat();
public override Behavior CreateInstance(EquippedItem item)
@ -32,25 +31,25 @@ public class LauncherData : LockWeaponData
}
}
[Inspectable, MessagePackObject]
[Inspectable]
public class GuidedWeaponData : InstantWeaponData
{
[InspectableAnimationCurve, Key(21)]
[InspectableAnimationCurve, RuntimeCatalogKey(21)]
public float4[] GuidanceCurve;
[InspectableAnimationCurve, Key(22)]
[InspectableAnimationCurve, RuntimeCatalogKey(22)]
public float4[] ThrustCurve;
[InspectableAnimationCurve, Key(23)]
[InspectableAnimationCurve, RuntimeCatalogKey(23)]
public float4[] LiftCurve;
[Inspectable, Key(24)]
[Inspectable, RuntimeCatalogKey(24)]
public PerformanceStat Thrust = new PerformanceStat();
[Inspectable, Key(25)]
[Inspectable, RuntimeCatalogKey(25)]
public float DodgeFrequency;
[Inspectable, Key(26), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(26), RuntimeInspectable]
public PerformanceStat MissileVelocity = new PerformanceStat();
public override Behavior CreateInstance(EquippedItem item)

View file

@ -1,26 +1,25 @@
using System;
using System.Collections;
using System.Collections.Generic;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject, RuntimeInspectable]
[Inspectable, RuntimeInspectable]
public class LockWeaponData : InstantWeaponData
{
[Inspectable, Key(21), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(21), RuntimeInspectable]
public PerformanceStat LockSpeed = new PerformanceStat();
[Inspectable, Key(22)]
[Inspectable, RuntimeCatalogKey(22)]
public PerformanceStat SensorImpact = new PerformanceStat();
[Inspectable, Key(23), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(23), RuntimeInspectable]
public PerformanceStat LockAngle = new PerformanceStat();
[Inspectable, Key(24)]
[Inspectable, RuntimeCatalogKey(24)]
public PerformanceStat DirectionImpact = new PerformanceStat();
[Inspectable, Key(25)]
[Inspectable, RuntimeCatalogKey(25)]
public PerformanceStat Decay = new PerformanceStat();
public override Behavior CreateInstance(EquippedItem item)

View file

@ -4,23 +4,22 @@
using System;
using System.Linq;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject, Order(10)]
[Inspectable, Order(10)]
public class MiningToolData : BehaviorData
{
[Inspectable, Key(1)]
[Inspectable, RuntimeCatalogKey(1)]
public PerformanceStat DamagePerSecond = new PerformanceStat();
[Inspectable, Key(2)]
[Inspectable, RuntimeCatalogKey(2)]
public PerformanceStat Efficiency = new PerformanceStat();
[Inspectable, Key(3)]
[Inspectable, RuntimeCatalogKey(3)]
public PerformanceStat Penetration = new PerformanceStat();
[Inspectable, Key(4)]
[Inspectable, RuntimeCatalogKey(4)]
public PerformanceStat Range = new PerformanceStat();
public override Behavior CreateInstance(EquippedItem item)

View file

@ -2,29 +2,28 @@
* 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 MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject, RuntimeInspectable]
[Inspectable, RuntimeInspectable]
public class RadiatorData : BehaviorData
{
[Inspectable, Key(1), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(1), RuntimeInspectable]
public PerformanceStat Emissivity = new PerformanceStat();
[Inspectable, Key(2), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(2), RuntimeInspectable]
public PerformanceStat PumpedHeat = new PerformanceStat();
[InspectableTemperature, Key(3), RuntimeInspectable]
[InspectableTemperature, RuntimeCatalogKey(3), RuntimeInspectable]
public float TemperatureFloor;
[Inspectable, Key(4), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(4), RuntimeInspectable]
public PerformanceStat WasteHeat = new PerformanceStat();
[Inspectable, Key(5), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(5), RuntimeInspectable]
public PerformanceStat EnergyUsage = new PerformanceStat();
[Inspectable, Key(6), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(6), RuntimeInspectable]
public PerformanceStat ThermalMass = new PerformanceStat();
public override Behavior CreateInstance(EquippedItem item)

View file

@ -5,24 +5,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MessagePack;
using UniRx;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject, RuntimeInspectable]
[Inspectable, RuntimeInspectable]
public class ReactorData : BehaviorData
{
[Inspectable, Key(1), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(1), RuntimeInspectable]
public PerformanceStat Charge = new PerformanceStat();
[Inspectable, Key(2), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(2), RuntimeInspectable]
public PerformanceStat Efficiency = new PerformanceStat();
[Inspectable, Key(3), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(3), RuntimeInspectable]
public PerformanceStat OverloadEfficiency = new PerformanceStat();
[Inspectable, Key(4), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(4), RuntimeInspectable]
public PerformanceStat ThrottlingFactor = new PerformanceStat();
public override Behavior CreateInstance(EquippedItem item)

View file

@ -2,17 +2,16 @@
* 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 MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject, RuntimeInspectable]
[Inspectable, RuntimeInspectable]
public class ReflectorData : BehaviorData
{
[Inspectable, Key(1), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(1), RuntimeInspectable]
public PerformanceStat CrossSection = new PerformanceStat();
// [InspectableAnimationCurve, Key(1)]
// [InspectableAnimationCurve, RuntimeCatalogKey(1)]
// public float4[] VisibilityCurve;
public override Behavior CreateInstance(EquippedItem item)

View file

@ -4,20 +4,19 @@
using System;
using System.Linq;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject, RuntimeInspectable]
[Inspectable, RuntimeInspectable]
public class ResourceScannerData : BehaviorData
{
[Inspectable, Key(1), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(1), RuntimeInspectable]
public PerformanceStat Range = new PerformanceStat();
[Inspectable, Key(2), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(2), RuntimeInspectable]
public PerformanceStat MinimumDensity = new PerformanceStat();
[Inspectable, Key(3), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(3), RuntimeInspectable]
public PerformanceStat ScanDuration = new PerformanceStat();
public override Behavior CreateInstance(EquippedItem item)

View file

@ -4,38 +4,37 @@
using System;
using System.Collections.Generic;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject, RuntimeInspectable]
[Inspectable, RuntimeInspectable]
public class SensorData : BehaviorData
{
[Inspectable, Key(3), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(3), RuntimeInspectable]
public PerformanceStat Sensitivity = new PerformanceStat();
[InspectableAnimationCurve, Key(4), RuntimeInspectable]
[InspectableAnimationCurve, RuntimeCatalogKey(4), RuntimeInspectable]
public BezierCurve SensitivityCurve;
[Inspectable, Key(5), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(5), RuntimeInspectable]
public PerformanceStat PingBoost;
[Inspectable, Key(6), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(6), RuntimeInspectable]
public PerformanceStat PingEnergy;
[Inspectable, Key(7), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(7), RuntimeInspectable]
public PerformanceStat PingVisibility;
[Inspectable, Key(8), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(8), RuntimeInspectable]
public PerformanceStat PingRange;
[Inspectable, Key(9), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(9), RuntimeInspectable]
public PerformanceStat PingCooldown;
[Inspectable, Key(10)]
[Inspectable, RuntimeCatalogKey(10)]
public float PingDuration = 2;
[Inspectable, Key(11)]
[Inspectable, RuntimeCatalogKey(11)]
public float PingRadiusExponent = .5f;
public override Behavior CreateInstance(EquippedItem item)

View file

@ -2,17 +2,16 @@
* 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 MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject, RuntimeInspectable]
[Inspectable, RuntimeInspectable]
public class ShieldData : BehaviorData
{
[Inspectable, Key(1), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(1), RuntimeInspectable]
public PerformanceStat Efficiency = new PerformanceStat();
[Inspectable, Key(2), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(2), RuntimeInspectable]
public PerformanceStat EnergyUsage = new PerformanceStat();
public override Behavior CreateInstance(EquippedItem item)

View file

@ -4,20 +4,19 @@
using System;
using System.Linq;
using MessagePack;
[Inspectable, MessagePackObject]
[Inspectable]
public class StatModifierData : BehaviorData
{
[Inspectable, Key(1)]
[Inspectable, RuntimeCatalogKey(1)]
public StatReference Stat = new StatReference();
[Inspectable, Key(2)]
[Inspectable, RuntimeCatalogKey(2)]
public PerformanceStat Modifier = new PerformanceStat();
[Inspectable, Key(3)]
[Inspectable, RuntimeCatalogKey(3)]
public StatModifierType Type;
[InspectableType(typeof(BehaviorData)), Key(4)]
[InspectableType(typeof(BehaviorData)), RuntimeCatalogKey(4)]
public Type RequireBehavior;
public override Behavior CreateInstance(EquippedItem item)
@ -128,12 +127,12 @@ public enum StatModifierType
Multiplier
}
[Inspectable, MessagePackObject]
[Inspectable]
public class StatReference
{
[InspectableType(typeof(BehaviorData)), Key(1)]
[InspectableType(typeof(BehaviorData)), RuntimeCatalogKey(1)]
public string Target;
[Inspectable, Key(2)]
[Inspectable, RuntimeCatalogKey(2)]
public string Stat;
}

View file

@ -4,8 +4,7 @@
using System;
using System.Linq;
using MessagePack;
[Inspectable, MessagePackObject, Order(-25)]
[Inspectable, Order(-25)]
public class SwitchData : BehaviorData
{
public override Behavior CreateInstance(EquippedItem item)

View file

@ -4,17 +4,16 @@
using System;
using System.Linq;
using MessagePack;
[Inspectable, MessagePackObject, Order(-22)]
[Inspectable, Order(-22)]
public class ThermotoggleData : BehaviorData
{
[InspectableTemperature, Key(1)]
[InspectableTemperature, RuntimeCatalogKey(1)]
public float TargetTemperature;
[Inspectable, Key(2)]
[Inspectable, RuntimeCatalogKey(2)]
public bool HighPass;
[Inspectable, Key(3)]
[Inspectable, RuntimeCatalogKey(3)]
public bool Adjustable;
public override Behavior CreateInstance(EquippedItem item)

View file

@ -2,26 +2,25 @@
* 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 MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject, EntityTypeRestriction(HullType.Ship), RuntimeInspectable]
[Inspectable, EntityTypeRestriction(HullType.Ship), RuntimeInspectable]
public class ThrusterData : BehaviorData
{
[Inspectable, Key(1), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(1), RuntimeInspectable]
public PerformanceStat Thrust = new PerformanceStat();
[Inspectable, Key(2), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(2), RuntimeInspectable]
public PerformanceStat Visibility = new PerformanceStat();
[Inspectable, Key(3), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(3), RuntimeInspectable]
public PerformanceStat Heat = new PerformanceStat();
[Inspectable, Key(4), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(4), RuntimeInspectable]
public PerformanceStat EnergyUsage = new PerformanceStat();
[InspectablePrefab, Key(5)]
[InspectablePrefab, RuntimeCatalogKey(5)]
public string ParticlesPrefab;
public override Behavior CreateInstance(EquippedItem item)
@ -80,7 +79,7 @@ public class Thruster : Behavior, IAnalogBehavior
Unity.Mathematics.float2x2.Rotate(_input * Torque * Thrust * ItemManager.GameplaySettings.TorqueMultiplier / Entity.Mass * dt));
AddHeat(_input * Evaluate(_data.Heat) * dt);
var vis = _input * Evaluate(_data.Visibility);
if (!Entity.VisibilitySources.ContainsKey(this) || vis > Entity.VisibilitySources[this])
if (!Entity.VisibilitySources.ContainsRuntimeCatalogKey(this) || vis > Entity.VisibilitySources[this])
Entity.VisibilitySources[this] = vis;
return true;
}

View file

@ -4,8 +4,7 @@
using System;
using System.Linq;
using MessagePack;
[Inspectable, MessagePackObject, Order(-20)]
[Inspectable, Order(-20)]
public class TriggerData : BehaviorData
{
public override Behavior CreateInstance(EquippedItem item)

View file

@ -4,13 +4,12 @@
using System.Collections.Generic;
using System.Linq;
using MessagePack;
using UniRx;
using Unity.Mathematics;
using static Unity.Mathematics.math;
using float3 = Unity.Mathematics.float3;
[MessagePackObject, RuntimeInspectable]
[RuntimeInspectable]
public class TurretControllerData : BehaviorData
{
public override Behavior CreateInstance(EquippedItem item)

View file

@ -2,14 +2,13 @@
* 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 MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[MessagePackObject, RuntimeInspectable]
[RuntimeInspectable]
public class VelocityConversionData : BehaviorData
{
[Inspectable, Key(1), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(1), RuntimeInspectable]
public PerformanceStat Lambda = new PerformanceStat();
public override Behavior CreateInstance(EquippedItem item)

View file

@ -2,14 +2,13 @@
* 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 MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject, RuntimeInspectable]
[Inspectable, RuntimeInspectable]
public class VelocityLimitData : BehaviorData
{
[Inspectable, Key(1), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(1), RuntimeInspectable]
public PerformanceStat TopSpeed = new PerformanceStat();
public override Behavior CreateInstance(EquippedItem item)

View file

@ -4,14 +4,13 @@
using System;
using System.Linq;
using MessagePack;
[Inspectable, MessagePackObject, RuntimeInspectable]
[Inspectable, RuntimeInspectable]
public class VisibilityData : BehaviorData
{
[Inspectable, Key(1), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(1), RuntimeInspectable]
public PerformanceStat Visibility = new PerformanceStat();
[Inspectable, Key(2)]
[Inspectable, RuntimeCatalogKey(2)]
public PerformanceStat VisibilityDecay = new PerformanceStat();
public override Behavior CreateInstance(EquippedItem item)

View file

@ -5,59 +5,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, RuntimeInspectable]
public abstract class WeaponData : BehaviorData
{
[Inspectable, Key(1), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(1), RuntimeInspectable]
public DamageType DamageType;
[Inspectable, Key(2), RuntimeInspectable]
[Inspectable, RuntimeCatalogKey(2), RuntimeInspectable]
public PerformanceStat Damage = new PerformanceStat();
[InspectableRangedFloat(0,1), Key(3), RuntimeInspectable]
[InspectableRangedFloat(0,1), RuntimeCatalogKey(3), RuntimeInspectable]
public PerformanceStat Penetration = new PerformanceStat();
[InspectableRangedFloat(0,1), Key(4)]
[InspectableRangedFloat(0,1), RuntimeCatalogKey(4)]
public PerformanceStat DamageSpread = new PerformanceStat();
[Inspectable, Key(5)]
[Inspectable, RuntimeCatalogKey(5)]
public PerformanceStat MinRange = new PerformanceStat();
[Inspectable, Key(6)]
[Inspectable, RuntimeCatalogKey(6)]
public PerformanceStat Range = new PerformanceStat();
[InspectableAnimationCurve, Key(7)]
[InspectableAnimationCurve, RuntimeCatalogKey(7)]
public BezierCurve DamageCurve;
[InspectablePrefab, Key(8)]
[InspectablePrefab, RuntimeCatalogKey(8)]
public string EffectPrefab;
[InspectablePrefab, Key(9), RuntimeInspectable]
[InspectablePrefab, RuntimeCatalogKey(9), RuntimeInspectable]
public PerformanceStat Energy = new PerformanceStat();
[InspectablePrefab, Key(10), RuntimeInspectable]
[InspectablePrefab, RuntimeCatalogKey(10), RuntimeInspectable]
public PerformanceStat Heat = new PerformanceStat();
[InspectablePrefab, Key(11), RuntimeInspectable]
[InspectablePrefab, RuntimeCatalogKey(11), RuntimeInspectable]
public PerformanceStat Visibility = new PerformanceStat();
[InspectableDatabaseLink(typeof(SimpleCommodityData)), Key(12), RuntimeInspectable]
[InspectableDatabaseLink(typeof(SimpleCommodityData)), RuntimeCatalogKey(12), RuntimeInspectable]
public Guid AmmoType;
[InspectablePrefab, Key(13)]
[InspectablePrefab, RuntimeCatalogKey(13)]
public int MagazineSize;
[InspectablePrefab, Key(14)]
[InspectablePrefab, RuntimeCatalogKey(14)]
public float ReloadTime = 1;
[InspectablePrefab, Key(15)]
[InspectablePrefab, RuntimeCatalogKey(15)]
public PerformanceStat Spread = new PerformanceStat();
[Inspectable, Key(16)]
[Inspectable, RuntimeCatalogKey(16)]
public PerformanceStat Velocity = new PerformanceStat();
}

View file

@ -3,14 +3,13 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
using System.Collections.Generic;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[Inspectable, MessagePackObject, Order(1000), RuntimeInspectable]
[Inspectable, Order(1000), RuntimeInspectable]
public class WearData : BehaviorData
{
[InspectableTemperature, Key(1)]
[InspectableTemperature, RuntimeCatalogKey(1)]
public bool PerSecond = true;
public override Behavior CreateInstance(EquippedItem item)

View file

@ -1,21 +1,18 @@
using System;
using System.Linq;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
[MessagePackObject]
public class BezierCurve
{
[Key(0)] public float4[] Keys;
[RuntimeCatalogKey(0)] public float4[] Keys;
[IgnoreMember] private int2 _cachedIndices;
private int2 _cachedIndices;
[IgnoreMember] private const int STEPS = 64;
private const int STEPS = 64;
[IgnoreMember] private float? _maximum;
private float? _maximum;
[IgnoreMember]
public float Maximum
{
get

View file

@ -6,16 +6,15 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using MessagePack;
using Unity.Mathematics;
using static Unity.Mathematics.math;
using float2 = Unity.Mathematics.float2;
using int2 = Unity.Mathematics.int2;
[Inspectable, MessagePackObject]
[Inspectable]
public class Shape
{
[Key(0)] public bool[,] Cells;
[RuntimeCatalogKey(0)] public bool[,] Cells;
private bool _dirty = true;
@ -30,14 +29,12 @@ public class Shape
Cells = new bool[width, height];
}
[IgnoreMember]
public int Width
{
get { return Cells.GetLength(0); }
set { Resize(value, Height); }
}
[IgnoreMember]
public int Height
{
get { return Cells.GetLength(1); }
@ -77,7 +74,6 @@ public class Shape
private int2[] _cachedShapeCoordinates;
[IgnoreMember]
public int2[] Coordinates
{
get
@ -104,7 +100,6 @@ public class Shape
private int2[] _cachedAllShapeCoordinates;
[IgnoreMember]
public int2[] AllCoordinates => _cachedAllShapeCoordinates ?? (_cachedAllShapeCoordinates = EnumerateAllShapeCoordinates().ToArray());
private IEnumerable<int2> EnumerateAllShapeCoordinates()
@ -120,7 +115,6 @@ public class Shape
private float2? _centerOfMass;
[IgnoreMember]
public float2 CenterOfMass => _centerOfMass ?? (_centerOfMass = Coordinates
.Aggregate(float2.zero, (total, coord) => total + coord) / Coordinates.Length).Value;
@ -266,35 +260,34 @@ public class Shape
}
[MessagePackObject]
public abstract class ItemData : DatabaseEntry, INamedEntry
{
[Inspectable, Key(1)]
[Inspectable, RuntimeCatalogKey(1)]
public string Name;
[InspectableText, Key(2)]
[InspectableText, RuntimeCatalogKey(2)]
public string Description;
[InspectableDatabaseLink(typeof(Faction)), Key(3)]
[InspectableDatabaseLink(typeof(Faction)), RuntimeCatalogKey(3)]
public Guid Manufacturer;
[Inspectable, Key(4)]
[Inspectable, RuntimeCatalogKey(4)]
public float Mass;
[InspectableSchematicShape, Key(5)]
[InspectableSchematicShape, RuntimeCatalogKey(5)]
public Shape Shape;
// Heat needed to change temperature of 1 gram by 1 degree
[Inspectable, Key(6)]
[Inspectable, RuntimeCatalogKey(6)]
public float SpecificHeat = 1;
[Inspectable, Key(7)]
[Inspectable, RuntimeCatalogKey(7)]
public float Conductivity = 1;
[Inspectable, Key(8)]
[Inspectable, RuntimeCatalogKey(8)]
public int Price = 0;
[IgnoreMember] public string EntryName
public string EntryName
{
get => Name;
set => Name = value;
@ -302,117 +295,114 @@ public abstract class ItemData : DatabaseEntry, INamedEntry
}
[LegacyCatalogGroup("Items"), Inspectable, MessagePackObject]
[LegacyCatalogGroup("Items"), Inspectable]
public class SimpleCommodityData : ItemData
{
// // Types of body where this resource can be found
// [InspectableField, Key(6)]
// [InspectableField, RuntimeCatalogKey(6)]
// public BodyType ResourceBodyType;
//
// // Link to map(s) controlling density of resource, multiplied together when more than one
// [InspectableDatabaseLink(typeof(GalaxyMapLayerData)), Key(7)]
// [InspectableDatabaseLink(typeof(GalaxyMapLayerData)), RuntimeCatalogKey(7)]
// public List<Guid> ResourceDensity = new List<Guid>();
//
// // Controls the lowest value in the resource distribution curve
// [InspectableField, Key(8)]
// [InspectableField, RuntimeCatalogKey(8)]
// public ExponentialLerp Distribution;
//
// // Minimum amount of resources needed for presence to register
// [InspectableField, Key(11)]
// [InspectableField, RuntimeCatalogKey(11)]
// public float Floor = 5f;
[Inspectable, Key(9)]
[Inspectable, RuntimeCatalogKey(9)]
public int MaxStack = 10;
[Inspectable, Key(10)]
[Inspectable, RuntimeCatalogKey(10)]
public SimpleCommodityCategory Category;
}
[MessagePackObject]
public abstract class CraftedItemData : ItemData
{
// [Inspectable, Key(9)]
// [Inspectable, RuntimeCatalogKey(9)]
// public float IngredientQualityWeight = .5f;
}
[LegacyCatalogGroup("Items"), Inspectable, MessagePackObject]
[LegacyCatalogGroup("Items"), Inspectable]
public class CompoundCommodityData : CraftedItemData
{
[InspectableDatabaseLink(typeof(PersonalityAttribute)), Key(10)]
[InspectableDatabaseLink(typeof(PersonalityAttribute)), RuntimeCatalogKey(10)]
public Dictionary<Guid, float> DemandProfile = new Dictionary<Guid, float>();
[Inspectable, Key(11)]
[Inspectable, RuntimeCatalogKey(11)]
public CompoundCommodityCategory Category;
}
[LegacyCatalogGroup("Items"), Inspectable, MessagePackObject]
[LegacyCatalogGroup("Items"), Inspectable]
public class ConsumableItemData : CraftedItemData
{
[Inspectable, Key(10)]
[Inspectable, RuntimeCatalogKey(10)]
public List<BehaviorData> Behaviors = new List<BehaviorData>();
[Inspectable, Key(11)]
[Inspectable, RuntimeCatalogKey(11)]
public bool Stackable;
[Inspectable, Key(12)]
[Inspectable, RuntimeCatalogKey(12)]
public float Duration;
[InspectableTexture, Key(13)]
[InspectableTexture, RuntimeCatalogKey(13)]
public string Icon;
[Inspectable, Key(14)]
[Inspectable, RuntimeCatalogKey(14)]
public BezierCurve Effectiveness;
}
public abstract class EquippableItemData : CraftedItemData
{
[InspectableTexture, Key(10)]
[InspectableTexture, RuntimeCatalogKey(10)]
public string Schematic;
[Inspectable, Key(11)]
[Inspectable, RuntimeCatalogKey(11)]
public List<BehaviorData> Behaviors = new List<BehaviorData>();
[Inspectable, Key(12)]
[Inspectable, RuntimeCatalogKey(12)]
public float Durability;
[InspectableTemperature, Key(13)]
[InspectableTemperature, RuntimeCatalogKey(13)]
public float MinimumTemperature;
[InspectableTemperature, Key(14)]
[InspectableTemperature, RuntimeCatalogKey(14)]
public float MaximumTemperature;
// [InspectableField, Key(15), SimplePerformanceStat]
// [InspectableField, RuntimeCatalogKey(15), SimplePerformanceStat]
// public PerformanceStat DurabilityExponent = new PerformanceStat();
//
// [InspectableField, Key(16), SimplePerformanceStat]
// [InspectableField, RuntimeCatalogKey(16), SimplePerformanceStat]
// public PerformanceStat HeatExponent = new PerformanceStat();
[InspectableAnimationCurve, Key(17)]
[InspectableAnimationCurve, RuntimeCatalogKey(17)]
public BezierCurve HeatPerformanceCurve;
[Inspectable, Key(18)]
[Inspectable, RuntimeCatalogKey(18)]
public float ThermalResilience = 1;
// [Inspectable, Key(19)]
// [Inspectable, RuntimeCatalogKey(19)]
// public string SoundEffectTrigger;
[InspectableTexture, Key(20)]
[InspectableTexture, RuntimeCatalogKey(20)]
public string ActionBarIcon;
[InspectableSoundBank, Key(21)]
[InspectableSoundBank, RuntimeCatalogKey(21)]
public uint SoundBank;
[Inspectable, Key(22)]
[Inspectable, RuntimeCatalogKey(22)]
public List<AudioStat> AudioStats = new List<AudioStat>();
[IgnoreMember]
public abstract HardpointType HardpointType { get; }
[IgnoreMember] private const int STEPS = 64;
private const int STEPS = 64;
[IgnoreMember] private float? _optimum;
private float? _optimum;
[IgnoreMember]
public float OptimalTemperature
{
get
@ -443,85 +433,84 @@ public abstract class EquippableItemData : CraftedItemData
}
}
[Inspectable, MessagePackObject]
[Inspectable]
public class AudioStat
{
[InspectableAudioParameter, Key(0)]
[InspectableAudioParameter, RuntimeCatalogKey(0)]
public uint Parameter;
[Inspectable, Key(1)]
[Inspectable, RuntimeCatalogKey(1)]
public PerformanceStat Stat = new PerformanceStat();
}
[LegacyCatalogGroup("Items"), Inspectable, MessagePackObject]
[LegacyCatalogGroup("Items"), Inspectable]
public class GearData : EquippableItemData
{
[Inspectable, Key(23)]
[Inspectable, RuntimeCatalogKey(23)]
public HardpointType Hardpoint;
[IgnoreMember] public override HardpointType HardpointType => Hardpoint;
public override HardpointType HardpointType => Hardpoint;
}
[LegacyCatalogGroup("Items"), Inspectable, MessagePackObject]
[LegacyCatalogGroup("Items"), Inspectable]
public class CargoBayData : EquippableItemData
{
[Inspectable, Key(24)]
[Inspectable, RuntimeCatalogKey(24)]
public Shape InteriorShape;
[IgnoreMember] public override HardpointType HardpointType => HardpointType.Tool;
public override HardpointType HardpointType => HardpointType.Tool;
}
[LegacyCatalogGroup("Items"), Inspectable, MessagePackObject]
[LegacyCatalogGroup("Items"), Inspectable]
public class DockingBayData : CargoBayData
{
[Inspectable, Key(25)]
[Inspectable, RuntimeCatalogKey(25)]
public int2 MaxSize;
}
[LegacyCatalogGroup("Items"), MessagePackObject]
[LegacyCatalogGroup("Items")]
public class WeaponItemData : GearData
{
[Inspectable, Key(24)]
[Inspectable, RuntimeCatalogKey(24)]
public WeaponRange WeaponRange;
[Inspectable, Key(25)]
[Inspectable, RuntimeCatalogKey(25)]
public WeaponCaliber WeaponCaliber;
[Inspectable, Key(26)]
[Inspectable, RuntimeCatalogKey(26)]
public WeaponType WeaponType;
[Inspectable, Key(27)]
[Inspectable, RuntimeCatalogKey(27)]
public WeaponFireType WeaponFireTypes;
[Inspectable, Key(28)]
[Inspectable, RuntimeCatalogKey(28)]
public WeaponModifiers WeaponModifiers;
}
[LegacyCatalogGroup("Items"), Inspectable, MessagePackObject]
[LegacyCatalogGroup("Items"), Inspectable]
public class HullData : EquippableItemData
{
[Inspectable, Key(23)]
[Inspectable, RuntimeCatalogKey(23)]
public List<HardpointData> Hardpoints = new List<HardpointData>();
[InspectablePrefab, Key(24)]
[InspectablePrefab, RuntimeCatalogKey(24)]
public string Prefab;
[Inspectable, Key(25)]
[Inspectable, RuntimeCatalogKey(25)]
public HullType HullType;
[Inspectable, Key(26)]
[Inspectable, RuntimeCatalogKey(26)]
public float GridOffset;
[Inspectable, Key(27)]
[Inspectable, RuntimeCatalogKey(27)]
public float Armor;
[Inspectable, Key(28)]
[Inspectable, RuntimeCatalogKey(28)]
public float Drag;
[Inspectable, Key(29)]
[Inspectable, RuntimeCatalogKey(29)]
public bool CanTow;
[IgnoreMember]
public Shape InteriorCells
{
get
@ -537,25 +526,24 @@ public class HullData : EquippableItemData
private Shape _interiorCells;
[IgnoreMember] public override HardpointType HardpointType => HardpointType.Hull;
public override HardpointType HardpointType => HardpointType.Hull;
}
[Inspectable, MessagePackObject]
[Inspectable]
public class HardpointData : ITintInspector
{
[Inspectable, Key(0)] public HardpointType Type;
[Inspectable, Key(1)] public int2 Position;
[Inspectable, Key(2)] public Shape Shape = new Shape();
[Inspectable, Key(3)] public string Transform;
[Inspectable, Key(4)] public ItemRotation Rotation;
[Inspectable, Key(5)] public float Armor;
[Inspectable, RuntimeCatalogKey(0)] public HardpointType Type;
[Inspectable, RuntimeCatalogKey(1)] public int2 Position;
[Inspectable, RuntimeCatalogKey(2)] public Shape Shape = new Shape();
[Inspectable, RuntimeCatalogKey(3)] public string Transform;
[Inspectable, RuntimeCatalogKey(4)] public ItemRotation Rotation;
[Inspectable, RuntimeCatalogKey(5)] public float Armor;
public override string ToString()
{
return $"{Enum.GetName(typeof(HardpointType), Type)} Hardpoint {Rotation.Arrow()}";
}
[IgnoreMember]
public float3 TintColor
{
get
@ -573,46 +561,43 @@ public class HardpointData : ITintInspector
x => ColorMath.HsvToRgb(float3(frac((float)(int)x/hardpointTypes.Length + .25f), 1, 1)));
}
return _tintColors.ContainsKey(type) ? _tintColors[type] : _tintColors[HardpointType.Hull];
return _tintColors.ContainsRuntimeCatalogKey(type) ? _tintColors[type] : _tintColors[HardpointType.Hull];
}
private static Dictionary<HardpointType, float3> _tintColors;
}
[MessagePackObject]
public class PerformanceStat
{
[Key(0)] public float Min;
[RuntimeCatalogKey(0)] public float Min;
[Key(1)] public float Max;
[RuntimeCatalogKey(1)] public float Max;
[Key(2)]
[RuntimeCatalogKey(2)]
public float HeatExponentMultiplier;
[Key(3)]
[RuntimeCatalogKey(3)]
public float DurabilityExponentMultiplier;
[Key(4)]
[RuntimeCatalogKey(4)]
public float QualityExponent;
//[Key(5)] public Guid ID = Guid.NewGuid();
//[RuntimeCatalogKey(5)] public Guid ID = Guid.NewGuid();
// [Key(5)] public Guid? Ingredient;
// [RuntimeCatalogKey(5)] public Guid? Ingredient;
[IgnoreMember] private Dictionary<Entity,Dictionary<Behavior,float>> _scaleModifiers;
[IgnoreMember] private Dictionary<Entity,Dictionary<Behavior,float>> _constantModifiers;
private Dictionary<Entity,Dictionary<Behavior,float>> _scaleModifiers;
private Dictionary<Entity,Dictionary<Behavior,float>> _constantModifiers;
[IgnoreMember]
private Dictionary<Entity, Dictionary<Behavior, float>> ScaleModifiers =>
_scaleModifiers = _scaleModifiers ?? new Dictionary<Entity, Dictionary<Behavior, float>>();
[IgnoreMember]
private Dictionary<Entity, Dictionary<Behavior, float>> ConstantModifiers =>
_constantModifiers = _constantModifiers ?? new Dictionary<Entity, Dictionary<Behavior, float>>();
public Dictionary<Behavior, float> GetScaleModifiers(Entity entity)
{
if(!ScaleModifiers.ContainsKey(entity))
if(!ScaleModifiers.ContainsRuntimeCatalogKey(entity))
ScaleModifiers[entity] = new Dictionary<Behavior, float>();
return ScaleModifiers[entity];
@ -620,26 +605,26 @@ public class PerformanceStat
public Dictionary<Behavior, float> GetConstantModifiers(Entity entity)
{
if(!ConstantModifiers.ContainsKey(entity))
if(!ConstantModifiers.ContainsRuntimeCatalogKey(entity))
ConstantModifiers[entity] = new Dictionary<Behavior, float>();
return ConstantModifiers[entity];
}
}
[LegacyCatalogGroup("Items"), Inspectable, MessagePackObject]
[LegacyCatalogGroup("Items"), Inspectable]
public class PersonalityAttribute : DatabaseEntry, INamedEntry
{
[Inspectable, Key(1)]
[Inspectable, RuntimeCatalogKey(1)]
public string Name;
[Inspectable, Key(2)]
[Inspectable, RuntimeCatalogKey(2)]
public string LowName;
[Inspectable, Key(3)]
[Inspectable, RuntimeCatalogKey(3)]
public string HighName;
[IgnoreMember] public string EntryName
public string EntryName
{
get => Name;
set => Name = value;

View file

@ -0,0 +1,12 @@
using System;
[AttributeUsage(AttributeTargets.Field)]
public sealed class RuntimeCatalogKeyAttribute : Attribute
{
public RuntimeCatalogKeyAttribute(int key)
{
Key = key;
}
public int Key { get; }
}

View file

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