Skip to content

Commit

Permalink
Merge pull request #6 from VMSolidus/latest-experimental-psychics
Browse files Browse the repository at this point in the history
Latest Experimental Psychics
  • Loading branch information
Fansana committed Jul 4, 2024
2 parents 4945ce3 + 23059a8 commit febd6c7
Show file tree
Hide file tree
Showing 190 changed files with 2,856 additions and 1,602 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@ public override Control GetUIFragmentRoot()
public override void Setup(BoundUserInterface userInterface, EntityUid? fragmentOwner)
{
_fragment = new CrimeAssistUiFragment();

_fragment.OnSync += _ => SendSyncMessage(userInterface);
}

private void SendSyncMessage(BoundUserInterface userInterface)
{
var syncMessage = new CrimeAssistSyncMessageEvent();
var message = new CartridgeUiMessage(syncMessage);
userInterface.SendMessage(message);
}

public override void UpdateState(BoundUserInterfaceState state)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Content.Client.Message;
using Content.Shared.DeltaV.CartridgeLoader.Cartridges;
using Robust.Client.AutoGenerated;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
Expand All @@ -13,9 +12,7 @@ namespace Content.Client.DeltaV.CartridgeLoader.Cartridges;
public sealed partial class CrimeAssistUiFragment : BoxContainer
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!;

public event Action<bool>? OnSync;
private CrimeAssistPage _currentPage;
private List<CrimeAssistPage>? _pages;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<BoxContainer xmlns="https://spacestation14.io"
xmlns:cartridges="clr-namespace:Content.Client.DeltaV.CartridgeLoader.Cartridges"
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
HorizontalExpand="True"
VerticalExpand="True"
Margin="5">
<!-- All labels populated in constructor -->
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Left">
<BoxContainer Orientation="Vertical">
<Label Name="Status"/>
<Label Text="{Loc 'criminal-records-console-reason'}"/>
</BoxContainer>
<customControls:VSeparator StyleClasses="LowDivider" Margin="8 0"/>
<BoxContainer Orientation="Vertical">
<Label Name="Title"/>
<Label Name="Reason"/>
</BoxContainer>
</BoxContainer>
</BoxContainer>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Content.Shared.CartridgeLoader.Cartridges;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client.DeltaV.CartridgeLoader.Cartridges;

[GenerateTypedNameReferences]
public sealed partial class SecWatchEntryControl : BoxContainer
{
public SecWatchEntryControl(SecWatchEntry entry)
{
RobustXamlLoader.Load(this);

Status.Text = Loc.GetString($"criminal-records-status-{entry.Status.ToString().ToLower()}");
Title.Text = Loc.GetString("sec-watch-entry", ("name", entry.Name), ("job", entry.Job));

Reason.Text = entry.Reason ?? Loc.GetString("sec-watch-no-reason");
}
}
27 changes: 27 additions & 0 deletions Content.Client/DeltaV/CartridgeLoader/Cartridges/SecWatchUi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Content.Client.UserInterface.Fragments;
using Content.Shared.CartridgeLoader;
using Content.Shared.CartridgeLoader.Cartridges;
using Robust.Client.UserInterface;

namespace Content.Client.DeltaV.CartridgeLoader.Cartridges;

public sealed partial class SecWatchUi : UIFragment
{
private SecWatchUiFragment? _fragment;

public override Control GetUIFragmentRoot()
{
return _fragment!;
}

public override void Setup(BoundUserInterface ui, EntityUid? owner)
{
_fragment = new SecWatchUiFragment();
}

public override void UpdateState(BoundUserInterfaceState state)
{
if (state is SecWatchUiState cast)
_fragment?.UpdateState(cast);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<cartridges:SecWatchUiFragment xmlns="https://spacestation14.io"
xmlns:cartridges="clr-namespace:Content.Client.DeltaV.CartridgeLoader.Cartridges"
Margin="5"
VerticalExpand="True">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True">
<Label Text="{Loc 'sec-watch-title'}" HorizontalExpand="True" HorizontalAlignment="Center"/>
<Label Name="NoEntries" Text="{Loc 'sec-watch-no-entries'}" HorizontalExpand="True" HorizontalAlignment="Center" Visible="False"/>
<ScrollContainer HorizontalExpand="True" VerticalExpand="True">
<!-- Populated when state received -->
<BoxContainer Name="Entries" Orientation="Vertical" VerticalAlignment="Top"/>
</ScrollContainer>
</BoxContainer>
</cartridges:SecWatchUiFragment>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Content.Shared.CartridgeLoader.Cartridges;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client.DeltaV.CartridgeLoader.Cartridges;

[GenerateTypedNameReferences]
public sealed partial class SecWatchUiFragment : BoxContainer
{
public SecWatchUiFragment()
{
RobustXamlLoader.Load(this);
}

public void UpdateState(SecWatchUiState state)
{
NoEntries.Visible = state.Entries.Count == 0;
Entries.RemoveAllChildren();
foreach (var entry in state.Entries)
{
Entries.AddChild(new SecWatchEntryControl(entry));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2086,7 +2086,7 @@ void AddSelector(LoadoutPreferenceSelector selector, int points, string id)
selector.PreferenceChanged += preference =>
{
// Make sure they have enough loadout points
preference = preference ? CheckPoints(points, preference) : CheckPoints(-points, preference);
preference = preference ? CheckPoints(-points, preference) : CheckPoints(points, preference);
// Update Preferences
Profile = Profile?.WithLoadoutPreference(id, preference);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
using Content.Client.Psionics.UI;
using Content.Client.UserInterface.Fragments;
using Content.Shared.CartridgeLoader.Cartridges;
using Content.Shared.CartridgeLoader;

namespace Content.Client.Nyanotrasen.CartridgeLoader.Cartridges;
namespace Content.Client.Psionics.GlimmerMonitor;

public sealed partial class GlimmerMonitorUi : UIFragment
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<cartridges:GlimmerMonitorUiFragment xmlns:cartridges="clr-namespace:Content.Client.Nyanotrasen.CartridgeLoader.Cartridges"
<cartridges:GlimmerMonitorUiFragment xmlns:cartridges="clr-namespace:Content.Client.Psionics.GlimmerMonitor"
xmlns="https://spacestation14.io" Margin="1 0 2 0">
<PanelContainer StyleClasses="BackgroundDark"></PanelContainer>
<BoxContainer Name="SettingsBox" Orientation="Horizontal" HorizontalExpand="True" VerticalExpand="False">
<Label Text="{Loc 'glimmer-monitor-interval'}"/>
<Button Name="IntervalButton6s" Access="Public" Text="6s" StyleClasses="OpenRight"/>
<Button Name="IntervalButton1" Access="Public" Text="1m" StyleClasses="OpenRight"/>
<Button Name="IntervalButton5" Access="Public" Text="5m" StyleClasses="OpenBoth"/>
<Button Name="IntervalButton10" Access="Public" Text="10m" StyleClasses="OpenLeft"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using System.Linq;
using System.Numerics;
using Content.Client.Nyanotrasen.UserInterface;
using Content.Client.Psionics.UI;
using Robust.Client.AutoGenerated;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client.Nyanotrasen.CartridgeLoader.Cartridges;
namespace Content.Client.Psionics.GlimmerMonitor;

[GenerateTypedNameReferences]
public sealed partial class GlimmerMonitorUiFragment : BoxContainer
Expand All @@ -26,12 +26,14 @@ public GlimmerMonitorUiFragment()
VerticalExpand = true;

var intervalGroup = new ButtonGroup();
IntervalButton6s.Group = intervalGroup;
IntervalButton1.Group = intervalGroup;
IntervalButton5.Group = intervalGroup;
IntervalButton10.Group = intervalGroup;

IntervalButton1.Pressed = true;
IntervalButton6s.Pressed = true;

IntervalButton6s.OnPressed += _ => UpdateState(_cachedValues);
IntervalButton1.OnPressed += _ => UpdateState(_cachedValues);
IntervalButton5.OnPressed += _ => UpdateState(_cachedValues);
IntervalButton10.OnPressed += _ => UpdateState(_cachedValues);
Expand Down Expand Up @@ -62,14 +64,12 @@ private List<int> FormatGlimmerValues(List<int> glimmerValues)
{
var returnList = glimmerValues;

if (IntervalButton5.Pressed)
{
returnList = GetAveragedList(glimmerValues, 5);
}
else if (IntervalButton10.Pressed)
{
if (IntervalButton1.Pressed)
returnList = GetAveragedList(glimmerValues, 10);
}
else if (IntervalButton5.Pressed)
returnList = GetAveragedList(glimmerValues, 50);
else if (IntervalButton10.Pressed)
returnList = GetAveragedList(glimmerValues, 100);

return ClipToFifteen(returnList);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Content.Shared.Abilities.Psionics;
using Content.Shared.Psionics.Abilities;
using Content.Client.Chat.Managers;
using Robust.Client.Player;

namespace Content.Client.Nyanotrasen.Chat
namespace Content.Client.Psionics.Chat
{
public sealed class PsionicChatUpdateSystem : EntitySystem
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;

namespace Content.Client.Nyanotrasen.UserInterface;
namespace Content.Client.Psionics.UI;

public sealed class GlimmerGraph : Control
{
Expand Down
9 changes: 4 additions & 5 deletions Content.Client/UserInterface/Systems/Chat/ChatUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
using Content.Shared.Examine;
using Content.Shared.Input;
using Content.Shared.Radio;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Client.Player;
Expand All @@ -37,7 +36,7 @@
using Robust.Shared.Replays;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Content.Client.Nyanotrasen.Chat; //Nyano - Summary: chat namespace.
using Content.Client.Psionics.Chat;

namespace Content.Client.UserInterface.Systems.Chat;

Expand All @@ -61,7 +60,7 @@ public sealed class ChatUIController : UIController
[UISystemDependency] private readonly GhostSystem? _ghost = default;
[UISystemDependency] private readonly TypingIndicatorSystem? _typingIndicator = default;
[UISystemDependency] private readonly ChatSystem? _chatSys = default;
[UISystemDependency] private readonly PsionicChatUpdateSystem? _psionic = default!; //Nyano - Summary: makes the psionic chat available.
[UISystemDependency] private readonly PsionicChatUpdateSystem? _psionic = default!; //EE - Summary: makes the psionic chat available.

[ValidatePrototypeId<ColorPalettePrototype>]
private const string ChatNamePalette = "ChatNames";
Expand All @@ -82,7 +81,7 @@ public sealed class ChatUIController : UIController
{SharedChatSystem.AdminPrefix, ChatSelectChannel.Admin},
{SharedChatSystem.RadioCommonPrefix, ChatSelectChannel.Radio},
{SharedChatSystem.DeadPrefix, ChatSelectChannel.Dead},
{SharedChatSystem.TelepathicPrefix, ChatSelectChannel.Telepathic} //Nyano - Summary: adds the telepathic prefix =.
{SharedChatSystem.TelepathicPrefix, ChatSelectChannel.Telepathic} //EE - Summary: adds the telepathic prefix =.
};

public static readonly Dictionary<ChatSelectChannel, char> ChannelPrefixes = new()
Expand All @@ -96,7 +95,7 @@ public sealed class ChatUIController : UIController
{ChatSelectChannel.Admin, SharedChatSystem.AdminPrefix},
{ChatSelectChannel.Radio, SharedChatSystem.RadioCommonPrefix},
{ChatSelectChannel.Dead, SharedChatSystem.DeadPrefix},
{ChatSelectChannel.Telepathic, SharedChatSystem.TelepathicPrefix } //Nyano - Summary: associates telepathic with =.
{ChatSelectChannel.Telepathic, SharedChatSystem.TelepathicPrefix } //EE - Summary: associates telepathic with =.
};

/// <summary>
Expand Down
12 changes: 12 additions & 0 deletions Content.Server/Abilities/Mime/MimePowersComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,17 @@ public sealed partial class MimePowersComponent : Component
/// </summary>
[DataField("vowCooldown")]
public TimeSpan VowCooldown = TimeSpan.FromMinutes(5);

/// <summary
/// Psionic Feedback for if a mime with their vow intact is scanned by a Mantis
/// </summary>
[DataField("mimeFeedback")]
public string MimeFeedback = "mime-feedback";

/// <summary
/// Psionic Feedback for if a mime with their vow intact is scanned by a Mantis
/// </summary>
[DataField("mimeBrokenFeedback")]
public string MimeBrokenFeedback = "mime-broken-feedback";
}
}
38 changes: 30 additions & 8 deletions Content.Server/Abilities/Mime/MimePowersSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Content.Server.Popups;
using Content.Server.Speech.Muting;
using Content.Shared.Actions;
using Content.Shared.Actions.Events;
using Content.Shared.Alert;
Expand All @@ -10,7 +9,7 @@
using Robust.Shared.Containers;
using Robust.Shared.Map;
using Robust.Shared.Timing;
using Content.Shared.Abilities.Psionics; //Nyano - Summary: Makes Mime psionic.
using Content.Shared.Psionics.Abilities;
using Content.Shared.Speech.Muting;

namespace Content.Server.Abilities.Mime
Expand Down Expand Up @@ -58,14 +57,21 @@ private void OnComponentInit(EntityUid uid, MimePowersComponent component, Compo
EnsureComp<MutedComponent>(uid);
_alertsSystem.ShowAlert(uid, AlertType.VowOfSilence);
_actionsSystem.AddAction(uid, ref component.InvisibleWallActionEntity, component.InvisibleWallAction, uid);
//Nyano - Summary: Add Psionic Ability to Mime.
if (TryComp<PsionicComponent>(uid, out var psionic) && psionic.PsionicAbility == null)
psionic.PsionicAbility = component.InvisibleWallActionEntity;

// Mimes gain their power from a special Vow, but this vow extends to Telepathic speech.
if (EnsureComp<PsionicComponent>(uid, out var psionic))
{
psionic.TelepathicMute = true;
psionic.ActivePowers.Add(component);
psionic.PsychicFeedback.Add(component.MimeFeedback);
psionic.Dampening += 1f;
}
}

/// <summary>
/// Creates an invisible wall in a free space after some checks.
/// </summary>
// TODO: Consider separating this out from the Mime entirely, and make a standalone "Telekinetic Barricade" power.
private void OnInvisibleWall(EntityUid uid, MimePowersComponent component, InvisibleWallActionEvent args)
{
if (!component.Enabled)
Expand Down Expand Up @@ -98,9 +104,9 @@ private void OnInvisibleWall(EntityUid uid, MimePowersComponent component, Invis
return;
}
}
// Begin Nyano-code: mime powers are psionic.
_psionics.LogPowerUsed(uid, "invisible wall");
// End Nyano-code.
if (TryComp<PsionicComponent>(uid, out var psionic))
_psionics.LogPowerUsed(uid, "invisible wall", psionic, 4, 6);

_popupSystem.PopupEntity(Loc.GetString("mime-invisible-wall-popup", ("mime", uid)), uid);
// Make sure we set the invisible wall to despawn properly
Spawn(component.WallPrototype, _turf.GetTileCenter(tile.Value));
Expand All @@ -126,6 +132,14 @@ public void BreakVow(EntityUid uid, MimePowersComponent? mimePowers = null)
_alertsSystem.ClearAlert(uid, AlertType.VowOfSilence);
_alertsSystem.ShowAlert(uid, AlertType.VowBroken);
_actionsSystem.RemoveAction(uid, mimePowers.InvisibleWallActionEntity);
if (TryComp<PsionicComponent>(uid, out var psionic))
{
psionic.TelepathicMute = false;
psionic.ActivePowers.Remove(mimePowers);
psionic.PsychicFeedback.Remove(mimePowers.MimeFeedback);
psionic.PsychicFeedback.Add(mimePowers.MimeBrokenFeedback);
psionic.Dampening -= 1f;
}
}

/// <summary>
Expand All @@ -149,6 +163,14 @@ public void RetakeVow(EntityUid uid, MimePowersComponent? mimePowers = null)
_alertsSystem.ClearAlert(uid, AlertType.VowBroken);
_alertsSystem.ShowAlert(uid, AlertType.VowOfSilence);
_actionsSystem.AddAction(uid, ref mimePowers.InvisibleWallActionEntity, mimePowers.InvisibleWallAction, uid);
if (TryComp<PsionicComponent>(uid, out var psionic))
{
psionic.TelepathicMute = true;
psionic.ActivePowers.Add(mimePowers);
psionic.PsychicFeedback.Add(mimePowers.MimeFeedback);
psionic.PsychicFeedback.Remove(mimePowers.MimeBrokenFeedback);
psionic.Dampening += 1f;
}
}
}
}
Loading

0 comments on commit febd6c7

Please sign in to comment.