Fix food & do-after bugs (#5716)

This commit is contained in:
Leon Friedrich
2021-12-07 19:19:26 +13:00
committed by GitHub
parent 7fa117bf7e
commit bd8acc5b6b
7 changed files with 117 additions and 36 deletions

View File

@@ -1,4 +1,3 @@
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Sound;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
@@ -7,6 +6,7 @@ using Robust.Shared.ViewVariables;
using Content.Server.Nutrition.EntitySystems;
using Content.Shared.FixedPoint;
using Robust.Shared.Analyzers;
using System.Threading;
namespace Content.Server.Nutrition.Components
{
@@ -50,8 +50,9 @@ namespace Content.Server.Nutrition.Components
public float ForceFeedDelay = 3;
/// <summary>
/// If true, this drink has some DoAfter active (someone is being force fed).
/// Token for interrupting a do-after action (e.g., force feeding). If not null, implies component is
/// currently "in use".
/// </summary>
public bool InUse = false;
public CancellationTokenSource? CancelToken;
}
}

View File

@@ -1,4 +1,5 @@
using System;
using System.Threading;
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Nutrition.EntitySystems;
using Content.Shared.FixedPoint;
@@ -55,9 +56,10 @@ namespace Content.Server.Nutrition.Components
public float ForceFeedDelay = 3;
/// <summary>
/// If true, this food has some DoAfter active (someone is being force fed).
/// Token for interrupting a do-after action (e.g., force feeding). If not null, implies component is
/// currently "in use".
/// </summary>
public bool InUse = false;
public CancellationTokenSource? CancelToken;
[ViewVariables]
public int UsesRemaining