From 109215906357d095255610c1cc83f37c63dc7e54 Mon Sep 17 00:00:00 2001 From: Reinier Vens Date: Sun, 7 Mar 2021 01:10:31 +0000 Subject: [PATCH] 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 --- .../.idea/contentModel.xml | 1 + Assets/Materials/UI/Map Gravity Lines.mat | 2 +- Assets/Prefabs/UI/Ranged Float Field.prefab | 9 +- Assets/Resources/Aetheria.inputactions | 21 ++- Assets/Resources/Sprites/Attribution.txt | 2 + .../Sprites/Icons/Boiling Thermometer.png | 3 + .../Icons/Boiling Thermometer.png.meta | 108 +++++++++++++++ .../Sprites/Icons/Worried Flame Stroked.png | 3 + .../Icons/Worried Flame Stroked.png.meta | 108 +++++++++++++++ .../Resources/Sprites/Icons/Worried Flame.png | 3 + .../Sprites/Icons/Worried Flame.png.meta | 108 +++++++++++++++ Assets/Scenes/ARPG.unity | 111 ++++++++++++++- Assets/Scripts/AetheriaInput.cs | 31 ++++- Assets/Scripts/Gameplay/ActionGameManager.cs | 24 +++- Assets/Scripts/Gameplay/GameSettings.cs | 1 + .../Scripts/Gameplay/Weapons/ConstantLaser.cs | 2 +- .../Gameplay/Weapons/ConstantLaserManager.cs | 8 +- .../Gameplay/Weapons/ConstantLightning.cs | 4 +- .../Weapons/ConstantLightningManager.cs | 8 +- .../Weapons/ConstantParticleWeaponManager.cs | 2 +- .../Gameplay/Weapons/GuidedProjectile.cs | 4 +- .../Weapons/GuidedProjectileManager.cs | 8 +- .../Scripts/Gameplay/Weapons/HitscanEffect.cs | 2 +- Assets/Scripts/Gameplay/Weapons/Laser.cs | 2 +- Assets/Scripts/Gameplay/Weapons/Lightning.cs | 4 +- Assets/Scripts/Gameplay/Weapons/Mine.cs | 4 +- Assets/Scripts/Gameplay/Weapons/Projectile.cs | 4 +- .../ServerShared/Agents/States/Combat.cs | 8 +- .../ServerShared/Behaviors/Capacitor.cs | 4 +- .../ServerShared/Behaviors/ChargedWeapon.cs | 6 +- .../ServerShared/Behaviors/ConstantWeapon.cs | 8 +- .../ServerShared/Behaviors/Cooldown.cs | 2 +- .../ServerShared/Behaviors/EnergyDraw.cs | 2 +- Assets/Scripts/ServerShared/Behaviors/Heat.cs | 2 +- .../ServerShared/Behaviors/InstantWeapon.cs | 8 +- .../ServerShared/Behaviors/LockWeapon.cs | 10 +- .../ServerShared/Behaviors/MiningTool.cs | 8 +- .../ServerShared/Behaviors/Radiator.cs | 8 +- .../Scripts/ServerShared/Behaviors/Reactor.cs | 8 +- .../ServerShared/Behaviors/ResourceScanner.cs | 6 +- .../Scripts/ServerShared/Behaviors/Sensor.cs | 2 +- .../Scripts/ServerShared/Behaviors/Shield.cs | 4 +- .../ServerShared/Behaviors/StatModifier.cs | 2 +- .../ServerShared/Behaviors/Thruster.cs | 8 +- .../Behaviors/TurretController.cs | 4 +- .../ServerShared/Behaviors/VelocityLimit.cs | 2 +- .../ServerShared/Behaviors/Visibility.cs | 4 +- .../Scripts/ServerShared/Behaviors/Weapon.cs | 25 ++-- Assets/Scripts/ServerShared/Behaviors/Wear.cs | 9 +- Assets/Scripts/ServerShared/DatabaseCache.cs | 2 +- Assets/Scripts/ServerShared/Entity.cs | 127 +++++++++++------- Assets/Scripts/ServerShared/ItemInstance.cs | 3 +- Assets/Scripts/ServerShared/ItemManager.cs | 21 --- Assets/Scripts/ServerShared/PlayerSettings.cs | 12 ++ .../ServerShared/PlayerSettings.cs.meta | 3 + Assets/Scripts/ServerShared/Settings.cs | 1 + Assets/Scripts/ServerShared/Ship.cs | 28 ++-- Assets/Scripts/UI/InventoryMenu.cs | 13 +- Assets/Scripts/UI/InventoryPanel.cs | 10 +- Assets/Scripts/UI/PropertiesPanel.cs | 1 + Assets/Scripts/UI/SchematicDisplay.cs | 7 +- .../Shaders/Raymarching/VolumeRender.shader | 2 +- Assets/ShieldManager.cs | 2 +- Economy.Shared.Unity.csproj | 1 + GameData/AetherDB.msgpack | Bin 58390 -> 58579 bytes GameData/PlayerSettings.msgpack | Bin 0 -> 7 bytes 66 files changed, 755 insertions(+), 205 deletions(-) create mode 100644 Assets/Resources/Sprites/Icons/Boiling Thermometer.png create mode 100644 Assets/Resources/Sprites/Icons/Boiling Thermometer.png.meta create mode 100644 Assets/Resources/Sprites/Icons/Worried Flame Stroked.png create mode 100644 Assets/Resources/Sprites/Icons/Worried Flame Stroked.png.meta create mode 100644 Assets/Resources/Sprites/Icons/Worried Flame.png create mode 100644 Assets/Resources/Sprites/Icons/Worried Flame.png.meta create mode 100644 Assets/Scripts/ServerShared/PlayerSettings.cs create mode 100644 Assets/Scripts/ServerShared/PlayerSettings.cs.meta create mode 100644 GameData/PlayerSettings.msgpack diff --git a/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml b/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml index 61d5712d6..90aee212e 100644 --- a/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml +++ b/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml @@ -2023,6 +2023,7 @@ + diff --git a/Assets/Materials/UI/Map Gravity Lines.mat b/Assets/Materials/UI/Map Gravity Lines.mat index 0d9aadfbe..1ae7b17e2 100644 --- a/Assets/Materials/UI/Map Gravity Lines.mat +++ b/Assets/Materials/UI/Map Gravity Lines.mat @@ -86,7 +86,7 @@ Material: - _Mode: 0 - _OcclusionStrength: 1 - _Parallax: 0.02 - - _Scale: 2.8484566 + - _Scale: 8.4506855 - _SmoothnessTextureChannel: 0 - _SpecularHighlights: 1 - _SrcBlend: 1 diff --git a/Assets/Prefabs/UI/Ranged Float Field.prefab b/Assets/Prefabs/UI/Ranged Float Field.prefab index 28aef017c..07c5826d3 100644 --- a/Assets/Prefabs/UI/Ranged Float Field.prefab +++ b/Assets/Prefabs/UI/Ranged Float Field.prefab @@ -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} diff --git a/Assets/Resources/Aetheria.inputactions b/Assets/Resources/Aetheria.inputactions index 2a0963e99..38b255860 100644 --- a/Assets/Resources/Aetheria.inputactions +++ b/Assets/Resources/Aetheria.inputactions @@ -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": "/#(G)", "interactions": "", "processors": "", - "groups": "", + "groups": "Keyboard&Mouse", "action": "Toggle Shield", "isComposite": false, "isPartOfComposite": false + }, + { + "name": "", + "id": "8e8b5d19-20fd-43f3-88cf-6246f374e7cf", + "path": "/#(O)", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Override Shutdown", + "isComposite": false, + "isPartOfComposite": false } ] }, diff --git a/Assets/Resources/Sprites/Attribution.txt b/Assets/Resources/Sprites/Attribution.txt index 2a4ead81a..f813b8cee 100644 --- a/Assets/Resources/Sprites/Attribution.txt +++ b/Assets/Resources/Sprites/Attribution.txt @@ -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 diff --git a/Assets/Resources/Sprites/Icons/Boiling Thermometer.png b/Assets/Resources/Sprites/Icons/Boiling Thermometer.png new file mode 100644 index 000000000..3261ab235 --- /dev/null +++ b/Assets/Resources/Sprites/Icons/Boiling Thermometer.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fc943f753b7d2c1c35edd49573fafc397bed2d4c88b992160ed51be6adcd9f30 +size 34354 diff --git a/Assets/Resources/Sprites/Icons/Boiling Thermometer.png.meta b/Assets/Resources/Sprites/Icons/Boiling Thermometer.png.meta new file mode 100644 index 000000000..19feb1fa0 --- /dev/null +++ b/Assets/Resources/Sprites/Icons/Boiling Thermometer.png.meta @@ -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: diff --git a/Assets/Resources/Sprites/Icons/Worried Flame Stroked.png b/Assets/Resources/Sprites/Icons/Worried Flame Stroked.png new file mode 100644 index 000000000..ee851a1e2 --- /dev/null +++ b/Assets/Resources/Sprites/Icons/Worried Flame Stroked.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4491329f54bcfa1a2a1c508d65c45f2ce51fbd7f6c5e5984929dd4bf725128d7 +size 49325 diff --git a/Assets/Resources/Sprites/Icons/Worried Flame Stroked.png.meta b/Assets/Resources/Sprites/Icons/Worried Flame Stroked.png.meta new file mode 100644 index 000000000..9c1705fc1 --- /dev/null +++ b/Assets/Resources/Sprites/Icons/Worried Flame Stroked.png.meta @@ -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: diff --git a/Assets/Resources/Sprites/Icons/Worried Flame.png b/Assets/Resources/Sprites/Icons/Worried Flame.png new file mode 100644 index 000000000..62ed1a117 --- /dev/null +++ b/Assets/Resources/Sprites/Icons/Worried Flame.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0ff2bf93f6dc0b7fc203a87f05ba3453e95e0525f0396eb3dc3eeb0372d1257a +size 23992 diff --git a/Assets/Resources/Sprites/Icons/Worried Flame.png.meta b/Assets/Resources/Sprites/Icons/Worried Flame.png.meta new file mode 100644 index 000000000..e69b8f1c4 --- /dev/null +++ b/Assets/Resources/Sprites/Icons/Worried Flame.png.meta @@ -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: diff --git a/Assets/Scenes/ARPG.unity b/Assets/Scenes/ARPG.unity index facf859c3..c07bf563b 100644 --- a/Assets/Scenes/ARPG.unity +++ b/Assets/Scenes/ARPG.unity @@ -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} diff --git a/Assets/Scripts/AetheriaInput.cs b/Assets/Scripts/AetheriaInput.cs index 765313dd1..cefbd5755 100644 --- a/Assets/Scripts/AetheriaInput.cs +++ b/Assets/Scripts/AetheriaInput.cs @@ -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"": ""/#(G)"", ""interactions"": """", ""processors"": """", - ""groups"": """", + ""groups"": ""Keyboard&Mouse"", ""action"": ""Toggle Shield"", ""isComposite"": false, ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""8e8b5d19-20fd-43f3-88cf-6246f374e7cf"", + ""path"": ""/#(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 { diff --git a/Assets/Scripts/Gameplay/ActionGameManager.cs b/Assets/Scripts/Gameplay/ActionGameManager.cs index a2f53df67..5c0da767b 100644 --- a/Assets/Scripts/Gameplay/ActionGameManager.cs +++ b/Assets/Scripts/Gameplay/ActionGameManager.cs @@ -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( + File.ReadAllBytes(playerSettingsFile.FullName)); + Loadouts.AddRange(_loadoutPath.EnumerateFiles("*.preset") .Select(fi => MessagePackSerializer.Deserialize(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); } }; diff --git a/Assets/Scripts/Gameplay/GameSettings.cs b/Assets/Scripts/Gameplay/GameSettings.cs index f5b72e170..b0ad1ea57 100644 --- a/Assets/Scripts/Gameplay/GameSettings.cs +++ b/Assets/Scripts/Gameplay/GameSettings.cs @@ -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; diff --git a/Assets/Scripts/Gameplay/Weapons/ConstantLaser.cs b/Assets/Scripts/Gameplay/Weapons/ConstantLaser.cs index 81b925a8f..3bd71ce3f 100644 --- a/Assets/Scripts/Gameplay/Weapons/ConstantLaser.cs +++ b/Assets/Scripts/Gameplay/Weapons/ConstantLaser.cs @@ -76,7 +76,7 @@ public class ConstantLaser : MonoBehaviour var shield = hit.collider.GetComponent(); 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); diff --git a/Assets/Scripts/Gameplay/Weapons/ConstantLaserManager.cs b/Assets/Scripts/Gameplay/Weapons/ConstantLaserManager.cs index 8d798558e..351314e61 100644 --- a/Assets/Scripts/Gameplay/Weapons/ConstantLaserManager.cs +++ b/Assets/Scripts/Gameplay/Weapons/ConstantLaserManager.cs @@ -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); } diff --git a/Assets/Scripts/Gameplay/Weapons/ConstantLightning.cs b/Assets/Scripts/Gameplay/Weapons/ConstantLightning.cs index 7f2446b55..d50717a22 100644 --- a/Assets/Scripts/Gameplay/Weapons/ConstantLightning.cs +++ b/Assets/Scripts/Gameplay/Weapons/ConstantLightning.cs @@ -55,14 +55,14 @@ public class ConstantLightning : MonoBehaviour foreach (var hit in hits) { var shield = hit.collider.GetComponent(); - 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(); - 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); diff --git a/Assets/Scripts/Gameplay/Weapons/ConstantLightningManager.cs b/Assets/Scripts/Gameplay/Weapons/ConstantLightningManager.cs index dbeb0cff4..77a1be884 100644 --- a/Assets/Scripts/Gameplay/Weapons/ConstantLightningManager.cs +++ b/Assets/Scripts/Gameplay/Weapons/ConstantLightningManager.cs @@ -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); } diff --git a/Assets/Scripts/Gameplay/Weapons/ConstantParticleWeaponManager.cs b/Assets/Scripts/Gameplay/Weapons/ConstantParticleWeaponManager.cs index 575ec67cd..6326330e3 100644 --- a/Assets/Scripts/Gameplay/Weapons/ConstantParticleWeaponManager.cs +++ b/Assets/Scripts/Gameplay/Weapons/ConstantParticleWeaponManager.cs @@ -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(); diff --git a/Assets/Scripts/Gameplay/Weapons/GuidedProjectile.cs b/Assets/Scripts/Gameplay/Weapons/GuidedProjectile.cs index 8fd55340d..d1ae0d6bf 100644 --- a/Assets/Scripts/Gameplay/Weapons/GuidedProjectile.cs +++ b/Assets/Scripts/Gameplay/Weapons/GuidedProjectile.cs @@ -147,7 +147,7 @@ public class GuidedProjectile : MonoBehaviour var shield = hit.collider.GetComponent(); 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(); - 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) { diff --git a/Assets/Scripts/Gameplay/Weapons/GuidedProjectileManager.cs b/Assets/Scripts/Gameplay/Weapons/GuidedProjectileManager.cs index f49d43fd5..8713e53f1 100644 --- a/Assets/Scripts/Gameplay/Weapons/GuidedProjectileManager.cs +++ b/Assets/Scripts/Gameplay/Weapons/GuidedProjectileManager.cs @@ -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!"); diff --git a/Assets/Scripts/Gameplay/Weapons/HitscanEffect.cs b/Assets/Scripts/Gameplay/Weapons/HitscanEffect.cs index 68e1bfd74..5d59c36b4 100644 --- a/Assets/Scripts/Gameplay/Weapons/HitscanEffect.cs +++ b/Assets/Scripts/Gameplay/Weapons/HitscanEffect.cs @@ -33,7 +33,7 @@ public class HitscanEffect : MonoBehaviour var shield = hit.collider.GetComponent(); 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); diff --git a/Assets/Scripts/Gameplay/Weapons/Laser.cs b/Assets/Scripts/Gameplay/Weapons/Laser.cs index 9c34d7c09..fdc7e777e 100644 --- a/Assets/Scripts/Gameplay/Weapons/Laser.cs +++ b/Assets/Scripts/Gameplay/Weapons/Laser.cs @@ -42,7 +42,7 @@ public class Laser : MonoBehaviour var shield = hit.collider.GetComponent(); 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); diff --git a/Assets/Scripts/Gameplay/Weapons/Lightning.cs b/Assets/Scripts/Gameplay/Weapons/Lightning.cs index cb63b3a86..5432761f3 100644 --- a/Assets/Scripts/Gameplay/Weapons/Lightning.cs +++ b/Assets/Scripts/Gameplay/Weapons/Lightning.cs @@ -36,7 +36,7 @@ public class Lightning : MonoBehaviour foreach (var hit in hits) { var shield = hit.collider.GetComponent(); - 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(); - 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 = () => diff --git a/Assets/Scripts/Gameplay/Weapons/Mine.cs b/Assets/Scripts/Gameplay/Weapons/Mine.cs index cad1114d3..fc3d42e71 100644 --- a/Assets/Scripts/Gameplay/Weapons/Mine.cs +++ b/Assets/Scripts/Gameplay/Weapons/Mine.cs @@ -109,13 +109,13 @@ public class Mine : MonoBehaviour foreach (var collider in Physics.OverlapSphere(t.position, BlastRange, 1 | (1 << 17))) { var shield = collider.GetComponent(); - 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(); - 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); } diff --git a/Assets/Scripts/Gameplay/Weapons/Projectile.cs b/Assets/Scripts/Gameplay/Weapons/Projectile.cs index f5c4f7400..31d6d61c1 100644 --- a/Assets/Scripts/Gameplay/Weapons/Projectile.cs +++ b/Assets/Scripts/Gameplay/Weapons/Projectile.cs @@ -61,14 +61,14 @@ public class Projectile : MonoBehaviour var hull = hit.collider.GetComponent(); 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) { diff --git a/Assets/Scripts/ServerShared/Agents/States/Combat.cs b/Assets/Scripts/ServerShared/Agents/States/Combat.cs index f09eee06d..99f6e7449 100644 --- a/Assets/Scripts/ServerShared/Agents/States/Combat.cs +++ b/Assets/Scripts/ServerShared/Agents/States/Combat.cs @@ -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); } diff --git a/Assets/Scripts/ServerShared/Behaviors/Capacitor.cs b/Assets/Scripts/ServerShared/Behaviors/Capacitor.cs index 6602f889d..6017711be 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Capacitor.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Capacitor.cs @@ -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; } } \ No newline at end of file diff --git a/Assets/Scripts/ServerShared/Behaviors/ChargedWeapon.cs b/Assets/Scripts/ServerShared/Behaviors/ChargedWeapon.cs index 3a468b603..8510e4cde 100644 --- a/Assets/Scripts/ServerShared/Behaviors/ChargedWeapon.cs +++ b/Assets/Scripts/ServerShared/Behaviors/ChargedWeapon.cs @@ -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)); diff --git a/Assets/Scripts/ServerShared/Behaviors/ConstantWeapon.cs b/Assets/Scripts/ServerShared/Behaviors/ConstantWeapon.cs index 5ca9f9498..8fdd7301b 100644 --- a/Assets/Scripts/ServerShared/Behaviors/ConstantWeapon.cs +++ b/Assets/Scripts/ServerShared/Behaviors/ConstantWeapon.cs @@ -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; } diff --git a/Assets/Scripts/ServerShared/Behaviors/Cooldown.cs b/Assets/Scripts/ServerShared/Behaviors/Cooldown.cs index ba16a09c8..36c63226b 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Cooldown.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Cooldown.cs @@ -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); } } \ No newline at end of file diff --git a/Assets/Scripts/ServerShared/Behaviors/EnergyDraw.cs b/Assets/Scripts/ServerShared/Behaviors/EnergyDraw.cs index 68b9dac66..dc5094d08 100644 --- a/Assets/Scripts/ServerShared/Behaviors/EnergyDraw.cs +++ b/Assets/Scripts/ServerShared/Behaviors/EnergyDraw.cs @@ -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)); } } \ No newline at end of file diff --git a/Assets/Scripts/ServerShared/Behaviors/Heat.cs b/Assets/Scripts/ServerShared/Behaviors/Heat.cs index 3f9dd6e2e..b135c32fd 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Heat.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Heat.cs @@ -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; } diff --git a/Assets/Scripts/ServerShared/Behaviors/InstantWeapon.cs b/Assets/Scripts/ServerShared/Behaviors/InstantWeapon.cs index 63dc23e72..f09e5c409 100644 --- a/Assets/Scripts/ServerShared/Behaviors/InstantWeapon.cs +++ b/Assets/Scripts/ServerShared/Behaviors/InstantWeapon.cs @@ -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; } diff --git a/Assets/Scripts/ServerShared/Behaviors/LockWeapon.cs b/Assets/Scripts/ServerShared/Behaviors/LockWeapon.cs index aeca0fad2..f030ed23c 100644 --- a/Assets/Scripts/ServerShared/Behaviors/LockWeapon.cs +++ b/Assets/Scripts/ServerShared/Behaviors/LockWeapon.cs @@ -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) diff --git a/Assets/Scripts/ServerShared/Behaviors/MiningTool.cs b/Assets/Scripts/ServerShared/Behaviors/MiningTool.cs index 651b2d7db..5c71e2d16 100644 --- a/Assets/Scripts/ServerShared/Behaviors/MiningTool.cs +++ b/Assets/Scripts/ServerShared/Behaviors/MiningTool.cs @@ -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; } diff --git a/Assets/Scripts/ServerShared/Behaviors/Radiator.cs b/Assets/Scripts/ServerShared/Behaviors/Radiator.cs index 30f50c653..7365a5d28 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Radiator.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Radiator.cs @@ -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; diff --git a/Assets/Scripts/ServerShared/Behaviors/Reactor.cs b/Assets/Scripts/ServerShared/Behaviors/Reactor.cs index 4659fe3ee..9f2d3c3f7 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Reactor.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Reactor.cs @@ -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; } diff --git a/Assets/Scripts/ServerShared/Behaviors/ResourceScanner.cs b/Assets/Scripts/ServerShared/Behaviors/ResourceScanner.cs index d6737adef..fa20a6b97 100644 --- a/Assets/Scripts/ServerShared/Behaviors/ResourceScanner.cs +++ b/Assets/Scripts/ServerShared/Behaviors/ResourceScanner.cs @@ -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); } } \ No newline at end of file diff --git a/Assets/Scripts/ServerShared/Behaviors/Sensor.cs b/Assets/Scripts/ServerShared/Behaviors/Sensor.cs index 62476cca4..5f91642b7 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Sensor.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Sensor.cs @@ -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; diff --git a/Assets/Scripts/ServerShared/Behaviors/Shield.cs b/Assets/Scripts/ServerShared/Behaviors/Shield.cs index ca7207e5d..e27fafe46 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Shield.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Shield.cs @@ -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; } diff --git a/Assets/Scripts/ServerShared/Behaviors/StatModifier.cs b/Assets/Scripts/ServerShared/Behaviors/StatModifier.cs index e2d9d9b18..3a1464872 100644 --- a/Assets/Scripts/ServerShared/Behaviors/StatModifier.cs +++ b/Assets/Scripts/ServerShared/Behaviors/StatModifier.cs @@ -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; } diff --git a/Assets/Scripts/ServerShared/Behaviors/Thruster.cs b/Assets/Scripts/ServerShared/Behaviors/Thruster.cs index 2cf70147b..c738ce8f9 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Thruster.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Thruster.cs @@ -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; diff --git a/Assets/Scripts/ServerShared/Behaviors/TurretController.cs b/Assets/Scripts/ServerShared/Behaviors/TurretController.cs index ccfcd53e7..f9496e49a 100644 --- a/Assets/Scripts/ServerShared/Behaviors/TurretController.cs +++ b/Assets/Scripts/ServerShared/Behaviors/TurretController.cs @@ -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(); } diff --git a/Assets/Scripts/ServerShared/Behaviors/VelocityLimit.cs b/Assets/Scripts/ServerShared/Behaviors/VelocityLimit.cs index 4f7417a72..e36700cdf 100644 --- a/Assets/Scripts/ServerShared/Behaviors/VelocityLimit.cs +++ b/Assets/Scripts/ServerShared/Behaviors/VelocityLimit.cs @@ -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; diff --git a/Assets/Scripts/ServerShared/Behaviors/Visibility.cs b/Assets/Scripts/ServerShared/Behaviors/Visibility.cs index 62fa242ca..735bf5040 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Visibility.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Visibility.cs @@ -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); } } } \ No newline at end of file diff --git a/Assets/Scripts/ServerShared/Behaviors/Weapon.cs b/Assets/Scripts/ServerShared/Behaviors/Weapon.cs index 3762e3672..6e599384a 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Weapon.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Weapon.cs @@ -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) diff --git a/Assets/Scripts/ServerShared/Behaviors/Wear.cs b/Assets/Scripts/ServerShared/Behaviors/Wear.cs index 8b6e68567..1062d0b26 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Wear.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Wear.cs @@ -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; } } \ No newline at end of file diff --git a/Assets/Scripts/ServerShared/DatabaseCache.cs b/Assets/Scripts/ServerShared/DatabaseCache.cs index 0469e3817..e55358c3f 100644 --- a/Assets/Scripts/ServerShared/DatabaseCache.cs +++ b/Assets/Scripts/ServerShared/DatabaseCache.cs @@ -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(bytes); AddAll(entries); } diff --git a/Assets/Scripts/ServerShared/Entity.cs b/Assets/Scripts/ServerShared/Entity.cs index 02a4259a5..89b4099c4 100644 --- a/Assets/Scripts/ServerShared/Entity.cs +++ b/Assets/Scripts/ServerShared/Entity.cs @@ -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 ItemOffline = new Subject(); - public Subject ItemOnline = new Subject(); + // public Subject ItemOffline = new Subject(); + // public Subject ItemOnline = new Subject(); public Subject HullDamage = new Subject(); public Subject Docked = new Subject(); public Subject HeatstrokeRisk = new Subject(); @@ -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 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 ThermalOnline { get; } = new ReactiveProperty(false); + public ReactiveProperty DurabilityOnline { get; } = new ReactiveProperty(false); + public ReadOnlyReactiveProperty Online { get; } + public ReactiveProperty Enabled { get; } = new ReactiveProperty(true); + public ReadOnlyReactiveProperty 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(ThermalOnline + .CombineLatest(DurabilityOnline, (thermal, durability) => thermal && durability).DistinctUntilChanged()); + Active = new ReadOnlyReactiveProperty(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) { diff --git a/Assets/Scripts/ServerShared/ItemInstance.cs b/Assets/Scripts/ServerShared/ItemInstance.cs index b8bb5f3cb..b76b535ba 100644 --- a/Assets/Scripts/ServerShared/ItemInstance.cs +++ b/Assets/Scripts/ServerShared/ItemInstance.cs @@ -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; } \ No newline at end of file diff --git a/Assets/Scripts/ServerShared/ItemManager.cs b/Assets/Scripts/ServerShared/ItemManager.cs index ffb1f903c..a939851ce 100644 --- a/Assets/Scripts/ServerShared/ItemManager.cs +++ b/Assets/Scripts/ServerShared/ItemManager.cs @@ -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)) diff --git a/Assets/Scripts/ServerShared/PlayerSettings.cs b/Assets/Scripts/ServerShared/PlayerSettings.cs new file mode 100644 index 000000000..1c0ed1f44 --- /dev/null +++ b/Assets/Scripts/ServerShared/PlayerSettings.cs @@ -0,0 +1,12 @@ +using System; +using MessagePack; + +[MessagePackObject, Serializable] +public class PlayerSettings +{ + [Key(0)] + public string Name; + + [Key(1)] + public float ShutdownPerformance = .25f; +} \ No newline at end of file diff --git a/Assets/Scripts/ServerShared/PlayerSettings.cs.meta b/Assets/Scripts/ServerShared/PlayerSettings.cs.meta new file mode 100644 index 000000000..3d9224fb5 --- /dev/null +++ b/Assets/Scripts/ServerShared/PlayerSettings.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ae0b9ef04d124cd5b5dbc098681b7fc2 +timeCreated: 1615064445 \ No newline at end of file diff --git a/Assets/Scripts/ServerShared/Settings.cs b/Assets/Scripts/ServerShared/Settings.cs index 95af78cb2..580952b7c 100644 --- a/Assets/Scripts/ServerShared/Settings.cs +++ b/Assets/Scripts/ServerShared/Settings.cs @@ -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; diff --git a/Assets/Scripts/ServerShared/Ship.cs b/Assets/Scripts/ServerShared/Ship.cs index 479d296df..2170f5f59 100644 --- a/Assets/Scripts/ServerShared/Ship.cs +++ b/Assets/Scripts/ServerShared/Ship.cs @@ -94,26 +94,38 @@ public class Ship : Entity _forwardThrusters = new HashSet(_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(_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(_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(_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(_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(_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; } } diff --git a/Assets/Scripts/UI/InventoryMenu.cs b/Assets/Scripts/UI/InventoryMenu.cs index 2c98baa28..8a5357324 100644 --- a/Assets/Scripts/UI/InventoryMenu.cs +++ b/Assets/Scripts/UI/InventoryMenu.cs @@ -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); + }); } } diff --git a/Assets/Scripts/UI/InventoryPanel.cs b/Assets/Scripts/UI/InventoryPanel.cs index dd8a7a5b9..fdaf1d604 100644 --- a/Assets/Scripts/UI/InventoryPanel.cs +++ b/Assets/Scripts/UI/InventoryPanel.cs @@ -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 OnBackgroundClick = new Subject(); public UniRx.IObservable OnClickAsObservable() => _onClick ?? (_onClick = new Subject()); public UniRx.IObservable OnBeginDragAsObservable() => _onBeginDrag ?? (_onBeginDrag = new Subject()); public UniRx.IObservable OnDragAsObservable() => _onDrag ?? (_onDrag = new Subject()); public UniRx.IObservable OnEndDragAsObservable() => _onEndDrag ?? (_onEndDrag = new Subject()); public UniRx.IObservable OnPointerEnterAsObservable() => _onPointerEnter ?? (_onPointerEnter = new Subject()); public UniRx.IObservable OnPointerExitAsObservable() => _onPointerExit ?? (_onPointerExit = new Subject()); + + public void OnPointerClick(PointerEventData eventData) + { + OnBackgroundClick.OnNext(eventData); + } } public abstract class InventoryEventData diff --git a/Assets/Scripts/UI/PropertiesPanel.cs b/Assets/Scripts/UI/PropertiesPanel.cs index 27754c2e6..f38844fe4 100644 --- a/Assets/Scripts/UI/PropertiesPanel.cs +++ b/Assets/Scripts/UI/PropertiesPanel.cs @@ -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) diff --git a/Assets/Scripts/UI/SchematicDisplay.cs b/Assets/Scripts/UI/SchematicDisplay.cs index 8a1f9fc6e..9b3deb505 100644 --- a/Assets/Scripts/UI/SchematicDisplay.cs +++ b/Assets/Scripts/UI/SchematicDisplay.cs @@ -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(); } } } diff --git a/Assets/Shaders/Raymarching/VolumeRender.shader b/Assets/Shaders/Raymarching/VolumeRender.shader index 181adbdc4..f939cc3ca 100644 --- a/Assets/Shaders/Raymarching/VolumeRender.shader +++ b/Assets/Shaders/Raymarching/VolumeRender.shader @@ -1,5 +1,5 @@ Shader "VolSample/Volume Render" { - Properties{ + Properties { _MainTex( "", 2D ) = "white" {} _StepExponent("Step Exponent", float) = 1 _Surface("Surface", 2D) = "black" {} diff --git a/Assets/ShieldManager.cs b/Assets/ShieldManager.cs index 68ff6105f..fc6ef5de6 100644 --- a/Assets/ShieldManager.cs +++ b/Assets/ShieldManager.cs @@ -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) diff --git a/Economy.Shared.Unity.csproj b/Economy.Shared.Unity.csproj index b67ad3fbd..7445659ca 100644 --- a/Economy.Shared.Unity.csproj +++ b/Economy.Shared.Unity.csproj @@ -363,6 +363,7 @@ + diff --git a/GameData/AetherDB.msgpack b/GameData/AetherDB.msgpack index dd15db465d126c70390fbf8c3207c467e7636fc0..8982d0837602d143773b700d6b848466a6bc4a17 100644 GIT binary patch delta 42 wcmbPsg8A}E<_&J0J9GhssI20 delta 47 zcmcb7l6l$*<_&J