+using System.Numerics;
using Content.Server.Atmos.Components;
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Content.Shared.Examine;
+using Content.Shared.Throwing;
using Content.Shared.Toggleable;
using Content.Shared.Verbs;
using JetBrains.Annotations;
[Dependency] private readonly UserInterfaceSystem _ui = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly IRobustRandom _random = default!;
+ [Dependency] private readonly ThrowingSystem _throwing = default!;
private const float TimerDelay = 0.5f;
private float _timer = 0f;
{
_atmosphereSystem.Merge(environment, removed);
}
- var impulse = removed.TotalMoles * removed.Temperature;
- _physics.ApplyLinearImpulse(gasTank, _random.NextAngle().ToWorldVec() * impulse);
- _physics.ApplyAngularImpulse(gasTank, _random.NextFloat(-3f, 3f));
+ var strength = removed.TotalMoles * MathF.Sqrt(removed.Temperature);
+ var dir = _random.NextAngle().ToWorldVec();
+ _throwing.TryThrow(gasTank, dir * strength, strength);
_audioSys.PlayPvs(gasTank.Comp.RuptureSound, gasTank);
}
}
#endregion
- #region Throw
- /// <summary>
- /// Calls Thrown on all components that implement the IThrown interface
- /// on an entity that has been thrown.
- /// </summary>
- public void ThrownInteraction(EntityUid user, EntityUid thrown)
- {
- var throwMsg = new ThrownEvent(user, thrown);
- RaiseLocalEvent(thrown, throwMsg, true);
- if (throwMsg.Handled)
- {
- _adminLogger.Add(LogType.Throw, LogImpact.Low,$"{ToPrettyString(user):user} threw {ToPrettyString(thrown):entity}");
- return;
- }
-
- _adminLogger.Add(LogType.Throw, LogImpact.Low,$"{ToPrettyString(user):user} threw {ToPrettyString(thrown):entity}");
- }
- #endregion
-
public void DroppedInteraction(EntityUid user, EntityUid item)
{
var dropMsg = new DroppedEvent(user);
args.Handled = true;
}
- private void OnEmitSoundOnThrown(EntityUid uid, BaseEmitSoundComponent component, ThrownEvent args)
+ private void OnEmitSoundOnThrown(EntityUid uid, BaseEmitSoundComponent component, ref ThrownEvent args)
{
TryEmitSound(uid, component, args.User, false);
}
+++ /dev/null
-using JetBrains.Annotations;
-
-namespace Content.Shared.Throwing
-{
- /// <summary>
- /// Raised when throwing the entity in your hands.
- /// </summary>
- [PublicAPI]
- public sealed class ThrownEvent : HandledEntityEventArgs
- {
- /// <summary>
- /// Entity that threw the item.
- /// </summary>
- public EntityUid User { get; }
-
- /// <summary>
- /// Item that was thrown.
- /// </summary>
- public EntityUid Thrown { get; }
-
- public ThrownEvent(EntityUid user, EntityUid thrown)
- {
- User = user;
- Thrown = thrown;
- }
- }
-}
using System.Numerics;
+using Content.Shared.Administration.Logs;
+using Content.Shared.Database;
using Content.Shared.Gravity;
using Content.Shared.Interaction;
using Content.Shared.Projectiles;
[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,
_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);
--- /dev/null
+using JetBrains.Annotations;
+
+namespace Content.Shared.Throwing;
+
+/// <summary>
+/// Raised on thrown entity.
+/// </summary>
+[PublicAPI]
+[ByRefEvent]
+public readonly record struct ThrownEvent(EntityUid? User, EntityUid Thrown);
component.ThrownTime ??= _gameTiming.CurTime;
}
- private void ThrowItem(EntityUid uid, ThrownItemComponent component, ThrownEvent args)
+ private void ThrowItem(EntityUid uid, ThrownItemComponent component, ref ThrownEvent @event)
{
if (!EntityManager.TryGetComponent(uid, out FixturesComponent? fixturesComponent) ||
fixturesComponent.Fixtures.Count != 1 ||
damage:
types:
Blunt: 10
+ - type: DamageOtherOnHit
+ damage:
+ types:
+ Blunt: 10
- type: PhysicalComposition
materialComposition:
Steel: 400
damage:
types:
Blunt: 5
+ - type: DamageOtherOnHit
+ damage:
+ types:
+ Blunt: 5
- type: PhysicalComposition
materialComposition:
Steel: 100
damage:
types:
Blunt: 7.5
+ - type: DamageOtherOnHit
+ damage:
+ types:
+ Blunt: 7.5
- type: entity
parent: GasTankRoundBase