Skip to content

Commit

Permalink
Merge pull request Simple-Station#387 from FoxxoTrystan/vore-update
Browse files Browse the repository at this point in the history
The "VORE" Update
  • Loading branch information
FoxxoTrystan authored Dec 2, 2024
2 parents e4a891d + 10ea7ec commit b9f5ef4
Show file tree
Hide file tree
Showing 21 changed files with 621 additions and 2 deletions.
47 changes: 47 additions & 0 deletions Content.Client/Floofstation/VoredSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using Content.Shared.FloofStation;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Player;

namespace Content.Client.Floofstation;

public sealed partial class VoredSystem : EntitySystem
{
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly ISharedPlayerManager _playerMan = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<VoredComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<VoredComponent, ComponentShutdown>(Onhutdown);
SubscribeLocalEvent<VoredComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<VoredComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);
}

private void OnInit(EntityUid uid, VoredComponent component, ComponentInit args)
{
if (uid != _playerMan.LocalEntity)
return;

component.Stream = _audio.PlayGlobal(component.SoundBelly, Filter.Local(), false)?.Entity;
}

private void Onhutdown(EntityUid uid, VoredComponent component, ComponentShutdown args)
{
if (uid != _playerMan.LocalEntity)
return;

QueueDel(component.Stream);
}

private void OnPlayerAttached(EntityUid uid, VoredComponent component, LocalPlayerAttachedEvent args)
{
component.Stream = _audio.PlayGlobal(component.SoundBelly, Filter.Local(), false)?.Entity;
}

private void OnPlayerDetached(EntityUid uid, VoredComponent component, LocalPlayerDetachedEvent args)
{
QueueDel(component.Stream);
}
}
Loading

0 comments on commit b9f5ef4

Please sign in to comment.