Add hunger and thirst (#363)

* Add hunger and thirst

Based on the SS13 systems.
Food (Nutriment) / Drink -> Stomach -> Hunger / Thirst

* Cleanup rebase

* Cleanup stuff that was prototyped

* Address feedback

Still need to add a statuseffects system in a separate branch

* More cleanup on nutrition

Fix Remie's feedback and also damage tick.

* Re-implement nutrition with master

* Updated to use the StatusEffectsUI update
* Removed all clientside components as they only receive the UI updates now
* Implemented PR feedback
* Had to make a slight adjustment to the chemistry SolutionComponent given it doesn't have an Owner, same with Solution

Still TODO:
* Metabolisation effects
* Change drink contents to alcohol / wine etc.
* Add items to the dispensers
* For transparent containers use RecalculateColor

Could probably genericise DrinkFoodContainer as well to be a temporary item dispenser

* Fix broken bottle parent
This commit is contained in:
metalgearsloth
2019-11-12 08:20:03 +11:00
committed by Pieter-Jan Briers
parent 6de5c01afb
commit de148fc98f
1026 changed files with 9617 additions and 8 deletions

View File

@@ -17,7 +17,7 @@ namespace Content.Shared.GameObjects.Components.Chemistry
#pragma warning restore 649
[ViewVariables]
protected Solution _containedSolution;
protected Solution _containedSolution = new Solution();
protected int _maxVolume;
private SolutionCaps _capabilities;
@@ -68,14 +68,14 @@ namespace Content.Shared.GameObjects.Components.Chemistry
/// <inheritdoc />
public sealed override Type StateType => typeof(SolutionComponentState);
/// <inheritdoc />
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
serializer.DataField(ref _maxVolume, "maxVol", 0);
serializer.DataField(ref _containedSolution, "contents", new Solution());
serializer.DataField(ref _containedSolution, "contents", _containedSolution);
serializer.DataField(ref _capabilities, "caps", SolutionCaps.None);
}

View File

@@ -32,5 +32,7 @@ namespace Content.Shared.GameObjects.Components.Mobs
public enum StatusEffect
{
Health,
Hunger,
Thirst,
}
}

View File

@@ -0,0 +1,28 @@
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Nutrition
{
public abstract class SharedDrinkFoodContainerComponent : Component
{
}
[NetSerializable, Serializable]
public enum DrinkFoodContainerVisualMode
{
/// <summary>
/// Discrete: 50 eggs in a carton -> down to 25, will show 12/12 until it gets below max
/// Rounded: 50 eggs in a carton -> down to 25, will round it to 6 of 12
/// </summary>
Discrete,
Rounded,
}
[NetSerializable, Serializable]
public enum DrinkFoodContainerVisuals
{
Capacity,
Current,
}
}

View File

@@ -0,0 +1,16 @@
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Nutrition
{
public class SharedFoodComponent
{
// TODO: Remove maybe? Add visualizer for food
[Serializable, NetSerializable]
public enum FoodVisuals
{
Visual,
MaxUses,
}
}
}

View File

@@ -0,0 +1,12 @@
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Nutrition
{
public class SharedStomachComponent : Component
{
public override string Name => "Stomach";
}
}

View File

@@ -30,5 +30,6 @@
public const uint COMBATMODE = 1025;
public const uint STATUSEFFECTS = 1026;
public const uint OVERLAYEFFECTS = 1027;
public const uint STOMACH = 1028;
}
}