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,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)