CatStation/Content.Shared/Kitchen/Components/KitchenSpikeComponent.cs
kosticia d9e523370a
Unite LogComponent, FoodSlicableComponent and partially ButcherableComponent into one. Sharp component removal. (#36895)
* Yay

* Do a LOT changes in yml

* and again

* Finale changes

* yml and locale

* locale tweak

* yml and charp cleanup

* fix carpets

* and some-some

* And some

* I want to believe that its last🙏🙏

* 😭

* 😭😭

* clean

* fix

* AAHHAHAHAHAHAH

* fix

* FINAL

* thisguyusa...

* LAST_ONE

* wawa

* merge2

* sdobfjibwdsjaqaksmzxsowaw2edqw84

* aoaoaooaoaao

* this hardcode took 30 minutes of my life

* fix aaaa

* fix test

* FIX BUILD

* oops

* oops

* aaooaoaoa

* fuck

* oops

* refactor: cleanup after merge + use protoId in KitchenSpikeComponent

* refactor: fix butcherable stuff again!~

* fix: now actively checks for EdibleComponent on slicing, predicted items splitting

* fix: changed knife.yaml to use Slicing tool

* fix: no more sounds spam on chop-chop

* refactor: cleanups

* refactor: default time value for slicable

* refactor: whitespaces and extract variables

* fix: slicable no longer prevents InteractUsingEvent by marking handled w/o actually handling

* feat: chopping trees now requires sawing tool, same for slicing logs

* refactor: cleanup after merge

* refactor: fix non-related PR changes

* refactor: rename locid

* refactor: remove unneeded red 'slice' verb name when slicing entities with mob-state.

* refactor: simplify test code changes

* refactor: better readability for test

* refactor: linebreak for unary op

* refactor: xml-doc for SliceableComponent corrected to be more fitting.

* refactor: cleanup SliceableSystem some more

* refactor: use HasComp instead of TryComp in AddSliceVerb

* refactor: extracted methods to improve readability

* refactor: remove unchecked operator - not needed when casting from uint

* refactor: SliceableSystem cleanups, fix logs not being chopped due to solution splitting

* fix: slice verb is now showing up even if disabled, slicing is done even if there is no solution to split, replaced direct dependency for sliceable component to food component with default solution-name

* refactor: comment about RandomPredicted + toy knife now fits into clown shoes

* refactor: remove EdibleComponent dependency from SliceableSystem

* refactor: moved SliceableSystem into ToolRefinableSystem

* refactor: basic renaming for comps

* refactor: cleanup after merge

* refactor: reorder methods, renaming, simplify polymorph related conditions on slicing

* refactor: xml-doc + reorder yaml fields

* refactor: fixing yaml + method renaming, unused usings removed

* refactor: removed unused usings

* refactor: fix typo

* refactor: remove reference for deleted meat proto

* refactor: clean up yaml after merge

* refactor: fix multiple typos from mass replace

* refactor: fix missed field renaming

* refactor: ensure all entities that had ToolRefinable got BaseSlicingRefinable (aftermerge cleanup)

* refactor: undo solution-related changes for animals.yml

* refactor: fix invalid parent set for corgi + fix amount of slices for the rest of pies

* refactor: revert Solution to SolutionContainerManager changes after merge

* refactor: revert Solution to SolutionContainerManager changes after merge

* refactor: fix invalid property name for toolMissingQualityTooltip in yml, fixed missing entity on which AttemptToolRefineEvent is raised

* refactor: remove over-indent for components of BaseSlicingRefinable and for Slicing tool quality

* refactor: remove over-indentation on MobCarpHolo

* empty collection

---------

Co-authored-by: pa.pecherskij <pa.pecherskij@interfax.ru>
Co-authored-by: Fildrance <fildrance@gmail.com>
Co-authored-by: iaada <iaada@users.noreply.github.com>
2026-05-28 20:47:49 +00:00

150 lines
4.5 KiB
C#

using Content.Shared.Damage;
using Content.Shared.FixedPoint;
using Content.Shared.Nutrition.Components;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Content.Shared.Tools;
namespace Content.Shared.Kitchen.Components;
/// <summary>
/// Used to mark entity that should act as a spike.
/// </summary>
[RegisterComponent, NetworkedComponent]
[AutoGenerateComponentState, AutoGenerateComponentPause]
[Access(typeof(SharedKitchenSpikeSystem))]
public sealed partial class KitchenSpikeComponent : Component
{
/// <summary>
/// Default sound to play when the victim is hooked or unhooked.
/// </summary>
private static readonly ProtoId<SoundCollectionPrototype> DefaultSpike = new("Spike");
/// <summary>
/// Default sound to play when the victim is butchered.
/// </summary>
private static readonly ProtoId<SoundCollectionPrototype> DefaultSpikeButcher = new("SpikeButcher");
/// <summary>
/// Tool quality that required for the entity that used for butchering.
/// </summary>
[DataField]
public ProtoId<ToolQualityPrototype> RequiredToolQuality = "Slicing";
/// <summary>
/// ID of the container where the victim will be stored.
/// </summary>
[DataField, AutoNetworkedField]
public string ContainerId = "body";
/// <summary>
/// Container where the victim will be stored.
/// </summary>
[ViewVariables]
public ContainerSlot BodyContainer = default!;
/// <summary>
/// Sound to play when the victim is hooked or unhooked.
/// </summary>
[DataField, AutoNetworkedField]
public SoundSpecifier SpikeSound = new SoundCollectionSpecifier(DefaultSpike);
/// <summary>
/// Sound to play when the victim is butchered.
/// </summary>
[DataField, AutoNetworkedField]
public SoundSpecifier ButcherSound = new SoundCollectionSpecifier(DefaultSpikeButcher);
/// <summary>
/// Damage that will be applied to the victim when they are hooked or unhooked.
/// </summary>
[DataField, AutoNetworkedField]
public DamageSpecifier SpikeDamage = new()
{
DamageDict = new()
{
{ "Piercing", 10 },
},
};
/// <summary>
/// Damage that will be applied to the victim when they are butchered.
/// </summary>
[DataField, AutoNetworkedField]
public DamageSpecifier ButcherDamage = new()
{
DamageDict = new()
{
{ "Slash", 20 },
},
};
/// <summary>
/// Damage that the victim will receive over time.
/// </summary>
[DataField, AutoNetworkedField]
public DamageSpecifier TimeDamage = new()
{
DamageDict = new()
{
{ "Blunt", 1 }, // Mobs are only gibbed from blunt (at least for now).
},
};
/// <summary>
/// The next time when the damage will be applied to the victim.
/// </summary>
[AutoPausedField, AutoNetworkedField]
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan NextDamage;
/// <summary>
/// How often the damage should be applied to the victim.
/// </summary>
[DataField, AutoNetworkedField]
public TimeSpan DamageInterval = TimeSpan.FromSeconds(10);
/// <summary>
/// Time that it will take to put the victim on the spike.
/// </summary>
[DataField, AutoNetworkedField]
public TimeSpan HookDelay = TimeSpan.FromSeconds(7);
/// <summary>
/// Time that it will take to put the victim off the spike.
/// </summary>
[DataField, AutoNetworkedField]
public TimeSpan UnhookDelay = TimeSpan.FromSeconds(10);
/// <summary>
/// Time that it will take to butcher the victim while they are alive.
/// </summary>
/// <remarks>
/// This is summed up with a <see cref="ButcherableComponent"/>'s butcher delay in butcher DoAfter.
/// </remarks>
[DataField, AutoNetworkedField]
public TimeSpan ButcherDelayAlive = TimeSpan.FromSeconds(8);
/// <summary>
/// Value by which the butchering delay will be multiplied if the victim is dead.
/// </summary>
[DataField, AutoNetworkedField]
public float ButcherModifierDead = 0.5f;
}
[Serializable, NetSerializable]
public enum KitchenSpikeVisuals : byte
{
Status,
}
[Serializable, NetSerializable]
public enum KitchenSpikeStatus : byte
{
Empty,
Bloody, // TODO: Add sprites for different species.
}