mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-25 01:27:06 +03:00
<!-- This is a semi-strict format, you can add/remove sections as needed but the order/format should be kept the same Remove these comments before submitting --> # Description <!-- Explain this PR in as much detail as applicable Some example prompts to consider: How might this affect the game? The codebase? What might be some alternatives to this? How/Who does this benefit/hurt [the game/codebase]? --> Check the changelog for the full list. --- # Changelog <!-- You can add an author after the `🆑` to change the name that appears in the changelog (ex: `🆑 Death`) Leaving it blank will default to your GitHub display name This includes all available types for the changelog --> 🆑 - add: Added Holopads (unmapped) - add: Intellicards are now useful for removing/adding a Station AI's brain. - add: Added the Communications Console to Station AI actions. - add: AI now has a warp point. - add: Added more things for the AI to press. - add: More AI laws have been added. - fix: Fixed the mail system - fix: Fixed AI actions - fix: Fixed invalid spawns for station AI breaking and ruining your ability to play it. - fix: The Station AI's name will now properly send in "arrived to the station" announcements. - fix: Changed the CPR sound to simply not loop until fixed. - fix: Fixed unlocalized messages being sent for the random sentience event. --------- Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com> Co-authored-by: Zachary Higgs <compgeek223@gmail.com> Co-authored-by: MendaxxDev <153332064+MendaxxDev@users.noreply.github.com> Co-authored-by: chromiumboy <50505512+chromiumboy@users.noreply.github.com> Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> (cherry picked from commit 3e8a7d9b00e19e160321eb81d69a884189dfa4e6)
102 lines
3.3 KiB
C#
102 lines
3.3 KiB
C#
using Content.Shared.Holopad;
|
|
using Content.Shared.Silicons.StationAi;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Shared.Player;
|
|
using System.Numerics;
|
|
|
|
namespace Content.Client.Holopad;
|
|
|
|
public sealed class HolopadBoundUserInterface : BoundUserInterface
|
|
{
|
|
[Dependency] private readonly ISharedPlayerManager _playerManager = default!;
|
|
[Dependency] private readonly IClyde _displayManager = default!;
|
|
|
|
[ViewVariables]
|
|
private HolopadWindow? _window;
|
|
|
|
public HolopadBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
|
{
|
|
IoCManager.InjectDependencies(this);
|
|
}
|
|
|
|
protected override void Open()
|
|
{
|
|
base.Open();
|
|
|
|
_window = this.CreateWindow<HolopadWindow>();
|
|
_window.Title = Loc.GetString("holopad-window-title", ("title", EntMan.GetComponent<MetaDataComponent>(Owner).EntityName));
|
|
|
|
if (this.UiKey is not HolopadUiKey)
|
|
{
|
|
Close();
|
|
return;
|
|
}
|
|
|
|
var uiKey = (HolopadUiKey)this.UiKey;
|
|
|
|
// AIs will see a different holopad interface to crew when interacting with them in the world
|
|
if (uiKey == HolopadUiKey.InteractionWindow && EntMan.HasComponent<StationAiHeldComponent>(_playerManager.LocalEntity))
|
|
uiKey = HolopadUiKey.InteractionWindowForAi;
|
|
|
|
_window.SetState(Owner, uiKey);
|
|
_window.UpdateState(new Dictionary<NetEntity, string>());
|
|
|
|
// Set message actions
|
|
_window.SendHolopadStartNewCallMessageAction += SendHolopadStartNewCallMessage;
|
|
_window.SendHolopadAnswerCallMessageAction += SendHolopadAnswerCallMessage;
|
|
_window.SendHolopadEndCallMessageAction += SendHolopadEndCallMessage;
|
|
_window.SendHolopadStartBroadcastMessageAction += SendHolopadStartBroadcastMessage;
|
|
_window.SendHolopadActivateProjectorMessageAction += SendHolopadActivateProjectorMessage;
|
|
_window.SendHolopadRequestStationAiMessageAction += SendHolopadRequestStationAiMessage;
|
|
|
|
// If this call is addressed to an AI, open the window in the bottom right hand corner of the screen
|
|
if (uiKey == HolopadUiKey.AiRequestWindow)
|
|
_window.OpenCenteredAt(new Vector2(1f, 1f));
|
|
|
|
// Otherwise offset to the left so the holopad can still be seen
|
|
else
|
|
_window.OpenCenteredAt(new Vector2(0.3333f, 0.50f));
|
|
}
|
|
|
|
protected override void UpdateState(BoundUserInterfaceState state)
|
|
{
|
|
base.UpdateState(state);
|
|
|
|
var castState = (HolopadBoundInterfaceState)state;
|
|
EntMan.TryGetComponent<TransformComponent>(Owner, out var xform);
|
|
|
|
_window?.UpdateState(castState.Holopads);
|
|
}
|
|
|
|
public void SendHolopadStartNewCallMessage(NetEntity receiver)
|
|
{
|
|
SendMessage(new HolopadStartNewCallMessage(receiver));
|
|
}
|
|
|
|
public void SendHolopadAnswerCallMessage()
|
|
{
|
|
SendMessage(new HolopadAnswerCallMessage());
|
|
}
|
|
|
|
public void SendHolopadEndCallMessage()
|
|
{
|
|
SendMessage(new HolopadEndCallMessage());
|
|
}
|
|
|
|
public void SendHolopadStartBroadcastMessage()
|
|
{
|
|
SendMessage(new HolopadStartBroadcastMessage());
|
|
}
|
|
|
|
public void SendHolopadActivateProjectorMessage()
|
|
{
|
|
SendMessage(new HolopadActivateProjectorMessage());
|
|
}
|
|
|
|
public void SendHolopadRequestStationAiMessage()
|
|
{
|
|
SendMessage(new HolopadStationAiRequestMessage());
|
|
}
|
|
}
|