Fix throwing and pointing ignoring CanChangeDirection action blocker (#1474)

* Fix being able to change direction while buckled by throwing

* Fix being able to change direction while buckled by pointing

* Wrap diff in can turn check
This commit is contained in:
DrSmugleaf
2020-07-24 23:51:55 +02:00
committed by GitHub
parent a6931e5773
commit 3a4ad42c80
2 changed files with 12 additions and 4 deletions

View File

@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Pointing;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Input;
using Content.Shared.Interfaces;
using JetBrains.Annotations;
@@ -97,11 +98,14 @@ namespace Content.Server.GameObjects.EntitySystems
return false;
}
if (ActionBlockerSystem.CanChangeDirection(player))
{
var diff = coords.ToMapPos(_mapManager) - player.Transform.MapPosition.Position;
if (diff.LengthSquared > 0.01f)
{
player.Transform.LocalRotation = new Angle(diff);
}
}
var viewers = _playerManager.GetPlayersInRange(player.Transform.GridPosition, 15);

View File

@@ -1,4 +1,5 @@
using Content.Server.GameObjects.Components;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Physics;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.Interfaces.GameObjects;
@@ -72,8 +73,11 @@ namespace Content.Server.Throw
projComp.User = throwSourceEnt;
projComp.IgnoreEntity(throwSourceEnt);
if (ActionBlockerSystem.CanChangeDirection(throwSourceEnt))
{
throwSourceEnt.Transform.LocalRotation = angle.GetCardinalDir().ToAngle();
}
}
// scaling is handled elsewhere, this is just multiplying by 10 independent of timing as a fix until elsewhere values are updated
var spd = throwForce * 10;