Disposal aftermerg fix (#27488)
* wtf * fix * delta fixes * Update ThrowInsertContainerSystem.cs
This commit is contained in:
@@ -10,7 +10,7 @@ namespace Content.Server.Containers;
|
|||||||
public sealed partial class ThrowInsertContainerComponent : Component
|
public sealed partial class ThrowInsertContainerComponent : Component
|
||||||
{
|
{
|
||||||
[DataField(required: true)]
|
[DataField(required: true)]
|
||||||
public string? ContainerId;
|
public string ContainerId = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Throw chance of hitting into the container
|
/// Throw chance of hitting into the container
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ public sealed class ThrowInsertContainerSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnThrowCollide(Entity<ThrowInsertContainerComponent> ent, ref ThrowHitByEvent args)
|
private void OnThrowCollide(Entity<ThrowInsertContainerComponent> ent, ref ThrowHitByEvent args)
|
||||||
{
|
{
|
||||||
if (ent.Comp.ContainerId == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var container = _containerSystem.GetContainer(ent, ent.Comp.ContainerId);
|
var container = _containerSystem.GetContainer(ent, ent.Comp.ContainerId);
|
||||||
|
|
||||||
if (!_containerSystem.CanInsert(args.Thrown, container))
|
if (!_containerSystem.CanInsert(args.Thrown, container))
|
||||||
@@ -35,18 +32,18 @@ public sealed class ThrowInsertContainerSystem : EntitySystem
|
|||||||
|
|
||||||
|
|
||||||
var rand = _random.NextFloat();
|
var rand = _random.NextFloat();
|
||||||
if (rand > ent.Comp.Probability)
|
if (_random.Prob(ent.Comp.Probability))
|
||||||
{
|
{
|
||||||
_audio.PlayPvs(ent.Comp.MissSound, ent);
|
_audio.PlayPvs(ent.Comp.MissSound, ent);
|
||||||
_popup.PopupEntity(Loc.GetString(ent.Comp.MissLocString), ent);
|
_popup.PopupEntity(Loc.GetString(ent.Comp.MissLocString), ent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_containerSystem.Insert(args.Thrown, container))
|
if (!_containerSystem.Insert(args.Thrown, container))
|
||||||
_audio.PlayPvs(ent.Comp.InsertSound, ent);
|
|
||||||
else
|
|
||||||
throw new InvalidOperationException("Container insertion failed but CanInsert returned true");
|
throw new InvalidOperationException("Container insertion failed but CanInsert returned true");
|
||||||
|
|
||||||
|
_audio.PlayPvs(ent.Comp.InsertSound, ent);
|
||||||
|
|
||||||
if (args.Component.Thrower != null)
|
if (args.Component.Thrower != null)
|
||||||
_adminLogger.Add(LogType.Landed, LogImpact.Low, $"{ToPrettyString(args.Thrown)} thrown by {ToPrettyString(args.Component.Thrower.Value):player} landed in {ToPrettyString(ent)}");
|
_adminLogger.Add(LogType.Landed, LogImpact.Low, $"{ToPrettyString(args.Thrown)} thrown by {ToPrettyString(args.Component.Thrower.Value):player} landed in {ToPrettyString(ent)}");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user