Revert 'Revert 'Solution Entities'' (#23168)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Content.Server.Chemistry.Components;
|
||||
using Content.Server.Chemistry.Containers.EntitySystems;
|
||||
using Content.Shared.Chemistry.EntitySystems;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Popups;
|
||||
@@ -16,21 +17,23 @@ public sealed class RehydratableSystem : EntitySystem
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<RehydratableComponent, SolutionChangedEvent>(OnSolutionChange);
|
||||
SubscribeLocalEvent<RehydratableComponent, SolutionContainerChangedEvent>(OnSolutionChange);
|
||||
}
|
||||
|
||||
private void OnSolutionChange(EntityUid uid, RehydratableComponent comp, SolutionChangedEvent args)
|
||||
private void OnSolutionChange(Entity<RehydratableComponent> entity, ref SolutionContainerChangedEvent args)
|
||||
{
|
||||
var quantity = _solutions.GetTotalPrototypeQuantity(uid, comp.CatalystPrototype);
|
||||
if (quantity != FixedPoint2.Zero && quantity >= comp.CatalystMinimum)
|
||||
var quantity = _solutions.GetTotalPrototypeQuantity(entity, entity.Comp.CatalystPrototype);
|
||||
if (quantity != FixedPoint2.Zero && quantity >= entity.Comp.CatalystMinimum)
|
||||
{
|
||||
Expand(uid, comp);
|
||||
Expand(entity);
|
||||
}
|
||||
}
|
||||
|
||||
// Try not to make this public if you can help it.
|
||||
private void Expand(EntityUid uid, RehydratableComponent comp)
|
||||
private void Expand(Entity<RehydratableComponent> entity)
|
||||
{
|
||||
var (uid, comp) = entity;
|
||||
|
||||
_popups.PopupEntity(Loc.GetString("rehydratable-component-expands-message", ("owner", uid)), uid);
|
||||
|
||||
var randomMob = _random.Pick(comp.PossibleSpawns);
|
||||
|
||||
Reference in New Issue
Block a user