Skip to content

Commit

Permalink
Merge remote-tracking branch 'floofstation/master' into floof/feat/pa…
Browse files Browse the repository at this point in the history
…rtial-merge-2024-12-04

# Conflicts:
#	Resources/Prototypes/Entities/Mobs/NPCs/revenant.yml
  • Loading branch information
Mnemotechnician committed Dec 9, 2024
2 parents 3bde61d + 99f6118 commit 7feee73
Show file tree
Hide file tree
Showing 56 changed files with 833 additions and 92 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/publish-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ name: Publish stable

concurrency:
group: publish

on:
workflow_dispatch:
push:
branches:
- stable # or the branch where merge requests are being merged into (e.g., 'master')


jobs:
build:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ concurrency:
group: publish

on:
workflow_dispatch:
schedule:
- cron: '0 6 * * *'
push:
branches:
- master

jobs:
build:
Expand Down
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
3 changes: 2 additions & 1 deletion Content.Client/Jittering/JitteringSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ private void OnShutdown(EntityUid uid, JitteringComponent jittering, ComponentSh

private void OnAnimationCompleted(EntityUid uid, JitteringComponent jittering, AnimationCompletedEvent args)
{
if(args.Key != _jitterAnimationKey)
// FLoofstation - avoid restarting the jittering animation on entites that already stopped jittering
if(args.Key != _jitterAnimationKey || jittering.LifeStage >= ComponentLifeStage.Stopping)
return;

if (TryComp(uid, out AnimationPlayerComponent? animationPlayer)
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
15 changes: 11 additions & 4 deletions Content.Server/Carrying/CarryingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,17 @@ private void OnMobStateChanged(EntityUid uid, CarryingComponent component, MobSt
/// </summary>
private void OnInteractionAttempt(EntityUid uid, BeingCarriedComponent component, InteractionAttemptEvent args)
{
if (args.Target == null)
// Floofstation - function body reviewed
Predicate<TransformComponent> isChildOfCarrier = null!; // C# doesn't have local functions eugh
isChildOfCarrier = (childXForm) => childXForm.ParentUid == component.Carrier
|| (childXForm.ParentUid is {Valid: true} parent && isChildOfCarrier(Transform(parent)));

if (args.Target == null // Allow self-interacts
|| isChildOfCarrier(Transform(args.Target.Value))) // Allow interacting with everything on the carriee
return;

// Also check if the interacted-with entity is on the carrier and cancel the event if not
var targetParent = Transform(args.Target.Value).ParentUid;

if (args.Target.Value != component.Carrier && targetParent != component.Carrier && targetParent != uid)
args.Cancel();
}
Expand Down Expand Up @@ -201,8 +207,9 @@ private void OnStandAttempt(EntityUid uid, BeingCarriedComponent component, Stan

private void OnInteractedWith(EntityUid uid, BeingCarriedComponent component, GettingInteractedWithAttemptEvent args)
{
if (args.Uid != component.Carrier)
args.Cancel();
// Floofstation - why.
// if (args.Uid != component.Carrier)
// args.Cancel();
}

private void OnPullAttempt(EntityUid uid, BeingCarriedComponent component, PullAttemptEvent args)
Expand Down
52 changes: 46 additions & 6 deletions Content.Server/Chat/Systems/ChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Text;
using Content.Server.Administration.Logs;
using Content.Server.Administration.Managers;
using Content.Server.Atmos.Components;
using Content.Server.Chat.Managers;
using Content.Server.GameTicking;
using Content.Server.Language;
Expand Down Expand Up @@ -36,6 +37,8 @@
using Robust.Shared.Replays;
using Robust.Shared.Utility;
using Content.Server.Shuttles.Components;
using Content.Shared.Actions;
using Robust.Shared.Map;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Dynamics.Joints;

Expand Down Expand Up @@ -69,10 +72,12 @@ public sealed partial class ChatSystem : SharedChatSystem
[Dependency] private readonly ReplacementAccentSystem _wordreplacement = default!;
[Dependency] private readonly LanguageSystem _language = default!;
[Dependency] private readonly TelepathicChatSystem _telepath = default!;
[Dependency] private readonly IMapManager _mapManager = default!;

public const int VoiceRange = 10; // how far voice goes in world units
public const int WhisperClearRange = 2; // how far whisper goes while still being understandable, in world units
public const int WhisperMuffledRange = 5; // how far whisper goes at all, in world units
public const float InSpaceRange = .3f; // how far speech travels in space
public const string DefaultAnnouncementSound = "/Audio/Announcements/announce.ogg";
public const float DefaultObfuscationFactor = 0.2f; // Percentage of symbols in a whispered message that can be seen even by "far" listeners
public readonly Color DefaultSpeakColor = Color.White;
Expand Down Expand Up @@ -747,18 +752,53 @@ private MessageRangeCheckResult MessageRangeCheck(ICommonSession session, ICChat
return initialResult;
}

public bool isSoundTransmittable(MapId mapId)
{
try
{
var map = _mapManager.GetMapEntityIdOrThrow(mapId);
if (!map.Valid)
return false;
if (!EntityManager.TryGetComponent<MapAtmosphereComponent>(map, out var _))
return false;
}
catch (Exception ex)
{
return false;
}

return true;
}
/// <summary>
/// Sends a chat message to the given players in range of the source entity.
/// </summary>
private void SendInVoiceRange(ChatChannel channel, string name, string message, string wrappedMessage, string obfuscated, string obfuscatedWrappedMessage, EntityUid source, ChatTransmitRange range, NetUserId? author = null, LanguagePrototype? languageOverride = null)
{
var language = languageOverride ?? _language.GetLanguage(source);
foreach (var (session, data) in GetRecipients(source, Transform(source).GridUid == null ? 0.3f : VoiceRange))
foreach (var (session, data) in GetRecipients(source, VoiceRange))
{
if (session.AttachedEntity != null
&& Transform(session.AttachedEntity.Value).GridUid != Transform(source).GridUid
&& !CheckAttachedGrids(source, session.AttachedEntity.Value))
continue;
if (language.SpeechOverride.RequireSpeech && channel != ChatChannel.LOOC && channel != ChatChannel.Emotes )
{
var sourceGrid = Transform(source).GridUid;
float transmitRange = VoiceRange;
if (sourceGrid == null && !isSoundTransmittable(Transform(source).MapID))
transmitRange = InSpaceRange;

if (session.AttachedEntity != null
&& Transform(session.AttachedEntity.Value).GridUid == null
&& !isSoundTransmittable(Transform(session.AttachedEntity.Value).MapID))
transmitRange = InSpaceRange;

if (session.AttachedEntity != null
&& Transform(session.AttachedEntity.Value).GridUid != sourceGrid
&& !isSoundTransmittable(Transform(session.AttachedEntity.Value).MapID)
&& !CheckAttachedGrids(source, session.AttachedEntity.Value))
transmitRange = InSpaceRange;

if (session.AttachedEntity != null && Transform(source).Coordinates.TryDistance(EntityManager, Transform(session.AttachedEntity.Value).Coordinates, out var distance) && distance > transmitRange)
continue;

}

var entRange = MessageRangeCheck(session, data, range);
if (entRange == MessageRangeCheckResult.Disallowed)
Expand Down Expand Up @@ -1088,4 +1128,4 @@ public EntitySpokeEvent(EntityUid source, string message, RadioChannelPrototype?
IsWhisper = isWhisper;
Language = language;
}
}
}
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 All @@ -80,7 +80,7 @@ private void OnPowerUsed(EntityUid uid, PsionicHypnoComponent component, HypnoPo
_popups.PopupEntity(Loc.GetString("hypno-phase-1", ("target", uid)), args.Target, args.Target, PopupType.Small);

args.Handled = true;
_psionics.LogPowerUsed(args.Performer, "hypno");
_psionics.LogPowerUsed(args.Performer, "hypno", 0, 0);
}

private void OnDispelled(EntityUid uid, PsionicHypnoComponent component, DispelledEvent args)
Expand Down Expand Up @@ -161,7 +161,7 @@ private void OnDoAfter(EntityUid uid, PsionicHypnoComponent component, PsionicHy
}
else if (args.Phase == 2)
{
_popups.PopupEntity(Loc.GetString("hypno-phase-3"), args.Target.Value, args.Target.Value, PopupType.Medium);
_popups.PopupEntity(Loc.GetString("hypno-phase-3", ("target", uid)), args.Target.Value, args.Target.Value, PopupType.Medium);

_doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, uid, component.UseDelay, new PsionicHypnosisDoAfterEvent(3), uid, target: args.Target)
{
Expand Down
Loading

0 comments on commit 7feee73

Please sign in to comment.