-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'AdventureTimeSS14:master' into ADTPizdec
- Loading branch information
Showing
1,100 changed files
with
219,203 additions
and
2,629 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
Content.Client/ADT/CollectiveMind/Systems/CollectiveMindSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
39
Content.Client/ADT/Heretic/HereticRitualRuneBoundUserInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
13
Content.Client/ADT/Heretic/UI/HereticRitualRuneRadialMenu.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
101
Content.Client/ADT/Heretic/UI/HereticRitualRuneRadialMenu.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
34
Content.Client/ADT/Heretic/UI/LivingHeartMenuBoundUserInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System.Linq; | ||
using Robust.Client.Graphics; | ||
using Robust.Client.ResourceManagement; | ||
using Robust.Client.UserInterface.RichText; | ||
using Robust.Shared.IoC; | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Utility; | ||
|
||
namespace Content.Client.ADT.UserInterface.RichText; | ||
|
||
public sealed class MonospaceTag : IMarkupTag | ||
{ | ||
public const string MonospaceFont = "Monospace"; | ||
|
||
[Dependency] private readonly IResourceCache _resourceCache = default!; | ||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; | ||
|
||
public string Name => "mono"; | ||
|
||
/// <inheritdoc/> | ||
public void PushDrawContext(MarkupNode node, MarkupDrawingContext context) | ||
{ | ||
var font = FontTag.CreateFont( | ||
context.Font, | ||
node, | ||
_resourceCache, | ||
_prototypeManager, | ||
MonospaceFont | ||
); | ||
context.Font.Push(font); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public void PopDrawContext(MarkupNode node, MarkupDrawingContext context) | ||
{ | ||
context.Font.Pop(); | ||
} | ||
} |
Oops, something went wrong.