2022-01-30 13:49:56 +13:00
|
|
|
using Content.Shared.Doors.Components;
|
|
|
|
|
using Content.Shared.Doors.Systems;
|
2021-11-04 02:43:10 +13:00
|
|
|
using Robust.Client.GameObjects;
|
2022-01-30 13:49:56 +13:00
|
|
|
using Robust.Shared.Audio;
|
2021-11-04 02:43:10 +13:00
|
|
|
using Robust.Shared.GameObjects;
|
2022-01-30 13:49:56 +13:00
|
|
|
using Robust.Shared.Player;
|
2021-02-12 07:02:14 -08:00
|
|
|
|
2022-01-30 13:49:56 +13:00
|
|
|
namespace Content.Client.Doors;
|
|
|
|
|
|
|
|
|
|
public sealed class DoorSystem : SharedDoorSystem
|
2021-02-12 07:02:14 -08:00
|
|
|
{
|
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)
|
2021-02-12 07:02:14 -08:00
|
|
|
{
|
2022-01-30 13:49:56 +13:00
|
|
|
if (!Resolve(uid, ref door))
|
|
|
|
|
return;
|
2021-02-12 07:02:14 -08:00
|
|
|
|
2022-01-30 13:49:56 +13:00
|
|
|
base.UpdateAppearance(uid, door);
|
2021-12-30 03:12:04 +01:00
|
|
|
|
2022-01-30 13:49:56 +13:00
|
|
|
if (TryComp(uid, out SpriteComponent? sprite))
|
2021-02-12 07:02:14 -08:00
|
|
|
{
|
2022-01-30 13:49:56 +13:00
|
|
|
sprite.DrawDepth = (door.State == DoorState.Open)
|
2021-11-04 02:43:10 +13:00
|
|
|
? door.OpenDrawDepth
|
|
|
|
|
: door.ClosedDrawDepth;
|
2021-02-12 07:02:14 -08:00
|
|
|
}
|
2022-01-30 13:49:56 +13:00
|
|
|
}
|
2021-02-12 07:02:14 -08: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);
|
2021-02-12 07:02:14 -08:00
|
|
|
}
|
|
|
|
|
}
|