spray bottle fix (#5012)

* fix-spray

* move vapor rotation
This commit is contained in:
Leon Friedrich
2021-10-25 19:29:02 +13:00
committed by GitHub
parent 41524dac5b
commit e016fc9906
3 changed files with 7 additions and 18 deletions

View File

@@ -37,11 +37,6 @@ namespace Content.Client.Chemistry.Visualizers
{
base.OnChangeData(component);
if (component.TryGetData<Angle>(VaporVisuals.Rotation, out var radians))
{
SetRotation(component, radians);
}
if (component.TryGetData<Color>(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<ISpriteComponent>();
sprite.Rotation = rotation;
}
private void SetColor(AppearanceComponent component, Color color)
{
var sprite = component.Owner.GetComponent<ISpriteComponent>();

View File

@@ -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>();
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);
}
}

View File

@@ -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