* Moves ContainsReagent from SolutionContainer to Solution GetMajorReagentId from SOlutionContainer to Solution Makes capability checks use HasFlag Moves Solution Color calculation from SolutionContainer to Solution Replaces SolutionContainerCaps.NoExamine with CanExamine Misc SolutionContainer.Capabilities yaml cleanup * Moves IReactionEffect from server to shared * Moves ReactionPrototype from server to shared * Moves SolutionValidReaction from SolutionContainer to ChemicalReactionSystem * Moves PerformReaction from SolutionContainer to ChemicalReactionSystem * Moves CheckForReaction from SolutionContainer to ChemicalReactionSystem * Removes unused SolutionContainer methods * Removes now-unused GetMajorReagentId from SOlutionContainer * ChemicalReactionSystem comments * Replaces usage of SolutionContainer.ContainsReagent and replaces it with SolutionContainer.Solution.ContainsReagent * ChemicalReactionSystem ProcessReactions * Moves ExplosionReactionEffect to shared, comments out server code, TODO: figure out how to let ReactionEffects in shared do server stuff * Fixes SolutionContainer.CheckForReaction infinite recursion * Moves IReactionEffect and ExplosionReactionEffect back to server * Moves ChemicalReactionSystem and ReactionPrototype back to server * Uncomments out Explosion code * namespace fixes * Moves ReactionPrototype and IReactionEffect from Server to Shared * Moves ChemicalReactionSystem from Server to Shared * ChemicalReaction code partial rewrite * Moves CanReact and PerformReaction to Solution * Revert "Moves CanReact and PerformReaction to Solution" This reverts commit bab791c3ebd0ff39d22f2610e27ca04f0d46d6b8. * Moves ChemistrySystem from Server to Shared * diff fix * TODO warning Co-authored-by: py01 <pyronetics01@gmail.com>
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using System;
|
|
using System.Linq;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.GameObjects.Systems;
|
|
using Robust.Shared.Interfaces.GameObjects;
|
|
|
|
namespace Content.Shared.GameObjects.EntitySystems
|
|
{
|
|
/// <summary>
|
|
/// This interface gives components behavior on whether entities solution (implying SolutionComponent is in place) is changed
|
|
/// </summary>
|
|
public interface ISolutionChange
|
|
{
|
|
/// <summary>
|
|
/// Called when solution is mixed with some other solution, or when some part of the solution is removed
|
|
/// </summary>
|
|
void SolutionChanged(SolutionChangeEventArgs eventArgs);
|
|
}
|
|
|
|
public class SolutionChangeEventArgs : EventArgs
|
|
{
|
|
public IEntity Owner { get; set; }
|
|
}
|
|
|
|
[UsedImplicitly]
|
|
public class ChemistrySystem : EntitySystem
|
|
{
|
|
public void HandleSolutionChange(IEntity owner)
|
|
{
|
|
var eventArgs = new SolutionChangeEventArgs
|
|
{
|
|
Owner = owner,
|
|
};
|
|
var solutionChangeArgs = owner.GetAllComponents<ISolutionChange>().ToList();
|
|
|
|
foreach (var solutionChangeArg in solutionChangeArgs)
|
|
{
|
|
solutionChangeArg.SolutionChanged(eventArgs);
|
|
}
|
|
}
|
|
}
|
|
}
|