Toilet Upgrade (needs review) (#22133)
* Toilet Draft * fixes * toilets now have secret stash to place items in cistern. * fixes * plungers now unblock toilets. * fix sprite * new sprites and fix * fixes * improve seat sprites. * fix * removed visualisersystem changed to genericvisualizers * flush sound for toilets and copyright for toilet sprites. * fix atrributions * fixes * fix datafield flushtime * sprite improvements * fixes * multiple changes * fix * fix * fixes remove vv * moved stash related functions to secret stash system from toilet. * fix * fix * changes for recent review. * fix * fix
This commit is contained in:
63
Content.Shared/Plants/PottedPlantHideSystem.cs
Normal file
63
Content.Shared/Plants/PottedPlantHideSystem.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Storage.Components;
|
||||
using Content.Shared.Storage.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
|
||||
namespace Content.Shared.Plants
|
||||
{
|
||||
public sealed class PottedPlantHideSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly SecretStashSystem _stashSystem = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<PottedPlantHideComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<PottedPlantHideComponent, InteractUsingEvent>(OnInteractUsing);
|
||||
SubscribeLocalEvent<PottedPlantHideComponent, InteractHandEvent>(OnInteractHand);
|
||||
}
|
||||
|
||||
private void OnInit(EntityUid uid, PottedPlantHideComponent component, ComponentInit args)
|
||||
{
|
||||
EntityManager.EnsureComponent<SecretStashComponent>(uid);
|
||||
}
|
||||
|
||||
private void OnInteractUsing(EntityUid uid, PottedPlantHideComponent component, InteractUsingEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
Rustle(uid, component);
|
||||
args.Handled = _stashSystem.TryHideItem(uid, args.User, args.Used);
|
||||
}
|
||||
|
||||
private void OnInteractHand(EntityUid uid, PottedPlantHideComponent component, InteractHandEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
Rustle(uid, component);
|
||||
|
||||
var gotItem = _stashSystem.TryGetItem(uid, args.User);
|
||||
if (!gotItem)
|
||||
{
|
||||
var msg = Loc.GetString("potted-plant-hide-component-interact-hand-got-no-item-message");
|
||||
_popupSystem.PopupEntity(msg, uid, args.User);
|
||||
}
|
||||
|
||||
args.Handled = gotItem;
|
||||
}
|
||||
|
||||
private void Rustle(EntityUid uid, PottedPlantHideComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
return;
|
||||
|
||||
_audio.PlayPvs(component.RustleSound, uid, AudioParams.Default.WithVariation(0.25f));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user