Revert 'Revert 'Solution Entities'' (#23168)

This commit is contained in:
TemporalOroboros
2023-12-29 04:47:43 -08:00
committed by GitHub
parent 93e1af2f8d
commit d23c8d5c19
180 changed files with 3541 additions and 2956 deletions

View File

@@ -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);