Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Secret stash refractor #29396

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Content.Server/Nutrition/EntitySystems/FoodSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
using System.Linq;
using Robust.Server.GameObjects;
using Content.Shared.Whitelist;
using Content.Shared.Destructible;

namespace Content.Server.Nutrition.EntitySystems;

Expand Down Expand Up @@ -322,6 +323,10 @@ public void DeleteAndSpawnTrash(FoodComponent component, EntityUid food, EntityU
if (ev.Cancelled)
return;

var dev = new DestructionEventArgs();

RaiseLocalEvent(food, dev);

if (string.IsNullOrEmpty(component.Trash))
{
QueueDel(food);
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Nutrition/EntitySystems/UtensilSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private void OnAfterInteract(EntityUid uid, UtensilComponent component, AfterInt
if ((food.Utensil & component.Types) == 0)
{
_popupSystem.PopupEntity(Loc.GetString("food-system-wrong-utensil", ("food", target), ("utensil", component.Owner)), user, user);
return (false, true);
return (false, false);
}

if (!_interactionSystem.InRangeUnobstructed(user, target, popup: true))
Expand Down
17 changes: 0 additions & 17 deletions Content.Shared/Plants/PottedPlantHideComponent.cs

This file was deleted.

63 changes: 0 additions & 63 deletions Content.Shared/Plants/PottedPlantHideSystem.cs

This file was deleted.

79 changes: 57 additions & 22 deletions Content.Shared/Storage/Components/SecretStashComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,54 +7,89 @@
using Robust.Shared.GameStates;
using Content.Shared.DoAfter;
using Robust.Shared.Serialization;
using Robust.Shared.Audio;

namespace Content.Shared.Storage.Components
{
/// <summary>
/// Logic for a secret slot stash, like plant pot or toilet cistern.
/// Unlike <see cref="ItemSlotsComponent"/> it doesn't have interaction logic or verbs.
/// Other classes like <see cref="ToiletComponent"/> should implement it.
/// Unlike <see cref="ItemSlotsComponent"/> it has logic for opening and closing
/// the stash.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
[Access(typeof(SecretStashSystem))]
public sealed partial class SecretStashComponent : Component
{
/// <summary>
/// Max item size that can be fitted into secret stash.
/// Max item size that can be inserted into secret stash.
/// </summary>
[DataField("maxItemSize")]
public ProtoId<ItemSizePrototype> MaxItemSize = "Small";

/// <summary>
/// If stash has way to open then this will switch between open and closed.
/// If stash has way to open then this will switch between open and closed.
/// </summary>
[DataField, AutoNetworkedField]
public bool ToggleOpen;
public bool IsStashOpen = false;

/// <summary>
/// Prying the door.
/// If a tool is needed to open the stash, this time will be used.
/// </summary>
[DataField]
public float PryDoorTime = 1f;
public float OpenStashTime = 1f;

/// <summary>
/// If a tool is needed to close the stash, this time will be used.
/// </summary>
[DataField]
public ProtoId<ToolQualityPrototype> PryingQuality = "Prying";
public float CloseStashTime = 1f;

/// <summary>
/// Is stash openable?.
/// What type of tool quality is needed to open the stash.
/// If null, the stash will only be openable by a verb.
/// </summary>
[DataField, AutoNetworkedField]
public bool OpenableStash = false;
[DataField]
public ProtoId<ToolQualityPrototype>? StashOpenToolQualityNeeded;

/// <summary>
/// What type of tool quality is needed to close the stash.
/// If null, the stash will only be closable by a verb.
/// </summary>
[DataField]
public ProtoId<ToolQualityPrototype>? StashCloseToolQualityNeeded;

/// <summary>
/// This sound will be played when you try to insert an item in the stash.
/// The sound will be played whether or not the item is actually inserted.
/// </summary>
[DataField]
public SoundSpecifier? TryInsertItemSound;

/// <summary>
/// IC secret stash name. For example "the toilet cistern".
/// If empty string, will replace it with entity name in init.
/// This sound will be played when you try to remove an item in the stash.
/// The sound will be played whether or not the item is actually removed.
/// </summary>
[DataField]
public string SecretPartName { get; set; } = "";
public SoundSpecifier? TryRemoveItemSound;

/// <summary>
/// If true the stash can be opened and closed, if false the stash cannot be opened or closed.
/// </summary>
[DataField, AutoNetworkedField]
public string ExamineStash = "comp-secret-stash-on-examine-found-hidden-item";
public bool CanBeOpenedAndClosed = true;

/// <summary>
/// If true, verbs will appear to help interact with the stash.
/// </summary>
[DataField, AutoNetworkedField]
public bool HasVerbs = true;

/// <summary>
/// The name of the secret stash. For example "the toilet cistern".
/// If null, the name of the entity will be used instead.
/// </summary>
[DataField]
public string? SecretStashName;

/// <summary>
/// Container used to keep secret stash item.
Expand All @@ -65,26 +100,26 @@ public sealed partial class SecretStashComponent : Component
}

/// <summary>
/// Simple pry event for prying open a stash door.
/// Simple pry event for prying open a stash door.
/// </summary>
[Serializable, NetSerializable]
public sealed partial class StashPryDoAfterEvent : SimpleDoAfterEvent
public sealed partial class SecretStashPryDoAfterEventToggleIsOpen : SimpleDoAfterEvent
{
}

/// <summary>
/// Visualizers for handling stash open closed state if stash has door.
/// Visualizers for handling stash open closed state if stash has door.
/// </summary>
[Serializable, NetSerializable]
public enum StashVisuals : byte
{
DoorVisualState,
StashVisualState,
}

[Serializable, NetSerializable]
public enum DoorVisualState : byte
public enum StashVisualState : byte
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this is just a bool

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not quite sure what your getting at with this! This is the way I've done it in other PRs and everything I can find also does it this way. Mind giving some more detail?

{
DoorOpen,
DoorClosed
StashOpen,
StashClosed
}
}
Loading
Loading