Solution Entities (#21916)

* Creates Content.Shared.Chemistry.Solutions
Copies Solution class to new namespace
Obsoletes old Solution class

* Switches over to the Solutions.Solution Solution

* Creates Content.Shared.Chemistry.Containers
Copies relevant components/systems to the new namespace
Obsoletes old versions

* Switches over to the Containers.XYZ namespace

* Creates SolutionSystem and obsoletes old SolutionContainerSystem methods

* Start using SolutionSystem for Solution manipulation

* EnumerateSolutions

* Move TryGetMixableSolution

* Move EnsureSolution to Server

* Create Solution Entities

* Stop using obsolete solution system methods

* Fix prototype component tests

* Add using ..Audio.Systems; back

* Wrap solution container slots in ContainerSlots

* Actually add the slot to the solution container map

* Dirty SolutionContainerComponent when ensuring solutions

* Revert namespace changes

* Remerge SolutionSystem and SolutionContainerSystem

* SolutionContainerManagerComponent refactor

* Avoid wrapping necessary code in DebugTools.Assert as it is removed when compiling for release

* Readd examine reagent sorting

* Fix errors

* Poke tests

* Fix solution names not being applied

* Fix WoolyComponent including statement

* Fix merge skew

* Fix compile errors

* Make reactions use solntities

* Reindent solution class namespace

* Field attribute changes

* AutoGenerateComponentState for SolutionContainerComponent

* SolutionContainerComponent -> ContainedSolutionComponent

* ref ReactionAttemptEvent

* Denetwork preinit solutions

* Misc 1

* Nullable TryGetSolution out vars

* Cache associated solutions

* Fix merge skew

* Use explicit regions in SharedSolutionContainerSystem.Capabilities

* Add debug assert

* Use explicit regions in SharedSolutionContainerSystem.Relay + ref SolutionContainerChangedEvent

* ContainedSolutionComponent.Name -> ContainedSolutionComponent.ContainerName

* SolutionComponent doc comments

* Implicit DataField names and property purge

* ReagentEffect DataField names

* Local variables for readability

* Sort using statements + Entity<T> event handlers

* Fix compile erros

* Fix compile errors

---------

Co-authored-by: ElectroJr <leonsfriedrich@gmail.com>
This commit is contained in:
TemporalOroboros
2023-12-28 17:58:14 -08:00
committed by GitHub
parent a4d36d408d
commit d75e743dd7
180 changed files with 3540 additions and 2956 deletions

View File

@@ -1,22 +1,22 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Shared.Nutrition.Components;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.Forensics;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Clothing.Components;
using Content.Shared.Clothing.EntitySystems;
using Content.Shared.FixedPoint;
using Content.Shared.Inventory;
using Content.Shared.Inventory.Events;
using Content.Shared.Item;
using Content.Shared.Nutrition.Components;
using Content.Shared.Smoking;
using Content.Shared.Temperature;
using Robust.Server.GameObjects;
using Robust.Shared.Containers;
using System.Linq;
using Content.Shared.Inventory.Events;
using Content.Server.Forensics;
namespace Content.Server.Nutrition.EntitySystems
{
@@ -79,21 +79,21 @@ namespace Content.Server.Nutrition.EntitySystems
_active.Remove(uid);
}
private void OnSmokableIsHotEvent(EntityUid uid, SmokableComponent component, IsHotEvent args)
private void OnSmokableIsHotEvent(Entity<SmokableComponent> entity, ref IsHotEvent args)
{
args.IsHot = component.State == SmokableState.Lit;
args.IsHot = entity.Comp.State == SmokableState.Lit;
}
private void OnSmokableShutdownEvent(EntityUid uid, SmokableComponent component, ComponentShutdown args)
private void OnSmokableShutdownEvent(Entity<SmokableComponent> entity, ref ComponentShutdown args)
{
_active.Remove(uid);
_active.Remove(entity);
}
private void OnSmokeableEquipEvent(EntityUid uid, SmokableComponent component, GotEquippedEvent args)
private void OnSmokeableEquipEvent(Entity<SmokableComponent> entity, ref GotEquippedEvent args)
{
if (args.Slot == "mask")
{
_forensics.TransferDna(uid, args.Equipee, false);
_forensics.TransferDna(entity.Owner, args.Equipee, false);
}
}
@@ -113,7 +113,7 @@ namespace Content.Server.Nutrition.EntitySystems
continue;
}
if (!_solutionContainerSystem.TryGetSolution(uid, smokable.Solution, out var solution))
if (!_solutionContainerSystem.TryGetSolution(uid, smokable.Solution, out var soln, out var solution))
{
_active.Remove(uid);
continue;
@@ -123,14 +123,14 @@ namespace Content.Server.Nutrition.EntitySystems
{
var transform = Transform(uid);
if (transform.GridUid is {} gridUid)
if (transform.GridUid is { } gridUid)
{
var position = _transformSystem.GetGridOrMapTilePosition(uid, transform);
_atmos.HotspotExpose(gridUid, position, smokable.ExposeTemperature, smokable.ExposeVolume, uid, true);
}
}
var inhaledSolution = _solutionContainerSystem.SplitSolution(uid, solution, smokable.InhaleAmount * _timer);
var inhaledSolution = _solutionContainerSystem.SplitSolution(soln.Value, smokable.InhaleAmount * _timer);
if (solution.Volume == FixedPoint2.Zero)
{