* Add sprites * Lock system now raises lock toggle events * Add prototype and barrier system * Toggle lock on click * Barrier blocks bullets (like a real wall) * Barrier now destroyable * Fancy visualzer and lighting. Also unlock by default * Deleted comma * Ignored components? * Update Resources/Prototypes/Entities/Objects/Specific/Security/barrier.yml Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Update Resources/Prototypes/Entities/Objects/Specific/Security/barrier.yml Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Toggle Lock no longer handled * Made it much easier to move through airlocks Co-authored-by: Swept <sweptwastaken@protonmail.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using Content.Shared.Security;
|
|
using JetBrains.Annotations;
|
|
using Robust.Client.GameObjects;
|
|
|
|
namespace Content.Client.Security
|
|
{
|
|
[UsedImplicitly]
|
|
public class DeployableBarrierVisualizer : AppearanceVisualizer
|
|
{
|
|
public override void OnChangeData(AppearanceComponent component)
|
|
{
|
|
base.OnChangeData(component);
|
|
|
|
if (!component.Owner.TryGetComponent(out SpriteComponent? sprite))
|
|
return;
|
|
|
|
if (!component.TryGetData(DeployableBarrierVisuals.State, out DeployableBarrierState state))
|
|
return;
|
|
|
|
switch (state)
|
|
{
|
|
case DeployableBarrierState.Idle:
|
|
sprite.LayerSetState(0, "idle");
|
|
ToggleLight(component, false);
|
|
break;
|
|
case DeployableBarrierState.Deployed:
|
|
sprite.LayerSetState(0, "deployed");
|
|
ToggleLight(component, true);
|
|
break;
|
|
}
|
|
}
|
|
|
|
private void ToggleLight(AppearanceComponent component, bool enabled)
|
|
{
|
|
if (component.Owner.TryGetComponent(out PointLightComponent? light))
|
|
light.Enabled = enabled;
|
|
}
|
|
}
|
|
}
|