Upload from upload_mods.ps1
This commit is contained in:
71
Scripts/Command/ConsoleCmdUnhideNPC.cs
Normal file
71
Scripts/Command/ConsoleCmdUnhideNPC.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user