Files
tbd-station-14/Content.Server/GameObjects/Components/PottedPlantHideComponent.cs
Alex Evgrashin 02ea6ce57c Toilet (#3012)
* Ported sprites from eris

* Added yml

* lid open/close logic

* interactivity

* Working on new secret stash component

* Object will drop on destruction

* Can get item and examine message

* Reagent container and some cleaning

* Moved potted plant to stash

* New base prefab

* Now you can deconstruct toilet

* Small fixes

* Fixed unknown components errors

* Fixed grammar errors

Co-authored-by: Paul Ritter <ritter.paul1@googlemail.com>

* Now use prob

* More grammar

* Update Content.Server/Construction/Conditions/ToiletLidClosed.cs

Aaaaaaaa

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* No delays

* Amazing sound design

* Moved sound to mono

* Toilet viz

Co-authored-by: Paul Ritter <ritter.paul1@googlemail.com>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2021-01-20 18:02:34 +11:00

56 lines
1.8 KiB
C#

using System.Threading.Tasks;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Shared.Audio;
using Content.Shared.Interfaces;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Server.GameObjects.Components.Container;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Localization;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components
{
[RegisterComponent]
public class PottedPlantHideComponent : Component, IInteractUsing, IInteractHand
{
public override string Name => "PottedPlantHide";
[ViewVariables] private SecretStashComponent _secretStash = default!;
public override void Initialize()
{
base.Initialize();
_secretStash = Owner.EnsureComponent<SecretStashComponent>();
}
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
{
Rustle();
return _secretStash.TryHideItem(eventArgs.User, eventArgs.Using);
}
bool IInteractHand.InteractHand(InteractHandEventArgs eventArgs)
{
Rustle();
var gotItem = _secretStash.TryGetItem(eventArgs.User);
if (!gotItem)
{
Owner.PopupMessage(eventArgs.User, Loc.GetString("You root around in the roots."));
}
return gotItem;
}
private void Rustle()
{
EntitySystem.Get<AudioSystem>()
.PlayFromEntity("/Audio/Effects/plant_rustle.ogg", Owner, AudioHelpers.WithVariation(0.25f));
}
}
}