Fixes debug assertion thrown when spiking with pills (#34813)
This commit is contained in:
@@ -26,7 +26,8 @@ public sealed class SolutionSpikerSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnInteractUsing(Entity<RefillableSolutionComponent> entity, ref InteractUsingEvent args)
|
private void OnInteractUsing(Entity<RefillableSolutionComponent> entity, ref InteractUsingEvent args)
|
||||||
{
|
{
|
||||||
TrySpike(args.Used, args.Target, args.User, entity.Comp);
|
if (TrySpike(args.Used, args.Target, args.User, entity.Comp))
|
||||||
|
args.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -36,7 +37,7 @@ public sealed class SolutionSpikerSystem : EntitySystem
|
|||||||
/// <param name="source">Source of the solution.</param>
|
/// <param name="source">Source of the solution.</param>
|
||||||
/// <param name="target">Target to spike with the solution from source.</param>
|
/// <param name="target">Target to spike with the solution from source.</param>
|
||||||
/// <param name="user">User spiking the target solution.</param>
|
/// <param name="user">User spiking the target solution.</param>
|
||||||
private void TrySpike(EntityUid source, EntityUid target, EntityUid user, RefillableSolutionComponent? spikableTarget = null,
|
private bool TrySpike(EntityUid source, EntityUid target, EntityUid user, RefillableSolutionComponent? spikableTarget = null,
|
||||||
SolutionSpikerComponent? spikableSource = null,
|
SolutionSpikerComponent? spikableSource = null,
|
||||||
SolutionContainerManagerComponent? managerSource = null,
|
SolutionContainerManagerComponent? managerSource = null,
|
||||||
SolutionContainerManagerComponent? managerTarget = null)
|
SolutionContainerManagerComponent? managerTarget = null)
|
||||||
@@ -46,21 +47,23 @@ public sealed class SolutionSpikerSystem : EntitySystem
|
|||||||
|| !_solution.TryGetRefillableSolution((target, spikableTarget, managerTarget), out var targetSoln, out var targetSolution)
|
|| !_solution.TryGetRefillableSolution((target, spikableTarget, managerTarget), out var targetSoln, out var targetSolution)
|
||||||
|| !_solution.TryGetSolution((source, managerSource), spikableSource.SourceSolution, out _, out var sourceSolution))
|
|| !_solution.TryGetSolution((source, managerSource), spikableSource.SourceSolution, out _, out var sourceSolution))
|
||||||
{
|
{
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetSolution.Volume == 0 && !spikableSource.IgnoreEmpty)
|
if (targetSolution.Volume == 0 && !spikableSource.IgnoreEmpty)
|
||||||
{
|
{
|
||||||
_popup.PopupClient(Loc.GetString(spikableSource.PopupEmpty, ("spiked-entity", target), ("spike-entity", source)), user, user);
|
_popup.PopupClient(Loc.GetString(spikableSource.PopupEmpty, ("spiked-entity", target), ("spike-entity", source)), user, user);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_solution.ForceAddSolution(targetSoln.Value, sourceSolution))
|
if (!_solution.ForceAddSolution(targetSoln.Value, sourceSolution))
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
_popup.PopupClient(Loc.GetString(spikableSource.Popup, ("spiked-entity", target), ("spike-entity", source)), user, user);
|
_popup.PopupClient(Loc.GetString(spikableSource.Popup, ("spiked-entity", target), ("spike-entity", source)), user, user);
|
||||||
sourceSolution.RemoveAllSolution();
|
sourceSolution.RemoveAllSolution();
|
||||||
if (spikableSource.Delete)
|
if (spikableSource.Delete)
|
||||||
QueueDel(source);
|
QueueDel(source);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user