quick fixes
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using Content.Client._White.UserInterface.Radial;
|
||||||
using Content.Client.White.UserInterface.Controls;
|
using Content.Client.White.UserInterface.Controls;
|
||||||
using Content.Shared.White.CheapSurgery;
|
using Content.Shared.White.CheapSurgery;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Content.Client._White.UserInterface.Radial;
|
||||||
using Content.Client.CombatMode;
|
using Content.Client.CombatMode;
|
||||||
using Content.Client.ContextMenu.UI;
|
using Content.Client.ContextMenu.UI;
|
||||||
using Content.Client.Gameplay;
|
using Content.Client.Gameplay;
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
<Control
|
|
||||||
xmlns="https://spacestation14.io"
|
|
||||||
xmlns:controls="clr-namespace:Content.Client.White.UserInterface.Controls">
|
|
||||||
|
|
||||||
<BoxContainer>
|
|
||||||
<TextureButton
|
|
||||||
Name="Controller"
|
|
||||||
Access="Public"
|
|
||||||
VerticalExpand="True"
|
|
||||||
HorizontalExpand="True">
|
|
||||||
<TextureRect Access="Public" Name="BackgroundTexture"
|
|
||||||
VerticalExpand="True"
|
|
||||||
HorizontalExpand="True"
|
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Center" Stretch="KeepAspect">
|
|
||||||
</TextureRect>
|
|
||||||
</TextureButton>
|
|
||||||
</BoxContainer>
|
|
||||||
</Control>
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
using System.Numerics;
|
|
||||||
using JetBrains.Annotations;
|
|
||||||
using Robust.Client.AutoGenerated;
|
|
||||||
using Robust.Client.Graphics;
|
|
||||||
using Robust.Client.UserInterface;
|
|
||||||
using Robust.Client.UserInterface.XAML;
|
|
||||||
using Robust.Shared.Animations;
|
|
||||||
using Robust.Shared.Timing;
|
|
||||||
|
|
||||||
namespace Content.Client.White.UserInterface.Controls;
|
|
||||||
|
|
||||||
[GenerateTypedNameReferences, Virtual, PublicAPI]
|
|
||||||
public sealed partial class RadialButton : Control
|
|
||||||
{
|
|
||||||
[Animatable] public Vector2 Offset { get; set; }
|
|
||||||
public string? Content { get; set; }
|
|
||||||
|
|
||||||
public string Texture
|
|
||||||
{
|
|
||||||
set => Controller.TexturePath = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Animatable]
|
|
||||||
public Vector2 ButtonSize
|
|
||||||
{
|
|
||||||
get => this.Size;
|
|
||||||
set => this.SetSize = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RadialButton()
|
|
||||||
{
|
|
||||||
RobustXamlLoader.Load(this);
|
|
||||||
Offset = Vector2.Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void FrameUpdate(FrameEventArgs args)
|
|
||||||
{
|
|
||||||
base.FrameUpdate(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<controls:RadialContainer
|
|
||||||
xmlns="https://spacestation14.io"
|
|
||||||
xmlns:controls="clr-namespace:Content.Client.White.UserInterface.Controls"
|
|
||||||
Visible="False"
|
|
||||||
MaxSize="0 0">
|
|
||||||
<BoxContainer>
|
|
||||||
<controls:RadialButton
|
|
||||||
Name="CloseButton"
|
|
||||||
Access="Public"
|
|
||||||
VerticalExpand="True"
|
|
||||||
HorizontalExpand="True"
|
|
||||||
Content="{Loc 'radial-ui-close'}"
|
|
||||||
Texture="/Textures/Interface/Default/blocked.png"/>
|
|
||||||
<LayoutContainer Access="Public" Name="Layout" HorizontalExpand="True" VerticalExpand="True"></LayoutContainer>
|
|
||||||
<BoxContainer Access="Public" Name="ActionBox" HorizontalExpand="True" VerticalExpand="True">
|
|
||||||
<Label Access="Public" Name="ActionLabel" HorizontalExpand="True" Visible="False"/>
|
|
||||||
</BoxContainer>
|
|
||||||
</BoxContainer>
|
|
||||||
</controls:RadialContainer>
|
|
||||||
@@ -1,302 +0,0 @@
|
|||||||
using System.Linq;
|
|
||||||
using System.Numerics;
|
|
||||||
using Content.Client.Gameplay;
|
|
||||||
using Content.Client.Resources;
|
|
||||||
using Content.Client.Viewport;
|
|
||||||
using JetBrains.Annotations;
|
|
||||||
using Robust.Client.Animations;
|
|
||||||
using Robust.Client.AutoGenerated;
|
|
||||||
using Robust.Client.GameObjects;
|
|
||||||
using Robust.Client.Graphics;
|
|
||||||
using Robust.Client.Player;
|
|
||||||
using Robust.Client.ResourceManagement;
|
|
||||||
using Robust.Client.UserInterface;
|
|
||||||
using Robust.Client.UserInterface.Controls;
|
|
||||||
using Robust.Client.UserInterface.XAML;
|
|
||||||
using Robust.Client.Utility;
|
|
||||||
using Robust.Shared.Animations;
|
|
||||||
using Robust.Shared.Console;
|
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
using Robust.Shared.Timing;
|
|
||||||
using Robust.Shared.Utility;
|
|
||||||
|
|
||||||
namespace Content.Client.White.UserInterface.Controls;
|
|
||||||
|
|
||||||
public sealed class RadialContainerCommandTest : LocalizedCommands
|
|
||||||
{
|
|
||||||
public override string Command => "radialtest";
|
|
||||||
|
|
||||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
||||||
{
|
|
||||||
var radial = new RadialContainer();
|
|
||||||
for (int i = 0; i < 24; i++)
|
|
||||||
{
|
|
||||||
var testButton = radial.AddButton("Action " + i, "/Textures/Interface/emotions.svg.192dpi.png");
|
|
||||||
testButton.Controller.OnPressed += _ => { Logger.Debug("Press gay"); };
|
|
||||||
}
|
|
||||||
|
|
||||||
radial.CloseButton.Controller.OnPressed += _ =>
|
|
||||||
{
|
|
||||||
Logger.Debug("Close event for your own logic");
|
|
||||||
};
|
|
||||||
|
|
||||||
radial.OpenCentered();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[GenerateTypedNameReferences, Virtual]
|
|
||||||
public partial class RadialContainer : Control
|
|
||||||
{
|
|
||||||
private bool _isOpened;
|
|
||||||
|
|
||||||
private Vector2 _focusSize = new(64, 64);
|
|
||||||
private Vector2 _normalSize = new(50, 50);
|
|
||||||
|
|
||||||
private IResourceCache _resourceCache;
|
|
||||||
|
|
||||||
private const int MaxButtons = 8;
|
|
||||||
|
|
||||||
private const string BackgroundTexture = "/Textures/Interface/Default/SlotBackground.png";
|
|
||||||
|
|
||||||
public const string MoveAnimationKey = "move";
|
|
||||||
public const string InSizeAnimationKey = "insize";
|
|
||||||
public const string OutSizeAnimationKey = "outsize";
|
|
||||||
|
|
||||||
public float FocusSize
|
|
||||||
{
|
|
||||||
get => _focusSize.Y;
|
|
||||||
set => _focusSize = new Vector2(value, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public float NormalSize
|
|
||||||
{
|
|
||||||
get => _normalSize.Y;
|
|
||||||
set => _normalSize = new Vector2(value, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public float MoveAnimationTime { get; set; } = 0.3f;
|
|
||||||
|
|
||||||
public float FocusAnimationTime { get; set; } = 0.25f;
|
|
||||||
|
|
||||||
public bool IsAction = true;
|
|
||||||
|
|
||||||
public RadialContainer()
|
|
||||||
{
|
|
||||||
RobustXamlLoader.Load(this);
|
|
||||||
IoCManager.InjectDependencies(this);
|
|
||||||
_resourceCache = IoCManager.Resolve<IResourceCache>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Open(Vector2 position)
|
|
||||||
{
|
|
||||||
AddToRoot();
|
|
||||||
LayoutContainer.SetPosition(this, position);
|
|
||||||
UpdateButtons();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OpenCentered()
|
|
||||||
{
|
|
||||||
AddToRoot();
|
|
||||||
if (Parent != null)
|
|
||||||
LayoutContainer.SetPosition(this, Parent.Size / 2 - Size / 2);
|
|
||||||
else
|
|
||||||
LayoutContainer.SetPosition(this, UserInterfaceManager.MainViewport.Size / 2 - Size / 2);
|
|
||||||
|
|
||||||
UpdateButtons();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OpenCenteredWithViewport()
|
|
||||||
{
|
|
||||||
if (UserInterfaceManager.ActiveScreen == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var ent = IoCManager.Resolve<IPlayerManager>().LocalSession?.AttachedEntity;
|
|
||||||
if (ent == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(ent, out TransformComponent? xform))
|
|
||||||
return;
|
|
||||||
|
|
||||||
AddToRoot();
|
|
||||||
var position = IoCManager.Resolve<TransformSystem>().GetMapCoordinates(xform);
|
|
||||||
|
|
||||||
LayoutContainer.SetPosition(this,
|
|
||||||
IoCManager.Resolve<IEyeManager>().MapToScreen(position).Position * 1.5f);
|
|
||||||
|
|
||||||
UpdateButtons();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Close(bool canDispose = true)
|
|
||||||
{
|
|
||||||
Parent?.RemoveChild(this);
|
|
||||||
Visible = false;
|
|
||||||
_isOpened = false;
|
|
||||||
if (canDispose)
|
|
||||||
Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public RadialButton AddButton(string action, string? texture = null)
|
|
||||||
{
|
|
||||||
var button = new RadialButton();
|
|
||||||
button.Content = action;
|
|
||||||
button.Controller.TextureNormal = _resourceCache.GetTexture(BackgroundTexture);
|
|
||||||
if (texture != null)
|
|
||||||
button.BackgroundTexture.Texture = _resourceCache.GetTexture(texture);
|
|
||||||
|
|
||||||
Layout.AddChild(button);
|
|
||||||
|
|
||||||
return button;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RadialButton AddButton(string action, Texture texture)
|
|
||||||
{
|
|
||||||
var button = new RadialButton();
|
|
||||||
button.Content = action;
|
|
||||||
button.Controller.TextureNormal = _resourceCache.GetTexture(BackgroundTexture);
|
|
||||||
button.BackgroundTexture.Texture = texture;
|
|
||||||
Layout.AddChild(button);
|
|
||||||
|
|
||||||
return button;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AddToRoot()
|
|
||||||
{
|
|
||||||
if (_isOpened)
|
|
||||||
return;
|
|
||||||
|
|
||||||
UserInterfaceManager.WindowRoot.AddChild(this);
|
|
||||||
_isOpened = !_isOpened;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateButtons()
|
|
||||||
{
|
|
||||||
Visible = true;
|
|
||||||
|
|
||||||
var angleDegrees = 360 / Layout.ChildCount;
|
|
||||||
var stepAngle = -angleDegrees + -90;
|
|
||||||
var distance = FocusSize * 1.2;
|
|
||||||
if (Layout.Children.Count() > MaxButtons)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < (Layout.Children.Count() - MaxButtons); i++)
|
|
||||||
{
|
|
||||||
distance += (NormalSize / 3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var child in Layout.Children)
|
|
||||||
{
|
|
||||||
var button = (RadialButton) child;
|
|
||||||
button.ButtonSize = _normalSize;
|
|
||||||
stepAngle += angleDegrees;
|
|
||||||
var pos = GetPointFromPolar(stepAngle, distance);
|
|
||||||
PlayRadialAnimation(button, pos, MoveAnimationKey);
|
|
||||||
|
|
||||||
button.Controller.OnMouseEntered += _ =>
|
|
||||||
{
|
|
||||||
PlaySizeAnimation(button, _focusSize, OutSizeAnimationKey, InSizeAnimationKey);
|
|
||||||
ActionLabel.Text = button.Content ?? string.Empty;
|
|
||||||
ActionLabel.Visible = IsAction;
|
|
||||||
};
|
|
||||||
|
|
||||||
button.Controller.OnMouseExited += _ =>
|
|
||||||
{
|
|
||||||
PlaySizeAnimation(button, _normalSize, InSizeAnimationKey, OutSizeAnimationKey);
|
|
||||||
ActionLabel.Visible = false;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
CloseButton.ButtonSize = _normalSize;
|
|
||||||
CloseButton.Controller.OnMouseEntered += _ =>
|
|
||||||
{
|
|
||||||
PlaySizeAnimation(CloseButton, _focusSize, OutSizeAnimationKey, InSizeAnimationKey);
|
|
||||||
ActionLabel.Text = CloseButton.Content ?? string.Empty;
|
|
||||||
ActionLabel.Visible = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
CloseButton.Controller.OnMouseExited += _ =>
|
|
||||||
{
|
|
||||||
PlaySizeAnimation(CloseButton, _normalSize, InSizeAnimationKey, OutSizeAnimationKey);
|
|
||||||
ActionLabel.Visible = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
CloseButton.Controller.OnPressed += _ =>
|
|
||||||
{
|
|
||||||
Close();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PlayRadialAnimation(Control button, Vector2 pos, string playKey)
|
|
||||||
{
|
|
||||||
var anim = new Animation
|
|
||||||
{
|
|
||||||
Length = TimeSpan.FromMilliseconds(MoveAnimationTime * 1000),
|
|
||||||
AnimationTracks =
|
|
||||||
{
|
|
||||||
new AnimationTrackControlProperty
|
|
||||||
{
|
|
||||||
Property = nameof(RadialButton.Offset),
|
|
||||||
InterpolationMode = AnimationInterpolationMode.Linear,
|
|
||||||
KeyFrames =
|
|
||||||
{
|
|
||||||
new AnimationTrackProperty.KeyFrame(new Vector2(0, 0), 0f),
|
|
||||||
new AnimationTrackProperty.KeyFrame(pos, MoveAnimationTime)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!button.HasRunningAnimation(playKey))
|
|
||||||
button.PlayAnimation(anim, playKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PlaySizeAnimation(Control button, Vector2 size, string playKey, string? stopKey)
|
|
||||||
{
|
|
||||||
var anim = new Animation
|
|
||||||
{
|
|
||||||
Length = TimeSpan.FromMilliseconds(FocusAnimationTime * 1000),
|
|
||||||
AnimationTracks =
|
|
||||||
{
|
|
||||||
new AnimationTrackControlProperty
|
|
||||||
{
|
|
||||||
Property = nameof(RadialButton.ButtonSize),
|
|
||||||
InterpolationMode = AnimationInterpolationMode.Linear,
|
|
||||||
KeyFrames =
|
|
||||||
{
|
|
||||||
new AnimationTrackProperty.KeyFrame(button.Size, 0f),
|
|
||||||
new AnimationTrackProperty.KeyFrame(size, FocusAnimationTime)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (stopKey != null && button.HasRunningAnimation(stopKey))
|
|
||||||
button.StopAnimation(stopKey);
|
|
||||||
|
|
||||||
if (!button.HasRunningAnimation(playKey))
|
|
||||||
button.PlayAnimation(anim, playKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Draw(DrawingHandleScreen handle)
|
|
||||||
{
|
|
||||||
base.Draw(handle);
|
|
||||||
|
|
||||||
foreach (var child in Layout.Children)
|
|
||||||
{
|
|
||||||
var button = (RadialButton) child;
|
|
||||||
LayoutContainer.SetPosition(child, button.Offset - (button.Size / 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
LayoutContainer.SetPosition(CloseButton, CloseButton.Offset - (CloseButton.Size / 2));
|
|
||||||
LayoutContainer.SetPosition(ActionBox, new Vector2(0 - (ActionLabel.Size.X), FocusSize * 1.5f));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Vector2 GetPointFromPolar(double angleDegrees, double distance)
|
|
||||||
{
|
|
||||||
var angleRadians = angleDegrees * (Math.PI / 180.0);
|
|
||||||
|
|
||||||
var x = distance * Math.Cos(angleRadians);
|
|
||||||
var y = distance * Math.Sin(angleRadians);
|
|
||||||
|
|
||||||
return new Vector2((int) Math.Round(x), (int) Math.Round(y));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Client._White.Cult;
|
namespace Content.Client._White.Cult;
|
||||||
|
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ public sealed partial class AdminVerbSystem
|
|||||||
if (!_minds.TryGetSession(targetMindComp.Mind, out var session))
|
if (!_minds.TryGetSession(targetMindComp.Mind, out var session))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var playerSession = session as ICommonSession;
|
var playerSession = session;
|
||||||
_cultRule.MakeCultist(playerSession!);
|
_cultRule.MakeCultist(playerSession!);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Shared.White.Cult;
|
|||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
using Robust.Shared.Enums;
|
using Robust.Shared.Enums;
|
||||||
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Server.Chat.Commands
|
namespace Content.Server.Chat.Commands
|
||||||
{
|
{
|
||||||
@@ -17,7 +18,7 @@ namespace Content.Server.Chat.Commands
|
|||||||
|
|
||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
if (shell.Player is not IPlayerSession player)
|
if (shell.Player is not { } player)
|
||||||
{
|
{
|
||||||
shell.WriteError("This command cannot be run from the server.");
|
shell.WriteError("This command cannot be run from the server.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Content.Shared.Roles;
|
|||||||
using Content.Shared.White.Cult;
|
using Content.Shared.White.Cult;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
||||||
@@ -41,7 +42,7 @@ public sealed partial class CultRuleComponent : Component
|
|||||||
[DataField("pentagramThreshold")]
|
[DataField("pentagramThreshold")]
|
||||||
public static int PentagramThreshold = 8;
|
public static int PentagramThreshold = 8;
|
||||||
|
|
||||||
public Dictionary<IPlayerSession, HumanoidCharacterProfile> StarCandidates = new();
|
public Dictionary<ICommonSession, HumanoidCharacterProfile> StarCandidates = new();
|
||||||
|
|
||||||
[DataField("cultistStartingItems", customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
|
[DataField("cultistStartingItems", customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
|
||||||
public List<string> StartingItems = new();
|
public List<string> StartingItems = new();
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ using Robust.Shared.Random;
|
|||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using Content.Shared._White;
|
using Content.Shared._White;
|
||||||
using Content.Shared.Mind;
|
using Content.Shared.Mind;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
|
|
||||||
namespace Content.Server.White.Cult.GameRule;
|
namespace Content.Server.White.Cult.GameRule;
|
||||||
|
|
||||||
@@ -308,7 +309,7 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<MindContainerComponent> FindPotentialTargets(List<IPlayerSession> exclude = null!)
|
private List<MindContainerComponent> FindPotentialTargets(List<ICommonSession> exclude = null!)
|
||||||
{
|
{
|
||||||
var querry = EntityManager.EntityQuery<MindContainerComponent, HumanoidAppearanceComponent, ActorComponent>();
|
var querry = EntityManager.EntityQuery<MindContainerComponent, HumanoidAppearanceComponent, ActorComponent>();
|
||||||
|
|
||||||
@@ -332,9 +333,9 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
|
|||||||
return potentialTargets;
|
return potentialTargets;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<IPlayerSession> FindPotentialCultist(in Dictionary<IPlayerSession, HumanoidCharacterProfile> candidates)
|
private List<ICommonSession> FindPotentialCultist(in Dictionary<ICommonSession, HumanoidCharacterProfile> candidates)
|
||||||
{
|
{
|
||||||
var list = new List<IPlayerSession>();
|
var list = new List<ICommonSession>();
|
||||||
var pendingQuery = GetEntityQuery<PendingClockInComponent>();
|
var pendingQuery = GetEntityQuery<PendingClockInComponent>();
|
||||||
|
|
||||||
foreach (var player in candidates.Keys)
|
foreach (var player in candidates.Keys)
|
||||||
@@ -349,7 +350,7 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
|
|||||||
list.Add(player);
|
list.Add(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
var prefList = new List<IPlayerSession>();
|
var prefList = new List<ICommonSession>();
|
||||||
|
|
||||||
foreach (var player in list)
|
foreach (var player in list)
|
||||||
{
|
{
|
||||||
@@ -388,9 +389,9 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
|
|||||||
return prefList;
|
return prefList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<IPlayerSession> PickCultists(List<IPlayerSession> prefList)
|
private List<ICommonSession> PickCultists(List<ICommonSession> prefList)
|
||||||
{
|
{
|
||||||
var result = new List<IPlayerSession>();
|
var result = new List<ICommonSession>();
|
||||||
if (prefList.Count == 0)
|
if (prefList.Count == 0)
|
||||||
{
|
{
|
||||||
_sawmill.Info("Insufficient ready players to fill up with cultists, stopping the selection.");
|
_sawmill.Info("Insufficient ready players to fill up with cultists, stopping the selection.");
|
||||||
@@ -410,7 +411,7 @@ public sealed class CultRuleSystem : GameRuleSystem<CultRuleComponent>
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool MakeCultist(IPlayerSession cultist)
|
public bool MakeCultist(ICommonSession cultist)
|
||||||
{
|
{
|
||||||
var cultistRule = EntityQuery<CultRuleComponent>().FirstOrDefault();
|
var cultistRule = EntityQuery<CultRuleComponent>().FirstOrDefault();
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Shared.Chemistry.Components.SolutionManager;
|
|||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
|
using Robust.Server.Audio;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
|
||||||
namespace Content.Server.White.Cult.HolyWater;
|
namespace Content.Server.White.Cult.HolyWater;
|
||||||
@@ -29,7 +30,10 @@ public sealed class HolyWaterSystem : EntitySystem
|
|||||||
if (!TryComp<SolutionContainerManagerComponent>(args.Target, out var container))
|
if (!TryComp<SolutionContainerManagerComponent>(args.Target, out var container))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var solution in container.Solutions.Values.Where(solution => solution.ContainsReagent(component.ConvertedId, null)))
|
if (container.Solutions != null)
|
||||||
|
{
|
||||||
|
foreach (var solution in container.Solutions.Values.Where(solution =>
|
||||||
|
solution.ContainsReagent(component.ConvertedId, null)))
|
||||||
{
|
{
|
||||||
foreach (var reagent in solution.Contents)
|
foreach (var reagent in solution.Contents)
|
||||||
{
|
{
|
||||||
@@ -51,4 +55,5 @@ public sealed class HolyWaterSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using Robust.Server.GameObjects;
|
|||||||
using Robust.Shared.Map.Components;
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Shared.Pulling.Components;
|
|||||||
using Content.Shared.White.Cult;
|
using Content.Shared.White.Cult;
|
||||||
using Content.Shared.White.Cult.Items;
|
using Content.Shared.White.Cult.Items;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using Timer = Robust.Shared.Timing.Timer;
|
using Timer = Robust.Shared.Timing.Timer;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ using Content.Shared.White.Cult.Pylon;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
@@ -180,7 +181,7 @@ public sealed class PylonSystem : EntitySystem
|
|||||||
? damageComp
|
? damageComp
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
if (playerDamageComp == null || playerDamageComp.Damage.Total == 0)
|
if (playerDamageComp == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var uid = comp.Owner;
|
var uid = comp.Owner;
|
||||||
@@ -234,7 +235,7 @@ public sealed class PylonSystem : EntitySystem
|
|||||||
var damage = comp.BurnDamageOnInteract;
|
var damage = comp.BurnDamageOnInteract;
|
||||||
var burnMsg = Loc.GetString("powered-light-component-burn-hand");
|
var burnMsg = Loc.GetString("powered-light-component-burn-hand");
|
||||||
|
|
||||||
_audio.Play(comp.BurnHandSound, Filter.Pvs(pylon), pylon, true);
|
_audio.PlayEntity(comp.BurnHandSound, Filter.Pvs(pylon), pylon, true);
|
||||||
_popupSystem.PopupEntity(burnMsg, pylon, user);
|
_popupSystem.PopupEntity(burnMsg, pylon, user);
|
||||||
_damageSystem.TryChangeDamage(user, damage, true);
|
_damageSystem.TryChangeDamage(user, damage, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Body.Components;
|
using Content.Server.Body.Components;
|
||||||
|
using Content.Server.Chemistry.Containers.EntitySystems;
|
||||||
using Content.Server.Emp;
|
using Content.Server.Emp;
|
||||||
using Content.Server.EUI;
|
using Content.Server.EUI;
|
||||||
using Content.Server.White.Cult.UI;
|
using Content.Server.White.Cult.UI;
|
||||||
|
using Content.Shared.Chemistry.Components;
|
||||||
using Content.Shared.Chemistry.EntitySystems;
|
using Content.Shared.Chemistry.EntitySystems;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.Damage.Prototypes;
|
using Content.Shared.Damage.Prototypes;
|
||||||
@@ -16,6 +18,7 @@ using Content.Shared.White.Cult;
|
|||||||
using Content.Shared.White.Cult.Actions;
|
using Content.Shared.White.Cult.Actions;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Server.White.Cult.Runes.Systems;
|
namespace Content.Server.White.Cult.Runes.Systems;
|
||||||
|
|
||||||
@@ -89,7 +92,7 @@ public partial class CultSystem
|
|||||||
if (!_solutionSystem.TryGetSolution(solutionEntity, puddleComponent.SolutionName, out var solution))
|
if (!_solutionSystem.TryGetSolution(solutionEntity, puddleComponent.SolutionName, out var solution))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
foreach (var solutionContent in solution.Contents.ToList())
|
foreach (var solutionContent in solution.Value.Comp.Solution.Contents.ToList())
|
||||||
{
|
{
|
||||||
if (solutionContent.Reagent.Prototype != "Blood")
|
if (solutionContent.Reagent.Prototype != "Blood")
|
||||||
continue;
|
continue;
|
||||||
@@ -97,7 +100,7 @@ public partial class CultSystem
|
|||||||
totalBloodAmount += solutionContent.Quantity;
|
totalBloodAmount += solutionContent.Quantity;
|
||||||
|
|
||||||
_bloodstreamSystem.TryModifyBloodLevel(uid, solutionContent.Quantity / 6f);
|
_bloodstreamSystem.TryModifyBloodLevel(uid, solutionContent.Quantity / 6f);
|
||||||
_solutionSystem.RemoveReagent(solutionEntity, solution, "Blood", FixedPoint2.MaxValue);
|
_solutionSystem.RemoveReagent((Entity<SolutionComponent>) solution, "Blood", FixedPoint2.MaxValue);
|
||||||
|
|
||||||
if (GetMissingBloodValue(bloodstreamComponent) == 0)
|
if (GetMissingBloodValue(bloodstreamComponent) == 0)
|
||||||
{
|
{
|
||||||
@@ -120,7 +123,7 @@ public partial class CultSystem
|
|||||||
|
|
||||||
private static FixedPoint2 GetMissingBloodValue(BloodstreamComponent bloodstreamComponent)
|
private static FixedPoint2 GetMissingBloodValue(BloodstreamComponent bloodstreamComponent)
|
||||||
{
|
{
|
||||||
return bloodstreamComponent.BloodMaxVolume - bloodstreamComponent.BloodSolution.Volume;
|
return bloodstreamComponent.BloodMaxVolume - bloodstreamComponent.BloodSolution!.Value.Comp.Solution.Volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnConcealPresence(EntityUid uid, CultistComponent component, CultConcealPresenceWorldActionEvent args)
|
private void OnConcealPresence(EntityUid uid, CultistComponent component, CultConcealPresenceWorldActionEvent args)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Content.Shared.White.Cult.UI;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Server.White.Cult.Runes.Systems;
|
namespace Content.Server.White.Cult.Runes.Systems;
|
||||||
|
|||||||
@@ -183,8 +183,8 @@ public partial class CultSystem
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check there are no mobs there
|
// Check there are no mobs there;
|
||||||
foreach (var entity in _lookupSystem.GetEntitiesIntersecting(tile.Value))
|
foreach (var entity in tile.Value.GetEntitiesInTile())
|
||||||
{
|
{
|
||||||
if (HasComp<MobStateComponent>(entity) && entity != performer)
|
if (HasComp<MobStateComponent>(entity) && entity != performer)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ using Content.Shared.White.Cult.Runes;
|
|||||||
using Content.Shared.White.Cult.UI;
|
using Content.Shared.White.Cult.UI;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.Audio.Components;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Physics.Events;
|
using Robust.Shared.Physics.Events;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
@@ -118,8 +120,6 @@ public sealed partial class CultSystem : EntitySystem
|
|||||||
|
|
||||||
private bool _doAfterAlreadyStarted;
|
private bool _doAfterAlreadyStarted;
|
||||||
|
|
||||||
private IPlayingAudioStream? _playingStream;
|
|
||||||
|
|
||||||
private readonly SoundPathSpecifier _teleportInSound = new("/Audio/White/Cult/veilin.ogg");
|
private readonly SoundPathSpecifier _teleportInSound = new("/Audio/White/Cult/veilin.ogg");
|
||||||
private readonly SoundPathSpecifier _teleportOutSound = new("/Audio/White/Cult/veilout.ogg");
|
private readonly SoundPathSpecifier _teleportOutSound = new("/Audio/White/Cult/veilout.ogg");
|
||||||
|
|
||||||
@@ -310,11 +310,12 @@ public sealed partial class CultSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#pragma warning disable RA0002
|
||||||
if (solution.Solutions.TryGetValue("vapor", out var vapor) && vapor.Contents.Any(x => x.Reagent.Prototype == "HolyWater"))
|
if (solution.Solutions!.TryGetValue("vapor", out var vapor) && vapor.Contents.Any(x => x.Reagent.Prototype == "HolyWater"))
|
||||||
{
|
{
|
||||||
Del(uid);
|
Del(uid);
|
||||||
}
|
}
|
||||||
|
#pragma warning restore RA0002
|
||||||
}
|
}
|
||||||
|
|
||||||
//Erasing end
|
//Erasing end
|
||||||
@@ -414,7 +415,8 @@ public sealed partial class CultSystem : EntitySystem
|
|||||||
var canBeConverted = _entityManager.TryGetComponent<MindContainerComponent>(victim.Value, out var mind) && mind.HasMind;
|
var canBeConverted = _entityManager.TryGetComponent<MindContainerComponent>(victim.Value, out var mind) && mind.HasMind;
|
||||||
|
|
||||||
// Проверка, является ли жертва целью
|
// Проверка, является ли жертва целью
|
||||||
var isTarget = mind != null && mind.Mind!.Value == target?.OwnedComponent?.Mind!.Value;
|
_entityManager.TryGetComponent<MindContainerComponent>(target?.CurrentEntity, out var targetMind);
|
||||||
|
var isTarget = mind != null && mind.Mind!.Value == targetMind?.Mind!.Value;
|
||||||
var jobAllowConvert = true;
|
var jobAllowConvert = true;
|
||||||
|
|
||||||
if(_jobSystem.MindTryGetJob(mind!.Mind!.Value, out var _, out var prototype))
|
if(_jobSystem.MindTryGetJob(mind!.Mind!.Value, out var _, out var prototype))
|
||||||
@@ -742,17 +744,13 @@ public sealed partial class CultSystem : EntitySystem
|
|||||||
_chat.DispatchGlobalAnnouncement(Loc.GetString("cult-ritual-started"), "CULT", false,
|
_chat.DispatchGlobalAnnouncement(Loc.GetString("cult-ritual-started"), "CULT", false,
|
||||||
colorOverride: Color.DarkRed);
|
colorOverride: Color.DarkRed);
|
||||||
|
|
||||||
_playingStream = _audio.PlayGlobal(_narsie40Sec, Filter.Broadcast(), false,
|
_audio.PlayGlobal(_narsie40Sec, Filter.Broadcast(), false, AudioParams.Default.WithLoop(true).WithVolume(0.15f));
|
||||||
AudioParams.Default.WithLoop(true).WithVolume(0.15f));
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NarsieSpawn(EntityUid uid, CultistComponent component, SummonNarsieDoAfterEvent args)
|
private void NarsieSpawn(EntityUid uid, CultistComponent component, SummonNarsieDoAfterEvent args)
|
||||||
{
|
{
|
||||||
if (_playingStream != null)
|
|
||||||
_playingStream.Stop();
|
|
||||||
|
|
||||||
_doAfterAlreadyStarted = false;
|
_doAfterAlreadyStarted = false;
|
||||||
|
|
||||||
if (args.Cancelled)
|
if (args.Cancelled)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Content.Shared.White.Cult;
|
using Content.Shared.White.Cult;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Server.White.Cult.Structures;
|
namespace Content.Server.White.Cult.Structures;
|
||||||
|
|
||||||
@@ -22,7 +23,7 @@ public sealed class CultStructureCraftSystem : EntitySystem
|
|||||||
if (!HasComp<CultistComponent>(args.User))
|
if (!HasComp<CultistComponent>(args.User))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!_playerManager.TryGetSessionByEntity(args.User, out var session) || session is not IPlayerSession playerSession)
|
if (!_playerManager.TryGetSessionByEntity(args.User, out var session) || session is not { } playerSession)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_uiSystem.TryGetUi(uid, component.UserInterfaceKey, out var bui))
|
if (_uiSystem.TryGetUi(uid, component.UserInterfaceKey, out var bui))
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ using Content.Shared.White.Cult;
|
|||||||
using Content.Shared.White.Cult.Structures;
|
using Content.Shared.White.Cult.Structures;
|
||||||
using Content.Shared.White.Cult.UI;
|
using Content.Shared.White.Cult.UI;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Audio.Systems;
|
||||||
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
|
|||||||
@@ -17,4 +17,9 @@ public sealed partial class DragInsertContainerComponent : Component
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
public bool UseVerbs = true;
|
public bool UseVerbs = true;
|
||||||
|
|
||||||
|
public DragInsertContainerComponent(string containerId)
|
||||||
|
{
|
||||||
|
ContainerId = containerId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,4 +11,9 @@ public sealed partial class ExitContainerOnMoveComponent : Component
|
|||||||
{
|
{
|
||||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
public string ContainerId;
|
public string ContainerId;
|
||||||
|
|
||||||
|
public ExitContainerOnMoveComponent(string containerId)
|
||||||
|
{
|
||||||
|
ContainerId = containerId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,6 +107,11 @@ public sealed partial class ArtifactCrusherComponent : Component
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
|
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
public bool AutoLock = false;
|
public bool AutoLock = false;
|
||||||
|
|
||||||
|
public ArtifactCrusherComponent(Container outputContainer)
|
||||||
|
{
|
||||||
|
OutputContainer = outputContainer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
|
|||||||
Reference in New Issue
Block a user