@@ -90,22 +90,20 @@ namespace Content.Client.GameObjects.Components.Doors
|
|||||||
state = DoorVisualState.Closed;
|
state = DoorVisualState.Closed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var unlitVisible = true;
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case DoorVisualState.Closed:
|
case DoorVisualState.Closed:
|
||||||
sprite.LayerSetState(DoorVisualLayers.Base, "closed");
|
sprite.LayerSetState(DoorVisualLayers.Base, "closed");
|
||||||
sprite.LayerSetState(DoorVisualLayers.BaseUnlit, "closed_unlit");
|
sprite.LayerSetState(DoorVisualLayers.BaseUnlit, "closed_unlit");
|
||||||
sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, true);
|
|
||||||
break;
|
break;
|
||||||
case DoorVisualState.Closing:
|
case DoorVisualState.Closing:
|
||||||
sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, true);
|
|
||||||
if (!animPlayer.HasRunningAnimation(AnimationKey))
|
if (!animPlayer.HasRunningAnimation(AnimationKey))
|
||||||
{
|
{
|
||||||
animPlayer.Play(CloseAnimation, AnimationKey);
|
animPlayer.Play(CloseAnimation, AnimationKey);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DoorVisualState.Opening:
|
case DoorVisualState.Opening:
|
||||||
sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, true);
|
|
||||||
if (!animPlayer.HasRunningAnimation(AnimationKey))
|
if (!animPlayer.HasRunningAnimation(AnimationKey))
|
||||||
{
|
{
|
||||||
animPlayer.Play(OpenAnimation, AnimationKey);
|
animPlayer.Play(OpenAnimation, AnimationKey);
|
||||||
@@ -114,10 +112,10 @@ namespace Content.Client.GameObjects.Components.Doors
|
|||||||
break;
|
break;
|
||||||
case DoorVisualState.Open:
|
case DoorVisualState.Open:
|
||||||
sprite.LayerSetState(DoorVisualLayers.Base, "open");
|
sprite.LayerSetState(DoorVisualLayers.Base, "open");
|
||||||
sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, false);
|
unlitVisible = false;
|
||||||
break;
|
break;
|
||||||
case DoorVisualState.Deny:
|
case DoorVisualState.Deny:
|
||||||
sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, false);
|
unlitVisible = false;
|
||||||
if (!animPlayer.HasRunningAnimation(AnimationKey))
|
if (!animPlayer.HasRunningAnimation(AnimationKey))
|
||||||
{
|
{
|
||||||
animPlayer.Play(DenyAnimation, AnimationKey);
|
animPlayer.Play(DenyAnimation, AnimationKey);
|
||||||
@@ -126,6 +124,13 @@ namespace Content.Client.GameObjects.Components.Doors
|
|||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (component.TryGetData(DoorVisuals.Powered, out bool powered) && !powered)
|
||||||
|
{
|
||||||
|
unlitVisible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprite.LayerSetVisible(DoorVisualLayers.BaseUnlit, unlitVisible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ using Content.Server.GameObjects.Components.Interactable.Tools;
|
|||||||
using Content.Server.GameObjects.Components.Power;
|
using Content.Server.GameObjects.Components.Power;
|
||||||
using Content.Server.GameObjects.Components.VendingMachines;
|
using Content.Server.GameObjects.Components.VendingMachines;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Shared.GameObjects.Components.Doors;
|
||||||
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -77,6 +79,16 @@ namespace Content.Server.GameObjects.Components.Doors
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
_powerDevice = Owner.GetComponent<PowerDeviceComponent>();
|
_powerDevice = Owner.GetComponent<PowerDeviceComponent>();
|
||||||
_wires = Owner.GetComponent<WiresComponent>();
|
_wires = Owner.GetComponent<WiresComponent>();
|
||||||
|
|
||||||
|
_powerDevice.OnPowerStateChanged += PowerDeviceOnOnPowerStateChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PowerDeviceOnOnPowerStateChanged(object sender, PowerStateEventArgs e)
|
||||||
|
{
|
||||||
|
if (Owner.TryGetComponent(out AppearanceComponent appearance))
|
||||||
|
{
|
||||||
|
appearance.SetData(DoorVisuals.Powered, e.Powered);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ActivateImpl(ActivateEventArgs args)
|
protected override void ActivateImpl(ActivateEventArgs args)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ namespace Content.Shared.GameObjects.Components.Doors
|
|||||||
public enum DoorVisuals
|
public enum DoorVisuals
|
||||||
{
|
{
|
||||||
VisualState,
|
VisualState,
|
||||||
|
Powered
|
||||||
}
|
}
|
||||||
|
|
||||||
[NetSerializable]
|
[NetSerializable]
|
||||||
|
|||||||
Reference in New Issue
Block a user