Skip to content

Commit

Permalink
Merge branch 'master' into ai-law-update
Browse files Browse the repository at this point in the history
  • Loading branch information
Schrodinger71 authored Oct 27, 2024
2 parents 13e4e47 + 75dc097 commit 484cea2
Show file tree
Hide file tree
Showing 2,139 changed files with 411,460 additions and 75,445 deletions.
8 changes: 5 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"program": "${workspaceFolder}/bin/Content.Client/Content.Client.dll",
"args": [],
"console": "internalConsole",
"stopAtEntry": false
"stopAtEntry": false,
"brokeredServicePipeName": "undefined"
},
{
"name": "Client (Compatibility renderer)",
Expand All @@ -29,7 +30,8 @@
"program": "${workspaceFolder}/bin/Content.Server/Content.Server.dll",
"args": [],
"console": "integratedTerminal",
"stopAtEntry": false
"stopAtEntry": false,
"brokeredServicePipeName": "undefined"
},
{
"name": "YAML Linter",
Expand All @@ -52,4 +54,4 @@
"preLaunchTask": "build"
}
]
}
}
31 changes: 31 additions & 0 deletions Content.Client/ADT/CollectiveMind/Systems/CollectiveMindSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Content.Client.Chat.Managers;
using Content.Shared.Sirena.CollectiveMind;
using Robust.Client.Player;

namespace Content.Client.Sirena.CollectiveMind;

public sealed class CollectiveMindSystem : EntitySystem
{
[Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CollectiveMindComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<CollectiveMindComponent, ComponentRemove>(OnRemove);
}

public CollectiveMindComponent? Player => CompOrNull<CollectiveMindComponent>(_playerManager.LocalPlayer?.ControlledEntity);
public bool IsCollectiveMind => Player != null;

private void OnInit(EntityUid uid, CollectiveMindComponent component, ComponentInit args)
{
_chatManager.UpdatePermissions();
}

private void OnRemove(EntityUid uid, CollectiveMindComponent component, ComponentRemove args)
{
_chatManager.UpdatePermissions();
}
}
39 changes: 39 additions & 0 deletions Content.Client/ADT/Heretic/HereticRitualRuneBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Content.Client.ADT.Heretic.UI;
using Content.Shared.ADT.Heretic.Components;
using Content.Shared.Heretic.Prototypes;
using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Client.UserInterface;
using Robust.Shared.Prototypes;

namespace Content.Client.ADT.Heretic;

public sealed class HereticRitualRuneBoundUserInterface : BoundUserInterface
{
[Dependency] private readonly IClyde _displayManager = default!;
[Dependency] private readonly IInputManager _inputManager = default!;

private HereticRitualRuneRadialMenu? _hereticRitualMenu;

public HereticRitualRuneBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
IoCManager.InjectDependencies(this);
}

protected override void Open()
{
base.Open();

_hereticRitualMenu = this.CreateWindow<HereticRitualRuneRadialMenu>();
_hereticRitualMenu.SetEntity(Owner);
_hereticRitualMenu.SendHereticRitualRuneMessageAction += SendHereticRitualMessage;

var vpSize = _displayManager.ScreenSize;
_hereticRitualMenu.OpenCenteredAt(_inputManager.MouseScreenPosition.Position / vpSize);
}

private void SendHereticRitualMessage(ProtoId<HereticRitualPrototype> protoId)
{
SendMessage(new HereticRitualMessage(protoId));
}
}
13 changes: 13 additions & 0 deletions Content.Client/ADT/Heretic/UI/HereticRitualRuneRadialMenu.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<ui:RadialMenu xmlns="https://spacestation14.io"
xmlns:ui="clr-namespace:Content.Client.UserInterface.Controls"
BackButtonStyleClass="RadialMenuBackButton"
CloseButtonStyleClass="RadialMenuCloseButton"
VerticalExpand="True"
HorizontalExpand="True"
MinSize="450 450">

<!-- Main -->
<ui:RadialContainer Name="Main" VerticalExpand="True" HorizontalExpand="True" Radius="64" ReserveSpaceForHiddenChildren="False">
</ui:RadialContainer>

</ui:RadialMenu>
101 changes: 101 additions & 0 deletions Content.Client/ADT/Heretic/UI/HereticRitualRuneRadialMenu.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
using Content.Client.UserInterface.Controls;
using Content.Shared.Heretic;
using Content.Shared.Heretic.Prototypes;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using System.Numerics;

namespace Content.Client.ADT.Heretic.UI;

public sealed partial class HereticRitualRuneRadialMenu : RadialMenu
{
[Dependency] private readonly EntityManager _entityManager = default!;
[Dependency] private readonly IEntitySystemManager _entitySystem = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly ISharedPlayerManager _playerManager = default!;
private readonly SpriteSystem _spriteSystem;

public event Action<ProtoId<HereticRitualPrototype>>? SendHereticRitualRuneMessageAction;

public EntityUid Entity { get; set; }

public HereticRitualRuneRadialMenu()
{
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);
_spriteSystem = _entitySystem.GetEntitySystem<SpriteSystem>();
}

public void SetEntity(EntityUid uid)
{
Entity = uid;
RefreshUI();
}

private void RefreshUI()
{
var main = FindControl<RadialContainer>("Main");
if (main == null)
return;

var player = _playerManager.LocalEntity;

if (!_entityManager.TryGetComponent<HereticComponent>(player, out var heretic))
return;

foreach (var ritual in heretic.KnownRituals)
{
if (!_prototypeManager.TryIndex(ritual, out var ritualPrototype))
continue;

var button = new HereticRitualMenuButton
{
StyleClasses = { "RadialMenuButton" },
SetSize = new Vector2(64, 64),
ToolTip = Loc.GetString(ritualPrototype.Name),
ProtoId = ritualPrototype.ID
};

var texture = new TextureRect
{
VerticalAlignment = VAlignment.Center,
HorizontalAlignment = HAlignment.Center,
Texture = _spriteSystem.Frame0(ritualPrototype.Icon),
TextureScale = new Vector2(2f, 2f)
};

button.AddChild(texture);
main.AddChild(button);
}

AddHereticRitualMenuButtonOnClickAction(main);
}

private void AddHereticRitualMenuButtonOnClickAction(RadialContainer mainControl)
{
if (mainControl == null)
return;

foreach(var child in mainControl.Children)
{
var castChild = child as HereticRitualMenuButton;

if (castChild == null)
continue;

castChild.OnButtonUp += _ =>
{
SendHereticRitualRuneMessageAction?.Invoke(castChild.ProtoId);
Close();
};
}
}

public sealed class HereticRitualMenuButton : RadialMenuTextureButton
{
public ProtoId<HereticRitualPrototype> ProtoId { get; set; }
}
}
16 changes: 16 additions & 0 deletions Content.Client/ADT/Heretic/UI/LivingHeartMenu.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<ui:RadialMenu xmlns="https://spacestation14.io"
xmlns:ui="clr-namespace:Content.Client.UserInterface.Controls"
BackButtonStyleClass="RadialMenuBackButton"
CloseButtonStyleClass="RadialMenuCloseButton"
VerticalExpand="True"
HorizontalExpand="True"
MinSize="450 450">

<ui:RadialContainer Name="Main"
VerticalExpand="True"
HorizontalExpand="True"
Radius="64"
ReserveSpaceForHiddenChildren="False"/>


</ui:RadialMenu>
97 changes: 97 additions & 0 deletions Content.Client/ADT/Heretic/UI/LivingHeartMenu.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
using Content.Client.UserInterface.Controls;
using Content.Shared.Heretic;
using Robust.Client.Player;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
using System.Numerics;

namespace Content.Client.ADT.Heretic.UI;

public sealed partial class LivingHeartMenu : RadialMenu
{
[Dependency] private readonly EntityManager _ent = default!;
[Dependency] private readonly IPrototypeManager _prot = default!;
[Dependency] private readonly IPlayerManager _player = default!;

public EntityUid Entity { get; private set; }

public event Action<NetEntity>? SendActivateMessageAction;

public LivingHeartMenu()
{
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);
}

public void SetEntity(EntityUid ent)
{
Entity = ent;
UpdateUI();
}

private void UpdateUI()
{
var main = FindControl<RadialContainer>("Main");
if (main == null) return;

var player = _player.LocalEntity;

if (!_ent.TryGetComponent<HereticComponent>(player, out var heretic))
return;

foreach (var target in heretic.SacrificeTargets)
{
if (target == null) continue;

var ent = _ent.GetEntity(target);
if (ent == null)
continue;

var button = new EmbeddedEntityMenuButton
{
StyleClasses = { "RadialMenuButton" },
SetSize = new Vector2(64, 64),
ToolTip = _ent.TryGetComponent<MetaDataComponent>(ent.Value, out var md) ? md.EntityName : "Unknown",
NetEntity = (NetEntity) target,
};

var texture = new SpriteView(ent.Value, _ent)
{
OverrideDirection = Direction.South,
VerticalAlignment = VAlignment.Center,
SetSize = new Vector2(64, 64),
VerticalExpand = true,
Stretch = SpriteView.StretchMode.Fill,
};
button.AddChild(texture);

main.AddChild(button);
}
AddAction(main);
}

private void AddAction(RadialContainer main)
{
if (main == null)
return;

foreach (var child in main.Children)
{
var castChild = child as EmbeddedEntityMenuButton;
if (castChild == null)
continue;

castChild.OnButtonUp += _ =>
{
SendActivateMessageAction?.Invoke(castChild.NetEntity);
Close();
};
}
}

public sealed class EmbeddedEntityMenuButton : RadialMenuTextureButton
{
public NetEntity NetEntity;
}
}
34 changes: 34 additions & 0 deletions Content.Client/ADT/Heretic/UI/LivingHeartMenuBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Content.Shared.Heretic;
using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Client.UserInterface;

namespace Content.Client.ADT.Heretic.UI;

public sealed partial class LivingHeartMenuBoundUserInterface : BoundUserInterface
{
[Dependency] private readonly IClyde _displayManager = default!;
[Dependency] private readonly IInputManager _inputManager = default!;

[NonSerialized] private LivingHeartMenu? _menu;

public LivingHeartMenuBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
IoCManager.InjectDependencies(this);
}

protected override void Open()
{
base.Open();

_menu = this.CreateWindow<LivingHeartMenu>();
_menu.SetEntity(Owner);
_menu.SendActivateMessageAction += SendMessage;
_menu.OpenCenteredAt(_inputManager.MouseScreenPosition.Position / _displayManager.ScreenSize);
}

private void SendMessage(NetEntity netent)
{
base.SendMessage(new EventHereticLivingHeartActivate() { Target = netent });
}
}
Loading

0 comments on commit 484cea2

Please sign in to comment.