Files
tbd-station-14/Content.Server/UserInterface/ActivatableUIComponent.cs
HerCoyote23 e45dd96af9 Northstar Gloves (#16021)
* Added Gloves of North Star, no sprite or talking yet...

* Added sprites for the gloves of the north star...

* Replaced more placeholder sprites for northstar gloves...

* Added gloves of the north star to uplink...

* Added speech on hit, not yet configureable

* Not functional yet, but a step in the right direction I hope...

* IT WORKS!!

* Licensing and cleanup

* Reduced attack speed, changed from chat to popup, added some admin logging. It was causing too much adminlog spam otherwise

* Reorganized some files, final build??

* Changed the adminlog type from Verb to new type ItemConfigure

* More cleanup, fix sprite reference maybe

* Keronshb's suggestions, fixed some stuff, made hit sound use the meaty punch sfx

* Adds support for hiding speak/whisper/emote from adminlogs, makes northstar speak again!

* Some file shuffling, some of Keronshb's requests. Might appear a bit funky in github because vscode kept duplicating files for some reason and I had to delete them

* Made it work with the latest changes on Master

* Final? cleanup, upped dmg to 8, made ui not activate on activateinhand, instead you need to right click

* Set value to 0 credits, that's all

* Well that was much easier than I made it out to be. Now you can only activate the gloves with right click, no more mispredicts.

* Update MeleeWeaponSystem.cs

Iunno why this got changed in the first place, but I'm changin it back

* emptycommit

* emptycommit

* The tiny fixening
2023-05-23 14:12:30 -04:00

82 lines
2.9 KiB
C#

using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Reflection;
using Robust.Shared.Serialization;
namespace Content.Server.UserInterface
{
[RegisterComponent]
public sealed class ActivatableUIComponent : Component,
ISerializationHooks
{
[ViewVariables]
public Enum? Key { get; set; }
[ViewVariables] public BoundUserInterface? UserInterface => (Key != null) ? Owner.GetUIOrNull(Key) : null;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("inHandsOnly")]
public bool InHandsOnly { get; set; } = false;
[DataField("singleUser")]
public bool SingleUser { get; set; } = false;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("adminOnly")]
public bool AdminOnly { get; set; } = false;
[DataField("key", readOnly: true, required: true)]
private string _keyRaw = default!;
[DataField("verbText")]
public string VerbText = "ui-verb-toggle-open";
/// <summary>
/// Whether you need a hand to operate this UI. The hand does not need to be free, you just need to have one.
/// </summary>
/// <remarks>
/// This should probably be true for most machines & computers, but there will still be UIs that represent a
/// more generic interaction / configuration that might not require hands.
/// </remarks>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("requireHands")]
public bool RequireHands = true;
/// <summary>
/// Whether you can activate this ui with activateinhand or not
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("rightClickOnly")]
public bool rightClickOnly = false;
/// <summary>
/// Whether spectators (non-admin ghosts) should be allowed to view this UI.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("allowSpectator")]
public bool AllowSpectator = true;
/// <summary>
/// Whether the UI should close when the item is deselected due to a hand swap or drop
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("closeOnHandDeselect")]
public bool CloseOnHandDeselect = true;
/// <summary>
/// The client channel currently using the object, or null if there's none/not single user.
/// NOTE: DO NOT DIRECTLY SET, USE ActivatableUISystem.SetCurrentSingleUser
/// </summary>
[ViewVariables]
public IPlayerSession? CurrentSingleUser;
void ISerializationHooks.AfterDeserialization()
{
var reflectionManager = IoCManager.Resolve<IReflectionManager>();
if (reflectionManager.TryParseEnumReference(_keyRaw, out var key))
Key = key;
}
}
}