Wormholes
This commit is contained in:
parent
4b10923448
commit
adfb200a91
38 changed files with 1102 additions and 59 deletions
|
|
@ -89,7 +89,7 @@ public abstract class PersistentBehaviorData
|
|||
Union(6, typeof(ReflectorData)),
|
||||
Union(7, typeof(ShieldData)),
|
||||
Union(8, typeof(ThrusterData)),
|
||||
// Union(9, typeof(TurningData)),
|
||||
Union(9, typeof(WearData)),
|
||||
Union(10, typeof(VelocityConversionData)),
|
||||
Union(11, typeof(VelocityLimitData)),
|
||||
Union(12, typeof(FactoryData)),
|
||||
|
|
@ -113,7 +113,7 @@ public abstract class PersistentBehaviorData
|
|||
// Union(30, typeof(HaulingControllerData)),
|
||||
Union(31, typeof(CapacitorData)),
|
||||
Union(32, typeof(CockpitData)),
|
||||
Union(33, typeof(HeatsinkData)),
|
||||
Union(33, typeof(HeatStorageData)),
|
||||
Union(34, typeof(TurretControllerData)),
|
||||
Union(35, typeof(InstantWeaponData)),
|
||||
Union(36, typeof(ConstantWeaponData)),
|
||||
|
|
|
|||
|
|
@ -9,17 +9,17 @@ using Unity.Mathematics;
|
|||
using static Unity.Mathematics.math;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
||||
public class HeatsinkData : BehaviorData
|
||||
public class HeatStorageData : BehaviorData
|
||||
{
|
||||
public override IBehavior CreateInstance(ItemManager context, Entity entity, EquippedItem item)
|
||||
{
|
||||
return new Heatsink(context, this, entity, item);
|
||||
return new HeatStorage(context, this, entity, item);
|
||||
}
|
||||
}
|
||||
|
||||
public class Heatsink : IBehavior
|
||||
public class HeatStorage : IBehavior
|
||||
{
|
||||
private HeatsinkData _data;
|
||||
private HeatStorageData _data;
|
||||
|
||||
public Entity Entity { get; }
|
||||
public EquippedItem Item { get; }
|
||||
|
|
@ -27,7 +27,7 @@ public class Heatsink : IBehavior
|
|||
|
||||
public BehaviorData Data => _data;
|
||||
|
||||
public Heatsink(ItemManager context, HeatsinkData data, Entity entity, EquippedItem item)
|
||||
public HeatStorage(ItemManager context, HeatStorageData data, Entity entity, EquippedItem item)
|
||||
{
|
||||
Context = context;
|
||||
_data = data;
|
||||
|
|
@ -73,6 +73,6 @@ public class Thruster : IAnalogBehavior
|
|||
var vis = _input * Context.Evaluate(_data.Visibility, Item);
|
||||
if(!Entity.VisibilitySources.ContainsKey(this) || vis > Entity.VisibilitySources[this])
|
||||
Entity.VisibilitySources[this] = vis;
|
||||
return true;
|
||||
return _input > .01f;
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ using System.Linq;
|
|||
using MessagePack;
|
||||
using Newtonsoft.Json;
|
||||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
[Union(0, typeof(InstantWeaponData)),
|
||||
Union(1, typeof(LauncherData)),
|
||||
|
|
@ -123,7 +124,10 @@ public abstract class Weapon : IActivatedBehavior
|
|||
Visibility = Context.Evaluate(_data.Visibility, Item);
|
||||
Spread = Context.Evaluate(_data.Spread, Item);
|
||||
Velocity = Context.Evaluate(_data.Velocity, Item);
|
||||
Wear = Context.Evaluate(_itemData.WearDamage, Item);
|
||||
Wear = (1 - pow(_itemData.Performance(Item.Temperature),
|
||||
(1 - pow(Item.EquippableItem.Quality, Context.GameplaySettings.QualityWearExponent)) *
|
||||
Context.GameplaySettings.ThermalWearExponent)
|
||||
) * _itemData.Durability;
|
||||
}
|
||||
|
||||
public virtual bool Execute(float delta)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ using static Unity.Mathematics.math;
|
|||
public class WearData : BehaviorData
|
||||
{
|
||||
[TemperatureInspectable, JsonProperty("perSecond"), Key(1)]
|
||||
public bool PerSecond;
|
||||
public bool PerSecond = true;
|
||||
|
||||
public override IBehavior CreateInstance(ItemManager context, Entity entity, EquippedItem item)
|
||||
{
|
||||
|
|
@ -42,7 +42,10 @@ public class Wear : IBehavior
|
|||
|
||||
public bool Execute(float delta)
|
||||
{
|
||||
var wear = Context.Evaluate(_itemData.WearDamage, Item);
|
||||
var wear = (1 - pow(_itemData.Performance(Item.Temperature),
|
||||
(1 - pow(Item.EquippableItem.Quality, Context.GameplaySettings.QualityWearExponent)) *
|
||||
Context.GameplaySettings.ThermalWearExponent)
|
||||
) * _itemData.Durability / _itemData.ThermalResilience;
|
||||
if (_data.PerSecond) wear *= delta;
|
||||
Item.EquippableItem.Durability -= wear;
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue