Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Культ крови #847

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 4 additions & 3 deletions Content.Client/UserInterface/Controls/RadialMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Robust.Client.UserInterface.CustomControls;
using System.Linq;
using System.Numerics;
using Robust.Client.Graphics;

namespace Content.Client.UserInterface.Controls;

Expand All @@ -16,7 +17,7 @@ public class RadialMenu : BaseWindow

/// <summary>
/// Set a style class to be applied to the contextual button when it is set to move the user back through previous layers of the radial menu
/// </summary>
/// </summary>
public string? BackButtonStyleClass
{
get
Expand Down Expand Up @@ -60,8 +61,8 @@ public string? CloseButtonStyleClass
/// A free floating menu which enables the quick display of one or more radial containers
/// </summary>
/// <remarks>
/// Only one radial container is visible at a time (each container forming a separate 'layer' within
/// the menu), along with a contextual button at the menu center, which will either return the user
/// Only one radial container is visible at a time (each container forming a separate 'layer' within
/// the menu), along with a contextual button at the menu center, which will either return the user
/// to the previous layer or close the menu if there are no previous layers left to traverse.
/// To create a functional radial menu, simply parent one or more named radial containers to it,
/// and populate the radial containers with RadialMenuButtons. Setting the TargetLayer field of these
Expand Down
65 changes: 65 additions & 0 deletions Content.Client/_Sunrise/BloodCult/CultPentagramSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using System.Numerics;
using Robust.Client.GameObjects;
using Robust.Shared.Random;
using Robust.Shared.Utility;

namespace Content.Client._Sunrise.BloodCult;

public sealed class CultPentagramSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _robustRandom = default!;

private const string Rsi = "_Sunrise/BloodCult/pentagram.rsi";
private static readonly string[] States =
{
"halo1",
"halo2",
"halo3",
"halo4",
"halo5",
"halo6"
};

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PentagramComponent, ComponentStartup>(PentagramAdded);
SubscribeLocalEvent<PentagramComponent, ComponentShutdown>(PentagramRemoved);
}

private void PentagramAdded(EntityUid uid, PentagramComponent component, ComponentStartup args)
{
if (!TryComp<SpriteComponent>(uid, out var sprite))
return;

if (sprite.LayerMapTryGet(PentagramKey.Key, out var _))
return;

var adj = sprite.Bounds.Height / 2 + ((1.0f/32) * 10.0f);

var randomIndex = _robustRandom.Next(0, States.Length);

var randomState = States[randomIndex];

var layer = sprite.AddLayer(new SpriteSpecifier.Rsi(new ResPath(Rsi), randomState));

sprite.LayerMapSet(PentagramKey.Key, layer);
sprite.LayerSetOffset(layer, new Vector2(0.0f, adj));
}

private void PentagramRemoved(EntityUid uid, PentagramComponent component, ComponentShutdown args)
{
if (!TryComp<SpriteComponent>(uid, out var sprite))
return;

if (!sprite.LayerMapTryGet(PentagramKey.Key, out var layer))
return;

sprite.RemoveLayer(layer);
}

private enum PentagramKey
{
Key
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Content.Shared._Sunrise.BloodCult.Items;
using Robust.Client.GameObjects;

namespace Content.Client._Sunrise.BloodCult.Items.VeilShifter;

public sealed class VeilVisualizerSystem : VisualizerSystem<VeilVisualsComponent>
{
private const string StateOn = "icon-on";
private const string StateOff = "icon";

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<VoidTeleportComponent, ComponentInit>(OnInit);
}

private void OnInit(EntityUid uid, VoidTeleportComponent component, ComponentInit args)
{
if (!TryComp<SpriteComponent>(uid, out var sprite)
|| !AppearanceSystem.TryGetData<bool>(uid, VeilVisuals.Activated, out var activated))
return;

sprite.LayerSetState(VeilVisualsLayers.Activated, activated ? StateOn : StateOff);
}

protected override void OnAppearanceChange(EntityUid uid, VeilVisualsComponent component, ref AppearanceChangeEvent args)
{
if (args.Sprite == null
|| !AppearanceSystem.TryGetData<bool>(uid, VeilVisuals.Activated, out var activated))
return;

args.Sprite.LayerSetState(VeilVisualsLayers.Activated, activated ? component.StateOn : component.StateOff);
}
}

public enum VeilVisualsLayers : byte
{
Activated
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Content.Client._Sunrise.BloodCult.Items.VeilShifter;

[RegisterComponent]
public sealed partial class VeilVisualsComponent : Component
{
[DataField("stateOn")]
[ViewVariables(VVAccess.ReadWrite)]
public string? StateOn = "icon-on";

[DataField("stateOff")]
[ViewVariables(VVAccess.ReadWrite)]
public string? StateOff = "icon";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Content.Shared._Sunrise.BloodCult.Items;
using Robust.Client.GameObjects;

namespace Content.Client._Sunrise.BloodCult.Items.VoidTorch;

public sealed class VoidTorchVisualizerSystem : VisualizerSystem<VoidTorchVisualsComponent>
{
protected override void OnAppearanceChange(EntityUid uid, VoidTorchVisualsComponent component, ref AppearanceChangeEvent args)
{
base.OnAppearanceChange(uid, component, ref args);

if (args.Sprite == null
|| !AppearanceSystem.TryGetData<bool>(uid, VoidTorchVisuals.Activated, out var activated))
return;

args.Sprite.LayerSetState(VoidTorchVisualsLayers.Activated, activated ? component.StateOn : component.StateOff);
}
}

public enum VoidTorchVisualsLayers : byte
{
Activated
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Content.Client._Sunrise.BloodCult.Items.VoidTorch;

[RegisterComponent]
public sealed partial class VoidTorchVisualsComponent : Component
{
[DataField("stateOn")]
[ViewVariables(VVAccess.ReadWrite)]
public string? StateOn = "icon-on";

[DataField("stateOff")]
[ViewVariables(VVAccess.ReadWrite)]
public string? StateOff = "icon";
}
6 changes: 6 additions & 0 deletions Content.Client/_Sunrise/BloodCult/Narsie/NarsieLayer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Content.Client._Sunrise.BloodCult.Narsie;

public enum NarsieLayer
{
Default
}
69 changes: 69 additions & 0 deletions Content.Client/_Sunrise/BloodCult/Narsie/NarsieVisualizer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using Content.Shared._Sunrise.BloodCult;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;

namespace Content.Client._Sunrise.BloodCult.Narsie;

public sealed class NarsieVisualizer : VisualizerSystem<NarsieComponent>
{
[Dependency] private readonly AnimationPlayerSystem _animationSystem = default!;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<NarsieComponent, AnimationCompletedEvent>(OnAnimationCompleted);
}

private void OnAnimationCompleted(EntityUid uid, NarsieComponent component, AnimationCompletedEvent args)
{
SetDefaultState(Comp<SpriteComponent>(uid));
}

protected override void OnAppearanceChange(EntityUid uid, NarsieComponent component, ref AppearanceChangeEvent args)
{
base.OnAppearanceChange(uid, component, ref args);

if(args.Sprite == null) return;

if (!args.AppearanceData.TryGetValue(NarsieVisualState.VisualState, out var narsieVisualsObject) || narsieVisualsObject is not NarsieVisuals narsieVisual)
return;

switch (narsieVisual)
{
case NarsieVisuals.Spawning:
PlaySpawnAnimation(uid);
break;
case NarsieVisuals.Spawned:
if(_animationSystem.HasRunningAnimation(uid, "narsie_spawn")) break;
SetDefaultState(args.Sprite);
break;
}

}

private void PlaySpawnAnimation(EntityUid uid)
{
_animationSystem.Play(uid, NarsieSpawnAnimation, "narsie_spawn");
}

private void SetDefaultState(SpriteComponent component)
{
component.LayerSetVisible(NarsieLayer.Default, true);
component.LayerSetState(NarsieLayer.Default, new RSI.StateId("narsie"));
component.LayerSetAutoAnimated(NarsieLayer.Default, true);
}

private static readonly Animation NarsieSpawnAnimation = new()
{
Length = TimeSpan.FromSeconds(3.5),
AnimationTracks =
{
new AnimationTrackSpriteFlick()
{
LayerKey = NarsieLayer.Default,
KeyFrames = {new AnimationTrackSpriteFlick.KeyFrame(new RSI.StateId("narsie_spawn_anim"), 0f)}
}
}
};
}
9 changes: 9 additions & 0 deletions Content.Client/_Sunrise/BloodCult/PentagramComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Content.Shared._Sunrise.BloodCult.Pentagram;
using Robust.Shared.GameStates;

namespace Content.Client._Sunrise.BloodCult;

[NetworkedComponent, RegisterComponent]
public sealed partial class PentagramComponent : SharedPentagramComponent
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using Content.Shared._Sunrise.BloodCult.Pylon;
using Robust.Client.GameObjects;
using SharedPylonComponent = Content.Shared._Sunrise.BloodCult.Pylon.SharedPylonComponent;

namespace Content.Client._Sunrise.BloodCult.Pylon;

public sealed class PylonVisualizerSystem : VisualizerSystem<PylonVisualsComponent>
{
private const string StateOn = "pylon";
private const string StateOff = "pylon_off";

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<SharedPylonComponent, ComponentInit>(OnInit);
}

private void OnInit(EntityUid uid, SharedPylonComponent component, ComponentInit args)
{
if (!TryComp<SpriteComponent>(uid, out var sprite)
|| !AppearanceSystem.TryGetData<bool>(uid, PylonVisualsLayers.Activated, out var activated))
return;

sprite.LayerSetState(PylonVisualsLayers.Activated, activated ? StateOn : StateOff);
}

protected override void OnAppearanceChange(EntityUid uid, PylonVisualsComponent component, ref AppearanceChangeEvent args)
{
if (args.Sprite == null
|| !AppearanceSystem.TryGetData<bool>(uid, PylonVisuals.Activated, out var activated))
return;

args.Sprite.LayerSetState(PylonVisualsLayers.Activated, activated ? component.StateOn : component.StateOff);
}
}

public enum PylonVisualsLayers : byte
{
Activated
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Content.Client._Sunrise.BloodCult.Pylon;

[RegisterComponent]
public sealed partial class PylonVisualsComponent : Component
{
[DataField("stateOn")]
[ViewVariables(VVAccess.ReadWrite)]
public string? StateOn = "pylon";

[DataField("stateOff")]
[ViewVariables(VVAccess.ReadWrite)]
public string? StateOff = "pylon_off";
}
29 changes: 29 additions & 0 deletions Content.Client/_Sunrise/BloodCult/ShowCultHudSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Content.Shared._Sunrise.BloodCult.Components;
using Content.Shared.StatusIcon.Components;
using Robust.Client.Player;
using Robust.Shared.Prototypes;

namespace Content.Client._Sunrise.BloodCult;
public sealed class ShowCultHudSystem : EntitySystem
{
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly IPrototypeManager _prototype = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<BloodCultistComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
}

private void OnGetStatusIconsEvent(EntityUid uid, BloodCultistComponent bloodCultistComponent, ref GetStatusIconsEvent args)
{
var ent = _player.LocalSession?.AttachedEntity;
if (!HasComp<BloodCultistComponent>(ent))
return;

if (_prototype.TryIndex(bloodCultistComponent.StatusIcon, out var iconPrototype))
args.StatusIcons.Add(iconPrototype);
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Content.Shared._Sunrise.BloodCult;
using Robust.Client.GameObjects;

namespace Content.Client._Sunrise.BloodCult.Structures;

public sealed class CultCraftStructureVisualizerSystem : VisualizerSystem<CultCraftStructureVisualsComponent>
{
protected override void OnAppearanceChange(EntityUid uid, CultCraftStructureVisualsComponent component, ref AppearanceChangeEvent args)
{
base.OnAppearanceChange(uid, component, ref args);

if (args.Sprite == null
|| !AppearanceSystem.TryGetData<bool>(uid, CultCraftStructureVisuals.Activated, out var activated))
return;

args.Sprite.LayerSetState(CultCraftStructureVisualsLayers.Activated, activated ? component.StateOn : component.StateOff);
}
}

public enum CultCraftStructureVisualsLayers : byte
{
Activated
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Content.Client._Sunrise.BloodCult.Structures;

[RegisterComponent]
public sealed partial class CultCraftStructureVisualsComponent : Component
{
[DataField("stateOn")]
[ViewVariables(VVAccess.ReadWrite)]
public string? StateOn = "icon";

[DataField("stateOff")]
[ViewVariables(VVAccess.ReadWrite)]
public string? StateOff = "icon-off";
}
Loading
Loading