2021-01-06 22:49:19 +11:00
|
|
|
using System;
|
2021-11-21 10:35:09 +03:00
|
|
|
using Content.Server.Nutrition.EntitySystems;
|
2021-07-10 17:35:33 +02:00
|
|
|
using Content.Shared.Sound;
|
2021-11-21 10:35:09 +03:00
|
|
|
using Robust.Shared.Analyzers;
|
2020-06-19 15:20:59 +02:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-03-05 01:08:38 +01:00
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2020-06-19 15:20:59 +02:00
|
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Nutrition.Components
|
2020-06-19 15:20:59 +02:00
|
|
|
{
|
2021-11-21 10:35:09 +03:00
|
|
|
[RegisterComponent, Friend(typeof(UtensilSystem))]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class UtensilComponent : Component
|
2020-06-19 15:20:59 +02:00
|
|
|
{
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("types")]
|
2021-01-06 22:49:19 +11:00
|
|
|
private UtensilType _types = UtensilType.None;
|
2020-06-19 15:20:59 +02:00
|
|
|
|
|
|
|
|
[ViewVariables]
|
2021-01-06 22:49:19 +11:00
|
|
|
public UtensilType Types
|
2020-06-19 15:20:59 +02:00
|
|
|
{
|
|
|
|
|
get => _types;
|
|
|
|
|
set
|
|
|
|
|
{
|
2021-01-06 22:49:19 +11:00
|
|
|
if (_types.Equals(value))
|
|
|
|
|
return;
|
|
|
|
|
|
2020-06-19 15:20:59 +02:00
|
|
|
_types = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The chance that the utensil has to break with each use.
|
|
|
|
|
/// A value of 0 means that it is unbreakable.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables]
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("breakChance")]
|
2021-11-21 10:35:09 +03:00
|
|
|
public float BreakChance;
|
2020-06-19 15:20:59 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The sound to be played if the utensil breaks.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables]
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("breakSound")]
|
2021-11-21 10:35:09 +03:00
|
|
|
public SoundSpecifier BreakSound = new SoundPathSpecifier("/Audio/Items/snap.ogg");
|
2020-06-19 15:20:59 +02:00
|
|
|
}
|
2021-01-06 22:49:19 +11:00
|
|
|
|
2021-11-21 10:35:09 +03:00
|
|
|
// If you want to make a fancy output on "wrong" composite utensil use (like: you need fork and knife)
|
|
|
|
|
// There should be Dictionary I guess (Dictionary<UtensilType, string>)
|
2021-01-06 22:49:19 +11:00
|
|
|
[Flags]
|
|
|
|
|
public enum UtensilType : byte
|
|
|
|
|
{
|
|
|
|
|
None = 0,
|
|
|
|
|
Fork = 1,
|
|
|
|
|
Spoon = 1 << 1,
|
|
|
|
|
Knife = 1 << 2
|
|
|
|
|
}
|
2020-06-19 15:20:59 +02:00
|
|
|
}
|