72 lines
2.4 KiB
C#
72 lines
2.4 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine.Scripting;
|
|
|
|
#nullable disable
|
|
[Preserve]
|
|
public class ConsoleCmdUnhideNPC : ConsoleCmdAbstract
|
|
{
|
|
public override bool IsExecuteOnClient => true;
|
|
|
|
[PublicizedFrom(EAccessModifier.Protected)]
|
|
public override string[] getCommands()
|
|
{
|
|
return new string[1] { "unhidenpc" };
|
|
}
|
|
|
|
[PublicizedFrom(EAccessModifier.Protected)]
|
|
public override string getDescription() => "Unhide hidden npcs";
|
|
|
|
[PublicizedFrom(EAccessModifier.Protected)]
|
|
public override string getHelp()
|
|
{
|
|
return "Unhides all matching npcs\nUsage:\n unhidenpc (all npcs)\n unhidenpc [EntityID] (npc with matching entity ID)";
|
|
}
|
|
|
|
public override void Execute(List<string> _params, CommandSenderInfo _senderInfo)
|
|
{
|
|
//Log.Out("ConsoleCmdUnhideNPC-Execute START");
|
|
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
|
{
|
|
//Log.Out("ConsoleCmdUnhideNPC-Execute 1");
|
|
if (_params.Count > 0)
|
|
{
|
|
//Log.Out("ConsoleCmdUnhideNPC-Execute 2");
|
|
string parameter = _params[0];
|
|
|
|
RebirthUtilities.UnhideNPC(parameter);
|
|
}
|
|
else
|
|
{
|
|
//Log.Out("ConsoleCmdUnhideNPC-Execute 3");
|
|
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
|
|
|
if (primaryPlayer != null)
|
|
{
|
|
//Log.Out("ConsoleCmdUnhideNPC-Execute 4");
|
|
RebirthUtilities.UnhideNPC("", primaryPlayer.position);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//Log.Out("ConsoleCmdUnhideNPC-Execute 5");
|
|
string parameter = "";
|
|
|
|
if (_params.Count > 0)
|
|
{
|
|
//Log.Out("ConsoleCmdUnhideNPC-Execute 6");
|
|
parameter = _params[0];
|
|
}
|
|
|
|
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
|
|
|
if (primaryPlayer != null)
|
|
{
|
|
//Log.Out("ConsoleCmdUnhideNPC-Execute 7");
|
|
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer((NetPackage)NetPackageManager.GetPackage<NetPackageUnhideNPC>().Setup(parameter, primaryPlayer.position));
|
|
RebirthUtilities.UnhideNPC("", primaryPlayer.position);
|
|
}
|
|
}
|
|
}
|
|
}
|