From e016fc9906c3fef95da2000177a590af6d4e9992 Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Mon, 25 Oct 2021 19:29:02 +1300 Subject: [PATCH] spray bottle fix (#5012) * fix-spray * move vapor rotation --- .../Chemistry/Visualizers/VaporVisualizer.cs | 12 ------------ Content.Server/Fluids/Components/SprayComponent.cs | 9 +++++---- .../Entities/Objects/Specific/Janitorial/spray.yml | 4 ++-- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/Content.Client/Chemistry/Visualizers/VaporVisualizer.cs b/Content.Client/Chemistry/Visualizers/VaporVisualizer.cs index ebbd71d926..a30bdb4717 100644 --- a/Content.Client/Chemistry/Visualizers/VaporVisualizer.cs +++ b/Content.Client/Chemistry/Visualizers/VaporVisualizer.cs @@ -37,11 +37,6 @@ namespace Content.Client.Chemistry.Visualizers { base.OnChangeData(component); - if (component.TryGetData(VaporVisuals.Rotation, out var radians)) - { - SetRotation(component, radians); - } - if (component.TryGetData(VaporVisuals.Color, out var color)) { SetColor(component, color); @@ -63,13 +58,6 @@ namespace Content.Client.Chemistry.Visualizers animPlayer.Play(VaporFlick, AnimationKey); } - private void SetRotation(AppearanceComponent component, Angle rotation) - { - var sprite = component.Owner.GetComponent(); - - sprite.Rotation = rotation; - } - private void SetColor(AppearanceComponent component, Color color) { var sprite = component.Owner.GetComponent(); diff --git a/Content.Server/Fluids/Components/SprayComponent.cs b/Content.Server/Fluids/Components/SprayComponent.cs index bad39a8232..7363d3d9df 100644 --- a/Content.Server/Fluids/Components/SprayComponent.cs +++ b/Content.Server/Fluids/Components/SprayComponent.cs @@ -162,9 +162,8 @@ namespace Content.Server.Fluids.Components var vapor = entManager.SpawnEntity(_vaporPrototype, playerPos.Offset(distance < 1 ? quarter : threeQuarters)); vapor.Transform.LocalRotation = rotation; - if (vapor.TryGetComponent(out AppearanceComponent? appearance)) // Vapor sprite should face down. + if (vapor.TryGetComponent(out AppearanceComponent? appearance)) { - appearance.SetData(VaporVisuals.Rotation, -Angle.Zero + rotation); appearance.SetData(VaporVisuals.Color, contents.Color.WithAlpha(1f)); appearance.SetData(VaporVisuals.State, true); } @@ -174,11 +173,13 @@ namespace Content.Server.Fluids.Components var vaporSystem = EntitySystem.Get(); vaporSystem.TryAddSolution(vaporComponent, solution); - vaporSystem.Start(vaporComponent, rotation.ToVec(), _sprayVelocity, target, _sprayAliveTime); + // impulse direction is defined in world-coordinates, not local coordinates + var impulseDirection = vapor.Transform.WorldRotation.ToVec(); + vaporSystem.Start(vaporComponent, impulseDirection, _sprayVelocity, target, _sprayAliveTime); if (_impulse > 0f && eventArgs.User.TryGetComponent(out IPhysBody? body)) { - body.ApplyLinearImpulse(-direction * _impulse); + body.ApplyLinearImpulse(-impulseDirection * _impulse); } } diff --git a/Resources/Prototypes/Entities/Objects/Specific/Janitorial/spray.yml b/Resources/Prototypes/Entities/Objects/Specific/Janitorial/spray.yml index 73f9a5bb93..98e02456f0 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Janitorial/spray.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Janitorial/spray.yml @@ -23,8 +23,6 @@ - type: DrainableSolution solution: spray - type: SolutionTransfer - - type: Spillable - solution: spray - type: ItemCooldown - type: Spray transferAmount: 10 @@ -77,6 +75,7 @@ - type: Sprite netsync: false sprite: Effects/chempuff.rsi + rotation: 90 layers: - state: chempuff map: ["enum.VaporVisualLayers.Base"] @@ -88,6 +87,7 @@ bounds: "-0.25,-0.25,0.25,0.25" hard: false mask: + - Opaque - Impassable - MobImpassable - SmallImpassable