* Remove the unnecessary NetID property from ComponentState. * Remove Component.NetworkSynchronizeExistence. * Removed Component.NetID. * Adds component netID automatic generation. * Removed NetIdAttribute from serverside components with no corresponding clientside registration. * Completely remove static NetIds. * Renamed NetIDAttribute to NetworkedComponentAttribute. * Add GenerateNetIds calls to client and server entry points. Add test to make sure auto generated NetIds are identical. * Component changes when rebasing that I am too lazy to rewrite into the branch. Co-authored-by: Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
39 lines
980 B
C#
39 lines
980 B
C#
#nullable enable
|
|
using Robust.Client.Console;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Shared.IoC;
|
|
|
|
namespace Content.Client.Administration.UI.CustomControls
|
|
{
|
|
public class CommandButton : Button
|
|
{
|
|
public string? Command { get; set; }
|
|
|
|
public CommandButton()
|
|
{
|
|
OnPressed += Execute;
|
|
}
|
|
|
|
protected virtual bool CanPress()
|
|
{
|
|
return string.IsNullOrEmpty(Command) ||
|
|
IoCManager.Resolve<IClientConGroupController>().CanCommand(Command);
|
|
}
|
|
|
|
protected override void EnteredTree()
|
|
{
|
|
if (!CanPress())
|
|
{
|
|
Visible = false;
|
|
}
|
|
}
|
|
|
|
protected virtual void Execute(ButtonEventArgs obj)
|
|
{
|
|
// Default is to execute command
|
|
if (!string.IsNullOrEmpty(Command))
|
|
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(Command);
|
|
}
|
|
}
|
|
}
|