Chemistry revamp and bartending features

-Ability to mix drinks to create cocktails with shiny icons
-New Chemistry System which can relay chemistry events to corresponding components
-moved some solution logic from Shared to Server
-fixed some weird stuff with DrinkComponent
This commit is contained in:
Injazz
2020-04-08 15:53:15 +05:00
parent 45e9be43ef
commit d400f77129
24 changed files with 822 additions and 1270 deletions

View File

@@ -0,0 +1,42 @@
using System;
using System.Linq;
using JetBrains.Annotations;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.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);
}
}
}
}