* Hyposprays Draw from Jugs * Fix last onlyMobs usage in yml * Some Suggested Changes * Remove unnecessary datafield name declarations * Remove unnecessary dirtying of component * Same line parentheses * Added client-side HypospraySystem * Cache UI values and only updates if values change * empty line * Update label * Label change * Reimplement ReactionMixerSystem * Remove DataField from Hypospray Toggle Mode * Change ToggleMode from enum to Bool OnlyAffectsMobs * Add DataField required back since it's required for replays...? * update EligibleEntity and uses of it * Add user argument back * Adds newline Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Guard for dirty entity * Adds summary tag --------- Co-authored-by: Plykiya <plykiya@protonmail.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
44 lines
1.5 KiB
C#
44 lines
1.5 KiB
C#
using Content.Shared.Chemistry.Reaction;
|
|
using Content.Shared.IdentityManagement;
|
|
using Content.Shared.Interaction;
|
|
using Content.Server.Chemistry.Containers.EntitySystems;
|
|
using Content.Server.Popups;
|
|
|
|
namespace Content.Server.Chemistry.EntitySystems;
|
|
|
|
public sealed partial class ReactionMixerSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly PopupSystem _popup = default!;
|
|
[Dependency] private readonly SolutionContainerSystem _solutionContainers = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<ReactionMixerComponent, AfterInteractEvent>(OnAfterInteract);
|
|
}
|
|
|
|
private void OnAfterInteract(Entity<ReactionMixerComponent> entity, ref AfterInteractEvent args)
|
|
{
|
|
if (!args.Target.HasValue || !args.CanReach)
|
|
return;
|
|
|
|
var mixAttemptEvent = new MixingAttemptEvent(entity);
|
|
RaiseLocalEvent(entity, ref mixAttemptEvent);
|
|
if (mixAttemptEvent.Cancelled)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (!_solutionContainers.TryGetMixableSolution(args.Target.Value, out var solution))
|
|
return;
|
|
|
|
_popup.PopupEntity(Loc.GetString(entity.Comp.MixMessage, ("mixed", Identity.Entity(args.Target.Value, EntityManager)), ("mixer", Identity.Entity(entity.Owner, EntityManager))), args.User, args.User);
|
|
|
|
_solutionContainers.UpdateChemicals(solution.Value, true, entity.Comp);
|
|
|
|
var afterMixingEvent = new AfterMixingEvent(entity, args.Target.Value);
|
|
RaiseLocalEvent(entity, afterMixingEvent);
|
|
}
|
|
}
|