Skip to content

Commit

Permalink
Merge pull request #399 from Fansana/master
Browse files Browse the repository at this point in the history
Floof Station Release v8
  • Loading branch information
Fansana authored Dec 9, 2024
2 parents 4a8e406 + 044a74b commit e388dac
Show file tree
Hide file tree
Showing 22 changed files with 249 additions and 50 deletions.
22 changes: 21 additions & 1 deletion Content.Client/Floofstation/VoredSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Content.Shared.CCVar;
using Content.Shared.FloofStation;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Configuration;
using Robust.Shared.Player;

namespace Content.Client.Floofstation;
Expand All @@ -8,6 +10,7 @@ public sealed partial class VoredSystem : EntitySystem
{
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly ISharedPlayerManager _playerMan = default!;
[Dependency] private readonly IConfigurationManager _configManager = default!;

public override void Initialize()
{
Expand All @@ -17,11 +20,14 @@ public override void Initialize()
SubscribeLocalEvent<VoredComponent, ComponentShutdown>(Onhutdown);
SubscribeLocalEvent<VoredComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<VoredComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);

Subs.CVar(_configManager, FloofCCVars.VoreSoundEnabled, VoreSoundCVarChanged);
}

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

component.Stream = _audio.PlayGlobal(component.SoundBelly, Filter.Local(), false)?.Entity;
Expand All @@ -35,8 +41,22 @@ private void Onhutdown(EntityUid uid, VoredComponent component, ComponentShutdow
QueueDel(component.Stream);
}

private void VoreSoundCVarChanged(bool voreEnabled)
{
if (!TryComp<VoredComponent>(_playerMan.LocalEntity, out var component))
return;

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

private void OnPlayerAttached(EntityUid uid, VoredComponent component, LocalPlayerAttachedEvent args)
{
if (!_configManager.GetCVar(FloofCCVars.VoreSoundEnabled))
return;

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

Expand Down
1 change: 1 addition & 0 deletions Content.Client/Options/UI/Tabs/AudioTab.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
Text="{Loc 'ui-options-announcer-disable-multiple-sounds'}"
ToolTip="{Loc 'ui-options-announcer-disable-multiple-sounds-tooltip'}" />
<CheckBox Name="AdminSoundsCheckBox" Text="{Loc 'ui-options-admin-sounds'}" />
<CheckBox Name="VoreSoundCheckBox" Text="{Loc 'ui-options-vore-sounds'}" />
</BoxContainer>
</BoxContainer>
<controls:StripeBack HasBottomEdge="False" HasMargins="False">
Expand Down
9 changes: 8 additions & 1 deletion Content.Client/Options/UI/Tabs/AudioTab.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Client.Audio;
using Content.Shared.CCVar;
using Content.Shared.FloofStation;
using Robust.Client.Audio;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
Expand All @@ -24,6 +25,7 @@ public AudioTab()

_audio = IoCManager.Resolve<IAudioManager>();
LobbyMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.LobbyMusicEnabled);
VoreSoundCheckBox.Pressed = _cfg.GetCVar(FloofCCVars.VoreSoundEnabled);
RestartSoundsCheckBox.Pressed = _cfg.GetCVar(CCVars.RestartSoundsEnabled);
EventMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.EventMusicEnabled);
AdminSoundsCheckBox.Pressed = _cfg.GetCVar(CCVars.AdminSoundsEnabled);
Expand All @@ -42,6 +44,7 @@ public AudioTab()
AnnouncerVolumeSlider,

LobbyMusicCheckBox,
VoreSoundCheckBox,
RestartSoundsCheckBox,
EventMusicCheckBox,
AnnouncerDisableMultipleSoundsCheckBox,
Expand Down Expand Up @@ -87,6 +90,7 @@ protected override void Dispose(bool disposing)
AnnouncerVolumeSlider,

LobbyMusicCheckBox,
VoreSoundCheckBox,
RestartSoundsCheckBox,
EventMusicCheckBox,
AnnouncerDisableMultipleSoundsCheckBox,
Expand Down Expand Up @@ -129,6 +133,7 @@ private void OnApplyButtonPressed(BaseButton.ButtonEventArgs args)
_cfg.SetCVar(CCVars.MaxAmbientSources, (int)AmbienceSoundsSlider.Value);

_cfg.SetCVar(CCVars.LobbyMusicEnabled, LobbyMusicCheckBox.Pressed);
_cfg.SetCVar(FloofCCVars.VoreSoundEnabled, VoreSoundCheckBox.Pressed);
_cfg.SetCVar(CCVars.RestartSoundsEnabled, RestartSoundsCheckBox.Pressed);
_cfg.SetCVar(CCVars.EventMusicEnabled, EventMusicCheckBox.Pressed);
_cfg.SetCVar(CCVars.AnnouncerDisableMultipleSounds, AnnouncerDisableMultipleSoundsCheckBox.Pressed);
Expand All @@ -155,6 +160,7 @@ private void Reset()
AmbienceSoundsSlider.Value = _cfg.GetCVar(CCVars.MaxAmbientSources);

LobbyMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.LobbyMusicEnabled);
VoreSoundCheckBox.Pressed = _cfg.GetCVar(FloofCCVars.VoreSoundEnabled);
RestartSoundsCheckBox.Pressed = _cfg.GetCVar(CCVars.RestartSoundsEnabled);
EventMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.EventMusicEnabled);
AnnouncerDisableMultipleSoundsCheckBox.Pressed = _cfg.GetCVar(CCVars.AnnouncerDisableMultipleSounds);
Expand Down Expand Up @@ -182,12 +188,13 @@ private void UpdateChanges()

var isAmbientSoundsSame = (int)AmbienceSoundsSlider.Value == _cfg.GetCVar(CCVars.MaxAmbientSources);
var isLobbySame = LobbyMusicCheckBox.Pressed == _cfg.GetCVar(CCVars.LobbyMusicEnabled);
var isVoreSoundSame = VoreSoundCheckBox.Pressed == _cfg.GetCVar(FloofCCVars.VoreSoundEnabled);
var isRestartSoundsSame = RestartSoundsCheckBox.Pressed == _cfg.GetCVar(CCVars.RestartSoundsEnabled);
var isEventSame = EventMusicCheckBox.Pressed == _cfg.GetCVar(CCVars.EventMusicEnabled);
var isAnnouncerDisableMultipleSoundsSame = AnnouncerDisableMultipleSoundsCheckBox.Pressed == _cfg.GetCVar(CCVars.AnnouncerDisableMultipleSounds);
var isAdminSoundsSame = AdminSoundsCheckBox.Pressed == _cfg.GetCVar(CCVars.AdminSoundsEnabled);
var isEverythingSame = isMasterVolumeSame && isMidiVolumeSame && isAmbientVolumeSame
&& isAmbientMusicVolumeSame && isAmbientSoundsSame && isLobbySame && isRestartSoundsSame && isEventSame
&& isAmbientMusicVolumeSame && isAmbientSoundsSame && isLobbySame && isVoreSoundSame && isRestartSoundsSame && isEventSame
&& isAnnouncerDisableMultipleSoundsSame && isAdminSoundsSame && isLobbyVolumeSame
&& isInterfaceVolumeSame && isAnnouncerVolumeSame;
ApplyButton.Disabled = isEverythingSame;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private void OnPowerUsed(EntityUid uid, PsionicHypnoComponent component, HypnoPo

if (HasComp<HypnotizedComponent>(args.Target))
{
_popups.PopupEntity(Loc.GetString("hypno-already-under", ("target", uid)), uid, uid, PopupType.Large);
_popups.PopupEntity(Loc.GetString("hypno-already-under", ("target", args.Target)), uid, uid, PopupType.Large);
return;
}

Expand Down
85 changes: 72 additions & 13 deletions Content.Server/FloofStation/VoreSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@
using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems;
using Content.Server.Power.EntitySystems;
using Content.Server.Silicon.Charge;
using Content.Shared.PowerCell.Components;
using System.Linq;
using Content.Shared.Forensics;
using Content.Server.Forensics;
using Content.Shared.Contests;
using Content.Shared.Standing;
using Content.Server.Power.Components;
using Content.Shared.PowerCell;
using Content.Server.Nutrition.EntitySystems;
using Content.Shared.Interaction.Events;
using Content.Shared.Hands.EntitySystems;
using Robust.Shared.Player;

namespace Content.Server.FloofStation;

Expand All @@ -60,6 +61,7 @@ public sealed class VoreSystem : EntitySystem
[Dependency] private readonly StandingStateSystem _standingState = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly FoodSystem _food = default!;
[Dependency] private readonly SharedHandsSystem _hands = default!;

public override void Initialize()
{
Expand All @@ -73,6 +75,7 @@ public override void Initialize()

SubscribeLocalEvent<VoredComponent, EntGotRemovedFromContainerMessage>(OnRelease);
SubscribeLocalEvent<VoredComponent, CanSeeAttemptEvent>(OnSeeAttempt);
SubscribeLocalEvent<VoredComponent, InteractionAttemptEvent>(CheckInteraction);
}

private void OnInit(EntityUid uid, VoreComponent component, MapInitEvent args)
Expand All @@ -83,6 +86,7 @@ private void OnInit(EntityUid uid, VoreComponent component, MapInitEvent args)
private void AddVerbs(EntityUid uid, VoreComponent component, GetVerbsEvent<InnateVerb> args)
{
DevourVerb(uid, component, args);
InsertSelfVerb(uid, args);
VoreVerb(uid, component, args);
}

Expand All @@ -91,22 +95,43 @@ private void DevourVerb(EntityUid uid, VoreComponent component, GetVerbsEvent<In
if (!args.CanInteract
|| !args.CanAccess
|| args.User == args.Target
|| !HasComp<MobStateComponent>(args.Target)
|| !_consent.HasConsent(args.Target, "Vore")
|| HasComp<VoredComponent>(args.User))
|| !HasComp<VoreComponent>(args.Target)
|| !_consent.HasConsent(args.User, "VorePred")
|| !_consent.HasConsent(args.Target, "Vore"))
return;

InnateVerb verbDevour = new()
{
Act = () => TryDevour(uid, args.Target, component),
Act = () => TryDevour(args.User, args.Target, component),
Text = Loc.GetString("vore-devour"),
Category = VerbCategory.Vore,
Category = VerbCategory.Interaction,
Icon = new SpriteSpecifier.Rsi(new ResPath("Interface/Actions/devour.rsi"), "icon-on"),
Priority = -1
};
args.Verbs.Add(verbDevour);
}

private void InsertSelfVerb(EntityUid uid, GetVerbsEvent<InnateVerb> args)
{
if (!args.CanInteract
|| !args.CanAccess
|| args.User == args.Target
|| !TryComp<VoreComponent>(args.Target, out var component)
|| !_consent.HasConsent(args.Target, "VorePred")
|| !_consent.HasConsent(args.User, "Vore"))
return;

InnateVerb verbInsert = new()
{
Act = () => TryDevour(args.Target, args.User, component),
Text = Loc.GetString("action-name-insert-self"),
Category = VerbCategory.Interaction,
Icon = new SpriteSpecifier.Rsi(new ResPath("Interface/Actions/devour.rsi"), "icon"),
Priority = -1
};
args.Verbs.Add(verbInsert);
}

private void VoreVerb(EntityUid uid, VoreComponent component, GetVerbsEvent<InnateVerb> args)
{
if (args.User != args.Target)
Expand Down Expand Up @@ -164,7 +189,8 @@ public void TryDevour(EntityUid uid, EntityUid target, VoreComponent? component
if (_food.IsMouthBlocked(uid, uid))
return;

_popups.PopupEntity(Loc.GetString("vore-attempt-devour", ("entity", uid), ("prey", target)), uid, PopupType.LargeCaution);
_popups.PopupEntity(Loc.GetString("vore-attempt-devour", ("entity", uid), ("prey", target)), uid, target, PopupType.MediumCaution);
_popups.PopupEntity(Loc.GetString("vore-attempt-devour", ("entity", uid), ("prey", target)), target, uid, PopupType.MediumCaution);

if (!TryComp<PhysicsComponent>(uid, out var predPhysics)
|| !TryComp<PhysicsComponent>(target, out var preyPhysics))
Expand Down Expand Up @@ -210,9 +236,27 @@ public void Devour(EntityUid uid, EntityUid target, VoreComponent? component = n
temp.AtmosTemperatureTransferEfficiency = 0;

_containerSystem.Insert(target, component.Stomach);
_audioSystem.PlayPvs(component.SoundDevour, uid);

_popups.PopupEntity(Loc.GetString("vore-devoured", ("entity", uid), ("prey", target)), uid, PopupType.LargeCaution);
if (_playerManager.TryGetSessionByEntity(target, out var sessionprey)
|| sessionprey is not null)
_audioSystem.PlayEntity(component.SoundDevour, sessionprey, uid);

if (_playerManager.TryGetSessionByEntity(uid, out var sessionpred)
|| sessionpred is not null)
{
_audioSystem.PlayEntity(component.SoundDevour, sessionpred, uid);
// var message = Loc.GetString("", ("entity", uid));
// _chatManager.ChatMessageToOne(
// ChatChannel.Emotes,
// message,
// message,
// EntityUid.Invalid,
// false,
// sessionprey.Channel);
}

_popups.PopupEntity(Loc.GetString("vore-devoured", ("entity", uid), ("prey", target)), target, target, PopupType.SmallCaution);
_popups.PopupEntity(Loc.GetString("vore-devoured", ("entity", uid), ("prey", target)), target, uid, PopupType.SmallCaution);

_adminLog.Add(LogType.Action, LogImpact.High, $"{ToPrettyString(uid)} vored {ToPrettyString(target)}");
}
Expand All @@ -232,9 +276,16 @@ private void OnRelease(EntityUid uid, VoredComponent component, EntGotRemovedFro
if (TryComp<TemperatureComponent>(uid, out var temp))
temp.AtmosTemperatureTransferEfficiency = 0.1f;

_audioSystem.PlayPvs(component.SoundRelease, args.Container.Owner);
if (_playerManager.TryGetSessionByEntity(args.Container.Owner, out var sessionpred)
|| sessionpred is not null)
_audioSystem.PlayEntity(component.SoundRelease, sessionpred, uid);

_popups.PopupEntity(Loc.GetString("vore-released", ("entity", uid), ("pred", args.Container.Owner)), uid, PopupType.Large);
if (_playerManager.TryGetSessionByEntity(uid, out var sessionprey)
|| sessionprey is not null)
_audioSystem.PlayEntity(component.SoundRelease, sessionprey, uid);

_popups.PopupEntity(Loc.GetString("vore-released", ("entity", uid), ("pred", args.Container.Owner)), uid, args.Container.Owner, PopupType.Medium);
_popups.PopupEntity(Loc.GetString("vore-released", ("entity", uid), ("pred", args.Container.Owner)), uid, uid, PopupType.Medium);

_adminLog.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(uid)} got released from {ToPrettyString(args.Container.Owner)} belly");
}
Expand Down Expand Up @@ -388,6 +439,14 @@ private void OnGibContents(EntityUid uid, VoreComponent component, ref BeingGibb
_containerSystem.EmptyContainer(component.Stomach);
}

private void CheckInteraction(EntityUid uid, VoredComponent component, InteractionAttemptEvent args)
{
if (component.Pred != args.Target)
return;

args.Cancel();
}

public override void Update(float frameTime)
{
base.Update(frameTime);
Expand All @@ -400,7 +459,7 @@ public override void Update(float frameTime)

vored.Accumulator += frameTime;

if (vored.Accumulator <= 1)
if (vored.Accumulator <= 5)
continue;

vored.Accumulator -= 1;
Expand Down
23 changes: 13 additions & 10 deletions Content.Server/Resist/EscapeInventorySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,17 @@ private void OnRelayMovement(EntityUid uid, CanEscapeInventoryComponent componen
if (!args.HasDirectionalMovement)
return;

if (!_containerSystem.TryGetContainingContainer(uid, out var container)
|| !_actionBlockerSystem.CanInteract(uid, container.Owner))
if (!_containerSystem.TryGetContainingContainer(uid, out var container))
return;

// Vore - Floofstation
if (HasComp<VoredComponent>(uid))
{
AttemptEscape(uid, container.Owner, component, 5f);
return;
}

if (!_actionBlockerSystem.CanInteract(uid, container.Owner))
return;

// Make sure there's nothing stopped the removal (like being glued)
Expand All @@ -78,13 +87,6 @@ private void OnRelayMovement(EntityUid uid, CanEscapeInventoryComponent componen
return;
}

// Vore - Floofstation
if (HasComp<VoredComponent>(uid))
{
AttemptEscape(uid, container.Owner, component, 5f);
return;
}

// Uncontested
if (HasComp<StorageComponent>(container.Owner) || HasComp<InventoryComponent>(container.Owner) || HasComp<SecretStashComponent>(container.Owner))
AttemptEscape(uid, container.Owner, component);
Expand All @@ -100,7 +102,8 @@ private void OnRelayMovement(EntityUid uid, CanEscapeInventoryComponent componen
BreakOnTargetMove = false,
BreakOnUserMove = true,
BreakOnDamage = true,
NeedHand = false
NeedHand = false,
RequireCanInteract = false
};

if (!_doAfterSystem.TryStartDoAfter(doAfterEventArgs, out component.DoAfter))
Expand Down
14 changes: 14 additions & 0 deletions Content.Shared/Floofstation/FloofCCvars.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Robust.Shared.Configuration;

namespace Content.Shared.FloofStation;

/// <summary>
/// Floofstation specific cvars.
/// </summary>
[CVarDefs]
// ReSharper disable once InconsistentNaming - Shush you
public sealed class FloofCCVars
{
public static readonly CVarDef<bool> VoreSoundEnabled =
CVarDef.Create("ambience.vore_sound_enabled", true, CVar.ARCHIVE | CVar.CLIENTONLY);
}
2 changes: 1 addition & 1 deletion Content.Shared/Floofstation/VoreComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public sealed partial class VoreComponent : Component
[DataField]
public SoundSpecifier? SoundDevour = new SoundPathSpecifier("/Audio/Floof/Vore/gulp.ogg")
{
Params = AudioParams.Default.WithVolume(-3f),
Params = AudioParams.Default.WithVolume(-4f).WithMaxDistance(1f),
};
public Container Stomach = default!;
}
Expand Down
4 changes: 2 additions & 2 deletions Content.Shared/Floofstation/VoredComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public sealed partial class VoredComponent : Component
[DataField, AutoNetworkedField]
public SoundSpecifier? SoundBelly = new SoundPathSpecifier("/Audio/Floof/Vore/stomach_loop.ogg")
{
Params = AudioParams.Default.WithLoop(true).WithVolume(-3f),
Params = AudioParams.Default.WithLoop(true).WithVolume(-4f),
};

[DataField]
public SoundSpecifier? SoundRelease = new SoundPathSpecifier("/Audio/Effects/Fluids/splat.ogg")
{
Params = AudioParams.Default.WithVolume(-3f),
Params = AudioParams.Default.WithVolume(-4f),
};
}
Loading

0 comments on commit e388dac

Please sign in to comment.