Heat Performance Curves + Wear & Tear
Added heat variation option for Performance Stats Ability to toggle radiators on/off using H key Item durability loss (Wear) is now heat dependent and incurred only when used Restricted equip/unequip to docked (inactive) entities Fixed race condition causing exceptions in database sync code
This commit is contained in:
parent
1bb058a8dc
commit
4b10923448
44 changed files with 437 additions and 184 deletions
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ContentModelStore">
|
||||
<e p="C:\Users\rwven\AppData\local\JetBrains\Rider2020.2\extResources" t="IncludeRecursive" />
|
||||
<e p="C:\Users\rwven\AppData\local\JetBrains\Rider2020.2\resharper-host\local\Transient\Rider\v202\SolutionCaches\_Aetheria-Economy.1645782805.00" t="ExcludeRecursive" />
|
||||
<e p="C:\Users\rwven\AppData\local\JetBrains\Rider2020.3\extResources" t="IncludeRecursive" />
|
||||
<e p="C:\Users\rwven\AppData\local\JetBrains\Rider2020.3\resharper-host\local\Transient\Rider\v203\SolutionCaches\_Aetheria-Economy.1645782805.00" t="ExcludeRecursive" />
|
||||
<e p="E:\Projects\Aetheria-Economy" t="IncludeRecursive">
|
||||
<e p="Aetheria-Economy.sln" t="IncludeFlat" />
|
||||
<e p="Assembly-CSharp-Editor-firstpass.csproj" t="IncludeRecursive" />
|
||||
|
|
@ -1559,6 +1559,7 @@
|
|||
<e p="Visibility.cs" t="Include" />
|
||||
<e p="WanderController.cs" t="Include" />
|
||||
<e p="Weapon.cs" t="Include" />
|
||||
<e p="Wear.cs" t="Include" />
|
||||
</e>
|
||||
<e p="BlueprintData.cs" t="Include" />
|
||||
<e p="ColorMath.cs" t="Include" />
|
||||
|
|
|
|||
2
.idea/.idea.Aetheria-Economy/.idea/modules.xml
generated
2
.idea/.idea.Aetheria-Economy/.idea/modules.xml
generated
|
|
@ -2,7 +2,7 @@
|
|||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/.idea.Aetheria-Economy/riderModule.iml" filepath="$PROJECT_DIR$/.idea/.idea.Aetheria-Economy/riderModule.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/.idea.Aetheria-Economy/.idea/riderModule.iml" filepath="$PROJECT_DIR$/.idea/.idea.Aetheria-Economy/.idea/riderModule.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
<Property Name="GenerateSoundBanks\x64_SelectedPlatforms" Type="string" Value="74wppGGLGUKocCTUjliE6atk2Ww+IVRJs5fEQCA5KRI="/>
|
||||
<Property Name="GenerateSoundBanks\x64_SelectedSoundBanks" Type="string" Value="IQwTht2BuE2QKvFyzNeWZg=="/>
|
||||
<Property Name="HardwareController\CurrentSession" Type="string" Value="{2451DD2E-A7B2-45E6-B93B-6F49B9B887AD}"/>
|
||||
<Property Name="HardwareController\{2451DD2E-A7B2-45E6-B93B-6F49B9B887AD}\x64_ActiveGroups" Type="string" Value="sahohopAK0WRE4XvXPYF/QGO7bL/////+lZlPDTFnUSwqLpTpFltuQGO7bL/////"/>
|
||||
<Property Name="HardwareController\{2451DD2E-A7B2-45E6-B93B-6F49B9B887AD}\x64_ActiveGroups" Type="string" Value="+lZlPDTFnUSwqLpTpFltuQGO7bL/////sahohopAK0WRE4XvXPYF/QGO7bL/////"/>
|
||||
<Property Name="MeterView\LastObject1" Type="string" Value="{1514A4D8-1DA6-412A-A17E-75CA0C2149F3}"/>
|
||||
<Property Name="MeterView\MeterMode1" Type="int32" Value="1"/>
|
||||
<Property Name="MeterView\MeterMode1Viewpoint0" Type="int32" Value="1"/>
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ Material:
|
|||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _Scale: 5.1991053
|
||||
- _Scale: 5.4972186
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
|
|
|
|||
|
|
@ -148,6 +148,14 @@
|
|||
"expectedControlType": "Button",
|
||||
"processors": "",
|
||||
"interactions": ""
|
||||
},
|
||||
{
|
||||
"name": "Toggle Heatsinks",
|
||||
"type": "Button",
|
||||
"id": "e6c6ff6a-4ac2-4e53-a3c9-9461f52e723f",
|
||||
"expectedControlType": "Button",
|
||||
"processors": "",
|
||||
"interactions": ""
|
||||
}
|
||||
],
|
||||
"bindings": [
|
||||
|
|
@ -535,6 +543,17 @@
|
|||
"action": "Target Nearest",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "71ac6088-1e18-4810-86be-1179918dd4a2",
|
||||
"path": "<Keyboard>/#(H)",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Toggle Heatsinks",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4547,6 +4547,9 @@ MonoBehaviour:
|
|||
Settings: {fileID: 11400000, guid: cd2344e2001a37544aab0960c164d4ff, type: 2}
|
||||
ListElementPrototype: {fileID: 1277237367}
|
||||
TriggerGroupPrototype: {fileID: 1564656282}
|
||||
HeaderElementEnabledColor: {r: 0, g: 0, b: 0, a: 0}
|
||||
HeaderElementDisabledColor: {r: 0, g: 0, b: 0, a: 0}
|
||||
HeatsinkBackground: {fileID: 0}
|
||||
EnergyLabel: {fileID: 0}
|
||||
CockpitTemperatureLabel: {fileID: 0}
|
||||
RadiatorTemperatureLabel: {fileID: 0}
|
||||
|
|
@ -13279,7 +13282,7 @@ MonoBehaviour:
|
|||
Spacing: 16
|
||||
Ceiling: -400
|
||||
Floor: 5
|
||||
HeightExponent: 10000
|
||||
HeightExponent: 1000
|
||||
Heightmap: {fileID: 8400000, guid: 2fc21a9d3e9647948b56e384cd9378b3, type: 2}
|
||||
ParticleColors: {fileID: 2800000, guid: 56db63da398b2d04394ddbccedce943c, type: 3}
|
||||
GravityCamera: {fileID: 1537342003}
|
||||
|
|
@ -29466,6 +29469,9 @@ MonoBehaviour:
|
|||
Settings: {fileID: 11400000, guid: cd2344e2001a37544aab0960c164d4ff, type: 2}
|
||||
ListElementPrototype: {fileID: 232470599}
|
||||
TriggerGroupPrototype: {fileID: 1564656282}
|
||||
HeaderElementEnabledColor: {r: 1, g: 1, b: 1, a: 0.078431375}
|
||||
HeaderElementDisabledColor: {r: 1, g: 1, b: 1, a: 0.011764706}
|
||||
HeatsinkBackground: {fileID: 661332569}
|
||||
EnergyLabel: {fileID: 804489113}
|
||||
CockpitTemperatureLabel: {fileID: 212527384}
|
||||
RadiatorTemperatureLabel: {fileID: 1752418078}
|
||||
|
|
|
|||
|
|
@ -161,6 +161,14 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
|
|||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """"
|
||||
},
|
||||
{
|
||||
""name"": ""Toggle Heatsinks"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""e6c6ff6a-4ac2-4e53-a3c9-9461f52e723f"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """"
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
|
|
@ -548,6 +556,17 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
|
|||
""action"": ""Target Nearest"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""71ac6088-1e18-4810-86be-1179918dd4a2"",
|
||||
""path"": ""<Keyboard>/#(H)"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Toggle Heatsinks"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -1132,6 +1151,7 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
|
|||
m_Player_TargetPrevious = m_Player.FindAction("Target Previous", throwIfNotFound: true);
|
||||
m_Player_TargetNext = m_Player.FindAction("Target Next", throwIfNotFound: true);
|
||||
m_Player_TargetNearest = m_Player.FindAction("Target Nearest", throwIfNotFound: true);
|
||||
m_Player_ToggleHeatsinks = m_Player.FindAction("Toggle Heatsinks", throwIfNotFound: true);
|
||||
// UI
|
||||
m_UI = asset.FindActionMap("UI", throwIfNotFound: true);
|
||||
m_UI_Navigate = m_UI.FindAction("Navigate", throwIfNotFound: true);
|
||||
|
|
@ -1215,6 +1235,7 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
|
|||
private readonly InputAction m_Player_TargetPrevious;
|
||||
private readonly InputAction m_Player_TargetNext;
|
||||
private readonly InputAction m_Player_TargetNearest;
|
||||
private readonly InputAction m_Player_ToggleHeatsinks;
|
||||
public struct PlayerActions
|
||||
{
|
||||
private @AetheriaInput m_Wrapper;
|
||||
|
|
@ -1237,6 +1258,7 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
|
|||
public InputAction @TargetPrevious => m_Wrapper.m_Player_TargetPrevious;
|
||||
public InputAction @TargetNext => m_Wrapper.m_Player_TargetNext;
|
||||
public InputAction @TargetNearest => m_Wrapper.m_Player_TargetNearest;
|
||||
public InputAction @ToggleHeatsinks => m_Wrapper.m_Player_ToggleHeatsinks;
|
||||
public InputActionMap Get() { return m_Wrapper.m_Player; }
|
||||
public void Enable() { Get().Enable(); }
|
||||
public void Disable() { Get().Disable(); }
|
||||
|
|
@ -1300,6 +1322,9 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
|
|||
@TargetNearest.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnTargetNearest;
|
||||
@TargetNearest.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnTargetNearest;
|
||||
@TargetNearest.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnTargetNearest;
|
||||
@ToggleHeatsinks.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnToggleHeatsinks;
|
||||
@ToggleHeatsinks.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnToggleHeatsinks;
|
||||
@ToggleHeatsinks.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnToggleHeatsinks;
|
||||
}
|
||||
m_Wrapper.m_PlayerActionsCallbackInterface = instance;
|
||||
if (instance != null)
|
||||
|
|
@ -1358,6 +1383,9 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
|
|||
@TargetNearest.started += instance.OnTargetNearest;
|
||||
@TargetNearest.performed += instance.OnTargetNearest;
|
||||
@TargetNearest.canceled += instance.OnTargetNearest;
|
||||
@ToggleHeatsinks.started += instance.OnToggleHeatsinks;
|
||||
@ToggleHeatsinks.performed += instance.OnToggleHeatsinks;
|
||||
@ToggleHeatsinks.canceled += instance.OnToggleHeatsinks;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1555,6 +1583,7 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
|
|||
void OnTargetPrevious(InputAction.CallbackContext context);
|
||||
void OnTargetNext(InputAction.CallbackContext context);
|
||||
void OnTargetNearest(InputAction.CallbackContext context);
|
||||
void OnToggleHeatsinks(InputAction.CallbackContext context);
|
||||
}
|
||||
public interface IUIActions
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1118,8 +1118,10 @@ public class DatabaseInspector : EditorWindow
|
|||
GUILayout.Label("", GUILayout.Width(width));
|
||||
if (!isSimple)
|
||||
{
|
||||
// GUILayout.Label("H", _labelStyle);
|
||||
// value.HeatDependent = Toggle(value.HeatDependent);
|
||||
GUILayout.Label("H", _labelStyle);
|
||||
value.HeatDependent = Toggle(value.HeatDependent);
|
||||
GUILayout.Label("HEx", _labelStyle, GUILayout.Width(labelWidth + 5));
|
||||
value.HeatExponentMultiplier = DelayedFloatField(value.HeatExponentMultiplier);
|
||||
GUILayout.Label("D", _labelStyle);
|
||||
value.DurabilityDependent = Toggle(value.DurabilityDependent);
|
||||
GUILayout.Label("QEx", _labelStyle, GUILayout.Width(labelWidth + 5));
|
||||
|
|
|
|||
|
|
@ -189,6 +189,12 @@ public class ActionGameManager : MonoBehaviour
|
|||
else Undock();
|
||||
};
|
||||
|
||||
_input.Player.ToggleHeatsinks.performed += context =>
|
||||
{
|
||||
CurrentShip.HeatsinksEnabled = !CurrentShip.HeatsinksEnabled;
|
||||
AkSoundEngine.PostEvent(CurrentShip.HeatsinksEnabled ? "UI_Success" : "UI_Fail", gameObject);
|
||||
};
|
||||
|
||||
_input.Player.TargetReticle.performed += context =>
|
||||
{
|
||||
var underReticle = Zone.Entities.Where(x => x != CurrentShip).MaxBy(x => dot(normalize(x.Position - CurrentShip.Position), CurrentShip.LookDirection));
|
||||
|
|
|
|||
|
|
@ -14,14 +14,14 @@ public class ConstantLaserManager : ConstantWeaponEffectManager
|
|||
p.SourceEntity = source.Entity;
|
||||
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
||||
var barrel = source.GetBarrel(hp);
|
||||
p.Range = source.Entity.ItemManager.Evaluate(data.Range, item.EquippableItem, source.Entity);
|
||||
p.Range = source.Entity.ItemManager.Evaluate(data.Range, item);
|
||||
var t = p.transform;
|
||||
t.SetParent(barrel);
|
||||
t.forward = barrel.forward;
|
||||
t.position = barrel.position;
|
||||
p.Damage = source.Entity.ItemManager.Evaluate(data.Damage, item.EquippableItem, source.Entity);
|
||||
p.Penetration = source.Entity.ItemManager.Evaluate(data.Penetration, item.EquippableItem, source.Entity);
|
||||
p.Spread = source.Entity.ItemManager.Evaluate(data.DamageSpread, item.EquippableItem, source.Entity);
|
||||
p.Damage = source.Entity.ItemManager.Evaluate(data.Damage, item);
|
||||
p.Penetration = source.Entity.ItemManager.Evaluate(data.Penetration, item);
|
||||
p.Spread = source.Entity.ItemManager.Evaluate(data.DamageSpread, item);
|
||||
p.DamageType = data.DamageType;
|
||||
_lasers.Add(item, p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ public class ConstantLightningManager : ConstantWeaponEffectManager
|
|||
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
||||
var barrel = source.GetBarrel(hp);
|
||||
p.Barrel = barrel;
|
||||
p.Damage = source.Entity.ItemManager.Evaluate(data.Damage, item.EquippableItem, source.Entity);
|
||||
p.Range = source.Entity.ItemManager.Evaluate(data.Range, item.EquippableItem, source.Entity);
|
||||
p.Penetration = source.Entity.ItemManager.Evaluate(data.Penetration, item.EquippableItem, source.Entity);
|
||||
p.Spread = source.Entity.ItemManager.Evaluate(data.DamageSpread, item.EquippableItem, source.Entity);
|
||||
p.Damage = source.Entity.ItemManager.Evaluate(data.Damage, item);
|
||||
p.Range = source.Entity.ItemManager.Evaluate(data.Range, item);
|
||||
p.Penetration = source.Entity.ItemManager.Evaluate(data.Penetration, item);
|
||||
p.Spread = source.Entity.ItemManager.Evaluate(data.DamageSpread, item);
|
||||
p.DamageType = data.DamageType;
|
||||
_bolts.Add(item, p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class ConstantParticleWeaponManager : ConstantWeaponEffectManager
|
|||
t.SetParent(barrel);
|
||||
t.forward = barrel.forward;
|
||||
t.position = barrel.position;
|
||||
p.Damage = source.Entity.ItemManager.Evaluate(data.Damage, item.EquippableItem, source.Entity);
|
||||
p.Damage = source.Entity.ItemManager.Evaluate(data.Damage, item);
|
||||
p.DamageType = data.DamageType;
|
||||
_weapons.Add(item, p);
|
||||
p.Initialize();
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ public class GuidedProjectileManager : InstantWeaponEffectManager
|
|||
p.LiftCurve = launcher.LiftCurve.ToCurve();
|
||||
p.ThrustCurve = launcher.ThrustCurve.ToCurve();
|
||||
p.Velocity = barrel.forward * weapon.Velocity;
|
||||
p.Thrust = source.Entity.ItemManager.Evaluate(launcher.Thrust, item.EquippableItem, source.Entity);
|
||||
p.TopSpeed = source.Entity.ItemManager.Evaluate(launcher.MissileVelocity, item.EquippableItem, source.Entity);
|
||||
p.Thrust = source.Entity.ItemManager.Evaluate(launcher.Thrust, item);
|
||||
p.TopSpeed = source.Entity.ItemManager.Evaluate(launcher.MissileVelocity, item);
|
||||
}
|
||||
else if(weapon.Data is GuidedWeaponData guidance)
|
||||
{
|
||||
|
|
@ -51,8 +51,8 @@ public class GuidedProjectileManager : InstantWeaponEffectManager
|
|||
p.LiftCurve = guidance.LiftCurve.ToCurve();
|
||||
p.ThrustCurve = guidance.ThrustCurve.ToCurve();
|
||||
p.Velocity = barrel.forward * weapon.Velocity;
|
||||
p.Thrust = source.Entity.ItemManager.Evaluate(guidance.Thrust, item.EquippableItem, source.Entity);
|
||||
p.TopSpeed = source.Entity.ItemManager.Evaluate(guidance.MissileVelocity, item.EquippableItem, source.Entity);
|
||||
p.Thrust = source.Entity.ItemManager.Evaluate(guidance.Thrust, item);
|
||||
p.TopSpeed = source.Entity.ItemManager.Evaluate(guidance.MissileVelocity, item);
|
||||
p.TargetPosition = () => source.Entity.Position + length( (float3)source.LookAtPoint.position - source.Entity.Position) * source.Entity.LookDirection;
|
||||
}
|
||||
else Debug.LogError($"Weapon {item.EquippableItem.Name} linked to {name} effect, but is not a Launcher!");
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ public class CombatState : BaseState
|
|||
SampleDps();
|
||||
foreach (var weapon in _agent.Ship.Weapons)
|
||||
{
|
||||
weapon.Item.OnDisable += SampleDps;
|
||||
weapon.Item.OnEnable += SampleDps;
|
||||
weapon.Item.OnOffline += SampleDps;
|
||||
weapon.Item.OnOnline += SampleDps;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ public class Capacitor : IBehavior
|
|||
|
||||
public bool Execute(float delta)
|
||||
{
|
||||
Capacity = Context.Evaluate(_data.Capacity, Item.EquippableItem, Entity);
|
||||
Efficiency = Context.Evaluate(_data.Efficiency, Item.EquippableItem, Entity);
|
||||
Capacity = Context.Evaluate(_data.Capacity, Item);
|
||||
Efficiency = Context.Evaluate(_data.Efficiency, Item);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -100,9 +100,9 @@ public class ChargedWeapon : InstantWeapon
|
|||
protected override void UpdateStats()
|
||||
{
|
||||
base.UpdateStats();
|
||||
ChargeTime = Context.Evaluate(_data.ChargeTime, Item.EquippableItem, Entity);
|
||||
ChargeEnergy = Context.Evaluate(_data.ChargeEnergy, Item.EquippableItem, Entity);
|
||||
ChargeHeat = Context.Evaluate(_data.ChargeHeat, Item.EquippableItem, Entity);
|
||||
ChargeTime = Context.Evaluate(_data.ChargeTime, Item);
|
||||
ChargeEnergy = Context.Evaluate(_data.ChargeEnergy, Item);
|
||||
ChargeHeat = Context.Evaluate(_data.ChargeHeat, Item);
|
||||
Damage *= lerp(1, _data.ChargeFiringDamageMultiplier, saturate(_charge));
|
||||
Heat *= lerp(1, _data.ChargeFiringHeatMultiplier, saturate(_charge));
|
||||
Spread *= lerp(1, _data.ChargeFiringSpreadMultiplier, saturate(_charge));
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public class ConstantWeapon : Weapon, IProgressBehavior
|
|||
base.Execute(delta);
|
||||
if (_firing)
|
||||
{
|
||||
if (!Entity.TryConsumeEnergy(Context.Evaluate(_data.Energy, Item.EquippableItem, Entity) * delta))
|
||||
if (!Entity.TryConsumeEnergy(Context.Evaluate(_data.Energy, Item) * delta))
|
||||
{
|
||||
_firing = false;
|
||||
OnStopFiring?.Invoke();
|
||||
|
|
@ -114,9 +114,10 @@ public class ConstantWeapon : Weapon, IProgressBehavior
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item.AddHeat(Context.Evaluate(_data.Heat, Item.EquippableItem, Entity) * delta);
|
||||
Entity.VisibilitySources[this] = Context.Evaluate(_data.Visibility, Item.EquippableItem, Entity);
|
||||
|
||||
Item.EquippableItem.Durability -= Wear * delta;
|
||||
Item.AddHeat(Context.Evaluate(_data.Heat, Item) * delta);
|
||||
Entity.VisibilitySources[this] = Context.Evaluate(_data.Visibility, Item);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,6 @@ public class Cooldown : IBehavior, IAlwaysUpdatedBehavior, IProgressBehavior
|
|||
|
||||
public void Update(float delta)
|
||||
{
|
||||
_cooldown -= delta / Context.Evaluate(_data.Cooldown, Item.EquippableItem, Entity);
|
||||
_cooldown -= delta / Context.Evaluate(_data.Cooldown, Item);
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ using System.Linq;
|
|||
using MessagePack;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn), Order(12), RuntimeInspectable]
|
||||
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn), Order(-20), RuntimeInspectable]
|
||||
public class EnergyDrawData : BehaviorData
|
||||
{
|
||||
[InspectableField, JsonProperty("draw"), Key(1), RuntimeInspectable]
|
||||
|
|
@ -42,6 +42,6 @@ public class EnergyDraw : IBehavior
|
|||
|
||||
public bool Execute(float delta)
|
||||
{
|
||||
return Entity.TryConsumeEnergy(Context.Evaluate(_data.EnergyDraw, Item.EquippableItem, Entity) * (_data.PerSecond ? delta : 1));
|
||||
return Entity.TryConsumeEnergy(Context.Evaluate(_data.EnergyDraw, Item) * (_data.PerSecond ? delta : 1));
|
||||
}
|
||||
}
|
||||
|
|
@ -42,7 +42,7 @@ public class Heat : IBehavior
|
|||
|
||||
public bool Execute(float delta)
|
||||
{
|
||||
Item.AddHeat(Context.Evaluate(_data.Heat, Item.EquippableItem, Entity) * (_data.PerSecond ? delta : 1));
|
||||
Item.AddHeat(Context.Evaluate(_data.Heat, Item) * (_data.PerSecond ? delta : 1));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,9 +92,9 @@ public class InstantWeapon : Weapon, IProgressBehavior
|
|||
protected override void UpdateStats()
|
||||
{
|
||||
base.UpdateStats();
|
||||
BurstCount = Context.Evaluate(_data.Count, Item.EquippableItem, Entity);
|
||||
BurstTime = Context.Evaluate(_data.BurstTime, Item.EquippableItem, Entity);
|
||||
Cooldown = Context.Evaluate(_data.Cooldown, Item.EquippableItem, Entity);
|
||||
BurstCount = Context.Evaluate(_data.Count, Item);
|
||||
BurstTime = Context.Evaluate(_data.BurstTime, Item);
|
||||
Cooldown = Context.Evaluate(_data.Cooldown, Item);
|
||||
|
||||
Damage /= (int) BurstCount;
|
||||
Heat /= (int) BurstCount;
|
||||
|
|
@ -165,6 +165,7 @@ public class InstantWeapon : Weapon, IProgressBehavior
|
|||
_burstRemaining--;
|
||||
_burstTimer -= _burstInterval;
|
||||
OnFire?.Invoke();
|
||||
Item.EquippableItem.Durability -= Wear;
|
||||
Item.AddHeat(Heat);
|
||||
Entity.VisibilitySources[this] = Visibility;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,11 +71,11 @@ public class LockWeapon : InstantWeapon
|
|||
|
||||
if (Entity.Target.Value != null)
|
||||
{
|
||||
LockSpeed = Context.Evaluate(_data.LockSpeed, Item.EquippableItem, Entity);
|
||||
SensorImpact = Context.Evaluate(_data.SensorImpact, Item.EquippableItem, Entity);
|
||||
LockAngle = Context.Evaluate(_data.LockAngle, Item.EquippableItem, Entity);
|
||||
DirectionImpact = Context.Evaluate(_data.DirectionImpact, Item.EquippableItem, Entity);
|
||||
Decay = Context.Evaluate(_data.Decay, Item.EquippableItem, Entity);
|
||||
LockSpeed = Context.Evaluate(_data.LockSpeed, Item);
|
||||
SensorImpact = Context.Evaluate(_data.SensorImpact, Item);
|
||||
LockAngle = Context.Evaluate(_data.LockAngle, Item);
|
||||
DirectionImpact = Context.Evaluate(_data.DirectionImpact, Item);
|
||||
Decay = Context.Evaluate(_data.Decay, Item);
|
||||
|
||||
var degrees = acos(dot(normalize(Entity.Target.Value.Position - Entity.Position), normalize(Entity.LookDirection))) * 57.2958f;
|
||||
if (degrees < LockAngle)
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class MiningTool : IBehavior
|
|||
|
||||
public bool Execute(float delta)
|
||||
{
|
||||
Range = Context.Evaluate(_data.Range, Item.EquippableItem, Entity);
|
||||
Range = Context.Evaluate(_data.Range, Item);
|
||||
var belt = Entity.Zone.AsteroidBelts[AsteroidBelt];
|
||||
if (AsteroidBelt != Guid.Empty &&
|
||||
Entity.Zone.AsteroidExists(AsteroidBelt, Asteroid) &&
|
||||
|
|
@ -64,9 +64,9 @@ public class MiningTool : IBehavior
|
|||
Entity,
|
||||
AsteroidBelt,
|
||||
Asteroid,
|
||||
Context.Evaluate(_data.DamagePerSecond, Item.EquippableItem, Entity) * delta,
|
||||
Context.Evaluate(_data.Efficiency, Item.EquippableItem, Entity),
|
||||
Context.Evaluate(_data.Penetration, Item.EquippableItem, Entity));
|
||||
Context.Evaluate(_data.DamagePerSecond, Item) * delta,
|
||||
Context.Evaluate(_data.Efficiency, Item),
|
||||
Context.Evaluate(_data.Penetration, Item));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,9 +57,9 @@ public class Radiator : IBehavior, IAlwaysUpdatedBehavior, IInitializableBehavio
|
|||
|
||||
public bool Execute(float delta)
|
||||
{
|
||||
PumpedHeat = Context.Evaluate(_data.PumpedHeat, Item.EquippableItem, Entity);
|
||||
WasteHeat = Context.Evaluate(_data.WasteHeat, Item.EquippableItem, Entity);
|
||||
EnergyUsage = Context.Evaluate(_data.EnergyUsage, Item.EquippableItem, Entity);
|
||||
PumpedHeat = Context.Evaluate(_data.PumpedHeat, Item);
|
||||
WasteHeat = Context.Evaluate(_data.WasteHeat, Item);
|
||||
EnergyUsage = Context.Evaluate(_data.EnergyUsage, Item);
|
||||
|
||||
var itemTemperature = Item.Temperature;
|
||||
var tempRatio = max(Temperature / itemTemperature, 1);
|
||||
|
|
@ -84,7 +84,7 @@ public class Radiator : IBehavior, IAlwaysUpdatedBehavior, IInitializableBehavio
|
|||
|
||||
public void Update(float delta)
|
||||
{
|
||||
Emissivity = Context.Evaluate(_data.Emissivity, Item.EquippableItem, Entity);
|
||||
Emissivity = Context.Evaluate(_data.Emissivity, Item);
|
||||
var rad = pow(Temperature, Context.GameplaySettings.HeatRadiationExponent) * Context.GameplaySettings.HeatRadiationMultiplier * Emissivity;
|
||||
Temperature -= rad * delta;
|
||||
Entity.VisibilitySources[this] = rad;
|
||||
|
|
|
|||
|
|
@ -74,8 +74,8 @@ public class Reactor : IBehavior, IOrderedBehavior
|
|||
|
||||
public bool Execute(float delta)
|
||||
{
|
||||
var charge = Context.Evaluate(_data.Charge, Item.EquippableItem, Entity) * delta;
|
||||
var efficiency = Context.Evaluate(_data.Efficiency, Item.EquippableItem, Entity);
|
||||
var charge = Context.Evaluate(_data.Charge, Item) * delta;
|
||||
var efficiency = Context.Evaluate(_data.Efficiency, Item);
|
||||
|
||||
// This behavior executes last, so any components drawing power have already done so
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ public class Reactor : IBehavior, IOrderedBehavior
|
|||
// We have an energy deficit, have to overload the reactor
|
||||
if (Draw > .01f)
|
||||
{
|
||||
var overloadEfficiency = Context.Evaluate(_data.OverloadEfficiency, Item.EquippableItem, Entity);
|
||||
var overloadEfficiency = Context.Evaluate(_data.OverloadEfficiency, Item);
|
||||
|
||||
// Generate heat using overload efficiency, usually much less efficient!
|
||||
heat += Draw / overloadEfficiency;
|
||||
|
|
@ -120,7 +120,7 @@ public class Reactor : IBehavior, IOrderedBehavior
|
|||
// We still have an energy surplus, try to throttle the reactor to reduce heat generation
|
||||
if (Draw < -.01f)
|
||||
{
|
||||
heat -= Draw / efficiency * (1 - 1 / Context.Evaluate(_data.ThrottlingFactor, Item.EquippableItem, Entity));
|
||||
heat -= Draw / efficiency * (1 - 1 / Context.Evaluate(_data.ThrottlingFactor, Item));
|
||||
Draw = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -105,8 +105,8 @@ public class ResourceScanner : IBehavior, IAlwaysUpdatedBehavior
|
|||
|
||||
public void Update(float delta)
|
||||
{
|
||||
Range = Context.Evaluate(_data.Range, Item.EquippableItem, Entity);
|
||||
MinimumDensity = Context.Evaluate(_data.MinimumDensity, Item.EquippableItem, Entity);
|
||||
ScanDuration = Context.Evaluate(_data.ScanDuration, Item.EquippableItem, Entity);
|
||||
Range = Context.Evaluate(_data.Range, Item);
|
||||
MinimumDensity = Context.Evaluate(_data.MinimumDensity, Item);
|
||||
ScanDuration = Context.Evaluate(_data.ScanDuration, Item);
|
||||
}
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ public class Sensor : IBehavior
|
|||
var next = saturate(
|
||||
previous +
|
||||
entity.Visibility *
|
||||
Context.Evaluate(_data.Sensitivity, Item.EquippableItem, Entity) *
|
||||
Context.Evaluate(_data.Sensitivity, Item) *
|
||||
_data.SensitivityCurve.Evaluate(angle / PI) *
|
||||
delta / dist);
|
||||
next *= 1 - Context.GameplaySettings.TargetInfoDecay * delta;
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public class StatModifier : IBehavior, IInitializableBehavior, IDisposableBehavi
|
|||
foreach (var stat in _stats)
|
||||
(_data.Type == StatModifierType.Constant
|
||||
? stat.GetConstantModifiers(Entity)
|
||||
: stat.GetScaleModifiers(Entity))[this] = Context.Evaluate(_data.Modifier, Item.EquippableItem, Entity);
|
||||
: stat.GetScaleModifiers(Entity))[this] = Context.Evaluate(_data.Modifier, Item);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,16 +61,16 @@ public class Thruster : IAnalogBehavior
|
|||
var itemCenter = hullData.Shape.Inset(itemData.Shape, item.Position, item.EquippableItem.Rotation).CenterOfMass;
|
||||
var toCenter = hullCenter - itemCenter;
|
||||
Torque = -dot(normalize(toCenter), float2(1, 0).Rotate(item.EquippableItem.Rotation));
|
||||
Thrust = Context.Evaluate(_data.Thrust, Item.EquippableItem, Entity);
|
||||
Thrust = Context.Evaluate(_data.Thrust, Item);
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
{
|
||||
Thrust = Context.Evaluate(_data.Thrust, Item.EquippableItem, Entity);
|
||||
Thrust = Context.Evaluate(_data.Thrust, Item);
|
||||
Entity.Velocity -= Entity.Direction.Rotate(Item.EquippableItem.Rotation) * _input * Thrust / Entity.Mass * delta;
|
||||
Entity.Direction = mul(Entity.Direction, Unity.Mathematics.float2x2.Rotate(_input * Torque * Thrust * Context.GameplaySettings.TorqueMultiplier / Entity.Mass * delta));
|
||||
Item.AddHeat(_input * Context.Evaluate(_data.Heat, Item.EquippableItem, Entity) * delta);
|
||||
var vis = _input * Context.Evaluate(_data.Visibility, Item.EquippableItem, Entity);
|
||||
Item.AddHeat(_input * Context.Evaluate(_data.Heat, Item) * delta);
|
||||
var vis = _input * Context.Evaluate(_data.Visibility, Item);
|
||||
if(!Entity.VisibilitySources.ContainsKey(this) || vis > Entity.VisibilitySources[this])
|
||||
Entity.VisibilitySources[this] = vis;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class TurretController : IBehavior
|
|||
if (b is Weapon weapon)
|
||||
{
|
||||
_weapons.Add(weapon);
|
||||
var vel = Context.Evaluate(weapon.WeaponData.Velocity, item.EquippableItem, EquippedEntity);
|
||||
var vel = Context.Evaluate(weapon.WeaponData.Velocity, item);
|
||||
if (vel > .1f)
|
||||
{
|
||||
_predictShots = true;
|
||||
|
|
@ -95,7 +95,7 @@ public class TurretController : IBehavior
|
|||
var fire = dot(
|
||||
EquippedEntity.HardpointTransforms[EquippedEntity.Hardpoints[x.Item.Position.x, x.Item.Position.y]].direction,
|
||||
EquippedEntity.LookDirection) > .99f;
|
||||
if (Context.Evaluate(data.Range, x.Item.EquippableItem, EquippedEntity) > dist && fire)
|
||||
if (Context.Evaluate(data.Range, x.Item) > dist && fire)
|
||||
{
|
||||
x.Activate();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class VelocityLimit : IBehavior
|
|||
|
||||
public bool Execute(float delta)
|
||||
{
|
||||
Limit = Context.Evaluate(_data.TopSpeed, Item.EquippableItem, Entity);
|
||||
Limit = Context.Evaluate(_data.TopSpeed, Item);
|
||||
if (length(Entity.Velocity) > Limit)
|
||||
Entity.Velocity = normalize(Entity.Velocity) * Limit;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class Visibility : IBehavior, IAlwaysUpdatedBehavior
|
|||
|
||||
public bool Execute(float delta)
|
||||
{
|
||||
Entity.VisibilitySources[this] = Context.Evaluate(_data.Visibility, Item.EquippableItem, Entity);
|
||||
Entity.VisibilitySources[this] = Context.Evaluate(_data.Visibility, Item);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ public class Visibility : IBehavior, IAlwaysUpdatedBehavior
|
|||
// TODO: Time independent decay?
|
||||
if(Entity.VisibilitySources.ContainsKey(this))
|
||||
{
|
||||
Entity.VisibilitySources[this] *= Context.Evaluate(_data.VisibilityDecay, Item.EquippableItem, Entity);
|
||||
Entity.VisibilitySources[this] *= Context.Evaluate(_data.VisibilityDecay, Item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -68,6 +68,7 @@ public abstract class WeaponData : BehaviorData
|
|||
public abstract class Weapon : IActivatedBehavior
|
||||
{
|
||||
private WeaponData _data;
|
||||
private EquippableItemData _itemData;
|
||||
|
||||
public Entity Entity { get; }
|
||||
public EquippedItem Item { get; }
|
||||
|
|
@ -89,6 +90,7 @@ public abstract class Weapon : IActivatedBehavior
|
|||
public float Visibility { get; protected set; }
|
||||
public float Spread { get; protected set; }
|
||||
public float Velocity { get; protected set; }
|
||||
public float Wear { get; protected set; }
|
||||
|
||||
protected bool _firing;
|
||||
|
||||
|
|
@ -104,22 +106,24 @@ public abstract class Weapon : IActivatedBehavior
|
|||
Entity = entity;
|
||||
Item = item;
|
||||
_data = data;
|
||||
_itemData = context.GetData(item.EquippableItem);
|
||||
}
|
||||
|
||||
public virtual void ResetEvents(){}
|
||||
|
||||
protected virtual void UpdateStats()
|
||||
{
|
||||
Damage = Context.Evaluate(_data.Damage, Item.EquippableItem, Entity);
|
||||
Penetration = Context.Evaluate(_data.Penetration, Item.EquippableItem, Entity);
|
||||
DamageSpread = Context.Evaluate(_data.DamageSpread, Item.EquippableItem, Entity);
|
||||
MinRange = Context.Evaluate(_data.MinRange, Item.EquippableItem, Entity);
|
||||
Range = Context.Evaluate(_data.Range, Item.EquippableItem, Entity);
|
||||
Energy = Context.Evaluate(_data.Energy, Item.EquippableItem, Entity);
|
||||
Heat = Context.Evaluate(_data.Heat, Item.EquippableItem, Entity);
|
||||
Visibility = Context.Evaluate(_data.Visibility, Item.EquippableItem, Entity);
|
||||
Spread = Context.Evaluate(_data.Spread, Item.EquippableItem, Entity);
|
||||
Velocity = Context.Evaluate(_data.Velocity, Item.EquippableItem, Entity);
|
||||
Damage = Context.Evaluate(_data.Damage, Item);
|
||||
Penetration = Context.Evaluate(_data.Penetration, Item);
|
||||
DamageSpread = Context.Evaluate(_data.DamageSpread, Item);
|
||||
MinRange = Context.Evaluate(_data.MinRange, Item);
|
||||
Range = Context.Evaluate(_data.Range, Item);
|
||||
Energy = Context.Evaluate(_data.Energy, Item);
|
||||
Heat = Context.Evaluate(_data.Heat, Item);
|
||||
Visibility = Context.Evaluate(_data.Visibility, Item);
|
||||
Spread = Context.Evaluate(_data.Spread, Item);
|
||||
Velocity = Context.Evaluate(_data.Velocity, Item);
|
||||
Wear = Context.Evaluate(_itemData.WearDamage, Item);
|
||||
}
|
||||
|
||||
public virtual bool Execute(float delta)
|
||||
|
|
|
|||
50
Assets/Scripts/ServerShared/Behaviors/Wear.cs
Normal file
50
Assets/Scripts/ServerShared/Behaviors/Wear.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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 System.Collections.Generic;
|
||||
using MessagePack;
|
||||
using Newtonsoft.Json;
|
||||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn), Order(1000), RuntimeInspectable]
|
||||
public class WearData : BehaviorData
|
||||
{
|
||||
[TemperatureInspectable, JsonProperty("perSecond"), Key(1)]
|
||||
public bool PerSecond;
|
||||
|
||||
public override IBehavior CreateInstance(ItemManager context, Entity entity, EquippedItem item)
|
||||
{
|
||||
return new Wear(context, this, entity, item);
|
||||
}
|
||||
}
|
||||
|
||||
public class Wear : IBehavior
|
||||
{
|
||||
private WearData _data;
|
||||
private EquippableItemData _itemData;
|
||||
|
||||
public Entity Entity { get; }
|
||||
public EquippedItem Item { get; }
|
||||
public ItemManager Context { get; }
|
||||
|
||||
public BehaviorData Data => _data;
|
||||
|
||||
public Wear(ItemManager context, WearData data, Entity entity, EquippedItem item)
|
||||
{
|
||||
Context = context;
|
||||
_data = data;
|
||||
Entity = entity;
|
||||
Item = item;
|
||||
_itemData = context.GetData(item.EquippableItem);
|
||||
}
|
||||
|
||||
public bool Execute(float delta)
|
||||
{
|
||||
var wear = Context.Evaluate(_itemData.WearDamage, Item);
|
||||
if (_data.PerSecond) wear *= delta;
|
||||
Item.EquippableItem.Durability -= wear;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/ServerShared/Behaviors/Wear.cs.meta
Normal file
3
Assets/Scripts/ServerShared/Behaviors/Wear.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: efacda60d2c34447a59c16bdb100ad80
|
||||
timeCreated: 1614819389
|
||||
|
|
@ -18,6 +18,8 @@ public class DatabaseCache
|
|||
public event Action<DatabaseEntry> OnDataUpdateRemote;
|
||||
public event Action<DatabaseEntry> OnDataDeleteRemote;
|
||||
|
||||
private readonly object addLock = new object();
|
||||
|
||||
public Action<string> Logger = Console.WriteLine;
|
||||
|
||||
private readonly Dictionary<Guid, DatabaseEntry> _entries = new Dictionary<Guid, DatabaseEntry>();
|
||||
|
|
@ -28,32 +30,35 @@ public class DatabaseCache
|
|||
|
||||
public void Add(DatabaseEntry entry, bool remote = false)
|
||||
{
|
||||
if (entry != null)
|
||||
lock(addLock)
|
||||
{
|
||||
var exists = _entries.ContainsKey(entry.ID);
|
||||
_entries[entry.ID] = entry;
|
||||
var type = entry.GetType();
|
||||
var types = type.GetParentTypes();
|
||||
foreach (var t in types)
|
||||
if (entry != null)
|
||||
{
|
||||
if(!_types.ContainsKey(t))
|
||||
_types[t] = new Dictionary<Guid, DatabaseEntry>();
|
||||
_types[t][entry.ID] = entry;
|
||||
}
|
||||
var exists = _entries.ContainsKey(entry.ID);
|
||||
_entries[entry.ID] = entry;
|
||||
var type = entry.GetType();
|
||||
var types = type.GetParentTypes();
|
||||
foreach (var t in types)
|
||||
{
|
||||
if (!_types.ContainsKey(t))
|
||||
_types[t] = new Dictionary<Guid, DatabaseEntry>();
|
||||
_types[t][entry.ID] = entry;
|
||||
}
|
||||
|
||||
if (remote)
|
||||
{
|
||||
if (exists)
|
||||
OnDataUpdateRemote?.Invoke(entry);
|
||||
if (remote)
|
||||
{
|
||||
if (exists)
|
||||
OnDataUpdateRemote?.Invoke(entry);
|
||||
else
|
||||
OnDataInsertRemote?.Invoke(entry);
|
||||
}
|
||||
else
|
||||
OnDataInsertRemote?.Invoke(entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (exists)
|
||||
OnDataUpdateLocal?.Invoke(entry);
|
||||
else
|
||||
OnDataInsertLocal?.Invoke(entry);
|
||||
{
|
||||
if (exists)
|
||||
OnDataUpdateLocal?.Invoke(entry);
|
||||
else
|
||||
OnDataInsertLocal?.Invoke(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,27 @@ public abstract class Entity
|
|||
private List<Weapon> _weapons = new List<Weapon>();
|
||||
private List<Capacitor> _capacitors = new List<Capacitor>();
|
||||
private List<Reactor> _reactors = new List<Reactor>();
|
||||
private List<Radiator> _heatsinks = new List<Radiator>();
|
||||
protected bool _active;
|
||||
|
||||
private bool _heatsinksEnabled = true;
|
||||
|
||||
public bool HeatsinksEnabled
|
||||
{
|
||||
get => _heatsinksEnabled;
|
||||
set
|
||||
{
|
||||
if (value == _heatsinksEnabled) return;
|
||||
_heatsinksEnabled = value;
|
||||
foreach (var heatsink in _heatsinks)
|
||||
heatsink.Item.Enabled = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Active
|
||||
{
|
||||
get => _active;
|
||||
}
|
||||
|
||||
public IEnumerable<Weapon> Weapons
|
||||
{
|
||||
|
|
@ -291,8 +311,11 @@ public abstract class Entity
|
|||
return quantityTransferred;
|
||||
}
|
||||
|
||||
public EquippableItem Unequip(EquippedItem item)
|
||||
public EquippableItem TryUnequip(EquippedItem item)
|
||||
{
|
||||
// Don't allow unequipping when the entity is active
|
||||
if (_active) return null;
|
||||
|
||||
if (item.EquippableItem == null)
|
||||
{
|
||||
ItemManager.Log("Attempted to remove equipped item with no equippable item on it! This should be impossible!");
|
||||
|
|
@ -330,6 +353,8 @@ public abstract class Entity
|
|||
_capacitors.Remove(capacitor);
|
||||
if(b is Reactor reactor)
|
||||
_reactors.Remove(reactor);
|
||||
if(b is Radiator heatsink)
|
||||
_heatsinks.Remove(heatsink);
|
||||
}
|
||||
|
||||
return item.EquippableItem;
|
||||
|
|
@ -396,6 +421,9 @@ public abstract class Entity
|
|||
// Check whether the given item will fit when its origin is placed at the given coordinate on the hull
|
||||
public bool ItemFits(EquippableItem item, int2 hullCoord)
|
||||
{
|
||||
// Don't allow equipping while deployed
|
||||
if (_active) return false;
|
||||
|
||||
var itemData = ItemManager.GetData(item);
|
||||
var hullData = ItemManager.GetData(Hull) as HullData;
|
||||
return ItemFits(itemData, hullData, item, hullCoord);
|
||||
|
|
@ -403,6 +431,12 @@ public abstract class Entity
|
|||
|
||||
public bool TryFindSpace(EquippableItem item, out int2 hullCoord)
|
||||
{
|
||||
// Don't allow equipping while deployed
|
||||
if (_active)
|
||||
{
|
||||
hullCoord = int2.zero;
|
||||
return false;
|
||||
}
|
||||
var itemData = ItemManager.GetData(item);
|
||||
var hullData = ItemManager.GetData(Hull) as HullData;
|
||||
|
||||
|
|
@ -451,6 +485,9 @@ public abstract class Entity
|
|||
// Try to equip the given item to the given location
|
||||
public bool TryEquip(EquippableItem item, int2 hullCoord)
|
||||
{
|
||||
// Don't allow equipping while deployed
|
||||
if (_active) return false;
|
||||
|
||||
var itemData = ItemManager.GetData(item);
|
||||
var hullData = ItemManager.GetData(Hull) as HullData;
|
||||
|
||||
|
|
@ -492,10 +529,12 @@ public abstract class Entity
|
|||
_capacitors.Add(capacitor);
|
||||
if(b is Reactor reactor)
|
||||
_reactors.Add(reactor);
|
||||
if(b is Radiator heatsink)
|
||||
_heatsinks.Add(heatsink);
|
||||
}
|
||||
|
||||
equippedItem.OnEnable += () => ItemOnline.OnNext(equippedItem);
|
||||
equippedItem.OnDisable += () => ItemOffline.OnNext(equippedItem);
|
||||
equippedItem.OnOnline += () => ItemOnline.OnNext(equippedItem);
|
||||
equippedItem.OnOffline += () => ItemOffline.OnNext(equippedItem);
|
||||
|
||||
foreach (var i in itemData.Shape.Coordinates)
|
||||
{
|
||||
|
|
@ -811,8 +850,10 @@ public class EquippedItem
|
|||
|
||||
public Dictionary<int, BehaviorGroup> BehaviorGroups;
|
||||
|
||||
public event Action OnDisable;
|
||||
public event Action OnEnable;
|
||||
public bool Enabled = true;
|
||||
|
||||
public event Action OnOffline;
|
||||
public event Action OnOnline;
|
||||
|
||||
public float Conductivity { get; }
|
||||
|
||||
|
|
@ -834,6 +875,11 @@ public class EquippedItem
|
|||
return sum/InsetShape.Coordinates.Length;
|
||||
}
|
||||
}
|
||||
|
||||
public Entity Entity
|
||||
{
|
||||
get => _entity;
|
||||
}
|
||||
|
||||
protected readonly ItemManager _itemManager;
|
||||
private readonly EquippableItemData _data;
|
||||
|
|
@ -882,22 +928,16 @@ public class EquippedItem
|
|||
|
||||
public void Update(float delta)
|
||||
{
|
||||
if (Temperature < _data.MinimumTemperature || Temperature > _data.MaximumTemperature)
|
||||
{
|
||||
_entity.ItemDamage.OnNext((this, delta));
|
||||
EquippableItem.Durability -= delta;
|
||||
}
|
||||
|
||||
foreach (var behavior in Behaviors)
|
||||
if(behavior is IAlwaysUpdatedBehavior alwaysUpdatedBehavior) alwaysUpdatedBehavior.Update(delta);
|
||||
|
||||
var previouslyOnline = _online;
|
||||
_online = EquippableItem.Durability > .01f && Temperature > _data.MinimumTemperature && Temperature < _data.MaximumTemperature;
|
||||
|
||||
if (!previouslyOnline && _online) OnEnable?.Invoke();
|
||||
if (previouslyOnline && !_online) OnDisable?.Invoke();
|
||||
if (!previouslyOnline && _online) OnOnline?.Invoke();
|
||||
if (previouslyOnline && !_online) OnOffline?.Invoke();
|
||||
|
||||
if (_online)
|
||||
if (Enabled && _online)
|
||||
{
|
||||
foreach (var group in BehaviorGroups.Values)
|
||||
{
|
||||
|
|
@ -958,6 +998,15 @@ public class EquippedCargoBay : EquippedItem
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TryFindSpace(ItemInstance item)
|
||||
{
|
||||
if (item is SimpleCommodity simpleCommodity)
|
||||
return TryFindSpace(simpleCommodity, out _);
|
||||
if (item is CraftedItemInstance craftedItem)
|
||||
return TryFindSpace(craftedItem, out _);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Tries to find a place to put the given items in the inventory
|
||||
// Will attempt to fill existing item stacks first
|
||||
|
|
@ -996,6 +1045,23 @@ public class EquippedCargoBay : EquippedItem
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Searches the cargo bay for a position where the item will fit, returns true when found
|
||||
public bool TryFindSpace(CraftedItemInstance item, out int2 position)
|
||||
{
|
||||
// Search all the space in the cargo bay for an empty space where the item fits
|
||||
foreach (var cargoCoord in Data.InteriorShape.Coordinates)
|
||||
{
|
||||
if (ItemFits(item, cargoCoord))
|
||||
{
|
||||
position = cargoCoord;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
position = int2.zero;
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryStore(ItemInstance item)
|
||||
{
|
||||
|
|
@ -1072,23 +1138,6 @@ public class EquippedCargoBay : EquippedItem
|
|||
return true;
|
||||
}
|
||||
|
||||
// Searches the cargo bay for a position where the item will fit, returns true when found
|
||||
public bool TryFindSpace(CraftedItemInstance item, out int2 position)
|
||||
{
|
||||
// Search all the space in the cargo bay for an empty space where the item fits
|
||||
foreach (var cargoCoord in Data.InteriorShape.Coordinates)
|
||||
{
|
||||
if (ItemFits(item, cargoCoord))
|
||||
{
|
||||
position = cargoCoord;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
position = int2.zero;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Try to store the given item anywhere it will fit, returns true when the item was successfully stored
|
||||
public bool TryStore(CraftedItemInstance item) => TryFindSpace(item, out var position) && TryStore(item, position);
|
||||
|
||||
|
|
|
|||
|
|
@ -290,6 +290,15 @@ public abstract class EquippableItemData : CraftedItemData
|
|||
|
||||
[InspectableField, JsonProperty("durabilityExponent"), Key(15), SimplePerformanceStat]
|
||||
public PerformanceStat DurabilityExponent = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("heatExponent"), Key(16), SimplePerformanceStat]
|
||||
public PerformanceStat HeatExponent = new PerformanceStat();
|
||||
|
||||
[InspectableAnimationCurve, JsonProperty("performanceCurve"), Key(17)]
|
||||
public float4[] HeatPerformanceCurve;
|
||||
|
||||
[InspectableField, JsonProperty("wearDamage"), Key(18)]
|
||||
public PerformanceStat WearDamage = new PerformanceStat();
|
||||
|
||||
[IgnoreMember]
|
||||
public abstract HardpointType HardpointType { get; }
|
||||
|
|
@ -297,12 +306,42 @@ public abstract class EquippableItemData : CraftedItemData
|
|||
[IgnoreMember] private const int STEPS = 64;
|
||||
|
||||
[IgnoreMember] private float? _optimum;
|
||||
|
||||
[IgnoreMember]
|
||||
public float OptimalTemperature
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_optimum==null)
|
||||
{
|
||||
var samples = Enumerable.Range(0, STEPS).Select(i => (float) i / STEPS).ToArray();
|
||||
float max = 0;
|
||||
_optimum = 0;
|
||||
foreach (var f in samples)
|
||||
{
|
||||
var p = HeatPerformanceCurve?.Evaluate(f)??0;
|
||||
if (p > max)
|
||||
{
|
||||
max = p;
|
||||
_optimum = f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (float) (MinimumTemperature + _optimum * (MaximumTemperature - MinimumTemperature));
|
||||
}
|
||||
}
|
||||
|
||||
public float Performance(float temperature)
|
||||
{
|
||||
return saturate(HeatPerformanceCurve.Evaluate(unlerp(MinimumTemperature, MaximumTemperature, temperature)));
|
||||
}
|
||||
}
|
||||
|
||||
[RethinkTable("Items"), Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class GearData : EquippableItemData
|
||||
{
|
||||
[InspectableField, JsonProperty("hardpointType"), Key(16)]
|
||||
[InspectableField, JsonProperty("hardpointType"), Key(19)]
|
||||
public HardpointType Hardpoint;
|
||||
|
||||
[IgnoreMember] public override HardpointType HardpointType => Hardpoint;
|
||||
|
|
@ -311,7 +350,7 @@ public class GearData : EquippableItemData
|
|||
[RethinkTable("Items"), Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class CargoBayData : EquippableItemData
|
||||
{
|
||||
[InspectableField, JsonProperty("interiorShape"), Key(16)]
|
||||
[InspectableField, JsonProperty("interiorShape"), Key(19)]
|
||||
public Shape InteriorShape;
|
||||
[IgnoreMember] public override HardpointType HardpointType => HardpointType.Tool;
|
||||
}
|
||||
|
|
@ -319,7 +358,7 @@ public class CargoBayData : EquippableItemData
|
|||
[RethinkTable("Items"), Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class DockingBayData : CargoBayData
|
||||
{
|
||||
[InspectableField, JsonProperty("maxSize"), Key(17)]
|
||||
[InspectableField, JsonProperty("maxSize"), Key(20)]
|
||||
public int2 MaxSize;
|
||||
[IgnoreMember] public override HardpointType HardpointType => HardpointType.Tool;
|
||||
}
|
||||
|
|
@ -327,19 +366,19 @@ public class DockingBayData : CargoBayData
|
|||
[RethinkTable("Items"), Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class HullData : EquippableItemData
|
||||
{
|
||||
[InspectableField, JsonProperty("hardpoints"), Key(16)]
|
||||
[InspectableField, JsonProperty("hardpoints"), Key(19)]
|
||||
public List<HardpointData> Hardpoints = new List<HardpointData>();
|
||||
|
||||
[InspectablePrefab, JsonProperty("prefab"), Key(17)]
|
||||
[InspectablePrefab, JsonProperty("prefab"), Key(20)]
|
||||
public string Prefab;
|
||||
|
||||
[InspectableField, JsonProperty("hullType"), Key(18)]
|
||||
[InspectableField, JsonProperty("hullType"), Key(21)]
|
||||
public HullType HullType;
|
||||
|
||||
[InspectableField, JsonProperty("gridOffset"), Key(19)]
|
||||
[InspectableField, JsonProperty("gridOffset"), Key(22)]
|
||||
public float GridOffset;
|
||||
|
||||
[InspectableField, JsonProperty("armor"), Key(20)]
|
||||
[InspectableField, JsonProperty("armor"), Key(23)]
|
||||
public float Armor;
|
||||
|
||||
[IgnoreMember]
|
||||
|
|
@ -410,11 +449,14 @@ public class PerformanceStat
|
|||
[JsonProperty("durabilityDependent"), Key(2)]
|
||||
public bool DurabilityDependent;
|
||||
|
||||
// [JsonProperty("heatDependent"), Key(3)]
|
||||
// public bool HeatDependent;
|
||||
|
||||
[JsonProperty("qualityExponent"), Key(3)]
|
||||
public float QualityExponent;
|
||||
|
||||
[JsonProperty("heatDependent"), Key(4)]
|
||||
public bool HeatDependent;
|
||||
|
||||
[JsonProperty("heatExponentMultiplier"), Key(5)]
|
||||
public float HeatExponentMultiplier = 1;
|
||||
|
||||
//[JsonProperty("id"), Key(5)] public Guid ID = Guid.NewGuid();
|
||||
|
||||
|
|
|
|||
|
|
@ -273,21 +273,21 @@ public class ItemManager
|
|||
}
|
||||
|
||||
// Returns stat using ship temperature and modifiers
|
||||
public float Evaluate(PerformanceStat stat, EquippableItem item, Entity entity)
|
||||
public float Evaluate(PerformanceStat stat, EquippedItem item)
|
||||
{
|
||||
var itemData = GetData(item);
|
||||
var itemData = GetData(item.EquippableItem);
|
||||
|
||||
//var heat = !stat.HeatDependent ? 1 : pow(itemData.Performance(entity.Temperature), Evaluate(itemData.HeatExponent,item));
|
||||
var durability = !stat.DurabilityDependent ? 1 : pow(item.Durability / itemData.Durability, Evaluate(itemData.DurabilityExponent,item));
|
||||
var quality = pow(Quality(stat, item), stat.QualityExponent);
|
||||
var heat = !stat.HeatDependent ? 1 : pow(itemData.Performance(item.Temperature), Evaluate(itemData.HeatExponent, item.EquippableItem) * stat.HeatExponentMultiplier);
|
||||
var durability = !stat.DurabilityDependent ? 1 : pow(item.EquippableItem.Durability / itemData.Durability, Evaluate(itemData.DurabilityExponent,item.EquippableItem));
|
||||
var quality = pow(Quality(stat, item.EquippableItem), stat.QualityExponent);
|
||||
|
||||
var scaleModifier = 1.0f;
|
||||
foreach (var value in stat.GetScaleModifiers(entity).Values) scaleModifier = scaleModifier * value;
|
||||
foreach (var value in stat.GetScaleModifiers(item.Entity).Values) scaleModifier = scaleModifier * value;
|
||||
|
||||
float constantModifier = 0;
|
||||
foreach (var value in stat.GetConstantModifiers(entity).Values) constantModifier += value;
|
||||
foreach (var value in stat.GetConstantModifiers(item.Entity).Values) constantModifier += value;
|
||||
|
||||
var result = lerp(stat.Min, stat.Max, durability * quality) * scaleModifier + constantModifier;
|
||||
var result = lerp(stat.Min, stat.Max, durability * quality * heat) * scaleModifier + constantModifier;
|
||||
if (float.IsNaN(result))
|
||||
return stat.Min;
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -110,30 +110,34 @@ public class InventoryMenu : MonoBehaviour
|
|||
}
|
||||
else if (data is InventoryEntityEventData entityEvent)
|
||||
{
|
||||
var item = entityEvent.Entity.GearOccupancy[entityEvent.Position.x, entityEvent.Position.y];
|
||||
if (item != null)
|
||||
if(!entityEvent.Entity.Active)
|
||||
{
|
||||
var itemData = GameManager.ItemManager.GetData(item.EquippableItem);
|
||||
var hullData = GameManager.ItemManager.GetData(entityEvent.Entity.Hull);
|
||||
|
||||
_originalRotation = item.EquippableItem.Rotation;
|
||||
_originalEquippedItem = entityEvent.Entity.GearOccupancy[data.Position.x, data.Position.y];
|
||||
_originalOccupancy = hullData.Shape.Inset(itemData.Shape, item.Position, item.EquippableItem.Rotation);
|
||||
_originalPanel = panel;
|
||||
_dragItem = item.EquippableItem;
|
||||
_dragCellOffset = item.Position - entityEvent.Position;
|
||||
_dragCells = _originalOccupancy.Coordinates
|
||||
.Select(v => Instantiate(panel.CellInstances[v], DragParent, true).transform).ToArray();
|
||||
foreach(var cell in _dragCells)
|
||||
var item = entityEvent.Entity.GearOccupancy[entityEvent.Position.x, entityEvent.Position.y];
|
||||
if (item != null)
|
||||
{
|
||||
foreach (var component in cell.GetComponentsInChildren<ObservableTriggerBase>())
|
||||
component.enabled = false;
|
||||
cell.GetComponentInChildren<Image>().raycastTarget = false;
|
||||
var itemData = GameManager.ItemManager.GetData(item.EquippableItem);
|
||||
var hullData = GameManager.ItemManager.GetData(entityEvent.Entity.Hull);
|
||||
|
||||
_originalRotation = item.EquippableItem.Rotation;
|
||||
_originalEquippedItem = entityEvent.Entity.GearOccupancy[data.Position.x, data.Position.y];
|
||||
_originalOccupancy = hullData.Shape.Inset(itemData.Shape, item.Position, item.EquippableItem.Rotation);
|
||||
_originalPanel = panel;
|
||||
_dragItem = item.EquippableItem;
|
||||
_dragCellOffset = item.Position - entityEvent.Position;
|
||||
_dragCells = _originalOccupancy.Coordinates
|
||||
.Select(v => Instantiate(panel.CellInstances[v], DragParent, true).transform).ToArray();
|
||||
foreach (var cell in _dragCells)
|
||||
{
|
||||
foreach (var component in cell.GetComponentsInChildren<ObservableTriggerBase>())
|
||||
component.enabled = false;
|
||||
cell.GetComponentInChildren<Image>().raycastTarget = false;
|
||||
}
|
||||
|
||||
_dragOffsets = _dragCells.Select(x => (Vector2) x.position - data.PointerEventData.position).ToArray();
|
||||
panel.IgnoreOccupancy = _originalOccupancy;
|
||||
panel.RefreshCells(_originalOccupancy.Expand().Coordinates);
|
||||
AkSoundEngine.PostEvent("Pickup", gameObject);
|
||||
}
|
||||
_dragOffsets = _dragCells.Select(x => (Vector2) x.position - data.PointerEventData.position).ToArray();
|
||||
panel.IgnoreOccupancy = _originalOccupancy;
|
||||
panel.RefreshCells(_originalOccupancy.Expand().Coordinates);
|
||||
AkSoundEngine.PostEvent("Pickup", gameObject);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -166,7 +170,7 @@ public class InventoryMenu : MonoBehaviour
|
|||
}
|
||||
else if (data is InventoryEntityEventData entityEvent)
|
||||
{
|
||||
if (entityEvent.Entity.Unequip(_originalEquippedItem) != null)
|
||||
if (entityEvent.Entity.TryUnequip(_originalEquippedItem) != null)
|
||||
{
|
||||
_dragTargetPanel.DropItem(_dragItem, _dragTargetPosition);
|
||||
AkSoundEngine.PostEvent("Unequip", gameObject);
|
||||
|
|
@ -196,7 +200,7 @@ public class InventoryMenu : MonoBehaviour
|
|||
}
|
||||
else if (data is InventoryEntityEventData entityEvent)
|
||||
{
|
||||
if (entityEvent.Entity.Unequip(_originalEquippedItem) == null)
|
||||
if (entityEvent.Entity.TryUnequip(_originalEquippedItem) == null)
|
||||
{
|
||||
Dialog.Clear();
|
||||
Dialog.Title.text = "Unable to destroy item!";
|
||||
|
|
@ -290,13 +294,15 @@ public class InventoryMenu : MonoBehaviour
|
|||
if (Mouse.current.clickCount.ReadValue() == 2)
|
||||
{
|
||||
var otherPanel = panel == InventoryPanels[0] ? InventoryPanels[1] : InventoryPanels[0];
|
||||
if (otherPanel.DropItem(item))
|
||||
if (otherPanel.CanDropItem(item))
|
||||
{
|
||||
otherPanel.DropItem(item);
|
||||
AkSoundEngine.PostEvent("Equip", gameObject);
|
||||
cargoEvent.CargoBay.Remove(item);
|
||||
panel.RefreshCells();
|
||||
otherPanel.RefreshCells();
|
||||
}
|
||||
else AkSoundEngine.PostEvent("UI_Fail", gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -336,12 +342,20 @@ public class InventoryMenu : MonoBehaviour
|
|||
if (Mouse.current.clickCount.ReadValue() == 2)
|
||||
{
|
||||
var otherPanel = panel == InventoryPanels[0] ? InventoryPanels[1] : InventoryPanels[0];
|
||||
if (otherPanel.DropItem(item.EquippableItem))
|
||||
if (otherPanel.CanDropItem(item.EquippableItem))
|
||||
{
|
||||
AkSoundEngine.PostEvent("Unequip", gameObject);
|
||||
entityEvent.Entity.Unequip(item);
|
||||
panel.RefreshCells();
|
||||
otherPanel.RefreshCells();
|
||||
if (!entityEvent.Entity.Active)
|
||||
{
|
||||
if (entityEvent.Entity.TryUnequip(item) != null)
|
||||
{
|
||||
otherPanel.DropItem(item.EquippableItem);
|
||||
AkSoundEngine.PostEvent("Unequip", gameObject);
|
||||
panel.RefreshCells();
|
||||
otherPanel.RefreshCells();
|
||||
}
|
||||
else AkSoundEngine.PostEvent("UI_Fail", gameObject);
|
||||
}
|
||||
else AkSoundEngine.PostEvent("UI_Fail", gameObject);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -640,6 +640,21 @@ public class InventoryPanel : MonoBehaviour
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool CanDropItem(ItemInstance item)
|
||||
{
|
||||
if (_displayedEntity != null && item is EquippableItem equippableItem)
|
||||
{
|
||||
return _displayedEntity.TryFindSpace(equippableItem, out _);
|
||||
}
|
||||
|
||||
if (_displayedCargo != null)
|
||||
{
|
||||
return _displayedCargo.TryFindSpace(item);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool DropItem(ItemInstance item)
|
||||
{
|
||||
if (_displayedEntity != null && item is EquippableItem equippableItem)
|
||||
|
|
|
|||
|
|
@ -386,7 +386,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
else if (fieldType == typeof(PerformanceStat))
|
||||
{
|
||||
var stat = (PerformanceStat) field.GetValue(behavior);
|
||||
AddProperty(field.Name, () => $"{Context.Evaluate(stat, gear, entity).SignificantDigits(Context.GameplaySettings.SignificantDigits)}");
|
||||
AddProperty(field.Name, () => $"{Context.Evaluate(stat, gear).SignificantDigits(Context.GameplaySettings.SignificantDigits)}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,11 @@ public class SchematicDisplay : MonoBehaviour
|
|||
public Prototype ListElementPrototype;
|
||||
public Prototype TriggerGroupPrototype;
|
||||
|
||||
public Color HeaderElementEnabledColor;
|
||||
public Color HeaderElementDisabledColor;
|
||||
|
||||
public Image HeatsinkBackground;
|
||||
|
||||
public TextMeshProUGUI EnergyLabel;
|
||||
public TextMeshProUGUI CockpitTemperatureLabel;
|
||||
public TextMeshProUGUI RadiatorTemperatureLabel;
|
||||
|
|
@ -209,13 +214,13 @@ public class SchematicDisplay : MonoBehaviour
|
|||
{
|
||||
if (!_enemy)
|
||||
{
|
||||
|
||||
if (_radiators.Length == 1)
|
||||
RadiatorTemperatureLabel.text = $"{((int)(_radiators[0].Temperature - 273.15f)).ToString()}°C";
|
||||
else if (_radiators.Length > 1)
|
||||
RadiatorTemperatureLabel.text =
|
||||
$"{((int)(_radiators.Min(r => r.Temperature) - 273.15f)).ToString()}-" +
|
||||
$"{((int)(_radiators.Max(r => r.Temperature) - 273.15f)).ToString()}°C";
|
||||
HeatsinkBackground.color = _entity.HeatsinksEnabled ? HeaderElementEnabledColor : HeaderElementDisabledColor;
|
||||
|
||||
if (_heatsinks.Length == 1)
|
||||
HeatsinkTemperatureLabel.text = $"{((int)(_heatsinks[0].Item.Temperature - 273.15f)).ToString()}°C";
|
||||
|
|
@ -282,7 +287,7 @@ public class SchematicDisplay : MonoBehaviour
|
|||
|
||||
if (x.Weapon.WeaponData != null)
|
||||
{
|
||||
x.ListElement.RangeLabel.text = ((int) _entity.ItemManager.Evaluate(x.Weapon.WeaponData.Range, x.Item.EquippableItem, _entity)).ToString();
|
||||
x.ListElement.RangeLabel.text = ((int) _entity.ItemManager.Evaluate(x.Weapon.WeaponData.Range, x.Item)).ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -523,6 +523,7 @@
|
|||
<Compile Include="Assets\Scripts\ServerShared\NIH\LinqFaster\SequenceEqual.cs" />
|
||||
<Compile Include="Assets\Scripts\ServerShared\NIH\LinqFaster\Skip.cs" />
|
||||
<Compile Include="Assets\Scripts\ServerShared\ItemManager.cs" />
|
||||
<Compile Include="Assets\Scripts\ServerShared\Behaviors\Wear.cs" />
|
||||
<None Include="Assets\Scripts\ServerShared\NIH\LinqFaster\readme.txt" />
|
||||
<None Include="Assets\Scripts\ServerShared\Economy.Shared.Unity.asmdef" />
|
||||
<Reference Include="System.Threading.Tasks.Extensions">
|
||||
|
|
|
|||
Loading…
Reference in a new issue