replacing sound (collection) names with SoundSpecifier - part 1

This commit is contained in:
Galactic Chimp
2021-07-10 17:35:33 +02:00
parent 4500b66f28
commit ce3c59e0e6
131 changed files with 934 additions and 587 deletions

View File

@@ -8,6 +8,7 @@ using Content.Shared.Interaction.Helpers;
using Content.Shared.Morgue;
using Content.Shared.Notification.Managers;
using Content.Shared.Physics;
using Content.Shared.Sound;
using Content.Shared.Standing;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
@@ -44,6 +45,9 @@ namespace Content.Server.Morgue.Components
[DataField("doSoulBeep")]
public bool DoSoulBeep = true;
[DataField("occupantHasSoulAlarmSound")]
private SoundSpecifier _occupantHasSoulAlarmSound = new SoundPathSpecifier("/Audio/Weapons/Guns/EmptyAlarm/smg_empty_alarm.ogg");
[ViewVariables]
[ComponentDependency] protected readonly AppearanceComponent? Appearance = null;
@@ -56,13 +60,15 @@ namespace Content.Server.Morgue.Components
public override Vector2 ContentsDumpPosition()
{
if (_tray != null) return _tray.Transform.WorldPosition;
if (_tray != null)
return _tray.Transform.WorldPosition;
return base.ContentsDumpPosition();
}
protected override bool AddToContents(IEntity entity)
{
if (entity.HasComponent<SharedBodyComponent>() && !EntitySystem.Get<StandingStateSystem>().IsDown(entity)) return false;
if (entity.HasComponent<SharedBodyComponent>() && !EntitySystem.Get<StandingStateSystem>().IsDown(entity))
return false;
return base.AddToContents(entity);
}
@@ -73,7 +79,8 @@ namespace Content.Server.Morgue.Components
collisionMask: CollisionGroup.Impassable | CollisionGroup.VaultImpassable
))
{
if(!silent) Owner.PopupMessage(user, Loc.GetString("morgue-entity-storage-component-cannot-open-no-space"));
if (!silent)
Owner.PopupMessage(user, Loc.GetString("morgue-entity-storage-component-cannot-open-no-space"));
return false;
}
@@ -112,8 +119,10 @@ namespace Content.Server.Morgue.Components
foreach (var entity in Contents.ContainedEntities)
{
count++;
if (!hasMob && entity.HasComponent<SharedBodyComponent>()) hasMob = true;
if (!hasSoul && entity.TryGetComponent<ActorComponent>(out var actor) && actor.PlayerSession != null) hasSoul = true;
if (!hasMob && entity.HasComponent<SharedBodyComponent>())
hasMob = true;
if (!hasSoul && entity.TryGetComponent<ActorComponent>(out var actor) && actor.PlayerSession != null)
hasSoul = true;
}
Appearance?.SetData(MorgueVisuals.HasContents, count > 0);
Appearance?.SetData(MorgueVisuals.HasMob, hasMob);
@@ -138,8 +147,11 @@ namespace Content.Server.Morgue.Components
{
CheckContents();
if(DoSoulBeep && Appearance !=null && Appearance.TryGetData(MorgueVisuals.HasSoul, out bool hasSoul) && hasSoul)
SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Weapons/Guns/EmptyAlarm/smg_empty_alarm.ogg", Owner);
if (DoSoulBeep && Appearance != null && Appearance.TryGetData(MorgueVisuals.HasSoul, out bool hasSoul) && hasSoul &&
_occupantHasSoulAlarmSound.TryGetSound(out var occupantHasSoulAlarmSound))
{
SoundSystem.Play(Filter.Pvs(Owner), occupantHasSoulAlarmSound, Owner);
}
}
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
@@ -159,7 +171,8 @@ namespace Content.Server.Morgue.Components
else if (Appearance.TryGetData(MorgueVisuals.HasContents, out bool hasContents) && hasContents)
{
message.AddMarkup(Loc.GetString("morgue-entity-storage-component-on-examine-details-has-contents"));
} else
}
else
{
message.AddMarkup(Loc.GetString("morgue-entity-storage-component-on-examine-details-empty"));
}