Files
tbd-station-14/Content.Shared/Sericulture/SericultureComponent.cs
poklj 1c58b6efc7 Fixup Sericulture to be clonable (#38516)
* Add CloningEvent and an action entity prototype

* Remove redundant action prototype from Yaml

* Add a field that might be changed

* CR

* CR - guard statement and Dirty
2025-06-25 21:50:47 +02:00

67 lines
2.3 KiB
C#

using Content.Shared.Nutrition.Components;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Sericulture;
/// <summary>
/// Should be applied to any mob that you want to be able to produce any material with an action and the cost of hunger.
/// TODO: Probably adjust this to utilize organs?
/// </summary>
[RegisterComponent, NetworkedComponent, Access(typeof(SharedSericultureSystem)), AutoGenerateComponentState]
public sealed partial class SericultureComponent : Component
{
/// <summary>
/// The text that pops up whenever sericulture fails for not having enough hunger.
/// </summary>
[DataField("popupText")]
[ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public string PopupText = "sericulture-failure-hunger";
/// <summary>
/// What will be produced at the end of the action.
/// </summary>
[DataField(required: true)]
[ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public EntProtoId EntityProduced;
/// <summary>
/// The entity needed to actually preform sericulture. This will be granted (and removed) upon the entity's creation.
/// </summary>
[DataField]
[ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public EntProtoId Action = "ActionSericulture";
[AutoNetworkedField]
[DataField("actionEntity")]
public EntityUid? ActionEntity;
/// <summary>
/// How long will it take to make.
/// </summary>
[DataField("productionLength")]
[ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public float ProductionLength = 3f;
/// <summary>
/// This will subtract (not add, don't get this mixed up) from the current hunger of the mob doing sericulture.
/// </summary>
[DataField("hungerCost")]
[ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public float HungerCost = 5f;
/// <summary>
/// The lowest hunger threshold that this mob can be in before it's allowed to spin silk.
/// </summary>
[DataField("minHungerThreshold")]
[ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public HungerThreshold MinHungerThreshold = HungerThreshold.Okay;
}