diff --git a/Content.Client/Graphics/Overlays/SingularityOverlay.cs b/Content.Client/Graphics/Overlays/SingularityOverlay.cs index bf1e0eb3b2..bb88af0401 100644 --- a/Content.Client/Graphics/Overlays/SingularityOverlay.cs +++ b/Content.Client/Graphics/Overlays/SingularityOverlay.cs @@ -43,10 +43,8 @@ namespace Content.Client.Graphics.Overlays SingularityQuery(args.Viewport.Eye); var viewportWB = args.WorldBounds; - // This is a blatant cheat. - // The correct way of doing this would be if the singularity shader performed the matrix transforms. - // I don't need to explain why I'm not doing that. - var resolution = Math.Max(0.125f, Math.Min(args.Viewport.RenderScale.X, args.Viewport.RenderScale.Y)); + // Has to be correctly handled because of the way intensity/falloff transform works so just do it. + _shader?.SetParameter("renderScale", args.Viewport.RenderScale); foreach (SingularityShaderInstance instance in _singularities.Values) { // To be clear, this needs to use "inside-viewport" pixels. @@ -56,8 +54,8 @@ namespace Content.Client.Graphics.Overlays _shader?.SetParameter("positionInput", tempCoords); if (ScreenTexture != null) _shader?.SetParameter("SCREEN_TEXTURE", ScreenTexture); - _shader?.SetParameter("intensity", instance.Intensity / resolution); - _shader?.SetParameter("falloff", instance.Falloff / resolution); + _shader?.SetParameter("intensity", instance.Intensity); + _shader?.SetParameter("falloff", instance.Falloff); var worldHandle = args.WorldHandle; worldHandle.UseShader(_shader); diff --git a/Content.Server/GameObjects/Components/Singularity/ServerSingularityComponent.cs b/Content.Server/GameObjects/Components/Singularity/ServerSingularityComponent.cs index 87e4421684..ba111d282a 100644 --- a/Content.Server/GameObjects/Components/Singularity/ServerSingularityComponent.cs +++ b/Content.Server/GameObjects/Components/Singularity/ServerSingularityComponent.cs @@ -61,12 +61,12 @@ namespace Content.Server.GameObjects.Components.Singularity if (value < 0) value = 0; if (value > 6) value = 6; - _level = value; if ((_level > 1) && (value <= 1)) { // Prevents it getting stuck (see SingularityController.MoveSingulo) if (_collidableComponent != null) _collidableComponent.LinearVelocity = Vector2.Zero; } + _level = value; if(_radiationPulseComponent != null) _radiationPulseComponent.RadsPerSecond = 10 * value; diff --git a/Resources/Prototypes/Entities/Constructible/Power/Engines/Singularity/generator.yml b/Resources/Prototypes/Entities/Constructible/Power/Engines/Singularity/generator.yml index ba9fef0866..82d64806be 100644 --- a/Resources/Prototypes/Entities/Constructible/Power/Engines/Singularity/generator.yml +++ b/Resources/Prototypes/Entities/Constructible/Power/Engines/Singularity/generator.yml @@ -15,8 +15,9 @@ bodyType: Static fixtures: - shape: - !type:PhysShapeAabb - bounds: "-0.5, -0.5, 0.5, 0.5" + # Using a circle here makes it a lot easier to pull it all the way from Cargo + !type:PhysShapeCircle + radius: 0.45 mass: 25 # Keep an eye on ParticlesProjectile when adjusting these layer: diff --git a/Resources/Prototypes/Entities/Constructible/Power/parts.yml b/Resources/Prototypes/Entities/Constructible/Power/parts.yml index b4da648207..a5300917ae 100644 --- a/Resources/Prototypes/Entities/Constructible/Power/parts.yml +++ b/Resources/Prototypes/Entities/Constructible/Power/parts.yml @@ -1,30 +1,12 @@ - type: entity abstract: true id: BaseSmes + parent: BaseMachine name: SMES description: A high-capacity superconducting magnetic energy storage (SMES) unit. placement: mode: SnapgridCenter components: - - type: Clickable - - type: InteractionOutline - - type: Physics - bodyType: Static - fixtures: - - shape: - !type:PhysShapeAabb {} - mass: 25 - mask: - - Impassable - - MobImpassable - - VaultImpassable - - SmallImpassable - layer: - - Opaque - - MobImpassable - - VaultImpassable - - SmallImpassable - - type: SnapGrid - type: Sprite netsync: false sprite: Constructible/Power/smes.rsi @@ -52,8 +34,6 @@ - type: PowerSupplier - type: BatteryDischarger activeSupplyRate: 1000 - - type: Anchorable - - type: Pullable - type: ClientEntitySpawner prototypes: - HVDummyWire @@ -61,30 +41,12 @@ - type: entity abstract: true id: BaseSubstation + parent: BaseMachine name: substation description: Reduces the voltage of electricity put into it. placement: mode: SnapgridCenter components: - - type: Clickable - - type: InteractionOutline - - type: Physics - bodyType: Static - fixtures: - - shape: - !type:PhysShapeAabb {} - mass: 25 - mask: - - Impassable - - MobImpassable - - VaultImpassable - - SmallImpassable - layer: - - Opaque - - MobImpassable - - VaultImpassable - - SmallImpassable - - type: SnapGrid - type: Sprite sprite: Constructible/Power/substation.rsi layers: @@ -113,8 +75,6 @@ voltage: Medium - type: BatteryDischarger activeSupplyRate: 1000 - - type: Anchorable - - type: Pullable - type: ClientEntitySpawner prototypes: - HVDummyWire diff --git a/Resources/Prototypes/Entities/Constructible/Specific/Medical/cloning_machine.yml b/Resources/Prototypes/Entities/Constructible/Specific/Medical/cloning_machine.yml index 4e597120e2..c0365ff0f7 100644 --- a/Resources/Prototypes/Entities/Constructible/Specific/Medical/cloning_machine.yml +++ b/Resources/Prototypes/Entities/Constructible/Specific/Medical/cloning_machine.yml @@ -1,6 +1,6 @@ - type: entity id: CloningPod - parent: BaseMachine + parent: BaseMachinePowered name: cloning pod description: A Cloning Pod. 50% reliable. components: diff --git a/Resources/Prototypes/Entities/Constructible/Specific/Medical/medical_scanner.yml b/Resources/Prototypes/Entities/Constructible/Specific/Medical/medical_scanner.yml index cb1e97a860..9e31fd109a 100644 --- a/Resources/Prototypes/Entities/Constructible/Specific/Medical/medical_scanner.yml +++ b/Resources/Prototypes/Entities/Constructible/Specific/Medical/medical_scanner.yml @@ -1,6 +1,6 @@ - type: entity id: MedicalScanner - parent: BaseMachine + parent: BaseMachinePowered name: medical scanner description: A bulky medical scanner. components: diff --git a/Resources/Prototypes/Entities/Constructible/base.yml b/Resources/Prototypes/Entities/Constructible/base.yml index 854f535d34..a1e8c5a0ab 100644 --- a/Resources/Prototypes/Entities/Constructible/base.yml +++ b/Resources/Prototypes/Entities/Constructible/base.yml @@ -10,7 +10,8 @@ bodyType: Static fixtures: - shape: - !type:PhysShapeAabb {} + !type:PhysShapeAabb + bounds: "-0.45, -0.45, 0.45, 0.45" mass: 50 layer: - SmallImpassable @@ -34,7 +35,8 @@ bodyType: Dynamic fixtures: - shape: - !type:PhysShapeAabb {} + !type:PhysShapeAabb + bounds: "-0.45, -0.45, 0.45, 0.45" mass: 50 layer: - SmallImpassable diff --git a/Resources/Prototypes/Entities/Constructible/base_machine.yml b/Resources/Prototypes/Entities/Constructible/base_machine.yml index 00f3927c80..f9a73bc11e 100644 --- a/Resources/Prototypes/Entities/Constructible/base_machine.yml +++ b/Resources/Prototypes/Entities/Constructible/base_machine.yml @@ -5,13 +5,12 @@ components: - type: InteractionOutline - type: Anchorable - - type: Pullable - - type: PowerReceiver - type: Physics bodyType: Static fixtures: - shape: - !type:PhysShapeAabb {} + !type:PhysShapeAabb + bounds: "-0.45, -0.45, 0.45, 0.45" mass: 25 layer: - MobMask @@ -28,3 +27,11 @@ behaviors: - !type:DoActsBehavior acts: ["Destruction"] + +- type: entity + abstract: true + parent: BaseMachine + id: BaseMachinePowered + components: + - type: PowerReceiver + diff --git a/Resources/Textures/Shaders/singularity.swsl b/Resources/Textures/Shaders/singularity.swsl index af51376f26..2752412c3d 100644 --- a/Resources/Textures/Shaders/singularity.swsl +++ b/Resources/Textures/Shaders/singularity.swsl @@ -2,13 +2,14 @@ uniform sampler2D SCREEN_TEXTURE; uniform highp vec2 positionInput; +uniform highp vec2 renderScale; uniform highp float falloff; uniform highp float intensity; void fragment() { - highp float distanceToCenter = length(FRAGCOORD.xy-positionInput); + highp float distanceToCenter = length((FRAGCOORD.xy - positionInput) / renderScale); highp vec2 finalCoords = FRAGCOORD.xy - positionInput; highp float deformation = (pow(intensity, 2.0)*500.0) / pow(distanceToCenter, pow(falloff, 0.5));