Add gas tanks throw damage (#20035)

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Vyacheslav Kovalevsky
2023-12-04 09:32:17 +03:00
committed by GitHub
parent fe2672744f
commit 5b55b9ce3b
8 changed files with 36 additions and 53 deletions

View File

@@ -1,4 +1,6 @@
using System.Numerics;
using Content.Shared.Administration.Logs;
using Content.Shared.Database;
using Content.Shared.Gravity;
using Content.Shared.Interaction;
using Content.Shared.Projectiles;
@@ -25,10 +27,10 @@ public sealed class ThrowingSystem : EntitySystem
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly SharedGravitySystem _gravity = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly ThrownItemSystem _thrownSystem = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
public void TryThrow(
EntityUid uid,
@@ -135,8 +137,10 @@ public sealed class ThrowingSystem : EntitySystem
_transform.SetLocalRotation(uid, angle + offset);
}
var throwEvent = new ThrownEvent(user, uid);
RaiseLocalEvent(uid, ref throwEvent, true);
if (user != null)
_interactionSystem.ThrownInteraction(user.Value, uid);
_adminLogger.Add(LogType.Throw, LogImpact.Low, $"{ToPrettyString(user.Value):user} threw {ToPrettyString(uid):entity}");
var impulseVector = direction.Normalized() * strength * physics.Mass;
_physics.ApplyLinearImpulse(uid, impulseVector, body: physics);