Refactors smoking to ECS, smoking actually makes you inhale reagents. (#4678)

This commit is contained in:
Vera Aguilera Puerto
2021-09-26 15:19:00 +02:00
committed by GitHub
parent 0767bd3777
commit f913d8361d
19 changed files with 284 additions and 150 deletions

View File

@@ -1,3 +1,4 @@
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reaction;
using Content.Shared.Chemistry.Reagent;
using JetBrains.Annotations;
@@ -12,15 +13,22 @@ namespace Content.Shared.Chemistry
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
public void ReactionEntity(IEntity? entity, ReactionMethod method, string reagentId, ReagentUnit reactVolume,
Components.Solution? source)
public void ReactionEntity(IEntity entity, ReactionMethod method, Solution solution)
{
foreach (var (id, quantity) in solution)
{
ReactionEntity(entity, method, id, quantity, solution);
}
}
public void ReactionEntity(IEntity entity, ReactionMethod method, string reagentId, ReagentUnit reactVolume, Solution? source)
{
// We throw if the reagent specified doesn't exist.
ReactionEntity(entity, method, _prototypeManager.Index<ReagentPrototype>(reagentId), reactVolume, source);
}
public void ReactionEntity(IEntity? entity, ReactionMethod method, ReagentPrototype reagent,
ReagentUnit reactVolume, Components.Solution? source)
public void ReactionEntity(IEntity entity, ReactionMethod method, ReagentPrototype reagent,
ReagentUnit reactVolume, Solution? source)
{
if (entity == null || entity.Deleted || !entity.TryGetComponent(out ReactiveComponent? reactive))
return;

View File

@@ -4,7 +4,7 @@ using Robust.Shared.Serialization;
namespace Content.Shared.Smoking
{
[Serializable, NetSerializable]
public enum SharedBurningStates : byte
public enum SmokableState : byte
{
Unlit,
Lit,