Files
OldThink/Content.Client/Doors/DoorSystem.cs

36 lines
1.2 KiB
C#
Raw Normal View History

2022-01-30 13:49:56 +13:00
using Content.Shared.Doors.Components;
using Content.Shared.Doors.Systems;
using Robust.Client.GameObjects;
2022-01-30 13:49:56 +13:00
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
2022-01-30 13:49:56 +13:00
using Robust.Shared.Player;
2022-01-30 13:49:56 +13:00
namespace Content.Client.Doors;
public sealed class DoorSystem : SharedDoorSystem
{
2022-01-30 13:49:56 +13:00
// Gotta love it when both the client-side and server-side sprite components both have a draw depth, but for
// whatever bloody reason the shared component doesn't.
protected override void UpdateAppearance(EntityUid uid, DoorComponent? door = null)
{
2022-01-30 13:49:56 +13:00
if (!Resolve(uid, ref door))
return;
2022-01-30 13:49:56 +13:00
base.UpdateAppearance(uid, door);
2022-01-30 13:49:56 +13:00
if (TryComp(uid, out SpriteComponent? sprite))
{
2022-01-30 13:49:56 +13:00
sprite.DrawDepth = (door.State == DoorState.Open)
? door.OpenDrawDepth
: door.ClosedDrawDepth;
}
2022-01-30 13:49:56 +13:00
}
2022-01-30 13:49:56 +13:00
// TODO AUDIO PREDICT see comments in server-side PlaySound()
protected override void PlaySound(EntityUid uid, string sound, AudioParams audioParams, EntityUid? predictingPlayer, bool predicted)
{
if (GameTiming.InPrediction && GameTiming.IsFirstTimePredicted)
SoundSystem.Play(Filter.Local(), sound, uid, audioParams);
}
}