Nuke portals (#4315)

This commit is contained in:
metalgearsloth
2021-07-21 19:16:10 +10:00
committed by GitHub
parent fddf1acab9
commit 94ef2cb66e
11 changed files with 0 additions and 596 deletions

View File

@@ -1,34 +0,0 @@
using System;
using Content.Shared.Portal.Components;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
namespace Content.Client.Movement.Visualizers
{
[UsedImplicitly]
public class HandTeleporterVisualizer : AppearanceVisualizer
{
public override void OnChangeData(AppearanceComponent component)
{
var sprite = component.Owner.GetComponent<ISpriteComponent>();
if (!component.TryGetData(TeleporterVisuals.VisualState, out TeleporterVisualState state))
{
state = TeleporterVisualState.Ready;
}
switch (state)
{
case TeleporterVisualState.Charging:
sprite.LayerSetState(0, "charging");
break;
case TeleporterVisualState.Ready:
sprite.LayerSetState(0, "ready");
break;
default:
throw new ArgumentOutOfRangeException();
}
}
}
}

View File

@@ -1,54 +0,0 @@
using Content.Shared.Portal.Components;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
namespace Content.Client.Movement.Visualizers
{
[UsedImplicitly]
public class PortalVisualizer : AppearanceVisualizer
{
public override void InitializeEntity(IEntity entity)
{
base.InitializeEntity(entity);
var sprite = entity.GetComponent<ISpriteComponent>();
sprite.LayerMapSet(Layers.Portal, sprite.AddLayerState("portal-pending"));
sprite.LayerSetShader(Layers.Portal, "unshaded");
}
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
var sprite = component.Owner.GetComponent<ISpriteComponent>();
if (component.TryGetData<PortalState>(PortalVisuals.State, out var state))
{
switch (state)
{
case PortalState.Pending:
sprite.LayerSetState(Layers.Portal, "portal-pending");
break;
// TODO: Spritework here?
case PortalState.UnableToTeleport:
sprite.LayerSetState(Layers.Portal, "portal-unconnected");
break;
case PortalState.RecentlyTeleported:
sprite.LayerSetState(Layers.Portal, "portal-unconnected");
break;
}
}
else
{
sprite.LayerSetState(Layers.Portal, "portal-pending");
}
}
enum Layers : byte
{
Portal
}
}
}