Thermal Performance Threshold & Thermal Override

Items will switch themselves off below a customizable threshold to avoid damage
Player can toggle thermal override to disable safety shutdown
Selecting an item allows player to select whether the item will override
Clicking on the background of an inventory panel will display general ship settings (including thermal shutdown threshold)
Performance Stat evaluation has been moved to EquippedItem, slight performance improvement
Item online and active status are now reactive properties
Created player settings file to store e.g. shutdown threshold
Fixed crash when entering wormhole while enemies are visible
This commit is contained in:
Reinier Vens 2021-03-07 01:10:31 +00:00
commit 1092159063
66 changed files with 756 additions and 206 deletions

View file

@ -2023,6 +2023,7 @@
<e p="Noise1D.cs" t="Include" />
<e p="OrbitalEntity.cs" t="Include" />
<e p="PlayerData.cs" t="Include" />
<e p="PlayerSettings.cs" t="Include" />
<e p="Rect.cs" t="Include" />
<e p="RegisterResolver.cs" t="Include" />
<e p="Settings.cs" t="Include" />

View file

@ -86,7 +86,7 @@ Material:
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Scale: 2.8484566
- _Scale: 8.4506855
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1

View file

@ -58,7 +58,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 0.49019608}
m_Color: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
@ -255,10 +255,10 @@ RectTransform:
m_Father: {fileID: 3222204141728529077}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchorMin: {x: 0.635, y: 0}
m_AnchorMax: {x: 0.635, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 20, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3123360186942093854
CanvasRenderer:
@ -631,6 +631,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}

View file

@ -172,6 +172,14 @@
"expectedControlType": "Button",
"processors": "",
"interactions": ""
},
{
"name": "Override Shutdown",
"type": "Button",
"id": "62a64686-4670-43c9-81ee-bbb8578e284b",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
}
],
"bindings": [
@ -588,10 +596,21 @@
"path": "<Keyboard>/#(G)",
"interactions": "",
"processors": "",
"groups": "",
"groups": "Keyboard&Mouse",
"action": "Toggle Shield",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "8e8b5d19-20fd-43f3-88cf-6246f374e7cf",
"path": "<Keyboard>/#(O)",
"interactions": "",
"processors": "",
"groups": "Keyboard&Mouse",
"action": "Override Shutdown",
"isComposite": false,
"isPartOfComposite": false
}
]
},

View file

@ -52,6 +52,8 @@ Tank by Creative Stall
Satellite by Amelia
distance by Anthony Ledoux
Cross by shashank singh
Worried Fire Flame by Akshar Pathak
Boiling Thermometer by KEN MURRAY
Other

BIN
Assets/Resources/Sprites/Icons/Boiling Thermometer.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,108 @@
fileFormatVersion: 2
guid: 8c679ed13c51b764b8304e50aef07931
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 64
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 64
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Resources/Sprites/Icons/Worried Flame Stroked.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,108 @@
fileFormatVersion: 2
guid: 2656fc64446ab434aac46c4a660281aa
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Resources/Sprites/Icons/Worried Flame.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,108 @@
fileFormatVersion: 2
guid: aabcc41df8eabd64686f0f801267d759
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -252,13 +252,13 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7628189704016736659}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -6, y: -8}
m_AnchoredPosition: {x: -18, y: -44}
m_SizeDelta: {x: 16, y: 16}
m_Pivot: {x: 1, y: 1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &19222413
MonoBehaviour:
m_ObjectHideFlags: 0
@ -4661,6 +4661,8 @@ MonoBehaviour:
TriggerGroupPrototype: {fileID: 1564656282}
HeaderElementEnabledColor: {r: 0, g: 0, b: 0, a: 0}
HeaderElementDisabledColor: {r: 0, g: 0, b: 0, a: 0}
OverrideIcon: {fileID: 0}
OverrideIconBlinkSpeed: 0
ShieldIcon: {fileID: 0}
HeatsinkBackground: {fileID: 0}
EnergyLabel: {fileID: 0}
@ -18244,7 +18246,7 @@ PrefabInstance:
- target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 55.675
objectReference: {fileID: 0}
- target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e,
type: 3}
@ -18961,6 +18963,102 @@ MonoBehaviour:
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!1 &1576705656
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1576705657}
- component: {fileID: 1576705660}
- component: {fileID: 1576705659}
- component: {fileID: 1576705658}
m_Layer: 5
m_Name: Override Icon
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1576705657
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1576705656}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7628189704016736659}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -18, y: -20}
m_SizeDelta: {x: 24, y: 24}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1576705658
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1576705656}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 1
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!114 &1576705659
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1576705656}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0.44583336, b: 0.050000012, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 8c679ed13c51b764b8304e50aef07931, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1576705660
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1576705656}
m_CullTransparentMesh: 1
--- !u!1 &1590553658
GameObject:
m_ObjectHideFlags: 0
@ -19175,7 +19273,7 @@ PrefabInstance:
- target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 60.98
objectReference: {fileID: 0}
- target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e,
type: 3}
@ -28762,6 +28860,7 @@ RectTransform:
m_Children:
- {fileID: 2851244030680155772}
- {fileID: 7628189703197605886}
- {fileID: 1576705657}
- {fileID: 19222412}
m_Father: {fileID: 7628189704109037581}
m_RootOrder: 4
@ -29687,6 +29786,8 @@ MonoBehaviour:
TriggerGroupPrototype: {fileID: 1564656282}
HeaderElementEnabledColor: {r: 1, g: 1, b: 1, a: 0.078431375}
HeaderElementDisabledColor: {r: 1, g: 1, b: 1, a: 0.011764706}
OverrideIcon: {fileID: 1576705656}
OverrideIconBlinkSpeed: 10
ShieldIcon: {fileID: 19222411}
HeatsinkBackground: {fileID: 661332569}
EnergyLabel: {fileID: 804489113}

View file

@ -185,6 +185,14 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""Override Shutdown"",
""type"": ""Button"",
""id"": ""62a64686-4670-43c9-81ee-bbb8578e284b"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
}
],
""bindings"": [
@ -601,10 +609,21 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
""path"": ""<Keyboard>/#(G)"",
""interactions"": """",
""processors"": """",
""groups"": """",
""groups"": ""Keyboard&Mouse"",
""action"": ""Toggle Shield"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""8e8b5d19-20fd-43f3-88cf-6246f374e7cf"",
""path"": ""<Keyboard>/#(O)"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard&Mouse"",
""action"": ""Override Shutdown"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
},
@ -1192,6 +1211,7 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
m_Player_ToggleHeatsinks = m_Player.FindAction("Toggle Heatsinks", throwIfNotFound: true);
m_Player_EnterWormhole = m_Player.FindAction("EnterWormhole", throwIfNotFound: true);
m_Player_ToggleShield = m_Player.FindAction("Toggle Shield", throwIfNotFound: true);
m_Player_OverrideShutdown = m_Player.FindAction("Override Shutdown", throwIfNotFound: true);
// UI
m_UI = asset.FindActionMap("UI", throwIfNotFound: true);
m_UI_Navigate = m_UI.FindAction("Navigate", throwIfNotFound: true);
@ -1278,6 +1298,7 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
private readonly InputAction m_Player_ToggleHeatsinks;
private readonly InputAction m_Player_EnterWormhole;
private readonly InputAction m_Player_ToggleShield;
private readonly InputAction m_Player_OverrideShutdown;
public struct PlayerActions
{
private @AetheriaInput m_Wrapper;
@ -1303,6 +1324,7 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
public InputAction @ToggleHeatsinks => m_Wrapper.m_Player_ToggleHeatsinks;
public InputAction @EnterWormhole => m_Wrapper.m_Player_EnterWormhole;
public InputAction @ToggleShield => m_Wrapper.m_Player_ToggleShield;
public InputAction @OverrideShutdown => m_Wrapper.m_Player_OverrideShutdown;
public InputActionMap Get() { return m_Wrapper.m_Player; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
@ -1375,6 +1397,9 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
@ToggleShield.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnToggleShield;
@ToggleShield.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnToggleShield;
@ToggleShield.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnToggleShield;
@OverrideShutdown.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnOverrideShutdown;
@OverrideShutdown.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnOverrideShutdown;
@OverrideShutdown.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnOverrideShutdown;
}
m_Wrapper.m_PlayerActionsCallbackInterface = instance;
if (instance != null)
@ -1442,6 +1467,9 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
@ToggleShield.started += instance.OnToggleShield;
@ToggleShield.performed += instance.OnToggleShield;
@ToggleShield.canceled += instance.OnToggleShield;
@OverrideShutdown.started += instance.OnOverrideShutdown;
@OverrideShutdown.performed += instance.OnOverrideShutdown;
@OverrideShutdown.canceled += instance.OnOverrideShutdown;
}
}
}
@ -1642,6 +1670,7 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
void OnToggleHeatsinks(InputAction.CallbackContext context);
void OnEnterWormhole(InputAction.CallbackContext context);
void OnToggleShield(InputAction.CallbackContext context);
void OnOverrideShutdown(InputAction.CallbackContext context);
}
public interface IUIActions
{

View file

@ -52,6 +52,7 @@ public class ActionGameManager : MonoBehaviour
// private CinemachineFramingTransposer _transposer;
// private CinemachineComposer _composer;
public PlayerSettings PlayerSettings { get; private set; }
private DirectoryInfo _filePath;
private DirectoryInfo _loadoutPath;
private bool _editMode;
@ -112,7 +113,10 @@ public class ActionGameManager : MonoBehaviour
if (CurrentShip != null)
{
CurrentShip.Deactivate();
CurrentShip.Zone = Zone;
Zone.Entities.Add(CurrentShip);
CurrentShip.Activate();
}
SectorRenderer.LoadZone(Zone);
@ -128,11 +132,20 @@ public class ActionGameManager : MonoBehaviour
ConsoleController.MessageReceiver = this;
_filePath = new DirectoryInfo(Application.dataPath).Parent.CreateSubdirectory("GameData");
_loadoutPath = _filePath.CreateSubdirectory("Loadouts");
ItemData = new DatabaseCache();
ItemData.Load(_filePath.FullName);
ItemData.Load(Path.Combine(_filePath.FullName, "AetherDB.msgpack"));
ItemManager = new ItemManager(ItemData, Settings.GameplaySettings, Debug.Log);
SectorRenderer.ItemManager = ItemManager;
FileInfo playerSettingsFile = new FileInfo(Path.Combine(_filePath.FullName, "PlayerSettings.msgpack"));
if (!playerSettingsFile.Exists)
{
File.WriteAllBytes(playerSettingsFile.FullName, MessagePackSerializer.Serialize(Settings.DefaultPlayerSettings));
}
PlayerSettings = MessagePackSerializer.Deserialize<PlayerSettings>(
File.ReadAllBytes(playerSettingsFile.FullName));
Loadouts.AddRange(_loadoutPath.EnumerateFiles("*.preset")
.Select(fi => MessagePackSerializer.Deserialize<EntityPack>(File.ReadAllBytes(fi.FullName))));
@ -230,6 +243,11 @@ public class ActionGameManager : MonoBehaviour
}
};
_input.Player.OverrideShutdown.performed += context =>
{
CurrentShip.OverrideShutdown = !CurrentShip.OverrideShutdown;
};
_input.Player.ToggleHeatsinks.performed += context =>
{
CurrentShip.HeatsinksEnabled = !CurrentShip.HeatsinksEnabled;
@ -240,8 +258,8 @@ public class ActionGameManager : MonoBehaviour
{
if (CurrentShip.Shield != null)
{
CurrentShip.Shield.Item.Enabled = !CurrentShip.Shield.Item.Enabled;
AkSoundEngine.PostEvent(CurrentShip.Shield.Item.Enabled ? "UI_Success" : "UI_Fail", gameObject);
CurrentShip.Shield.Item.Enabled.Value = !CurrentShip.Shield.Item.Enabled.Value;
AkSoundEngine.PostEvent(CurrentShip.Shield.Item.Enabled.Value ? "UI_Success" : "UI_Fail", gameObject);
}
};

View file

@ -27,6 +27,7 @@ public class GameSettings : ScriptableObject
public PlanetSettings PlanetSettings;
public ZoneGenerationSettings ZoneSettings;
public GameplaySettings GameplaySettings;
public PlayerSettings DefaultPlayerSettings;
public Color HullHitColor;
public Color ArmorHitColor;
public Color HardpointHitColor;

View file

@ -76,7 +76,7 @@ public class ConstantLaser : MonoBehaviour
var shield = hit.collider.GetComponent<ShieldManager>();
if (shield)
{
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active.Value && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
if (shield.Entity != SourceEntity)
{
shield.Entity.Shield.TakeHit(DamageType, Damage);

View file

@ -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);
p.Range = item.Evaluate(data.Range);
var t = p.transform;
t.SetParent(barrel);
t.forward = barrel.forward;
t.position = barrel.position;
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.Damage = item.Evaluate(data.Damage);
p.Penetration = item.Evaluate(data.Penetration);
p.Spread = item.Evaluate(data.DamageSpread);
p.DamageType = data.DamageType;
_lasers.Add(item, p);
}

View file

@ -55,14 +55,14 @@ public class ConstantLightning : MonoBehaviour
foreach (var hit in hits)
{
var shield = hit.collider.GetComponent<ShieldManager>();
if (shield && (shield.Entity.Shield != null && shield.Entity.Shield.Item.Active && shield.Entity.Shield.CanTakeHit(DamageType, Damage)))
if (shield && (shield.Entity.Shield != null && shield.Entity.Shield.Item.Active.Value && shield.Entity.Shield.CanTakeHit(DamageType, Damage)))
{
if (shield.Entity == Source.Entity) continue;
shield.Entity.Shield.TakeHit(DamageType, Damage * Time.deltaTime);
shield.ShowHit(hit.point, sqrt(Damage));
}
var hull = hit.collider.GetComponent<HullCollider>();
if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active.Value && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
{
if (hull.Entity == Source.Entity) continue;
hull.SendHit(Damage * Time.deltaTime, Penetration, Spread, DamageType, Source.Entity, hit.textureCoord, Barrel.forward);

View file

@ -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);
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.Damage = item.Evaluate(data.Damage);
p.Range = item.Evaluate(data.Range);
p.Penetration = item.Evaluate(data.Penetration);
p.Spread = item.Evaluate(data.DamageSpread);
p.DamageType = data.DamageType;
_bolts.Add(item, p);
}

View file

@ -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);
p.Damage = item.Evaluate(data.Damage);
p.DamageType = data.DamageType;
_weapons.Add(item, p);
p.Initialize();

View file

@ -147,7 +147,7 @@ public class GuidedProjectile : MonoBehaviour
var shield = hit.collider.GetComponent<ShieldManager>();
if (shield)
{
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active.Value && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
if (shield.Entity != SourceEntity)
{
shield.Entity.Shield.TakeHit(DamageType, Damage);
@ -155,7 +155,7 @@ public class GuidedProjectile : MonoBehaviour
}
}
var hull = hit.collider.GetComponent<HullCollider>();
if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active.Value && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
{
if (hull.Entity != SourceEntity)
{

View file

@ -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);
p.TopSpeed = source.Entity.ItemManager.Evaluate(launcher.MissileVelocity, item);
p.Thrust = item.Evaluate(launcher.Thrust);
p.TopSpeed = item.Evaluate(launcher.MissileVelocity);
}
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);
p.TopSpeed = source.Entity.ItemManager.Evaluate(guidance.MissileVelocity, item);
p.Thrust = item.Evaluate(guidance.Thrust);
p.TopSpeed = item.Evaluate(guidance.MissileVelocity);
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!");

View file

@ -33,7 +33,7 @@ public class HitscanEffect : MonoBehaviour
var shield = hit.collider.GetComponent<ShieldManager>();
if (shield)
{
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active.Value && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
if (shield.Entity != SourceEntity)
{
shield.Entity.Shield.TakeHit(DamageType, Damage);

View file

@ -42,7 +42,7 @@ public class Laser : MonoBehaviour
var shield = hit.collider.GetComponent<ShieldManager>();
if (shield)
{
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active.Value && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
if (shield.Entity != SourceEntity)
{
shield.Entity.Shield.TakeHit(DamageType, Damage);

View file

@ -36,7 +36,7 @@ public class Lightning : MonoBehaviour
foreach (var hit in hits)
{
var shield = hit.collider.GetComponent<ShieldManager>();
if (shield && (shield.Entity.Shield != null && shield.Entity.Shield.Item.Active && shield.Entity.Shield.CanTakeHit(DamageType, Damage)))
if (shield && (shield.Entity.Shield != null && shield.Entity.Shield.Item.Active.Value && shield.Entity.Shield.CanTakeHit(DamageType, Damage)))
{
if (shield.Entity == Source.Entity) continue;
LightningCompute.OnLeaderComplete = () =>
@ -46,7 +46,7 @@ public class Lightning : MonoBehaviour
};
}
var hull = hit.collider.GetComponent<HullCollider>();
if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active.Value && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
{
if (hull.Entity == Source.Entity) continue;
LightningCompute.OnLeaderComplete = () =>

View file

@ -109,13 +109,13 @@ public class Mine : MonoBehaviour
foreach (var collider in Physics.OverlapSphere(t.position, BlastRange, 1 | (1 << 17)))
{
var shield = collider.GetComponent<ShieldManager>();
if (shield && (shield.Entity.Shield != null && shield.Entity.Shield.Item.Active && shield.Entity.Shield.CanTakeHit(DamageType, Damage)))
if (shield && (shield.Entity.Shield != null && shield.Entity.Shield.Item.Active.Value && shield.Entity.Shield.CanTakeHit(DamageType, Damage)))
{
shield.Entity.Shield.TakeHit(DamageType, Damage);
shield.ShowHit(t.position, sqrt(Damage));
}
var hull = collider.GetComponent<HullCollider>();
if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active.Value && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
{
hull.SendSplash(Damage, DamageType, Source.Entity, (collider.transform.position - t.position).normalized);
}

View file

@ -61,14 +61,14 @@ public class Projectile : MonoBehaviour
var hull = hit.collider.GetComponent<HullCollider>();
if (shield)
{
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active.Value && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
if (shield.Entity != SourceEntity)
{
shield.Entity.Shield.TakeHit(DamageType, Damage*DirectHitDamageMultiplier);
shield.ShowHit(hit.point, sqrt(Damage * DirectHitDamageMultiplier));
}
}
else if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
else if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active.Value && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
{
if (hull.Entity != SourceEntity)
{

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UniRx;
using static Unity.Mathematics.math;
using float2 = Unity.Mathematics.float2;
using float3 = Unity.Mathematics.float3;
@ -18,8 +19,7 @@ public class CombatState : BaseState
SampleDps();
foreach (var weapon in _agent.Ship.Weapons)
{
weapon.Item.OnOffline += SampleDps;
weapon.Item.OnOnline += SampleDps;
weapon.Item.Online.Subscribe(b => SampleDps());
}
}
@ -38,7 +38,7 @@ public class CombatState : BaseState
var group = _agent.Ship.TriggerGroups[i];
var dps = 0f;
foreach (var weapon in group.weapons)
if (weapon.Item.Online &&
if (weapon.Item.Online.Value &&
weapon.MinRange < targetDistance &&
targetDistance < weapon.Range &&
(weapon is ConstantWeapon ||
@ -134,7 +134,7 @@ public class CombatState : BaseState
float dps = 0;
foreach (var weapon in _agent.Ship.Weapons)
{
if (weapon.Item.Online && weapon.MinRange < range && range < weapon.Range)
if (weapon.Item.Online.Value && weapon.MinRange < range && range < weapon.Range)
dps += weapon.RangeDamagePerSecond(range);
}

View file

@ -53,8 +53,8 @@ public class Capacitor : IBehavior
public bool Execute(float delta)
{
Capacity = Context.Evaluate(_data.Capacity, Item);
Efficiency = Context.Evaluate(_data.Efficiency, Item);
Capacity = Item.Evaluate(_data.Capacity);
Efficiency = Item.Evaluate(_data.Efficiency);
return true;
}
}

View file

@ -100,9 +100,9 @@ public class ChargedWeapon : InstantWeapon
protected override void UpdateStats()
{
base.UpdateStats();
ChargeTime = Context.Evaluate(_data.ChargeTime, Item);
ChargeEnergy = Context.Evaluate(_data.ChargeEnergy, Item);
ChargeHeat = Context.Evaluate(_data.ChargeHeat, Item);
ChargeTime = Item.Evaluate(_data.ChargeTime);
ChargeEnergy = Item.Evaluate(_data.ChargeEnergy);
ChargeHeat = Item.Evaluate(_data.ChargeHeat);
Damage *= lerp(1, _data.ChargeFiringDamageMultiplier, saturate(_charge));
Heat *= lerp(1, _data.ChargeFiringHeatMultiplier, saturate(_charge));
Spread *= lerp(1, _data.ChargeFiringSpreadMultiplier, saturate(_charge));

View file

@ -67,7 +67,7 @@ public class ConstantWeapon : Weapon, IProgressBehavior
base.Execute(delta);
if (_firing)
{
if (!Entity.TryConsumeEnergy(Context.Evaluate(_data.Energy, Item) * delta))
if (!Entity.TryConsumeEnergy(Item.Evaluate(_data.Energy) * delta))
{
_firing = false;
OnStopFiring?.Invoke();
@ -115,9 +115,9 @@ public class ConstantWeapon : Weapon, IProgressBehavior
}
}
Item.EquippableItem.Durability -= Wear * delta;
Item.AddHeat(Context.Evaluate(_data.Heat, Item) * delta);
Entity.VisibilitySources[this] = Context.Evaluate(_data.Visibility, Item);
Item.EquippableItem.Durability -= Item.Wear * delta;
Item.AddHeat(Item.Evaluate(_data.Heat) * delta);
Entity.VisibilitySources[this] = Item.Evaluate(_data.Visibility);
}
return true;
}

View file

@ -56,6 +56,6 @@ public class Cooldown : IBehavior, IAlwaysUpdatedBehavior, IProgressBehavior
public void Update(float delta)
{
_cooldown -= delta / Context.Evaluate(_data.Cooldown, Item);
_cooldown -= delta / Item.Evaluate(_data.Cooldown);
}
}

View file

@ -42,6 +42,6 @@ public class EnergyDraw : IBehavior
public bool Execute(float delta)
{
return Entity.TryConsumeEnergy(Context.Evaluate(_data.EnergyDraw, Item) * (_data.PerSecond ? delta : 1));
return Entity.TryConsumeEnergy(Item.Evaluate(_data.EnergyDraw) * (_data.PerSecond ? delta : 1));
}
}

View file

@ -42,7 +42,7 @@ public class Heat : IBehavior
public bool Execute(float delta)
{
Item.AddHeat(Context.Evaluate(_data.Heat, Item) * (_data.PerSecond ? delta : 1));
Item.AddHeat(Item.Evaluate(_data.Heat) * (_data.PerSecond ? delta : 1));
return true;
}

View file

@ -92,9 +92,9 @@ public class InstantWeapon : Weapon, IProgressBehavior
protected override void UpdateStats()
{
base.UpdateStats();
BurstCount = Context.Evaluate(_data.Count, Item);
BurstTime = Context.Evaluate(_data.BurstTime, Item);
Cooldown = Context.Evaluate(_data.Cooldown, Item);
BurstCount = Item.Evaluate(_data.Count);
BurstTime = Item.Evaluate(_data.BurstTime);
Cooldown = Item.Evaluate(_data.Cooldown);
Damage /= (int) BurstCount;
Heat /= (int) BurstCount;
@ -165,7 +165,7 @@ public class InstantWeapon : Weapon, IProgressBehavior
_burstRemaining--;
_burstTimer -= _burstInterval;
OnFire?.Invoke();
Item.EquippableItem.Durability -= Wear;
Item.EquippableItem.Durability -= Item.Wear;
Item.AddHeat(Heat);
Entity.VisibilitySources[this] = Visibility;
}

View file

@ -71,11 +71,11 @@ public class LockWeapon : InstantWeapon
if (Entity.Target.Value != null)
{
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);
LockSpeed = Item.Evaluate(_data.LockSpeed);
SensorImpact = Item.Evaluate(_data.SensorImpact);
LockAngle = Item.Evaluate(_data.LockAngle);
DirectionImpact = Item.Evaluate(_data.DirectionImpact);
Decay = Item.Evaluate(_data.Decay);
var degrees = acos(dot(normalize(Entity.Target.Value.Position - Entity.Position), normalize(Entity.LookDirection))) * 57.2958f;
if (degrees < LockAngle)

View file

@ -54,7 +54,7 @@ public class MiningTool : IBehavior
public bool Execute(float delta)
{
Range = Context.Evaluate(_data.Range, Item);
Range = Item.Evaluate(_data.Range);
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) * delta,
Context.Evaluate(_data.Efficiency, Item),
Context.Evaluate(_data.Penetration, Item));
Item.Evaluate(_data.DamagePerSecond) * delta,
Item.Evaluate(_data.Efficiency),
Item.Evaluate(_data.Penetration));
return true;
}

View file

@ -57,9 +57,9 @@ public class Radiator : IBehavior, IAlwaysUpdatedBehavior, IInitializableBehavio
public bool Execute(float delta)
{
PumpedHeat = Context.Evaluate(_data.PumpedHeat, Item);
WasteHeat = Context.Evaluate(_data.WasteHeat, Item);
EnergyUsage = Context.Evaluate(_data.EnergyUsage, Item);
PumpedHeat = Item.Evaluate(_data.PumpedHeat);
WasteHeat = Item.Evaluate(_data.WasteHeat);
EnergyUsage = Item.Evaluate(_data.EnergyUsage);
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);
Emissivity = Item.Evaluate(_data.Emissivity);
var rad = pow(Temperature, Context.GameplaySettings.HeatRadiationExponent) * Context.GameplaySettings.HeatRadiationMultiplier * Emissivity;
Temperature -= rad * delta;
Entity.VisibilitySources[this] = rad;

View file

@ -74,8 +74,8 @@ public class Reactor : IBehavior, IOrderedBehavior
public bool Execute(float delta)
{
var charge = Context.Evaluate(_data.Charge, Item) * delta;
var efficiency = Context.Evaluate(_data.Efficiency, Item);
var charge = Item.Evaluate(_data.Charge) * delta;
var efficiency = Item.Evaluate(_data.Efficiency);
// 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);
var overloadEfficiency = Item.Evaluate(_data.OverloadEfficiency);
// 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));
heat -= Draw / efficiency * (1 - 1 / Item.Evaluate(_data.ThrottlingFactor));
Draw = 0;
}

View file

@ -105,8 +105,8 @@ public class ResourceScanner : IBehavior, IAlwaysUpdatedBehavior
public void Update(float delta)
{
Range = Context.Evaluate(_data.Range, Item);
MinimumDensity = Context.Evaluate(_data.MinimumDensity, Item);
ScanDuration = Context.Evaluate(_data.ScanDuration, Item);
Range = Item.Evaluate(_data.Range);
MinimumDensity = Item.Evaluate(_data.MinimumDensity);
ScanDuration = Item.Evaluate(_data.ScanDuration);
}
}

View file

@ -59,7 +59,7 @@ public class Sensor : IBehavior
var next = saturate(
previous +
entity.Visibility *
Context.Evaluate(_data.Sensitivity, Item) *
Item.Evaluate(_data.Sensitivity) *
_data.SensitivityCurve.Evaluate(angle / PI) *
delta / dist);
next *= 1 - Context.GameplaySettings.TargetInfoDecay * delta;

View file

@ -45,8 +45,8 @@ public class Shield : IBehavior
public bool Execute(float delta)
{
Efficiency = Context.Evaluate(_data.Efficiency, Item);
EnergyUsage = Context.Evaluate(_data.EnergyUsage, Item);
Efficiency = Item.Evaluate(_data.Efficiency);
EnergyUsage = Item.Evaluate(_data.EnergyUsage);
return true;
}

View file

@ -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);
: stat.GetScaleModifiers(Entity))[this] = Item.Evaluate(_data.Modifier);
return true;
}

View file

@ -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);
Thrust = Item.Evaluate(_data.Thrust);
}
public bool Execute(float delta)
{
Thrust = Context.Evaluate(_data.Thrust, Item);
Thrust = Item.Evaluate(_data.Thrust);
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) * delta);
var vis = _input * Context.Evaluate(_data.Visibility, Item);
Item.AddHeat(_input * Item.Evaluate(_data.Heat) * delta);
var vis = _input * Item.Evaluate(_data.Visibility);
if(!Entity.VisibilitySources.ContainsKey(this) || vis > Entity.VisibilitySources[this])
Entity.VisibilitySources[this] = vis;
return _input > .01f;

View file

@ -60,7 +60,7 @@ public class TurretController : IBehavior
if (b is Weapon weapon)
{
_weapons.Add(weapon);
var vel = Context.Evaluate(weapon.WeaponData.Velocity, item);
var vel = weapon.Item.Evaluate(weapon.WeaponData.Velocity);
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) > dist && fire)
if (x.Item.Evaluate(data.Range) > dist && fire)
{
x.Activate();
}

View file

@ -46,7 +46,7 @@ public class VelocityLimit : IBehavior
public bool Execute(float delta)
{
Limit = Context.Evaluate(_data.TopSpeed, Item);
Limit = Item.Evaluate(_data.TopSpeed);
if (length(Entity.Velocity) > Limit)
Entity.Velocity = normalize(Entity.Velocity) * Limit;
return true;

View file

@ -44,7 +44,7 @@ public class Visibility : IBehavior, IAlwaysUpdatedBehavior
public bool Execute(float delta)
{
Entity.VisibilitySources[this] = Context.Evaluate(_data.Visibility, Item);
Entity.VisibilitySources[this] = Item.Evaluate(_data.Visibility);
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);
Entity.VisibilitySources[this] *= Item.Evaluate(_data.VisibilityDecay);
}
}
}

View file

@ -91,7 +91,6 @@ 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;
@ -114,20 +113,16 @@ public abstract class Weapon : IActivatedBehavior
protected virtual void UpdateStats()
{
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 = (1 - pow(_itemData.Performance(Item.Temperature),
(1 - pow(Item.EquippableItem.Quality, Context.GameplaySettings.QualityWearExponent)) *
Context.GameplaySettings.ThermalWearExponent)
) * _itemData.Durability;
Damage = Item.Evaluate(_data.Damage);
Penetration = Item.Evaluate(_data.Penetration);
DamageSpread = Item.Evaluate(_data.DamageSpread);
MinRange = Item.Evaluate(_data.MinRange);
Range = Item.Evaluate(_data.Range);
Energy = Item.Evaluate(_data.Energy);
Heat = Item.Evaluate(_data.Heat);
Visibility = Item.Evaluate(_data.Visibility);
Spread = Item.Evaluate(_data.Spread);
Velocity = Item.Evaluate(_data.Velocity);
}
public virtual bool Execute(float delta)

View file

@ -42,12 +42,9 @@ public class Wear : IBehavior
public bool Execute(float delta)
{
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;
if (_data.PerSecond)
Item.EquippableItem.Durability -= Item.Wear * delta;
else Item.EquippableItem.Durability -= Item.Wear;
return true;
}
}

View file

@ -109,7 +109,7 @@ public class DatabaseCache
public void Load(string path)
{
RegisterResolver.Register();
var bytes = File.ReadAllBytes(Path.Combine(path, "AetherDB.msgpack"));
var bytes = File.ReadAllBytes(path);
var entries = MessagePackSerializer.Deserialize<DatabaseEntry[]>(bytes);
AddAll(entries);
}

View file

@ -22,6 +22,7 @@ public abstract class Entity
{
public Zone Zone;
public MegaCorporation Faction;
public PlayerSettings PlayerSettings;
public EquippableItem Hull;
public float3 Position;
@ -82,10 +83,12 @@ public abstract class Entity
if (value == _heatsinksEnabled) return;
_heatsinksEnabled = value;
foreach (var heatsink in _heatsinks)
heatsink.Item.Enabled = value;
heatsink.Item.Enabled.Value = value;
}
}
public bool OverrideShutdown { get; set; }
public bool Active
{
get => _active;
@ -110,8 +113,8 @@ public abstract class Entity
public Subject<(int2 pos, float damage)> ArmorDamage = new Subject<(int2, float)>();
public Subject<(EquippedItem item, float damage)> ItemDamage = new Subject<(EquippedItem, float)>();
public Subject<EquippedItem> ItemOffline = new Subject<EquippedItem>();
public Subject<EquippedItem> ItemOnline = new Subject<EquippedItem>();
// public Subject<EquippedItem> ItemOffline = new Subject<EquippedItem>();
// public Subject<EquippedItem> ItemOnline = new Subject<EquippedItem>();
public Subject<float> HullDamage = new Subject<float>();
public Subject<Entity> Docked = new Subject<Entity>();
public Subject<Unit> HeatstrokeRisk = new Subject<Unit>();
@ -543,8 +546,8 @@ public abstract class Entity
Cockpit = cockpit;
}
equippedItem.OnOnline += () => ItemOnline.OnNext(equippedItem);
equippedItem.OnOffline += () => ItemOffline.OnNext(equippedItem);
// equippedItem.OnOnline += () => ItemOnline.OnNext(equippedItem);
// equippedItem.OnOffline += () => ItemOffline.OnNext(equippedItem);
foreach (var i in itemData.Shape.Coordinates)
{
@ -597,7 +600,7 @@ public abstract class Entity
public bool CanConsumeEnergy(float energy)
{
var capEnergy = _capacitors.Sum(cap => cap.Charge);
int onlineReactors = _reactors.Count(reactor=>reactor.Item.Online);
int onlineReactors = _reactors.Count(reactor=>reactor.Item.Online.Value);
return capEnergy > energy || onlineReactors > 0;
}
@ -622,10 +625,10 @@ public abstract class Entity
if (energy < .01f) return true;
int onlineReactors = _reactors.Count(reactor=>reactor.Item.Online);
int onlineReactors = _reactors.Count(reactor=>reactor.Item.Online.Value);
foreach (var reactor in _reactors)
{
if (reactor.Item.Online)
if (reactor.Item.Online.Value)
{
reactor.ConsumeEnergy(energy / onlineReactors);
}
@ -877,67 +880,66 @@ public abstract class Entity
public class EquippedItem
{
public int SortPosition;
public EquippableItem EquippableItem;
public int2 Position;
public IBehavior[] Behaviors;
public Dictionary<int, BehaviorGroup> BehaviorGroups;
public bool Enabled = true;
public event Action OnOffline;
public event Action OnOnline;
private bool _thermalOnline;
private bool _durabilityOnline;
public IBehavior[] Behaviors { get; }
public float Conductivity { get; }
public float ThermalPerformance { get; private set; }
public float ThermalExponent { get; }
public float DurabilityPerformance { get; private set; }
public float DurabilityExponent { get; }
public float Wear { get; private set; }
public Shape InsetShape { get; }
public Entity Entity { get; }
public EquippableItemData Data { get; }
public int SortPosition;
public bool Active
{
get => _online && Enabled;
}
public ReactiveProperty<bool> ThermalOnline { get; } = new ReactiveProperty<bool>(false);
public ReactiveProperty<bool> DurabilityOnline { get; } = new ReactiveProperty<bool>(false);
public ReadOnlyReactiveProperty<bool> Online { get; }
public ReactiveProperty<bool> Enabled { get; } = new ReactiveProperty<bool>(true);
public ReadOnlyReactiveProperty<bool> Active { get; }
public bool Online
{
get => _online;
}
public float Temperature
{
get
{
float sum = 0;
foreach (var x in InsetShape.Coordinates) sum += _entity.Temperature[x.x, x.y];
foreach (var x in InsetShape.Coordinates) sum += Entity.Temperature[x.x, x.y];
return sum/InsetShape.Coordinates.Length;
}
}
public Entity Entity
{
get => _entity;
}
protected readonly ItemManager _itemManager;
private readonly EquippableItemData _data;
private Entity _entity;
private bool _online;
//private bool _online;
public EquippedItem(ItemManager itemManager, EquippableItem item, int2 position, Entity entity)
{
_itemManager = itemManager;
_data = _itemManager.GetData(item);
_entity = entity;
Data = _itemManager.GetData(item);
Entity = entity;
EquippableItem = item;
Position = position;
Conductivity = _data.Conductivity;
Conductivity = Data.Conductivity;
ThermalExponent = _itemManager.Evaluate(Data.HeatExponent, EquippableItem);
DurabilityExponent = _itemManager.Evaluate(Data.DurabilityExponent, EquippableItem);
var hullData = itemManager.GetData(entity.Hull);
InsetShape = hullData.Shape.Inset(_data.Shape, position, item.Rotation);
InsetShape = hullData.Shape.Inset(Data.Shape, position, item.Rotation);
Behaviors = _data.Behaviors
Online = new ReadOnlyReactiveProperty<bool>(ThermalOnline
.CombineLatest(DurabilityOnline, (thermal, durability) => thermal && durability).DistinctUntilChanged());
Active = new ReadOnlyReactiveProperty<bool>(Enabled
.CombineLatest(Online, (enabled, online) => enabled && online).DistinctUntilChanged());
Behaviors = Data.Behaviors
.Select(bd => bd.CreateInstance(itemManager, entity, this))
.ToArray();
@ -946,9 +948,7 @@ public class EquippedItem
.OrderBy(g => g.Key)
.ToDictionary(g => g.Key, g => new BehaviorGroup
{
Behaviors = g.ToArray(),
// Switch = (Switch) g.FirstOrDefault(b => b is Switch),
// Trigger = (Trigger) g.FirstOrDefault(b => b is Trigger)
Behaviors = g.ToArray()
});
foreach (var behavior in Behaviors)
@ -960,10 +960,32 @@ public class EquippedItem
}
}
public float Evaluate(PerformanceStat stat)
{
var heat = 1f;
if(stat.HeatDependent)
heat = pow(ThermalPerformance, ThermalExponent * stat.HeatExponentMultiplier);
var durability = 1f;
if(stat.DurabilityDependent)
durability = pow(DurabilityPerformance, DurabilityExponent);
var quality = pow(_itemManager.Quality(stat, EquippableItem), stat.QualityExponent);
var scaleModifier = 1.0f;
foreach (var value in stat.GetScaleModifiers(Entity).Values) scaleModifier = scaleModifier * value;
float constantModifier = 0;
foreach (var value in stat.GetConstantModifiers(Entity).Values) constantModifier += value;
var result = lerp(stat.Min, stat.Max, durability * quality * heat) * scaleModifier + constantModifier;
if (float.IsNaN(result))
return stat.Min;
return result;
}
public void AddHeat(float heat, bool ignoreThermalMass = false)
{
foreach(var hullCoord in InsetShape.Coordinates)
_entity.AddHeat(hullCoord, heat / InsetShape.Coordinates.Length, ignoreThermalMass);
Entity.AddHeat(hullCoord, heat / InsetShape.Coordinates.Length, ignoreThermalMass);
}
public void Update(float delta)
@ -971,13 +993,18 @@ public class EquippedItem
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;
var temp = Temperature;
ThermalPerformance = Data.Performance(temp);
DurabilityPerformance = EquippableItem.Durability / Data.Durability;
var performanceThreshold = Entity.PlayerSettings?.ShutdownPerformance ?? _itemManager.GameplaySettings.DefaultShutdownPerformance;
Wear = (1 - pow(Data.Performance(temp),
(1 - pow(_itemManager.CompoundQuality(EquippableItem), _itemManager.GameplaySettings.QualityWearExponent)) *
_itemManager.GameplaySettings.ThermalWearExponent)
) * Data.Durability / Data.ThermalResilience;
ThermalOnline.Value = ThermalPerformance > performanceThreshold || Entity.OverrideShutdown && EquippableItem.OverrideShutdown;
DurabilityOnline.Value = EquippableItem.Durability > .01f;
if (!previouslyOnline && _online) OnOnline?.Invoke();
if (previouslyOnline && !_online) OnOffline?.Invoke();
if (Active)
if (Active.Value)
{
foreach (var group in BehaviorGroups.Values)
{

View file

@ -55,5 +55,6 @@ public class SimpleCommodity : ItemInstance
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class EquippableItem : CraftedItemInstance
{
[JsonProperty("durability"), Key(7)] public float Durability;
[JsonProperty("durability"), Key(7)] public float Durability;
[JsonProperty("override"), Key(8)] public bool OverrideShutdown;
}

View file

@ -272,27 +272,6 @@ public class ItemManager
return result;
}
// Returns stat using ship temperature and modifiers
public float Evaluate(PerformanceStat stat, EquippedItem item)
{
var itemData = GetData(item.EquippableItem);
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(item.Entity).Values) scaleModifier = scaleModifier * value;
float constantModifier = 0;
foreach (var value in stat.GetConstantModifiers(item.Entity).Values) constantModifier += value;
var result = lerp(stat.Min, stat.Max, durability * quality * heat) * scaleModifier + constantModifier;
if (float.IsNaN(result))
return stat.Min;
return result;
}
// public Entity CreateEntity(Guid zoneID, Guid corporation, Guid loadout)
// {
// if (!(ItemData.Get(loadout) is LoadoutData loadoutData))

View file

@ -0,0 +1,12 @@
using System;
using MessagePack;
[MessagePackObject, Serializable]
public class PlayerSettings
{
[Key(0)]
public string Name;
[Key(1)]
public float ShutdownPerformance = .25f;
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ae0b9ef04d124cd5b5dbc098681b7fc2
timeCreated: 1615064445

View file

@ -88,6 +88,7 @@ public class ZoneGenerationSettings
[Serializable, MessagePackObject(keyAsPropertyName: true), JsonObject]
public class GameplaySettings
{
public float DefaultShutdownPerformance = .25f;
public float SevereHeatstrokeRiskThreshold = .25f;
public float WormholeDepth = 1000;
public float WormholeExitVelocity = 20;

View file

@ -94,26 +94,38 @@ public class Ship : Entity
_forwardThrusters = new HashSet<Thruster>(_allThrusters
.Where(x => x.Item.EquippableItem.Rotation == ItemRotation.Reversed));
RecalculateForwardThrust();
foreach (var thruster in _forwardThrusters)
thruster.Item.Online.Skip(1).Subscribe(b => RecalculateForwardThrust());
_reverseThrusters = new HashSet<Thruster>(_allThrusters
.Where(x => x.Item.EquippableItem.Rotation == ItemRotation.None));
RecalculateReverseThrust();
foreach (var thruster in _reverseThrusters)
thruster.Item.Online.Skip(1).Subscribe(b => RecalculateReverseThrust());
_rightThrusters = new HashSet<Thruster>(_allThrusters
.Where(x => x.Item.EquippableItem.Rotation == ItemRotation.CounterClockwise));
RecalculateRightStrafeThrust();
foreach (var thruster in _rightThrusters)
thruster.Item.Online.Skip(1).Subscribe(b => RecalculateRightStrafeThrust());
_leftThrusters = new HashSet<Thruster>(_allThrusters
.Where(x => x.Item.EquippableItem.Rotation == ItemRotation.Clockwise));
RecalculateLeftStrafeThrust();
foreach (var thruster in _leftThrusters)
thruster.Item.Online.Skip(1).Subscribe(b => RecalculateLeftStrafeThrust());
_counterClockwiseThrusters = new HashSet<Thruster>(_allThrusters
.Where(x => x.Torque < -ItemManager.GameplaySettings.TorqueFloor));
RecalculateCounterClockwiseTorque();
foreach (var thruster in _counterClockwiseThrusters)
thruster.Item.Online.Skip(1).Subscribe(b => RecalculateCounterClockwiseTorque());
_clockwiseThrusters = new HashSet<Thruster>(_allThrusters
.Where(x => x.Torque > ItemManager.GameplaySettings.TorqueFloor));
RecalculateClockwiseTorque();
foreach (var thruster in _clockwiseThrusters)
thruster.Item.Online.Skip(1).Subscribe(b => RecalculateClockwiseTorque());
}
public Ship(ItemManager itemManager, Zone zone, EquippableItem hull) : base(itemManager, zone, hull)
@ -138,8 +150,6 @@ public class Ship : Entity
}
ItemDamage.Select(x => x.item).Subscribe(CheckForThruster);
ItemOffline.Subscribe(CheckForThruster);
ItemOnline.Subscribe(CheckForThruster);
}
#region ThrustCalculation
@ -149,7 +159,7 @@ public class Ship : Entity
ForwardThrust = 0;
foreach (var thruster in _forwardThrusters)
{
if(thruster.Item.Online)
if(thruster.Item.Active.Value)
ForwardThrust += thruster.Thrust;
}
}
@ -159,7 +169,7 @@ public class Ship : Entity
ReverseThrust = 0;
foreach (var thruster in _reverseThrusters)
{
if(thruster.Item.Online)
if(thruster.Item.Active.Value)
ReverseThrust += thruster.Thrust;
}
}
@ -170,7 +180,7 @@ public class Ship : Entity
LeftStrafeTotalTorque = 0;
foreach (var thruster in _leftThrusters)
{
if(thruster.Item.Online)
if(thruster.Item.Active.Value)
{
LeftStrafeThrust += thruster.Thrust;
LeftStrafeTotalTorque += thruster.Torque * thruster.Thrust;
@ -187,7 +197,7 @@ public class Ship : Entity
RightStrafeTotalTorque = 0;
foreach (var thruster in _rightThrusters)
{
if(thruster.Item.Online)
if(thruster.Item.Active.Value)
{
RightStrafeThrust += thruster.Thrust;
RightStrafeTotalTorque += thruster.Torque * thruster.Thrust;
@ -203,7 +213,7 @@ public class Ship : Entity
ClockwiseTorque = 0;
foreach (var thruster in _clockwiseThrusters)
{
if(thruster.Item.Online)
if(thruster.Item.Active.Value)
ClockwiseTorque += thruster.Torque;
}
}
@ -213,7 +223,7 @@ public class Ship : Entity
CounterClockwiseTorque = 0;
foreach (var thruster in _counterClockwiseThrusters)
{
if(thruster.Item.Online)
if(thruster.Item.Active.Value)
CounterClockwiseTorque -= thruster.Torque;
}
}

View file

@ -282,8 +282,7 @@ public class InventoryMenu : MonoBehaviour
floatCells();
}
});
panel.OnClickAsObservable().Subscribe(data =>
{
if (data is InventoryCargoEventData cargoEvent)
@ -387,6 +386,16 @@ public class InventoryMenu : MonoBehaviour
}
}
});
panel.OnBackgroundClick.Subscribe(data =>
{
PropertiesPanel.Clear();
PropertiesPanel.AddField("Shutdown Threshold",
() => GameManager.PlayerSettings.ShutdownPerformance,
f => GameManager.PlayerSettings.ShutdownPerformance = f,
0,
1);
});
}
}

View file

@ -17,7 +17,7 @@ using Unity.Mathematics;
using static Unity.Mathematics.math;
using int2 = Unity.Mathematics.int2;
public class InventoryPanel : MonoBehaviour
public class InventoryPanel : MonoBehaviour, IPointerClickHandler
{
public ConfirmationDialog ConfirmationDialog;
public bool Flip;
@ -669,13 +669,19 @@ public class InventoryPanel : MonoBehaviour
return false;
}
public Subject<PointerEventData> OnBackgroundClick = new Subject<PointerEventData>();
public UniRx.IObservable<InventoryEventData> OnClickAsObservable() => _onClick ?? (_onClick = new Subject<InventoryEventData>());
public UniRx.IObservable<InventoryEventData> OnBeginDragAsObservable() => _onBeginDrag ?? (_onBeginDrag = new Subject<InventoryEventData>());
public UniRx.IObservable<InventoryEventData> OnDragAsObservable() => _onDrag ?? (_onDrag = new Subject<InventoryEventData>());
public UniRx.IObservable<InventoryEventData> OnEndDragAsObservable() => _onEndDrag ?? (_onEndDrag = new Subject<InventoryEventData>());
public UniRx.IObservable<InventoryEventData> OnPointerEnterAsObservable() => _onPointerEnter ?? (_onPointerEnter = new Subject<InventoryEventData>());
public UniRx.IObservable<InventoryEventData> OnPointerExitAsObservable() => _onPointerExit ?? (_onPointerExit = new Subject<InventoryEventData>());
public void OnPointerClick(PointerEventData eventData)
{
OnBackgroundClick.OnNext(eventData);
}
}
public abstract class InventoryEventData

View file

@ -485,6 +485,7 @@ public class PropertiesPanel : MonoBehaviour
Clear();
if (item.EquippableItem != null)
{
AddField("Override Shutdown", () => item.EquippableItem.OverrideShutdown, b => item.EquippableItem.OverrideShutdown = b);
AddProperty("Temperature", () => (item.Temperature - 273.15f).SignificantDigits(Context.GameplaySettings.SignificantDigits));
AddItemProperties(entity, item.EquippableItem);
foreach (var behavior in item.Behaviors)

View file

@ -18,6 +18,8 @@ public class SchematicDisplay : MonoBehaviour
public Color HeaderElementEnabledColor;
public Color HeaderElementDisabledColor;
public GameObject OverrideIcon;
public float OverrideIconBlinkSpeed;
public GameObject ShieldIcon;
public Image HeatsinkBackground;
@ -216,7 +218,8 @@ public class SchematicDisplay : MonoBehaviour
{
if (!_enemy)
{
ShieldIcon.SetActive(_entity.Shield!=null && _entity.Shield.Item.Active);
OverrideIcon.SetActive(_entity.OverrideShutdown && cos(Time.time * OverrideIconBlinkSpeed) > 0);
ShieldIcon.SetActive(_entity.Shield!=null && _entity.Shield.Item.Active.Value);
if (_radiators.Length == 1)
RadiatorTemperatureLabel.text = $"{((int)(_radiators[0].Temperature - 273.15f)).ToString()}°C";
else if (_radiators.Length > 1)
@ -290,7 +293,7 @@ public class SchematicDisplay : MonoBehaviour
if (x.Weapon.WeaponData != null)
{
x.ListElement.RangeLabel.text = ((int) _entity.ItemManager.Evaluate(x.Weapon.WeaponData.Range, x.Item)).ToString();
x.ListElement.RangeLabel.text = ((int) x.Weapon.Range).ToString();
}
}
}

View file

@ -1,5 +1,5 @@
Shader "VolSample/Volume Render" {
Properties{
Properties {
_MainTex( "", 2D ) = "white" {}
_StepExponent("Step Exponent", float) = 1
_Surface("Surface", 2D) = "black" {}

View file

@ -30,7 +30,7 @@ public class ShieldManager : MonoBehaviour
var v1np = PostCollisionVelocity(v1n, Entity.Mass, v2n, otherShield.Entity.Mass);
Entity.Velocity = tangent * v1t + normal * v1np;
if(Entity.Shield != null && Entity.Shield.Item.Active) ShowHit(contact.point, CollisionHitDuration);
if(Entity.Shield != null && Entity.Shield.Item.Active.Value) ShowHit(contact.point, CollisionHitDuration);
}
private float PostCollisionVelocity(float v1, float m1, float v2, float m2)

View file

@ -363,6 +363,7 @@
<Compile Include="Assets\Scripts\ServerShared\NIH\RethinkDb.Driver\Ast\TopLevel.cs" />
<Compile Include="Assets\Scripts\ServerShared\NIH\LiteNetLib\NetConstants.cs" />
<Compile Include="Assets\Scripts\ServerShared\NIH\RethinkDb.Driver\Generated\Proto\Protocol.cs" />
<Compile Include="Assets\Scripts\ServerShared\PlayerSettings.cs" />
<Compile Include="Assets\Scripts\ServerShared\NIH\RethinkDb.Driver\Generated\Ast\Filter.cs" />
<Compile Include="Assets\Scripts\ServerShared\NIH\RethinkDb.Driver\Net\Response.cs" />
<Compile Include="Assets\Scripts\ServerShared\NIH\RethinkDb.Driver\Net\JsonConverters\ReqlExprConverter.cs" />

Binary file not shown.

Binary file not shown.