Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.

Commit b0cce24

Browse files
committed
Fix
1 parent 157b7fc commit b0cce24

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

TestingDummies/Commands/RemoveDummy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
3030
}
3131
if(Plugin.Instance.DumRef.Contains(Dummy.ReferenceHub))
3232
{
33+
Dummy.Disconnect(null);
3334
Player.Dictionary.Remove(Plugin.Instance.spawning.PlayerPrefabs[Dummy]);
3435
Plugin.Instance.DumRef.Remove(Dummy.ReferenceHub);
35-
Dummy.Disconnect();
3636
NetworkServer.DestroyPlayerForConnection(Plugin.Instance.spawning.PlayerConnIDs[Dummy]);
3737
NetworkServer.Destroy(Dummy.GameObject);
3838
response = $"Removed {Dummy.Nickname}!";

TestingDummies/Config.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@ public class Config : IConfig
1717

1818
[Description("If NPCBadge is enabled, sets the name")]
1919
public string NPCBadgeName { get; set; } = "NPC";
20+
[Description("Gives spawned NPCs AFK Immunity (HIGHLY RECOMMENED TO KEEP TRUE AS NPCS ARE CONSTANTLY AFK)")]
21+
public bool NPCAFKImmunity { get; set; } = true;
2022
}
2123
}

TestingDummies/SpawningHandler/Spawn.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
using System.Collections.Generic;
66
using UnityEngine;
77
using MEC;
8+
using Exiled.API.Features.Pickups;
9+
using System.Linq;
810

911
namespace TestingDummies.SpawningHandler
1012
{
@@ -13,7 +15,7 @@ public class Spawn : MonoBehaviour
1315
readonly int IDs = 1000;
1416
public Dictionary<Player, GameObject> PlayerPrefabs = new();
1517
public Dictionary<Player, FakeConnection> PlayerConnIDs = new();
16-
public IEnumerator<float> SpawnDum(string Name, RoleTypeId Role, Player targert)
18+
public IEnumerator<float> SpawnDum(string Name, RoleTypeId Role, Player target)
1719
{
1820
GameObject newPlayer = Instantiate(NetworkManager.singleton.playerPrefab);
1921
Player NewPlayer = new(newPlayer);
@@ -40,10 +42,10 @@ public IEnumerator<float> SpawnDum(string Name, RoleTypeId Role, Player targert)
4042
NewPlayer.RankColor = Plugin.Instance.Config.NPCBadgeColor;
4143
}
4244
hubPlayer.characterClassManager.GodMode = false;
43-
NewPlayer.RemoteAdminPermissions = PlayerPermissions.AFKImmunity;
45+
if (Plugin.Instance.Config.NPCAFKImmunity) NewPlayer.RemoteAdminPermissions = PlayerPermissions.AFKImmunity;
4446
yield return Timing.WaitForSeconds(0.3f);
4547
NewPlayer.Role.Set(Role, Exiled.API.Enums.SpawnReason.ForceClass);
46-
NewPlayer.Position = targert.Position;
48+
NewPlayer.Position = target.Position;
4749
NewPlayer.SessionVariables.Add("npc", true);
4850
yield break;
4951
}

0 commit comments

Comments
 (0)